https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
19class FEProblemBase;
20class MooseMesh;
21class RandomInterface;
22
24{
25public:
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
50private:
51 void updateGenerators();
52
55
59
60 unsigned int _master_seed;
62 unsigned int _new_seed;
63
64 std::unordered_map<dof_id_type, unsigned int> _seeds;
65};
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Class for containing MooseEnum item information.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
This class encapsulates a useful, consistent, cross-platform random number generator with multiple ut...
Definition MooseRandom.h:38
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
unsigned int _new_seed
Definition RandomData.h:62
ExecFlagType _reset_on
Definition RandomData.h:58
MooseRandom _generator
Definition RandomData.h:56
MooseRandom & getGenerator()
Return the underlying MooseRandom generator object for this data instance.
Definition RandomData.h:41
unsigned int getSeed(dof_id_type id)
Get the seed for the passed in elem/node id.
Definition RandomData.C:40
MooseMesh & _rd_mesh
Definition RandomData.h:54
unsigned int _current_master_seed
Definition RandomData.h:61
unsigned int _master_seed
Definition RandomData.h:60
~RandomData()=default
FEProblemBase & _rd_problem
Definition RandomData.h:53
std::unordered_map< dof_id_type, unsigned int > _seeds
Definition RandomData.h:64
void updateGenerators()
Definition RandomData.C:80
bool _is_nodal
Definition RandomData.h:57
Interface for objects that need parallel consistent random numbers without patterns over the course o...