39namespace distributionModels
57 distributionModelDict_.lookupCompat
60 {{
"expectation", 2112}}
65 distributionModelDict_.lookupCompat
73 distributionModelDict_.lookupCompat
83 for (label i = 0; i < weight_.size(); ++i)
85 if (i > 0 && weight_[i] < weight_[i-1])
88 <<
type() <<
"distribution: "
89 <<
"Weights must be specified in a monotonic order." <<
nl
90 <<
"Please see the row i = " << i <<
nl
91 <<
"weight[i-1] = " << weight_[i-1] <<
nl
92 <<
"weight[i] = " << weight_[i]
102 <<
type() <<
"distribution: "
103 <<
"The sum of weights cannot be zero." <<
nl
104 <<
"weight = " << weight_
108 for (label i = 1; i < weight_.size(); ++i)
110 weight_[i] += weight_[i-1];
113 for (
auto& w : weight_)
133 const scalar u = rndGen_.sample01<scalar>();
135 for (label i = 0; i < weight_.size(); ++i)
139 return sample(mu_[i], sigma_[i]);
143 const label last = weight_.size() - 1;
145 return sample(mu_[last], sigma_[last]);
155 const scalar a = (minValue_ -
mu)/sigma;
156 const scalar
b = (maxValue_ -
mu)/sigma;
161 const scalar u = rndGen_.sample01<scalar>();
162 const scalar
p = u*(bPhi - aPhi) + aPhi;
171 return min(
max(
x, minValue_), maxValue_);
180 mean += weight_[i]*mu_[i];
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Minimal example by using system/controlDict.functions:
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A library of runtime-selectable doubly-truncated probability distribution models. Returns random samp...
Particle-size distribution model wherein random samples are drawn from a mixture of a finite set of d...
virtual scalar meanValue() const
Return the theoretical mean of the distribution.
virtual scalar sample() const
Sample the distribution.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & mu
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar erfInv(const scalar y)
Inverse error function of a real-number argument.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
dimensionedScalar erf(const dimensionedScalar &ds)
static void check(const int retVal, const char *what)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
dimensionedScalar sqrt(const dimensionedScalar &ds)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.