#include <RandomData.h>
Public Member Functions | |
RandomData (FEProblemBase &fe_problem, const RandomInterface &random_interface) | |
RandomData (FEProblemBase &fe_problem, bool is_nodal, ExecFlagType reset_on, unsigned int seed) | |
~RandomData ()=default | |
void | updateSeeds (ExecFlagType exec_flag) |
This method is called to reset or update the seeds based on the reset_on flag and the passed execution point. More... | |
MooseRandom & | getGenerator () |
Return the underlying MooseRandom generator object for this data instance. More... | |
unsigned int | getSeed (dof_id_type id) |
Get the seed for the passed in elem/node id. More... | |
Private Member Functions | |
void | updateGenerators () |
Private Attributes | |
FEProblemBase & | _rd_problem |
MooseMesh & | _rd_mesh |
MooseRandom | _generator |
bool | _is_nodal |
ExecFlagType | _reset_on |
unsigned int | _master_seed |
unsigned int | _current_master_seed |
unsigned int | _new_seed |
std::unordered_map< dof_id_type, unsigned int > | _seeds |
Definition at line 23 of file RandomData.h.
RandomData::RandomData | ( | FEProblemBase & | fe_problem, |
const RandomInterface & | random_interface | ||
) |
Definition at line 17 of file RandomData.C.
RandomData::RandomData | ( | FEProblemBase & | fe_problem, |
bool | is_nodal, | ||
ExecFlagType | reset_on, | ||
unsigned int | seed | ||
) |
Definition at line 25 of file RandomData.C.
|
default |
|
inline |
Return the underlying MooseRandom generator object for this data instance.
Definition at line 41 of file RandomData.h.
Referenced by RandomInterface::setRandomDataPointer().
unsigned int RandomData::getSeed | ( | dof_id_type | id | ) |
Get the seed for the passed in elem/node id.
id | - dof object id |
Definition at line 40 of file RandomData.C.
Referenced by RandomInterface::getSeed().
|
private |
When using parallel mesh it's not worth generating parallel consistent numbers. Each processor may not be aware of which entities belong on another mesh. We do have to be careful to not generate the same patterns on different processors however. To do that, we will use the MASTER generator to generate new master seeds for each processor based on their individual processor ids before generating seeds for the mesh entities.
Definition at line 80 of file RandomData.C.
Referenced by updateSeeds().
void RandomData::updateSeeds | ( | ExecFlagType | exec_flag | ) |
This method is called to reset or update the seeds based on the reset_on flag and the passed execution point.
Set the seed. This part is critical! If this is done incorrectly, it may lead to difficult to detect patterns in your random numbers either within a single run or over the course of several runs. We will default to _master_seed + the current time step.
case EXEC_TIMESTEP_BEGIN: // reset and advance every timestep case EXEC_TIMESTEP_END: // reset and advance every timestep case EXEC_LINEAR: // Reset every residual, advance every timestep case EXEC_NONLINEAR: // Reset every Jacobian, advance every timestep
Definition at line 49 of file RandomData.C.
|
private |
Definition at line 61 of file RandomData.h.
Referenced by updateGenerators(), and updateSeeds().
|
private |
Definition at line 56 of file RandomData.h.
Referenced by getGenerator(), updateGenerators(), and updateSeeds().
|
private |
Definition at line 57 of file RandomData.h.
Referenced by updateGenerators().
|
private |
Definition at line 60 of file RandomData.h.
Referenced by updateSeeds().
|
private |
Definition at line 62 of file RandomData.h.
Referenced by updateSeeds().
|
private |
Definition at line 54 of file RandomData.h.
Referenced by updateGenerators().
|
private |
Definition at line 53 of file RandomData.h.
Referenced by updateGenerators(), and updateSeeds().
|
private |
Definition at line 58 of file RandomData.h.
Referenced by updateSeeds().
|
private |
Definition at line 64 of file RandomData.h.
Referenced by getSeed(), and updateGenerators().