Go to the documentation of this file.
61 hasGaussSample_(false),
88 samples_(cr.samples_),
89 sampleI_(cr.sampleI_),
90 hasGaussSample_(cr.hasGaussSample_),
91 gaussSample_(cr.gaussSample_)
101 <<
"Copy constructor called, but samples not being cached. "
102 <<
"This may lead to non-repeatable behaviour" <<
endl;
132 return round(scalar01());
141 hasGaussSample_ =
false;
149 v1 = 2*scalar01() - 1;
150 v2 = 2*scalar01() - 1;
152 }
while (rsq >= 1 || rsq == 0);
154 scalar fac =
sqrt(-2*
log(rsq)/rsq);
156 gaussSample_ = v1*fac;
157 hasGaussSample_ =
true;
167 return round(GaussNormal<scalar>());
178 return start + scalar01()*(end - start);
185 return start + round(scalar01()*(end - start));
192 scalar value = -GREAT;
208 scalar value = -GREAT;
224 scalar value = -GREAT;
228 value = GaussNormal<scalar>();
240 scalar value = -GREAT;
244 value = GaussNormal<scalar>();
260 scalar value = -GREAT;
264 value = scalar01()*(end - start);
269 return start + value;
284 value = round(scalar01()*(end - start));
289 return start + value;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Type sample01()
Return a sample whose components lie in the range 0-1.
#define forAll(list, i)
Loop across all elements in list.
label sampleI_
Current sample marker.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Type globalSample01()
Return a sample whose components lie in the range 0-1.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void osRandomSeed(const label seed)
Seed random number generator.
Type globalPosition(const Type &start, const Type &end)
Return a sample between start and end.
static const label labelMin
label seed_
Initial random number seed.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Type globalGaussNormal()
Return a sample whose components are normally distributed.
Type position(const Type &start, const Type &end)
Return a sample between start and end.
dimensionedScalar log(const dimensionedScalar &ds)
scalar scalar01()
Returns the current sample.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
scalar gaussSample_
Stored sample value.
static bool master(const label communicator=0)
Am I the master process.
void setSize(const label)
Reset size of List.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
scalarList samples_
List of scalar samples.
bool hasGaussSample_
Indicator, which tells if there is a stored gaussian sample.
dimensionedScalar sqrt(const dimensionedScalar &ds)
label seed() const
Return const access to the initial random number seed.
cachedRandom(const label seed, const label count)
Construct given seed and sample count.
Type GaussNormal()
Return a sample whose components are normally distributed.
void size(const label)
Override size to be inconsistent with allocated storage.
scalar osRandomDouble()
Return random double precision (uniform distribution between 0 and 1)
#define WarningInFunction
Report a warning using Foam::Warning.