OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PartBins Class Reference

#include <PartBins.h>

Inheritance diagram for PartBins:
Inheritance graph
[legend]

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 ()
 
Informprint (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
 

Detailed Description

Definition at line 32 of file PartBins.h.

Constructor & Destructor Documentation

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.

Here is the call graph for this function:

PartBins::~PartBins ( )
virtual

Definition at line 131 of file PartBins.cpp.

References isEmitted_m, and tmppart_m.

Member Function Documentation

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.

Here is the call graph for this function:

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().

Here is the call graph for this function:

bool PartBins::doEmission ( )
inline

Is true if we still have particles to emit.

Definition at line 82 of file PartBins.h.

References getNp().

Here is the call graph for this function:

void PartBins::fill ( std::vector< double > &  p)
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().

int PartBins::getBin ( double  x)
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().

Here is the call graph for this function:

bool PartBins::getBinEmitted ( int  bin)
inline

Definition at line 79 of file PartBins.h.

References binsEmitted_m.

int PartBins::getBinToEmit ( )
inline

Definition at line 181 of file PartBins.h.

References getNBins(), and nemittedBins_m.

Here is the call graph for this function:

int PartBins::getDelBinCont ( int  bin)
inline

How many deleted particles are on one bin.

Definition at line 52 of file PartBins.h.

References nDelBin_m, and reduce().

Here is the call graph for this function:

void PartBins::getExtrema ( double &  min,
double &  max 
)
inline

Definition at line 114 of file PartBins.h.

References xmax_m, and xmin_m.

double PartBins::getGamma ( )
inline

Definition at line 133 of file PartBins.h.

References gamma_m.

virtual size_t PartBins::getGlobalBinCount ( int  bin)
inlinevirtual

How many particles are on one bin.

Reimplemented in PartBinsCyc.

Definition at line 222 of file PartBins.h.

References h_m, and reduce().

Here is the call graph for this function:

int PartBins::getLastemittedBin ( )
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().

virtual size_t PartBins::getLocalBinCount ( int  bin)
inlinevirtual

How many particles are on one energy bin.

Reimplemented in PartBinsCyc.

Definition at line 229 of file PartBins.h.

References h_m, and sBins_m.

size_t PartBins::getLocalSBinCount ( int  bin)
inline

How many particles are in one sampling bin.

Definition at line 238 of file PartBins.h.

References h_m.

virtual int PartBins::getNBins ( )
inlinevirtual

get the number of used bin

Reimplemented in PartBinsCyc.

Definition at line 176 of file PartBins.h.

References h_m, and sBins_m.

Referenced by getBinToEmit().

size_t PartBins::getNp ( )
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().

virtual int PartBins::getNSBins ( )
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.

int PartBins::getSBins ( )
inline

Definition at line 173 of file PartBins.h.

References sBins_m.

int PartBins::getSBinToEmit ( )
inline

Definition at line 191 of file PartBins.h.

References getNSBins(), and nemittedSBins_m.

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

bool PartBins::isEmitted ( int  n,
int   
)
inline

Definition at line 84 of file PartBins.h.

References isEmitted_m, and Hypervolume::n.

Inform & PartBins::print ( Inform os)

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<<().

Here is the call graph for this function:

void PartBins::resetBins ( )
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void PartBins::setActualemittedBin ( int  bin)
inline

set the actual emitted bib

Definition at line 205 of file PartBins.h.

References nemittedBins_m.

Referenced by sortArrayT().

void PartBins::setBinEmitted ( int  bin)
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().

void PartBins::setEmitted ( int  n,
int   
)
inline

Definition at line 88 of file PartBins.h.

References isEmitted_m, and Hypervolume::n.

void PartBins::setGamma ( double  gamma)
inline

Definition at line 132 of file PartBins.h.

References gamma_m.

Referenced by Distribution::setupParticleBins().

void PartBins::setHistogram ( gsl_histogram *  h)
inline

Definition at line 219 of file PartBins.h.

References h_m.

void PartBins::setPartNum ( int  bin,
long long  num 
)
inline

set particles number in given bin

Definition at line 74 of file PartBins.h.

References nBin_m.

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().

Here is the call graph for this function:

void PartBins::sortArrayT ( )

sort the vector of particles according to the bin number

Definition at line 174 of file PartBins.cpp.

References setActualemittedBin().

Here is the call graph for this function:

void PartBins::updateDeletedPartsInBin ( size_t  countLost[])

Definition at line 70 of file PartBins.cpp.

References endl(), getLastemittedBin(), nDelBin_m, and reduce().

Here is the call graph for this function:

void PartBins::updateExtramePos ( int  bin,
double  dz 
)
inline

Definition at line 96 of file PartBins.h.

References xbinmax_m, and xbinmin_m.

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().

Here is the call graph for this function:

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.

void PartBins::updatePartPos ( int  n,
int  ,
double  z 
)
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().

Here is the call graph for this function:

virtual bool PartBins::weHaveBins ( )
inlinevirtual

Reimplemented in PartBinsCyc.

Definition at line 212 of file PartBins.h.

References h_m.

Member Data Documentation

int PartBins::bins_m
protected
std::unique_ptr<bool[]> PartBins::binsEmitted_m
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().

double PartBins::gamma_m
protected

Definition at line 137 of file PartBins.h.

Referenced by getGamma(), setGamma(), and sortArray().

std::unique_ptr<gsl_histogram> PartBins::h_m
protected
double PartBins::hBin_m
protected

bin size

Definition at line 156 of file PartBins.h.

Referenced by getBin(), print(), and sortArray().

std::vector< bool > PartBins::isEmitted_m
protected

Definition at line 160 of file PartBins.h.

Referenced by fill(), isEmitted(), setEmitted(), and ~PartBins().

std::unique_ptr<size_t[]> PartBins::nBin_m
protected
std::unique_ptr<size_t[]> PartBins::nDelBin_m
protected

number of deleted particles in the bins

Definition at line 260 of file PartBins.h.

Referenced by getDelBinCont(), getTotalNum(), PartBins(), and updateDeletedPartsInBin().

int PartBins::nemittedBins_m
protected
int PartBins::nemittedSBins_m
protected

Number of total sampled bins emitted

Definition at line 254 of file PartBins.h.

Referenced by getSBinToEmit().

int PartBins::sBins_m
protected

Definition at line 145 of file PartBins.h.

Referenced by getLocalBinCount(), getNBins(), getSBins(), and print().

std::vector< std::vector<double> > PartBins::tmppart_m
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().

std::unique_ptr<double[]> PartBins::xbinmax_m
protected

Definition at line 153 of file PartBins.h.

Referenced by calcExtrema(), PartBins(), and updateExtramePos().

std::unique_ptr<double[]> PartBins::xbinmin_m
protected

extremal particle position within the bins

Definition at line 152 of file PartBins.h.

Referenced by calcExtrema(), PartBins(), and updateExtramePos().

double PartBins::xmax_m
protected

Definition at line 149 of file PartBins.h.

Referenced by calcGlobalExtrema(), getBin(), getExtrema(), and sortArray().

double PartBins::xmin_m
protected

extremal particle positions

Definition at line 148 of file PartBins.h.

Referenced by calcGlobalExtrema(), getExtrema(), and sortArray().


The documentation for this class was generated from the following files: