22#include <gsl/gsl_histogram.h>
50 void fill(std::vector<double> &p) {
74 bool getPart(
size_t n,
int bin, std::vector<double> &p);
144 return h_m !=
nullptr;
165 std::unique_ptr<gsl_histogram>
h_m;
179 bool operator()(
const std::vector<double>& first_part,
const std::vector<double>& second_part) {
191 bool operator()(
const std::vector<double>& first_part,
const std::vector<double>& second_part) {
Inform & operator<<(Inform &os, PartBins &p)
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
size_t getNp()
get the number of particles in the temporary particle structure used for binning
bool doEmission()
Is true if we still have particles to emit.
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 setGamma(double gamma)
bool isEmitted(int n, int)
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
virtual int getNBins()
get the number of used bin
void setPartNum(int bin, long long num)
set particles number in given bin
void setBinEmitted(int bin)
assume we emit in monotonic increasing order
void fill(std::vector< double > &p)
Add a particle to the temporary container.
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.
virtual bool weHaveBins()
void resetBins()
If the bunch object rebins we need to call resetBins()
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
bool operator()(const std::vector< double > &first_part, const std::vector< double > &second_part)
AscendingLocationSort(int direction=0)
bool operator()(const std::vector< double > &first_part, const std::vector< double > &second_part)
DescendingLocationSort(int direction=0)