https://mooseframework.inl.gov
RandomData.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 // MOOSE includes
13 #include "MooseRandom.h"
14 #include "MooseTypes.h"
15 #include "MooseEnumItem.h"
16 
17 #include <unordered_map>
18 
19 class FEProblemBase;
20 class MooseMesh;
21 class RandomInterface;
22 
24 {
25 public:
26  RandomData(FEProblemBase & fe_problem, const RandomInterface & random_interface);
27 
28  RandomData(FEProblemBase & fe_problem, bool is_nodal, ExecFlagType reset_on, unsigned int seed);
29 
30  ~RandomData() = default;
31 
36  void updateSeeds(ExecFlagType exec_flag);
37 
42 
48  unsigned int getSeed(dof_id_type id);
49 
50 private:
51  void updateGenerators();
52 
55 
57  bool _is_nodal;
59 
60  unsigned int _master_seed;
61  unsigned int _current_master_seed;
62  unsigned int _new_seed;
63 
64  std::unordered_map<dof_id_type, unsigned int> _seeds;
65 };
Interface for objects that need parallel consistent random numbers without patterns over the course o...
unsigned int _new_seed
Definition: RandomData.h:62
std::unordered_map< dof_id_type, unsigned int > _seeds
Definition: RandomData.h:64
void updateGenerators()
Definition: RandomData.C:80
MooseMesh & _rd_mesh
Definition: RandomData.h:54
unsigned int _master_seed
Definition: RandomData.h:60
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
bool _is_nodal
Definition: RandomData.h:57
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:88
unsigned int _current_master_seed
Definition: RandomData.h:61
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
MooseRandom _generator
Definition: RandomData.h:56
ExecFlagType _reset_on
Definition: RandomData.h:58
unsigned int getSeed(dof_id_type id)
Get the seed for the passed in elem/node id.
Definition: RandomData.C:40
~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 executio...
Definition: RandomData.C:49
FEProblemBase & _rd_problem
Definition: RandomData.h:53
RandomData(FEProblemBase &fe_problem, const RandomInterface &random_interface)
Definition: RandomData.C:17
MooseRandom & getGenerator()
Return the underlying MooseRandom generator object for this data instance.
Definition: RandomData.h:41
This class encapsulates a useful, consistent, cross-platform random number generator with multiple ut...
Definition: MooseRandom.h:37
uint8_t dof_id_type