https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Functions
MooseRandomPerturbation.h File Reference

Go to the source code of this file.

Classes

class  MooseRandomPerturbation
 Generates a keyed pseudo-random permutation of the integers [0, n) using a balanced Feistel network. More...
 

Functions

template<>
void dataStore (std::ostream &stream, MooseRandomPerturbation &v, void *context)
 
template<>
void dataStore (std::ostream &stream, std::unique_ptr< MooseRandomPerturbation > &v, void *context)
 
template<>
void dataLoad (std::istream &stream, std::unique_ptr< MooseRandomPerturbation > &v, void *context)
 

Function Documentation

◆ dataLoad()

template<>
void dataLoad ( std::istream &  stream,
std::unique_ptr< MooseRandomPerturbation > &  v,
void *  context 
)
inline

Definition at line 152 of file MooseRandomPerturbation.h.

153{
154 uint64_t seed;
155 unsigned int n, rounds;
156 dataLoad(stream, seed, context);
157 dataLoad(stream, n, context);
158 dataLoad(stream, rounds, context);
159 v = std::make_unique<MooseRandomPerturbation>(seed, n, rounds);
160}
void dataLoad(std::istream &stream, std::unique_ptr< MooseRandomPerturbation > &v, void *context)

Referenced by dataLoad().

◆ dataStore() [1/2]

template<>
void dataStore ( std::ostream &  stream,
MooseRandomPerturbation &  v,
void *  context 
)
inline

Definition at line 135 of file MooseRandomPerturbation.h.

136{
137 uint64_t seed = (static_cast<uint64_t>(v._k1) << 32) | v._k0;
138 dataStore(stream, seed, context);
139 dataStore(stream, v._n, context);
140 dataStore(stream, v._rounds, context);
141}
void dataStore(std::ostream &stream, MooseRandomPerturbation &v, void *context)
const uint32_t _k0
Lower 32 bits of the seed, used as the first subkey in the round function.
const unsigned int _n
Size of the permutation domain [0, n)
const uint32_t _k1
Upper 32 bits of the seed, used as the second subkey in the round function.
const unsigned int _rounds
Number of Feistel rounds to apply per permute/invert call.

Referenced by dataStore().

◆ dataStore() [2/2]

template<>
void dataStore ( std::ostream &  stream,
std::unique_ptr< MooseRandomPerturbation > &  v,
void *  context 
)
inline

Definition at line 145 of file MooseRandomPerturbation.h.

146{
147 dataStore(stream, *v, context);
148}