OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
PartBinsCyc Class Reference

#include <PartBinsCyc.h>

Inheritance diagram for PartBinsCyc:
Collaboration diagram for PartBinsCyc:

Public Member Functions

 PartBinsCyc (int bunches, int bins, size_t partInBin[])
 PartBinsCyc (int specifiedNumBins, int bins)
virtual int getNBins ()
virtual bool weHaveBins ()
void fill (std::vector< double > &p)
 Add a particle to the temporary container.
size_t getNp ()
 get the number of particles in the temporary particle structure used for binning
void setPartNum (int bin, long long num)
bool doEmission ()
 Is true if we still have particles to emit.
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 ()
Informprint (Inform &os)
int getSBins ()
int getLastemittedBin ()
void resetBins ()
 If the bunch object rebins we need to call resetBins().
size_t getTotalNum ()
 How many particles are in all the bins.
size_t getTotalNumPerBin (int b)
 How many particles are in the bin b.

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)

Detailed Description

Definition at line 32 of file PartBinsCyc.h.

Constructor & Destructor Documentation

◆ PartBinsCyc() [1/2]

PartBinsCyc::PartBinsCyc ( int bunches,
int bins,
size_t partInBin[] )

constructor function for cyclotron

Definition at line 35 of file PartBinsCyc.cpp.

References PartBins::bins_m, PartBins::binsEmitted_m, endl(), PartBins::getTotalNumPerBin(), gmsg, PartBins::nBin_m, PartBins::nemittedBins_m, and PartBins::PartBins().

Here is the call graph for this function:

◆ PartBinsCyc() [2/2]

PartBinsCyc::PartBinsCyc ( int specifiedNumBins,
int bins )

Definition at line 50 of file PartBinsCyc.cpp.

References PartBins::bins_m, PartBins::binsEmitted_m, PartBins::nemittedBins_m, and PartBins::PartBins().

Here is the call graph for this function:

Member Function Documentation

◆ calcExtrema()

void PartBins::calcExtrema ( )
privateinherited

Definition at line 150 of file PartBins.cpp.

References tmppart_m, xbinmax_m, and xbinmin_m.

Referenced by calcHBins().

◆ calcHBins()

void PartBins::calcHBins ( )
privateinherited

assigns the particles to the bins

Definition at line 143 of file PartBins.cpp.

References calcExtrema(), getBin(), and tmppart_m.

Referenced by sortArray().

Here is the call graph for this function:

◆ doEmission()

bool PartBins::doEmission ( )
inlineinherited

Is true if we still have particles to emit.

Definition at line 67 of file PartBins.h.

References getNp().

Here is the call graph for this function:

◆ fill()

void PartBins::fill ( std::vector< double > & p)
inlineinherited

Add a particle to the temporary container.

Definition at line 50 of file PartBins.h.

References isEmitted_m, and tmppart_m.

◆ getBin()

int PartBins::getBin ( double x)
protectedinherited

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 183 of file PartBins.cpp.

References hBin_m, nBin_m, and xmax_m.

Referenced by calcHBins().

◆ getGamma()

double PartBins::getGamma ( )
inlineinherited

Definition at line 95 of file PartBins.h.

References gamma_m.

◆ getLastemittedBin()

int PartBins::getLastemittedBin ( )
inlineinherited

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

◆ getNBins()

virtual int PartBinsCyc::getNBins ( )
inlinevirtual

get the number of used bin

Reimplemented from PartBins.

Definition at line 42 of file PartBinsCyc.h.

References PartBins::bins_m.

◆ getNp()

size_t PartBins::getNp ( )
inlineinherited

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

◆ getPart()

bool PartBins::getPart ( size_t n,
int bin,
std::vector< double > & p )
inherited

assigns the proper position of particle n if it belongs to bin 'bin'

Definition at line 106 of file PartBins.cpp.

References tmppart_m.

◆ getSBins()

int PartBins::getSBins ( )
inlineinherited

Definition at line 130 of file PartBins.h.

References sBins_m.

◆ getTotalNum()

size_t PartBins::getTotalNum ( )
inherited

How many particles are in all the bins.

Definition at line 59 of file PartBins.cpp.

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

Here is the call graph for this function:

◆ getTotalNumPerBin()

size_t PartBins::getTotalNumPerBin ( int b)
inherited

How many particles are in the bin b.

Definition at line 73 of file PartBins.cpp.

References nBin_m, and reduce().

Referenced by PartBinsCyc::PartBinsCyc().

Here is the call graph for this function:

◆ isEmitted()

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

Definition at line 69 of file PartBins.h.

References isEmitted_m.

◆ print()

Inform & PartBins::print ( Inform & os)
inherited

Definition at line 160 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:

◆ resetBins()

void PartBins::resetBins ( )
inlineinherited

If the bunch object rebins we need to call resetBins().

Definition at line 139 of file PartBins.h.

References h_m.

◆ resetPartInBin_cyc()

void PartBins::resetPartInBin_cyc ( size_t newPartNum[],
int binID )
inherited

update local particles number in bin after reset Bin ID of PartBunch

Definition at line 89 of file PartBins.cpp.

References nBin_m, nemittedBins_m, reduce(), and setBinEmitted().

Here is the call graph for this function:

◆ setBinEmitted()

void PartBins::setBinEmitted ( int bin)
inlineprivateinherited

assume we emit in monotonic increasing order

Definition at line 86 of file PartBins.h.

References binsEmitted_m.

Referenced by resetPartInBin_cyc(), and sortArray().

◆ setGamma()

void PartBins::setGamma ( double gamma)
inlineinherited

Definition at line 94 of file PartBins.h.

References gamma_m.

◆ setPartNum()

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

set particles number in given bin

Definition at line 64 of file PartBins.h.

References nBin_m.

◆ sortArray()

void PartBins::sortArray ( )
inherited

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 116 of file PartBins.cpp.

References bins_m, Physics::c, calcHBins(), gamma_m, hBin_m, nBin_m, Units::ps2s, reduce(), setBinEmitted(), tmppart_m, xmax_m, and xmin_m.

Here is the call graph for this function:

◆ updatePartInBin_cyc()

void PartBins::updatePartInBin_cyc ( size_t countLost[])
inherited

update local particles number in bin after particle deletion

Definition at line 81 of file PartBins.cpp.

References nBin_m, and nemittedBins_m.

◆ weHaveBins()

virtual bool PartBinsCyc::weHaveBins ( )
inlinevirtual

Reimplemented from PartBins.

Definition at line 44 of file PartBinsCyc.h.

References PartBins::nemittedBins_m.

Member Data Documentation

◆ bins_m

int PartBins::bins_m
protectedinherited

◆ binsEmitted_m

std::unique_ptr<bool[]> PartBins::binsEmitted_m
protectedinherited

holds information whether all particles of a bin are emitted

Definition at line 124 of file PartBins.h.

Referenced by PartBins(), PartBinsCyc::PartBinsCyc(), PartBinsCyc::PartBinsCyc(), and setBinEmitted().

◆ gamma_m

double PartBins::gamma_m
protectedinherited

Definition at line 99 of file PartBins.h.

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

◆ h_m

std::unique_ptr<gsl_histogram> PartBins::h_m
protectedinherited

Definition at line 165 of file PartBins.h.

Referenced by getNBins(), print(), resetBins(), and weHaveBins().

◆ hBin_m

double PartBins::hBin_m
protectedinherited

bin size

Definition at line 118 of file PartBins.h.

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

◆ isEmitted_m

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

Definition at line 122 of file PartBins.h.

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

◆ nBin_m

std::unique_ptr<size_t[]> PartBins::nBin_m
protectedinherited

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

◆ nDelBin_m

std::unique_ptr<size_t[]> PartBins::nDelBin_m
protectedinherited

number of deleted particles in the bins

Definition at line 163 of file PartBins.h.

Referenced by getTotalNum(), and PartBins().

◆ nemittedBins_m

int PartBins::nemittedBins_m
protectedinherited

◆ sBins_m

int PartBins::sBins_m
protectedinherited

Definition at line 107 of file PartBins.h.

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

◆ tmppart_m

std::vector< std::vector<double> > PartBins::tmppart_m
protectedinherited

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

◆ xbinmax_m

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

Definition at line 115 of file PartBins.h.

Referenced by calcExtrema(), and PartBins().

◆ xbinmin_m

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

extremal particle position within the bins

Definition at line 114 of file PartBins.h.

Referenced by calcExtrema(), and PartBins().

◆ xmax_m

double PartBins::xmax_m
protectedinherited

Definition at line 111 of file PartBins.h.

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

◆ xmin_m

double PartBins::xmin_m
protectedinherited

extremal particle positions

Definition at line 110 of file PartBins.h.

Referenced by PartBins(), and sortArray().


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