multiFixedValue Class Reference

Distribution which comprises a list of fixed values with given probabilities. The probabilities are normalised so that they sum to one, so they can be provided as fractions or percentages or with any other arbitrary scale factor. More...

Inheritance diagram for multiFixedValue:
Collaboration diagram for multiFixedValue:

Public Member Functions

 TypeName ("multiFixedValue")
 Runtime type information. More...
 
 multiFixedValue (const unitConversion &units, const dictionary &dict, const label sampleQ, randomGenerator &&rndGen)
 Construct from a dictionary. More...
 
 multiFixedValue (const multiFixedValue &d, const label sampleQ)
 Construct copy. More...
 
virtual autoPtr< distributionclone (const label sampleQ) const
 Construct and return a clone. More...
 
virtual ~multiFixedValue ()
 Destructor. More...
 
virtual scalar sample () const
 Sample the distribution. More...
 
virtual scalar min () const
 Return the minimum value. More...
 
virtual scalar max () const
 Return the maximum value. More...
 
virtual scalar mean () const
 Return the mean value. More...
 
virtual tmp< scalarFieldintegralPDFxPow (const scalarField &x, const label e, const bool consistent=false) const
 Return the integral of the PDF multiplied by an integer power of x. More...
 
virtual void write (Ostream &os, const unitConversion &units) const
 Write to a stream. More...
 
virtual tmp< scalarFieldplotX (const label n) const
 Return coordinates to plot across the range of the distribution. More...
 
virtual tmp< scalarFieldplotPDF (const scalarField &x) const
 Return values to plot the probability density function. More...
 
- Public Member Functions inherited from FieldDistribution< distribution, multiFixedValue >
Type sample () const
 Sample the distribution into components of a primitive type. More...
 
virtual tmp< scalarFieldsample (const label n) const
 Sample the distribution into a field. More...
 
- Public Member Functions inherited from distribution
 TypeName ("distribution")
 Runtime type information. More...
 
 declareRunTimeSelectionTable (autoPtr, distribution, dictionary,(const unitConversion &units, const dictionary &dict, const label sampleQ, randomGenerator &&rndGen),(units, dict, sampleQ, std::move(rndGen)))
 Declare runtime constructor selection table. More...
 
 distribution (const word &name, const unitConversion &units, const dictionary &dict, const label sampleQ, randomGenerator &&rndGen)
 Construct from dictionary. More...
 
 distribution (const label Q, const label sampleQ, randomGenerator &&rndGen)
 Construct from components. More...
 
 distribution (const distribution &d, const label sampleQ)
 Construct copy. More...
 
autoPtr< distributionclone () const
 Construct and return a clone. More...
 
virtual ~distribution ()
 Destructor. More...
 
label sampleQ () const
 Access the sample size exponent. More...
 
void start (const bool repeat) const
 Start a sequence of samples. Either a new sequence, or a. More...
 
template<class Type >
Type sample () const
 Sample the distribution into components of a primitive type. More...
 
virtual tmp< scalarFieldCDF (const scalarField &x) const
 Return the cumulative density function at the given coordinates. More...
 
virtual void writeState (Ostream &os) const
 Write the state to a stream. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from distribution
static autoPtr< distributionNew (const unitConversion &units, const dictionary &dict, const label sampleQ, randomGenerator &&rndGen, const bool report=true)
 Select from dictionary and a random generator. More...
 
static autoPtr< distributionNew (const unitConversion &units, const dictionary &dict, const label sampleQ, const randomGenerator::seed &s, const bool global=false, const bool report=true)
 Select from a dictionary and a random generator seed and global flag. More...
 
static autoPtr< distributionNew (autoPtr< distribution > &dPtr, const label sampleQ)
 Re-select with a different sample size exponent. More...
 
- Protected Member Functions inherited from FieldDistribution< distribution, multiFixedValue >
 FOR_ALL_FIELD_TYPES (VIRTUAL_SAMPLE_TYPE)
 
- Protected Member Functions inherited from distribution
virtual void validateBounds (const dictionary &dict) const
 Validate that the bounds are monotonic. More...
 
virtual void validatePositive (const dictionary &dict) const
 Validate that the lower bound is positive. More...
 
tmp< scalarFieldclipPDF (const scalarField &x, const tmp< scalarField > &pdf) const
 Clip the PDF values to zero outside the bounds. More...
 
label q () const
 Return the effective distribution size exponent. More...
 
 FOR_ALL_FIELD_TYPES (VIRTUAL_SAMPLE_TYPE)
 
- Protected Attributes inherited from distribution
const label Q_
 Distribution size exponent. More...
 
const label sampleQ_
 Sample size exponent. More...
 
restartableRandomGenerator rndGen_
 Random number generator. More...
 

Detailed Description

Distribution which comprises a list of fixed values with given probabilities. The probabilities are normalised so that they sum to one, so they can be provided as fractions or percentages or with any other arbitrary scale factor.

Usage
Example usage:
{
    type    multiFixedValue;
    values
    (
        (1e-6 30)
        (2e-6 60)
        (5e-6 10)
    );
}
Source files
See also
Foam::distribution

Definition at line 71 of file multiFixedValue.H.

Constructor & Destructor Documentation

◆ multiFixedValue() [1/2]

multiFixedValue ( const unitConversion units,
const dictionary dict,
const label  sampleQ,
randomGenerator &&  rndGen 
)

Construct from a dictionary.

Definition at line 43 of file multiFixedValue.C.

References Foam::unitAny.

Referenced by multiFixedValue::clone().

Here is the caller graph for this function:

◆ multiFixedValue() [2/2]

multiFixedValue ( const multiFixedValue d,
const label  sampleQ 
)

Construct copy.

Definition at line 116 of file multiFixedValue.C.

References forAll, Foam::integerPow(), UList< T >::last(), distribution::q(), List< T >::resize(), and List< T >::size().

Here is the call graph for this function:

◆ ~multiFixedValue()

~multiFixedValue ( )
virtual

Destructor.

Definition at line 149 of file multiFixedValue.C.

Member Function Documentation

◆ TypeName()

TypeName ( "multiFixedValue"  )

Runtime type information.

◆ clone()

virtual autoPtr<distribution> clone ( const label  sampleQ) const
inlinevirtual

Construct and return a clone.

Implements distribution.

Definition at line 111 of file multiFixedValue.H.

References multiFixedValue::multiFixedValue(), and distribution::sampleQ().

Here is the call graph for this function:

◆ sample()

Foam::scalar sample ( ) const
virtual

Sample the distribution.

Implements distribution.

Definition at line 155 of file multiFixedValue.C.

References Foam::fvm::S().

Here is the call graph for this function:

◆ min()

Foam::scalar min ( ) const
virtual

Return the minimum value.

Implements distribution.

Definition at line 166 of file multiFixedValue.C.

◆ max()

Foam::scalar max ( ) const
virtual

Return the maximum value.

Implements distribution.

Definition at line 172 of file multiFixedValue.C.

◆ mean()

Foam::scalar mean ( ) const
virtual

Return the mean value.

Implements distribution.

Definition at line 178 of file multiFixedValue.C.

References Foam::sum().

Here is the call graph for this function:

◆ integralPDFxPow()

Foam::tmp< Foam::scalarField > integralPDFxPow ( const scalarField x,
const label  e,
const bool  consistent = false 
) const
virtual

Return the integral of the PDF multiplied by an integer power of x.

Implements distribution.

Definition at line 185 of file multiFixedValue.C.

References Foam::e, Foam::integerPow(), tmp< T >::ref(), and x.

Here is the call graph for this function:

◆ write()

void write ( Ostream os,
const unitConversion units 
) const
virtual

Write to a stream.

Reimplemented from distribution.

Definition at line 226 of file multiFixedValue.C.

References UList< T >::first(), forAll, Foam::integerPow(), Foam::sum(), Foam::unitAny, Foam::units(), and Foam::vtkWriteOps::write().

Here is the call graph for this function:

◆ plotX()

Foam::tmp< Foam::scalarField > plotX ( const label  n) const
virtual

Return coordinates to plot across the range of the distribution.

Reimplemented from distribution.

Definition at line 252 of file multiFixedValue.C.

References forAll, and tmp< T >::ref().

Here is the call graph for this function:

◆ plotPDF()

Foam::tmp< Foam::scalarField > plotPDF ( const scalarField x) const
virtual

Return values to plot the probability density function.

Implements distribution.

Definition at line 267 of file multiFixedValue.C.

References forAll, and tmp< T >::ref().

Here is the call graph for this function:

The documentation for this class was generated from the following files: