OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
Gaussian Class Reference

Generating particles following a Gaussian distribution. More...

#include <Gaussian.h>

Inheritance diagram for Gaussian:
Inheritance graph
Collaboration diagram for Gaussian:
Collaboration graph

Public Member Functions

 Gaussian (std::shared_ptr< ParticleContainer_t > &pc, std::shared_ptr< FieldContainer_t > &fc, std::shared_ptr< Distribution_t > &opalDist)
 Constructor for the Gaussian sampler. More...
 
 Gaussian (std::shared_ptr< ParticleContainer_t > pc, const Vector_t< double, 3 > &sigmaR, const Vector_t< double, 3 > &sigmaP, double avrgpz, const Vector_t< double, 3 > &cutoffR, bool fix_meanR=true)
 Constructor for the Gaussian sampler without field container and distribution object. More...
 
void generateParticles (size_t &numberOfParticles, Vector_t< double, 3 > nr) override
 Generates particles with a Gaussian distribution. More...
 
void setSigmaR (const Vector_t< double, 3 > &sigmaR)
 
void setSigmaP (const Vector_t< double, 3 > &sigmaP)
 
void setAvrgpz (double avrgpz)
 
void setCutoffR (const Vector_t< double, 3 > &cutoffR)
 
void getParameters (Vector_t< double, 3 > &sigmaR, Vector_t< double, 3 > &sigmaP, double &avrgpz, Vector_t< double, 3 > &cutoffR) const
 
void setFixMeanR (bool fixMeanR)
 
void getFixMeanR (bool &fixMeanR) const
 
virtual void emitParticles (double, double)
 
virtual void testNumEmitParticles (size_t, double)
 
virtual void testEmitParticles (size_t, double)
 
virtual void initDomainDecomp (double)
 
virtual void setWithDomainDecomp (bool)
 

Public Attributes

IpplTimings::TimerRef samperTimer_m
 Timer for performance profiling. More...
 

Protected Attributes

std::shared_ptr< ParticleContainer_tpc_m
 
std::shared_ptr< FieldContainer_tfc_m
 
std::shared_ptr< Distribution_topalDist_m
 
std::string samplingMethod_m
 

Private Member Functions

void initRandomPool ()
 Initializes the random number generator pool. More...
 

Private Attributes

GeneratorPool randPool_m
 Pool of random number generators for parallel sampling. More...
 
Vector_t< double, 3 > sigmaR_m
 Standard deviations for position and momentum distributions. More...
 
Vector_t< double, 3 > sigmaP_m
 
double avrgpz_m
 Average momentum in the z-direction. More...
 
Vector_t< double, 3 > cutoffR_m
 Cutoff multiplier for position distribution. More...
 
bool fixMeanR_m = true
 Flag to exactly fix the mean position of particles after sampling. More...
 

Detailed Description

Generating particles following a Gaussian distribution.

This function samples particle positions R and momenta P given following normal distributions a normal distribution R ~ N ( [0, 0, 0 ], sdR) P ~ N ( [0, 0, avrgpz], sdP) where sdR = [SigmaR[0] 0 0 0 SigmaR[1] 0 0 0 SigmaR[2]]

and sdP = [SigmaP[0] 0 0 0 SigmaP[1] 0 0 0 SigmaP[2]].

Here, R is sampled in a bounded domains R \in [-CutoffR*SigmaR, CutoffR*SigmaR]^3 and corrected by translation to ensure mean = [0,0,0].

Parameters
numberOfParticlesThe total number of particles to generate.
nrThe number of grid points in each dimension (not used here).

Definition at line 41 of file Gaussian.h.

Constructor & Destructor Documentation

◆ Gaussian() [1/2]

Gaussian::Gaussian ( std::shared_ptr< ParticleContainer_t > &  pc,
std::shared_ptr< FieldContainer_t > &  fc,
std::shared_ptr< Distribution_t > &  opalDist 
)

Constructor for the Gaussian sampler.

Constructs a Gaussian sampler.

Parameters
pcShared pointer to the particle container.
fcShared pointer to the field container.
opalDistShared pointer to the distribution object.

Definition at line 14 of file Gaussian.cpp.

References IpplTimings::getTimer(), initRandomPool(), samperTimer_m, setAvrgpz(), setCutoffR(), setSigmaP(), and setSigmaR().

Here is the call graph for this function:

◆ Gaussian() [2/2]

Gaussian::Gaussian ( std::shared_ptr< ParticleContainer_t pc,
const Vector_t< double, 3 > &  sigmaR,
const Vector_t< double, 3 > &  sigmaP,
double  avrgpz,
const Vector_t< double, 3 > &  cutoffR,
bool  fix_meanR = true 
)

Constructor for the Gaussian sampler without field container and distribution object.

Parameters
pcShared pointer to the particle container.
sigmaRStandard deviation for position distribution.
sigmaPStandard deviation for momentum distribution.
avrgpzAverage momentum in the z-direction.
cutoffRCutoff multiplier for position distribution.
fix_meanRFlag to exactly fix the mean position of particles after sampling.

Definition at line 26 of file Gaussian.cpp.

References IpplTimings::getTimer(), initRandomPool(), samperTimer_m, setAvrgpz(), setCutoffR(), setFixMeanR(), setSigmaP(), and setSigmaR().

Here is the call graph for this function:

Member Function Documentation

◆ emitParticles()

virtual void SamplingBase::emitParticles ( double  ,
double   
)
inlinevirtualinherited

Reimplemented in FlatTop.

Definition at line 40 of file SamplingBase.hpp.

◆ generateParticles()

void Gaussian::generateParticles ( size_t &  numberOfParticles,
Vector_t< double, 3 >  nr 
)
overridevirtual

Generates particles with a Gaussian distribution.

Generates particles following a Gaussian distribution.

Parameters
numberOfParticlesThe total number of particles to generate.
nrthe number of grid cells in R (used in domain decomposition).
numberOfParticlesThe total number of particles to generate.
nrThe number of grid points in each dimension (not used here).

Reimplemented from SamplingBase.

Definition at line 64 of file Gaussian.cpp.

References avrgpz_m, ippl::Comm, cutoffR_m, ippl::fence(), fixMeanR_m, ippl::parallel_for(), ippl::parallel_reduce(), SamplingBase::pc_m, randPool_m, samperTimer_m, sigmaP_m, sigmaR_m, IpplTimings::startTimer(), and IpplTimings::stopTimer().

Here is the call graph for this function:

◆ getFixMeanR()

void Gaussian::getFixMeanR ( bool &  fixMeanR) const
inline

Definition at line 111 of file Gaussian.h.

References fixMeanR_m.

◆ getParameters()

void Gaussian::getParameters ( Vector_t< double, 3 > &  sigmaR,
Vector_t< double, 3 > &  sigmaP,
double &  avrgpz,
Vector_t< double, 3 > &  cutoffR 
) const
inline

Definition at line 97 of file Gaussian.h.

References avrgpz_m, cutoffR_m, sigmaP_m, and sigmaR_m.

◆ initDomainDecomp()

virtual void SamplingBase::initDomainDecomp ( double  )
inlinevirtualinherited

Reimplemented in FlatTop.

Definition at line 48 of file SamplingBase.hpp.

◆ initRandomPool()

void Gaussian::initRandomPool ( )
private

Initializes the random number generator pool.

Definition at line 42 of file Gaussian.cpp.

References ippl::Comm, endl(), gmsg, randPool_m, and Options::seed.

Referenced by Gaussian().

Here is the call graph for this function:

◆ setAvrgpz()

void Gaussian::setAvrgpz ( double  avrgpz)
inline

Definition at line 89 of file Gaussian.h.

References avrgpz_m.

Referenced by Gaussian().

◆ setCutoffR()

void Gaussian::setCutoffR ( const Vector_t< double, 3 > &  cutoffR)
inline

Definition at line 93 of file Gaussian.h.

References cutoffR_m.

Referenced by Gaussian().

◆ setFixMeanR()

void Gaussian::setFixMeanR ( bool  fixMeanR)
inline

Definition at line 107 of file Gaussian.h.

References fixMeanR_m.

Referenced by Gaussian().

◆ setSigmaP()

void Gaussian::setSigmaP ( const Vector_t< double, 3 > &  sigmaP)
inline

Definition at line 85 of file Gaussian.h.

References sigmaP_m.

Referenced by Gaussian().

◆ setSigmaR()

void Gaussian::setSigmaR ( const Vector_t< double, 3 > &  sigmaR)
inline

Definition at line 81 of file Gaussian.h.

References sigmaR_m.

Referenced by Gaussian().

◆ setWithDomainDecomp()

virtual void SamplingBase::setWithDomainDecomp ( bool  )
inlinevirtualinherited

Reimplemented in FlatTop.

Definition at line 50 of file SamplingBase.hpp.

◆ testEmitParticles()

virtual void SamplingBase::testEmitParticles ( size_t  ,
double   
)
inlinevirtualinherited

Definition at line 46 of file SamplingBase.hpp.

◆ testNumEmitParticles()

virtual void SamplingBase::testNumEmitParticles ( size_t  ,
double   
)
inlinevirtualinherited

Definition at line 43 of file SamplingBase.hpp.

Member Data Documentation

◆ avrgpz_m

double Gaussian::avrgpz_m
private

Average momentum in the z-direction.

Definition at line 135 of file Gaussian.h.

Referenced by generateParticles(), getParameters(), and setAvrgpz().

◆ cutoffR_m

Vector_t<double, 3> Gaussian::cutoffR_m
private

Cutoff multiplier for position distribution.

Definition at line 140 of file Gaussian.h.

Referenced by generateParticles(), getParameters(), and setCutoffR().

◆ fc_m

std::shared_ptr<FieldContainer_t> SamplingBase::fc_m
protectedinherited

Definition at line 14 of file SamplingBase.hpp.

Referenced by FlatTop::initDomainDecomp(), and FlatTop::setParameters().

◆ fixMeanR_m

bool Gaussian::fixMeanR_m = true
private

Flag to exactly fix the mean position of particles after sampling.

Definition at line 145 of file Gaussian.h.

Referenced by generateParticles(), getFixMeanR(), and setFixMeanR().

◆ opalDist_m

std::shared_ptr<Distribution_t> SamplingBase::opalDist_m
protectedinherited

◆ pc_m

◆ randPool_m

GeneratorPool Gaussian::randPool_m
private

Pool of random number generators for parallel sampling.

Definition at line 124 of file Gaussian.h.

Referenced by generateParticles(), and initRandomPool().

◆ samperTimer_m

IpplTimings::TimerRef Gaussian::samperTimer_m

Timer for performance profiling.

Definition at line 46 of file Gaussian.h.

Referenced by Gaussian(), and generateParticles().

◆ samplingMethod_m

std::string SamplingBase::samplingMethod_m
protectedinherited

Definition at line 16 of file SamplingBase.hpp.

◆ sigmaP_m

Vector_t<double, 3> Gaussian::sigmaP_m
private

Definition at line 130 of file Gaussian.h.

Referenced by generateParticles(), getParameters(), and setSigmaP().

◆ sigmaR_m

Vector_t<double, 3> Gaussian::sigmaR_m
private

Standard deviations for position and momentum distributions.

Definition at line 129 of file Gaussian.h.

Referenced by generateParticles(), getParameters(), and setSigmaR().


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