OPAL (Object Oriented Parallel Accelerator Library)
2021.1.99
OPAL
|
#include <PartBins.h>
Public Member Functions | |
PartBins (int bins, int sbins) | |
virtual | ~PartBins () |
void | fill (std::vector< double > &p) |
Add a particle to the temporary container. More... | |
size_t | getNp () |
get the number of particles in the temporary particle structure used for binning More... | |
void | setPartNum (int bin, long long num) |
bool | doEmission () |
Is true if we still have particles to emit. More... | |
bool | isEmitted (int n, int) |
bool | getPart (size_t n, int bin, std::vector< double > &p) |
void | sortArray () |
void | resetPartInBin_cyc (size_t newPartNum[], int binID) |
void | updatePartInBin_cyc (size_t countLost[]) |
void | setGamma (double gamma) |
double | getGamma () |
Inform & | print (Inform &os) |
int | getSBins () |
virtual int | getNBins () |
int | getLastemittedBin () |
void | resetBins () |
If the bunch object rebins we need to call resetBins() More... | |
virtual bool | weHaveBins () |
size_t | getTotalNum () |
How many particles are in all the bins. More... | |
size_t | getTotalNumPerBin (int b) |
How many particles are in the bin b. More... | |
Protected Member Functions | |
int | getBin (double x) |
Protected Attributes | |
double | gamma_m |
int | bins_m |
int | sBins_m |
double | xmin_m |
double | xmax_m |
std::unique_ptr< double[]> | xbinmin_m |
std::unique_ptr< double[]> | xbinmax_m |
double | hBin_m |
std::vector< std::vector< double > > | tmppart_m |
std::vector< bool > | isEmitted_m |
std::unique_ptr< bool[]> | binsEmitted_m |
int | nemittedBins_m |
std::unique_ptr< size_t[]> | nBin_m |
std::unique_ptr< size_t[]> | nDelBin_m |
std::unique_ptr< gsl_histogram > | h_m |
Private Member Functions | |
void | calcHBins () |
void | calcExtrema () |
void | setBinEmitted (int bin) |
Definition at line 30 of file PartBins.h.
PartBins::PartBins | ( | int | bins, |
int | sbins | ||
) |
Definition of a bin: low <= x < hi Low water mark is included, high water is excluded.
Definition at line 28 of file PartBins.cpp.
References bins_m, binsEmitted_m, max(), nBin_m, nDelBin_m, xbinmax_m, and xbinmin_m.
|
virtual |
Definition at line 97 of file PartBins.cpp.
References isEmitted_m, and tmppart_m.
|
private |
Definition at line 147 of file PartBins.cpp.
References Hypervolume::n, tmppart_m, xbinmax_m, and xbinmin_m.
Referenced by calcHBins().
|
private |
assigns the particles to the bins
Definition at line 140 of file PartBins.cpp.
References calcExtrema(), getBin(), Hypervolume::n, and tmppart_m.
Referenced by sortArray().
|
inline |
Is true if we still have particles to emit.
Definition at line 67 of file PartBins.h.
References getNp().
|
inline |
Add a particle to the temporary container.
Definition at line 50 of file PartBins.h.
References isEmitted_m, and tmppart_m.
Referenced by Distribution::fillParticleBins().
|
protected |
returns the index of the bin to which the particle with z = 'x' belongs. If getBin returns b < 0 || b >= bins_m, then x is out of range!
returns the index of the bin to which the particle with z = 'x' belongs. If getBin returns b < 0 || b >= bins_m, then is x out of range!
Definition at line 180 of file PartBins.cpp.
References abs(), floor(), hBin_m, nBin_m, and xmax_m.
Referenced by calcHBins().
|
inline |
Definition at line 95 of file PartBins.h.
References gamma_m.
|
inline |
the last emitted bin is always smaller or equal getNbins
Definition at line 136 of file PartBins.h.
References nemittedBins_m.
Referenced by getTotalNum(), MultiBunchHandler::MultiBunchHandler(), and print().
|
inlinevirtual |
|
inline |
get the number of particles in the temporary particle structure used for binning
Definition at line 56 of file PartBins.h.
References tmppart_m.
Referenced by doEmission().
bool PartBins::getPart | ( | size_t | n, |
int | bin, | ||
std::vector< double > & | p | ||
) |
assigns the proper position of particle n if it belongs to bin 'bin'
Definition at line 103 of file PartBins.cpp.
References Hypervolume::n, and tmppart_m.
|
inline |
Definition at line 130 of file PartBins.h.
References sBins_m.
size_t PartBins::getTotalNum | ( | ) |
How many particles are in all the bins.
Definition at line 56 of file PartBins.cpp.
References getLastemittedBin(), nBin_m, nDelBin_m, and reduce().
size_t PartBins::getTotalNumPerBin | ( | int | b | ) |
How many particles are in the bin b.
Definition at line 70 of file PartBins.cpp.
References nBin_m, and reduce().
Referenced by PartBinsCyc::PartBinsCyc().
|
inline |
Definition at line 69 of file PartBins.h.
References isEmitted_m, and Hypervolume::n.
Definition at line 157 of file PartBins.cpp.
References bins_m, endl(), getLastemittedBin(), h_m, hBin_m, sBins_m, and tmppart_m.
Referenced by operator<<().
|
inline |
If the bunch object rebins we need to call resetBins()
Definition at line 139 of file PartBins.h.
References h_m.
void PartBins::resetPartInBin_cyc | ( | size_t | newPartNum[], |
int | binID | ||
) |
update local particles number in bin after reset Bin ID of PartBunch
Definition at line 86 of file PartBins.cpp.
References nBin_m, nemittedBins_m, reduce(), and setBinEmitted().
|
inlineprivate |
assume we emit in monotonic increasing order
Definition at line 86 of file PartBins.h.
References binsEmitted_m.
Referenced by resetPartInBin_cyc(), and sortArray().
|
inline |
Definition at line 94 of file PartBins.h.
References gamma_m.
Referenced by Distribution::setupParticleBins().
|
inline |
void PartBins::sortArray | ( | ) |
sort the vector of particles such that positions of the particles decrease with increasing index. Then push the particles back by xmax_m + jifactor * bunch_length. In order that the method getBin(double x) works xmin_m has to be lowered a bit more.
/brief There is only a local sort, no global yet
sort the vector of particles such that position of the particles decrease with increasing index. Then push the particles back by 1e-13 s * beta * c (approximately one step). In order that the method getBin(double x) works xmin_m has to be lowered a bit more.
Definition at line 113 of file PartBins.cpp.
References abs(), bins_m, Physics::c, calcHBins(), Physics::e, gamma_m, hBin_m, Hypervolume::n, nBin_m, reduce(), setBinEmitted(), sqrt(), tmppart_m, xmax_m, and xmin_m.
Referenced by Distribution::fillParticleBins().
void PartBins::updatePartInBin_cyc | ( | size_t | countLost[] | ) |
update local particles number in bin after particle deletion
Definition at line 78 of file PartBins.cpp.
References nBin_m, and nemittedBins_m.
|
inlinevirtual |
|
protected |
Definition at line 106 of file PartBins.h.
Referenced by PartBinsCyc::getNBins(), PartBins(), PartBinsCyc::PartBinsCyc(), print(), and sortArray().
|
protected |
holds information whether all particles of a bin are emitted
Definition at line 124 of file PartBins.h.
Referenced by PartBins(), PartBinsCyc::PartBinsCyc(), and setBinEmitted().
|
protected |
Definition at line 99 of file PartBins.h.
Referenced by getGamma(), setGamma(), and sortArray().
|
protected |
Definition at line 165 of file PartBins.h.
Referenced by getNBins(), print(), resetBins(), and weHaveBins().
|
protected |
bin size
Definition at line 118 of file PartBins.h.
Referenced by getBin(), print(), and sortArray().
|
protected |
Definition at line 122 of file PartBins.h.
Referenced by fill(), isEmitted(), and ~PartBins().
|
protected |
number of particles in the bins, the sum of all the nodes
Definition at line 160 of file PartBins.h.
Referenced by getBin(), getTotalNum(), getTotalNumPerBin(), PartBins(), PartBinsCyc::PartBinsCyc(), resetPartInBin_cyc(), setPartNum(), sortArray(), and updatePartInBin_cyc().
|
protected |
number of deleted particles in the bins
Definition at line 163 of file PartBins.h.
Referenced by getTotalNum(), and PartBins().
|
protected |
number of emitted bins
Definition at line 157 of file PartBins.h.
Referenced by getLastemittedBin(), PartBinsCyc::PartBinsCyc(), resetPartInBin_cyc(), updatePartInBin_cyc(), and PartBinsCyc::weHaveBins().
|
protected |
Definition at line 107 of file PartBins.h.
Referenced by getNBins(), getSBins(), and print().
|
protected |
holds the particles not yet in the bunch
Definition at line 121 of file PartBins.h.
Referenced by calcExtrema(), calcHBins(), fill(), getNp(), getPart(), print(), sortArray(), and ~PartBins().
|
protected |
Definition at line 115 of file PartBins.h.
Referenced by calcExtrema(), and PartBins().
|
protected |
extremal particle position within the bins
Definition at line 114 of file PartBins.h.
Referenced by calcExtrema(), and PartBins().
|
protected |
Definition at line 111 of file PartBins.h.
Referenced by getBin(), and sortArray().
|
protected |