11 #ifndef __Pulsar_Divided_h
12 #define __Pulsar_Divided_h
14 #include "Pulsar/Integrate.h"
19 class Integrate<C>::Divided :
public Integrate<C>::RangePolicy {
27 void set_ndivide (
unsigned ndivide);
30 unsigned get_ndivide ()
const;
33 void set_nintegrate (
unsigned nintegrate);
36 unsigned get_nintegrate ()
const;
39 void divide (
unsigned ndivide,
40 unsigned& nrange,
unsigned& nintegrate)
const;
45 virtual unsigned get_size (
const C*) = 0;
84 nintegrate = _nintegrate;
97 unsigned& output_ndivide,
98 unsigned& output_nintegrate)
const
101 output_nintegrate = input_ndivide;
107 std::cerr <<
"Pulsar::Integrate::Divided::divide ndivide=" << ndivide
112 output_ndivide = ndivide;
114 output_nintegrate = input_ndivide / output_ndivide;
115 if (input_ndivide % output_ndivide)
116 output_nintegrate ++;
123 std::cerr <<
"Pulsar::Integrate::Divided::divide nintegrate="
124 << nintegrate << std::endl;
128 output_nintegrate = nintegrate;
130 output_ndivide = input_ndivide / output_nintegrate;
131 if (input_ndivide % output_nintegrate)
137 std::cerr <<
"Pulsar::Integrate::Divided::divide into " << output_ndivide
138 <<
" ranges with " << output_nintegrate <<
" elements per range"