|
chombo-discharge
|
Class for encapsulating random number generation. This class is MPI and OpenMP safe. More...
#include <CD_Random.H>
Public Member Functions | |
| Random ()=delete | |
| Disallowed constructor. | |
| Random (const Random &a_other)=delete | |
| Deleted copy constructor. Must be impossible because this is a singleton. | |
| Random (const Random &&a_other)=delete | |
| Deleted copy constructor. Must be impossible because this is a singleton. | |
| Random & | operator= (const Random &a_other)=delete |
| Disallowed copy assignment. | |
| Random & | operator= (const Random &&a_other)=delete |
| Disallowed move assignment. | |
Static Public Member Functions | |
| template<typename T , typename = std::enable_if_t<std::is_integral<T>::value>> | |
| static T | getPoisson (const Real a_mean) |
| Get Poisson distributed number. | |
| template<typename T , typename = std::enable_if_t<std::is_integral<T>::value>> | |
| static T | getBinomial (const T a_N, const Real a_p) noexcept |
| Get Poisson distributed number. | |
| static Real | getUniformReal01 () |
| Get a uniform real number on the interval [0,1]. | |
| static Real | getUniformReal11 () |
| Get a uniform real number on the interval [-1,1]. | |
| static Real | getNormal01 () |
| Get a number from a normal distribution centered on zero and variance 1. | |
| static RealVect | getDirection () |
| Get a random direction in space. | |
| template<typename T > | |
| static Real | get (T &a_distribution) |
| For getting a random number from a user-supplied distribution. T must be a distribution for which we can call T(s_rng) | |
| template<typename T > | |
| static size_t | getDiscrete (T &a_distribution) |
| For getting a random number from a user-supplied distribution. T must be a distribution for which we can call T(s_rng) | |
| static void | seed () |
| Seed the RNG. | |
| static void | setSeed (const int a_seed) |
| Set the RNG seed. | |
| static void | setRandomSeed () |
| Set a random RNG seed. | |
| static RealVect | randomPosition (const RealVect a_lo, const RealVect a_hi) noexcept |
| Return a random position in the cube (a_lo, a_hi);. | |
| static RealVect | randomPosition (const RealVect a_cellPos, const RealVect a_lo, const RealVect a_hi, const RealVect a_bndryCentroid, const RealVect a_normal, const Real a_dx, const Real a_kappa) noexcept |
| Draw a random position physical somewhere in a grid cell. | |
| static RealVect | randomPosition (const RealVect a_lo, const RealVect a_hi, const RealVect a_bndryCentroid, const RealVect a_normal) noexcept |
| Draw a random position somewhere in a cut-cell. | |
Class for encapsulating random number generation. This class is MPI and OpenMP safe.
The user can specify a seed 's' where each MPI rank will initialize their RNG with seed 's + procID()'. Note that unless the user specifies Random.seed = <number> in the input script, the RNG will use a seed of '0 + procID()' for the various ranks. If the user specifies a <number> less than 0, a random seed will be used.
Deleted copy constructor. Must be impossible because this is a singleton.
| [in] | a_other | Other RNG engine. |
Deleted copy constructor. Must be impossible because this is a singleton.
| [in] | a_other | Other RNG engine. |
For getting a random number from a user-supplied distribution. T must be a distribution for which we can call T(s_rng)
| [in] | a_distribution | Distribution. Must have object of type |
Get Poisson distributed number.
| [in] | a_N | Number of trials |
| [in] | a_p | The usual success probability in binomial distributions |
|
inlinestatic |
Get a random direction in space.
Uses Marsaglia algorithm.
For getting a random number from a user-supplied distribution. T must be a distribution for which we can call T(s_rng)
| [in] | a_distribution | Distribution. Must have object of type |
Get Poisson distributed number.
| [in] | a_mean | Poisson mean value (inverse rate) |
Disallowed move assignment.
| [in] | a_other | Other RNG engine. |
Disallowed copy assignment.
| [in] | a_other | Other RNG engine. |
|
inlinestaticnoexcept |
Draw a random position physical somewhere in a grid cell.
This is the version that respects cut-cells – it will draw a position (through rejection sampling) such that the particle ends up on the correct side of the EB.
| [in] | a_cellPos | Cell-center position. |
| [in] | a_lo | Lower-left corner of volume that encloses the cut-cell. This is relative to the unit cell. |
| [in] | a_hi | Upper-right corner of volume that encloses the cut-cell. This is relative to the unit cell. |
| [in] | a_bndryCentroid | EB centroid position |
| [in] | a_normal | EB normal (points into the fluid region) |
| [in] | a_dx | Grid resolution |
| [in] | a_kappa | Cell volume |
Return a random position in the cube (a_lo, a_hi);.
| [in] | a_lo | Lower-left corner |
| [in] | a_hi | Upper-right corner |
|
inlinestaticnoexcept |
Draw a random position somewhere in a cut-cell.
| [in] | a_lo | Lower-left corner of volume that encloses the cut-cell. This is relative to the unit cell. |
| [in] | a_hi | Upper-right corner of volume that encloses the cut-cell. This is relative to the unit cell. |
| [in] | a_bndryCentroid | EB centroid position |
| [in] | a_normal | EB normal (points into the fluid region) |
Set the RNG seed.
If using MPI, the seed is set to a_seed + procID().
| [in] | a_seed | Seed to use for RNG. |