https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
16class Assembly;
17class FEProblemBase;
18class InputParameters;
19class MooseRandom;
20class RandomData;
21template <typename T>
23
29{
30public:
31 RandomInterface(const InputParameters & parameters,
32 FEProblemBase & problem,
33 THREAD_ID tid,
34 bool is_nodal);
35
36#ifdef MOOSE_KOKKOS_ENABLED
41#endif
42
44
46
52
56 unsigned long getRandomLong() const;
57
61 Real getRandomReal() const;
62
68 unsigned int getSeed(std::size_t id);
69
70 /**************************************************
71 * Data Accessors *
72 **************************************************/
73 unsigned int getMasterSeed() const { return _master_seed; }
74 bool isNodal() const { return _is_nodal; }
76
77 void setRandomDataPointer(RandomData * random_data);
78
79private:
82
84 const std::string _ri_name;
85
86 unsigned int _master_seed;
89
90 const Node * const & _curr_node;
91 const Elem * const & _curr_element;
92
93 // friend void FEProblemBase::registerRandomInterface(RandomInterface *random_interface, const
94 // std::string & name, ExecFlagType exec_flag);
95};
unsigned int THREAD_ID
Definition MooseTypes.h:237
InputParameters validParams()
Keeps track of stuff related to assembling.
Definition Assembly.h:110
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Class for containing MooseEnum item information.
This class encapsulates a useful, consistent, cross-platform random number generator with multiple ut...
Definition MooseRandom.h:38
Interface for objects that need parallel consistent random numbers without patterns over the course o...
bool isNodal() const
const Elem *const & _curr_element
Real getRandomReal() const
Returns the next random number (Real) from the generator tied to this object (elem/node).
RandomData * _random_data
void setRandomResetFrequency(ExecFlagType exec_flag)
This interface should be called from a derived class to enable random number generation in this objec...
const std::string _ri_name
unsigned int getSeed(std::size_t id)
Get the seed for the passed in elem/node id.
MooseRandom * _generator
static InputParameters validParams()
unsigned long getRandomLong() const
Returns the next random number (long) from the generator tied to this object (elem/node).
ExecFlagType _reset_on
unsigned int _master_seed
const Node *const & _curr_node
unsigned int getMasterSeed() const
ExecFlagType getResetOnTime() const
FEProblemBase & _ri_problem
void setRandomDataPointer(RandomData *random_data)