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

Generating particles following a Gaussian distribution. More...

#include <Gaussian.h>

Inheritance diagram for Gaussian:
Collaboration diagram for Gaussian:

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.
 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.
void generateParticles (size_t &numberOfParticles, Vector_t< double, 3 > nr) override
 Generates particles with a Gaussian distribution.
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 t, double dt)
virtual void testNumEmitParticles (size_t nsteps, double dt)
virtual void testEmitParticles (size_t nsteps, double dt)
virtual void initDomainDecomp (double BoxIncr)
virtual void setWithDomainDecomp (bool withDomainDecomp)

Public Attributes

IpplTimings::TimerRef samperTimer_m
 Timer for performance profiling.

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.

Private Attributes

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

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 initRandomPool(), samperTimer_m, SamplingBase::SamplingBase(), 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 initRandomPool(), samperTimer_m, SamplingBase::SamplingBase(), setAvrgpz(), setCutoffR(), setFixMeanR(), setSigmaP(), and setSigmaR().

Here is the call graph for this function:

Member Function Documentation

◆ emitParticles()

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

Reimplemented in FlatTop.

Definition at line 31 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, cutoffR_m, fixMeanR_m, gmsg, nr, SamplingBase::pc_m, randPool_m, samperTimer_m, sigmaP_m, and sigmaR_m.

◆ 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 BoxIncr)
inlinevirtualinherited

Reimplemented in FlatTop.

Definition at line 39 of file SamplingBase.hpp.

◆ initRandomPool()

void Gaussian::initRandomPool ( )
private

Initializes the random number generator pool.

Definition at line 42 of file Gaussian.cpp.

References gmsg, randPool_m, and Options::seed.

Referenced by Gaussian(), and Gaussian().

Here is the caller 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(), and Gaussian().

Here is the caller graph for this function:

◆ 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(), and Gaussian().

Here is the caller graph for this function:

◆ setFixMeanR()

void Gaussian::setFixMeanR ( bool fixMeanR)
inline

Definition at line 107 of file Gaussian.h.

References fixMeanR_m.

Referenced by Gaussian().

Here is the caller graph for this function:

◆ 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(), and Gaussian().

Here is the caller graph for this function:

◆ 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(), and Gaussian().

Here is the caller graph for this function:

◆ setWithDomainDecomp()

virtual void SamplingBase::setWithDomainDecomp ( bool withDomainDecomp)
inlinevirtualinherited

Reimplemented in FlatTop.

Definition at line 41 of file SamplingBase.hpp.

◆ testEmitParticles()

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

Definition at line 37 of file SamplingBase.hpp.

◆ testNumEmitParticles()

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

Definition at line 34 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

◆ 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

◆ 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(), 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: