www.mooseframework.org
RandomInterface.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 RANDOMINTERFACE_H
16 #define RANDOMINTERFACE_H
17 
18 #include "MooseTypes.h"
19 
20 // Forward declarations
21 class Assembly;
22 class FEProblemBase;
23 class InputParameters;
24 class MooseRandom;
25 class RandomData;
26 class RandomInterface;
27 
28 template <typename T>
30 
31 template <>
33 
39 {
40 public:
41  RandomInterface(const InputParameters & parameters,
42  FEProblemBase & problem,
43  THREAD_ID tid,
44  bool is_nodal);
45 
47 
52  void setRandomResetFrequency(ExecFlagType exec_flag);
53 
57  unsigned long getRandomLong() const;
58 
62  Real getRandomReal() const;
63 
69  unsigned int getSeed(unsigned int id);
70 
71  /**************************************************
72  * Data Accessors *
73  **************************************************/
74  unsigned int getMasterSeed() const { return _master_seed; }
75  bool isNodal() const { return _is_nodal; }
77 
78  void setRandomDataPointer(RandomData * random_data);
79 
80 private:
83 
85  const std::string _ri_name;
86 
87  unsigned int _master_seed;
88  bool _is_nodal;
90 
91  const Node *& _curr_node;
92  const Elem *& _curr_element;
93 
94  // friend void FEProblemBase::registerRandomInterface(RandomInterface *random_interface, const
95  // std::string & name, ExecFlagType exec_flag);
96 };
97 
98 #endif /* RANDOMINTERFACE_H */
Interface for objects that need parallel consistent random numbers without patterns over the course o...
Real getRandomReal() const
Returns the next random number (Real) from the generator tied to this object (elem/node).
RandomInterface(const InputParameters &parameters, FEProblemBase &problem, THREAD_ID tid, bool is_nodal)
const Node *& _curr_node
Keeps track of stuff related to assembling.
Definition: Assembly.h:63
RandomData * _random_data
unsigned int getSeed(unsigned int id)
Get the seed for the passed in elem/node id.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void setRandomResetFrequency(ExecFlagType exec_flag)
This interface should be called from a derived class to enable random number generation in this objec...
bool isNodal() const
ExecFlagType _reset_on
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
unsigned long getRandomLong() const
Returns the next random number (long) from the generator tied to this object (elem/node).
InputParameters validParams()
const Elem *& _curr_element
InputParameters validParams< RandomInterface >()
const std::string _ri_name
FEProblemBase & _ri_problem
unsigned int _master_seed
ExecFlagType getResetOnTime() const
void setRandomDataPointer(RandomData *random_data)
unsigned int getMasterSeed() const
MooseRandom * _generator
ExecFlagType
Execution flags - when is the object executed/evaluated.
Definition: MooseTypes.h:90
This class encapsulates a useful, consistent, cross-platform random number generator with multiple ut...
Definition: MooseRandom.h:42
unsigned int THREAD_ID
Definition: MooseTypes.h:79