https://mooseframework.inl.gov
RandomInterface.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "MooseTypes.h"
13 #include "MooseEnumItem.h"
14 
15 // Forward declarations
16 class Assembly;
17 class FEProblemBase;
18 class InputParameters;
19 class MooseRandom;
20 class RandomData;
21 template <typename T>
23 
29 {
30 public:
31  RandomInterface(const InputParameters & parameters,
32  FEProblemBase & problem,
33  THREAD_ID tid,
34  bool is_nodal);
35 
37 
39 
44  void setRandomResetFrequency(ExecFlagType exec_flag);
45 
49  unsigned long getRandomLong() const;
50 
54  Real getRandomReal() const;
55 
61  unsigned int getSeed(std::size_t id);
62 
63  /**************************************************
64  * Data Accessors *
65  **************************************************/
66  unsigned int getMasterSeed() const { return _master_seed; }
67  bool isNodal() const { return _is_nodal; }
69 
70  void setRandomDataPointer(RandomData * random_data);
71 
72 private:
75 
77  const std::string _ri_name;
78 
79  unsigned int _master_seed;
80  bool _is_nodal;
82 
83  const Node * const & _curr_node;
84  const Elem * const & _curr_element;
85 
86  // friend void FEProblemBase::registerRandomInterface(RandomInterface *random_interface, const
87  // std::string & name, ExecFlagType exec_flag);
88 };
Interface for objects that need parallel consistent random numbers without patterns over the course o...
unsigned long getRandomLong() const
Returns the next random number (long) from the generator tied to this object (elem/node).
RandomInterface(const InputParameters &parameters, FEProblemBase &problem, THREAD_ID tid, bool is_nodal)
const Node *const & _curr_node
Keeps track of stuff related to assembling.
Definition: Assembly.h:101
RandomData * _random_data
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int getSeed(std::size_t id)
Get the seed for the passed in elem/node id.
void setRandomResetFrequency(ExecFlagType exec_flag)
This interface should be called from a derived class to enable random number generation in this objec...
ExecFlagType _reset_on
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
ExecFlagType getResetOnTime() const
InputParameters validParams()
const std::string _ri_name
static InputParameters validParams()
const Elem *const & _curr_element
bool isNodal() const
FEProblemBase & _ri_problem
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _master_seed
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
unsigned int getMasterSeed() const
void setRandomDataPointer(RandomData *random_data)
MooseRandom * _generator
Real getRandomReal() const
Returns the next random number (Real) from the generator tied to this object (elem/node).
This class encapsulates a useful, consistent, cross-platform random number generator with multiple ut...
Definition: MooseRandom.h:37
unsigned int THREAD_ID
Definition: MooseTypes.h:209