OPAL (Object Oriented Parallel Accelerator Library)
2.2.0
OPAL
|
#include <PartBins.h>
Public Member Functions | |
PartBins (int bins, int sbins) | |
virtual | ~PartBins () |
int | getDelBinCont (int bin) |
How many deleted particles are on one bin. More... | |
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) |
void | setBinEmitted (int bin) |
bool | getBinEmitted (int bin) |
bool | doEmission () |
Is true if we still have particles to emit. More... | |
bool | isEmitted (int n, int) |
void | setEmitted (int n, int) |
void | updatePartPos (int n, int, double z) |
void | updateExtramePos (int bin, double dz) |
bool | getPart (size_t n, int bin, std::vector< double > &p) |
void | sortArray () |
void | calcHBins () |
size_t | getSum () |
void | calcGlobalExtrema () |
void | calcExtrema () |
void | getExtrema (double &min, double &max) |
void | updateStatus (int bunchCount, size_t nPartInBin) |
void | resetPartInBin (size_t newPartNum[]) |
void | resetPartInBin_cyc (size_t newPartNum[], int binID) |
void | updatePartInBin (size_t countLost[]) |
void | updatePartInBin_cyc (size_t countLost[]) |
void | updateDeletedPartsInBin (size_t countLost[]) |
void | setGamma (double gamma) |
double | getGamma () |
Inform & | print (Inform &os) |
int | getSBins () |
virtual int | getNBins () |
virtual int | getNSBins () |
int | getBinToEmit () |
int | getSBinToEmit () |
int | getLastemittedBin () |
void | setActualemittedBin (int bin) |
void | resetBins () |
If the bunch object rebins we need to call resetBins() More... | |
virtual bool | weHaveBins () |
void | sortArrayT () |
void | setHistogram (gsl_histogram *h) |
virtual size_t | getGlobalBinCount (int bin) |
How many particles are on one bin. More... | |
virtual size_t | getLocalBinCount (int bin) |
How many particles are on one energy bin. More... | |
size_t | getLocalSBinCount (int bin) |
How many particles are in one sampling bin. More... | |
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 |
int | nemittedSBins_m |
std::unique_ptr< size_t[]> | nBin_m |
std::unique_ptr< size_t[]> | nDelBin_m |
std::unique_ptr< gsl_histogram > | h_m |
Definition at line 32 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 10 of file PartBins.cpp.
References bins_m, binsEmitted_m, max(), nBin_m, nDelBin_m, xbinmax_m, and xbinmin_m.
|
virtual |
Definition at line 131 of file PartBins.cpp.
References isEmitted_m, and tmppart_m.
void PartBins::calcExtrema | ( | ) |
Definition at line 206 of file PartBins.cpp.
References Hypervolume::n, tmppart_m, xbinmax_m, and xbinmin_m.
Referenced by calcHBins().
void PartBins::calcGlobalExtrema | ( | ) |
Definition at line 192 of file PartBins.cpp.
References max(), Hypervolume::n, tmppart_m, xmax_m, and xmin_m.
void PartBins::calcHBins | ( | ) |
assigns the particles to the bins
Definition at line 178 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 82 of file PartBins.h.
References getNp().
|
inline |
Add a particle to the temporary container.
Definition at line 60 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 239 of file PartBins.cpp.
References fabs(), floor(), hBin_m, nBin_m, and xmax_m.
Referenced by calcHBins().
|
inline |
Definition at line 79 of file PartBins.h.
References binsEmitted_m.
|
inline |
Definition at line 181 of file PartBins.h.
References getNBins(), and nemittedBins_m.
|
inline |
How many deleted particles are on one bin.
Definition at line 52 of file PartBins.h.
References nDelBin_m, and reduce().
|
inline |
Definition at line 114 of file PartBins.h.
|
inline |
Definition at line 133 of file PartBins.h.
References gamma_m.
|
inlinevirtual |
How many particles are on one bin.
Reimplemented in PartBinsCyc.
Definition at line 222 of file PartBins.h.
|
inline |
the last emitted bin is always smaller or equal getNbins
Definition at line 202 of file PartBins.h.
References nemittedBins_m.
Referenced by getTotalNum(), MultiBunchHandler::MultiBunchHandler(), print(), and updateDeletedPartsInBin().
|
inlinevirtual |
How many particles are on one energy bin.
Reimplemented in PartBinsCyc.
Definition at line 229 of file PartBins.h.
|
inline |
How many particles are in one sampling bin.
Definition at line 238 of file PartBins.h.
References h_m.
|
inlinevirtual |
get the number of used bin
Reimplemented in PartBinsCyc.
Definition at line 176 of file PartBins.h.
Referenced by getBinToEmit().
|
inline |
get the number of particles in the temporary particle structure used for binning
Definition at line 66 of file PartBins.h.
References tmppart_m.
Referenced by doEmission().
|
inlinevirtual |
Get the total number of sampled bins
Definition at line 179 of file PartBins.h.
References h_m.
Referenced by getSBinToEmit().
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 137 of file PartBins.cpp.
References Hypervolume::n, and tmppart_m.
|
inline |
Definition at line 173 of file PartBins.h.
References sBins_m.
|
inline |
Definition at line 191 of file PartBins.h.
References getNSBins(), and nemittedSBins_m.
size_t PartBins::getSum | ( | ) |
Definition at line 185 of file PartBins.cpp.
References bins_m, Hypervolume::n, and nBin_m.
size_t PartBins::getTotalNum | ( | ) |
How many particles are in all the bins.
Definition at line 39 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 53 of file PartBins.cpp.
References nBin_m, and reduce().
Referenced by PartBinsCyc::PartBinsCyc().
|
inline |
Definition at line 84 of file PartBins.h.
References isEmitted_m, and Hypervolume::n.
Here comes the new stuff, t-binning
Definition at line 216 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 208 of file PartBins.h.
References h_m.
void PartBins::resetPartInBin | ( | size_t | newPartNum[] | ) |
update particles number in bin after reset Bin ID of PartBunch
Definition at line 110 of file PartBins.cpp.
References endl(), INFOMSG, nBin_m, nemittedBins_m, and reduce().
void PartBins::resetPartInBin_cyc | ( | size_t | newPartNum[], |
int | binID | ||
) |
update local particles number in bin after reset Bin ID of PartBunch
Definition at line 119 of file PartBins.cpp.
References nBin_m, nemittedBins_m, reduce(), and setBinEmitted().
|
inline |
set the actual emitted bib
Definition at line 205 of file PartBins.h.
References nemittedBins_m.
Referenced by sortArrayT().
|
inline |
assume we emmit in monotinic increasing order
Definition at line 77 of file PartBins.h.
References binsEmitted_m.
Referenced by resetPartInBin_cyc(), and sortArray().
|
inline |
Definition at line 88 of file PartBins.h.
References isEmitted_m, and Hypervolume::n.
|
inline |
Definition at line 132 of file PartBins.h.
References gamma_m.
Referenced by Distribution::setupParticleBins().
|
inline |
Definition at line 219 of file PartBins.h.
References h_m.
|
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 147 of file PartBins.cpp.
References bins_m, Physics::c, calcHBins(), Physics::e, fabs(), gamma_m, hBin_m, Hypervolume::n, nBin_m, reduce(), setBinEmitted(), sqrt(), tmppart_m, xmax_m, and xmin_m.
Referenced by Distribution::fillParticleBins().
void PartBins::sortArrayT | ( | ) |
sort the vector of particles according to the bin number
Definition at line 174 of file PartBins.cpp.
References setActualemittedBin().
void PartBins::updateDeletedPartsInBin | ( | size_t | countLost[] | ) |
Definition at line 70 of file PartBins.cpp.
References endl(), getLastemittedBin(), nDelBin_m, and reduce().
|
inline |
Definition at line 96 of file PartBins.h.
void PartBins::updatePartInBin | ( | size_t | countLost[] | ) |
update particles number in bin after particle deletion
Definition at line 84 of file PartBins.cpp.
References endl(), nBin_m, nemittedBins_m, and reduce().
void PartBins::updatePartInBin_cyc | ( | size_t | countLost[] | ) |
update local particles number in bin after particle deletion
Definition at line 101 of file PartBins.cpp.
References nBin_m, and nemittedBins_m.
|
inline |
Definition at line 92 of file PartBins.h.
References Hypervolume::n, and tmppart_m.
void PartBins::updateStatus | ( | int | bunchCount, |
size_t | nPartInBin | ||
) |
update global bin parameters after inject a new bunch
Definition at line 60 of file PartBins.cpp.
References binsEmitted_m, nBin_m, nemittedBins_m, and reduce().
|
inlinevirtual |
|
protected |
Definition at line 144 of file PartBins.h.
Referenced by PartBinsCyc::getLocalBinCount(), PartBinsCyc::getNBins(), getSum(), PartBins(), PartBinsCyc::PartBinsCyc(), print(), and sortArray().
|
protected |
holds information whether all particles of a bin are emitted
Definition at line 163 of file PartBins.h.
Referenced by getBinEmitted(), PartBins(), PartBinsCyc::PartBinsCyc(), setBinEmitted(), and updateStatus().
|
protected |
Definition at line 137 of file PartBins.h.
Referenced by getGamma(), setGamma(), and sortArray().
|
protected |
Definition at line 262 of file PartBins.h.
Referenced by getGlobalBinCount(), getLocalBinCount(), getLocalSBinCount(), getNBins(), getNSBins(), print(), resetBins(), setHistogram(), and weHaveBins().
|
protected |
bin size
Definition at line 156 of file PartBins.h.
Referenced by getBin(), print(), and sortArray().
|
protected |
Definition at line 160 of file PartBins.h.
Referenced by fill(), isEmitted(), setEmitted(), and ~PartBins().
|
protected |
number of particles in the bins, the sum of all the nodes
Definition at line 257 of file PartBins.h.
Referenced by getBin(), PartBinsCyc::getGlobalBinCount(), PartBinsCyc::getLocalBinCount(), getSum(), getTotalNum(), getTotalNumPerBin(), PartBins(), PartBinsCyc::PartBinsCyc(), resetPartInBin(), resetPartInBin_cyc(), setPartNum(), sortArray(), updatePartInBin(), updatePartInBin_cyc(), and updateStatus().
|
protected |
number of deleted particles in the bins
Definition at line 260 of file PartBins.h.
Referenced by getDelBinCont(), getTotalNum(), PartBins(), and updateDeletedPartsInBin().
|
protected |
number of emitted bins
Definition at line 251 of file PartBins.h.
Referenced by getBinToEmit(), getLastemittedBin(), PartBinsCyc::PartBinsCyc(), resetPartInBin(), resetPartInBin_cyc(), setActualemittedBin(), updatePartInBin(), updatePartInBin_cyc(), updateStatus(), and PartBinsCyc::weHaveBins().
|
protected |
Number of total sampled bins emitted
Definition at line 254 of file PartBins.h.
Referenced by getSBinToEmit().
|
protected |
Definition at line 145 of file PartBins.h.
Referenced by getLocalBinCount(), getNBins(), getSBins(), and print().
|
protected |
holds the particles not yet in the bunch
Definition at line 159 of file PartBins.h.
Referenced by calcExtrema(), calcGlobalExtrema(), calcHBins(), fill(), getNp(), getPart(), print(), sortArray(), updatePartPos(), and ~PartBins().
|
protected |
Definition at line 153 of file PartBins.h.
Referenced by calcExtrema(), PartBins(), and updateExtramePos().
|
protected |
extremal particle position within the bins
Definition at line 152 of file PartBins.h.
Referenced by calcExtrema(), PartBins(), and updateExtramePos().
|
protected |
Definition at line 149 of file PartBins.h.
Referenced by calcGlobalExtrema(), getBin(), getExtrema(), and sortArray().
|
protected |
extremal particle positions
Definition at line 148 of file PartBins.h.
Referenced by calcGlobalExtrema(), getExtrema(), and sortArray().