www.mooseframework.org
RandomData.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef RANDOMDATA_H
16 #define RANDOMDATA_H
17 
18 // MOOSE includes
19 #include "MooseRandom.h"
20 #include "MooseTypes.h"
21 
22 #include <unordered_map>
23 
24 class FEProblemBase;
25 class MooseMesh;
26 class RandomInterface;
27 
29 {
30 public:
31  RandomData(FEProblemBase & problem, const RandomInterface & random_interface);
32 
37  void updateSeeds(ExecFlagType exec_flag);
38 
43 
49  unsigned int getSeed(dof_id_type id);
50 
51 private:
52  void updateGenerators();
53 
54  template <typename T>
55  void updateGeneratorHelper(T it, T end_it);
56 
59 
61  bool _is_nodal;
63 
64  unsigned int _master_seed;
65  unsigned int _current_master_seed;
66  unsigned int _new_seed;
67 
68  std::unordered_map<dof_id_type, unsigned int> _seeds;
69 };
70 
71 #endif // RANDOMDATA_H
Interface for objects that need parallel consistent random numbers without patterns over the course o...
RandomData(FEProblemBase &problem, const RandomInterface &random_interface)
Definition: RandomData.C:22
unsigned int _new_seed
Definition: RandomData.h:66
std::unordered_map< dof_id_type, unsigned int > _seeds
Definition: RandomData.h:68
void updateGenerators()
Definition: RandomData.C:74
MooseMesh & _rd_mesh
Definition: RandomData.h:58
unsigned int _master_seed
Definition: RandomData.h:64
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool _is_nodal
Definition: RandomData.h:61
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
unsigned int _current_master_seed
Definition: RandomData.h:65
MooseRandom _generator
Definition: RandomData.h:60
ExecFlagType _reset_on
Definition: RandomData.h:62
unsigned int getSeed(dof_id_type id)
Get the seed for the passed in elem/node id.
Definition: RandomData.C:34
ExecFlagType
Execution flags - when is the object executed/evaluated.
Definition: MooseTypes.h:90
void updateSeeds(ExecFlagType exec_flag)
This method is called to reset or update the seeds based on the reset_on flag and the passed executio...
Definition: RandomData.C:43
FEProblemBase & _rd_problem
Definition: RandomData.h:57
MooseRandom & getGenerator()
Return the underlying MooseRandom generator object for this data instance.
Definition: RandomData.h:42
void updateGeneratorHelper(T it, T end_it)
Definition: RandomData.C:109
This class encapsulates a useful, consistent, cross-platform random number generator with multiple ut...
Definition: MooseRandom.h:42