49 for (
int i = 0; i <
bins_m; i++) {
67 ippl::Comm->reduce(gs, gs, 1, std::plus<size_t>());
74 ippl::Comm->reduce(s, s, 1, std::plus<size_t>());
80 if (countLost[ii] > 0)
81 nBin_m[ii] -= countLost[ii];
87 ippl::Comm->reduce(maxbinIndex, maxbinIndex, 1, std::greater<size_t>());
91 nBin_m[ii] = newPartNum[ii];
121 for (
unsigned int n = 0; n <
tmppart_m.size(); n++)
136 for (
int n = 0; n <
bins_m; n++)
142 for (
unsigned int n = 0; n <
tmppart_m.size(); n++)
148 for (
unsigned int n = 0; n <
tmppart_m.size(); n++) {
158 os <<
"-----------------------------------------" <<
endl;
159 os <<
" CREATE BINNED GAUSS DISTRIBUTION DONE " <<
endl;
161 os <<
"Bins= " <<
bins_m <<
" hBin= " <<
hBin_m <<
" Particle vector length "
166 for (
int i = 0; i <
bins_m; i++) {
168 for (
int j = 0; j <
sBins_m; j++)
169 msum += gsl_histogram_get(
h_m.get(), i *
sBins_m + j);
170 os <<
"Bin # " << i <<
" val " << msum <<
endl;
176 os <<
"No bin is emitted !" <<
endl;
Inform & endl(Inform &inf)
constexpr double c
The velocity of light in m/s.
KOKKOS_INLINE_FUNCTION Vector< T, Dim > max(const Vector< T, Dim > &a, const Vector< T, Dim > &b)
std::unique_ptr< mpi::Communicator > Comm
void calcHBins()
assigns the particles to the bins
std::vector< std::vector< double > > tmppart_m
holds the particles not yet in the bunch
std::unique_ptr< double[]> xbinmax_m
std::unique_ptr< double[]> xbinmin_m
extremal particle position within the bins
double xmin_m
extremal particle positions
PartBins(int bins, int sbins)
Definition of a bin: low <= x < hi Low water mark is included, high water is excluded.
std::unique_ptr< size_t[]> nDelBin_m
number of deleted particles in the bins
size_t getTotalNumPerBin(int b)
How many particles are in the bin b.
void resetPartInBin_cyc(size_t newPartNum[], int binID)
update local particles number in bin after reset Bin ID of PartBunch
std::vector< bool > isEmitted_m
void setBinEmitted(int bin)
assume we emit in monotonic increasing order
int getBin(double x)
returns the index of the bin to which the particle with z = 'x' belongs.
void updatePartInBin_cyc(size_t countLost[])
update local particles number in bin after particle deletion
void sortArray()
sort the vector of particles such that positions of the particles decrease with increasing index.
Inform & print(Inform &os)
std::unique_ptr< bool[]> binsEmitted_m
holds information whether all particles of a bin are emitted
bool getPart(size_t n, int bin, std::vector< double > &p)
assigns the proper position of particle n if it belongs to bin 'bin'
int nemittedBins_m
number of emitted bins
size_t getTotalNum()
How many particles are in all the bins.
int getLastemittedBin()
the last emitted bin is always smaller or equal getNbins
std::unique_ptr< size_t[]> nBin_m
number of particles in the bins, the sum of all the nodes
std::unique_ptr< gsl_histogram > h_m