Distribution< Type > Class Template Reference

Accumulating histogram of component values. Specified bin resolution, automatic generation of bins. More...

Public Types

typedef pTraits< Type >::cmptType cmptType
 Component type. More...
 

Public Member Functions

 Distribution ()
 Construct null. More...
 
 Distribution (const Type &binWidth)
 Construct from separate binWidth for each component. More...
 
 Distribution (const Distribution &d)
 Construct as copy. More...
 
 ~Distribution ()
 Destructor. More...
 
scalar totalWeight (direction cmpt) const
 Sum the total weight added to the component in the. More...
 
List< label > keys (direction cmpt) const
 
label index (direction cmpt, label n)
 Return the appropriate List index for the given bin index. More...
 
Pair< label > validLimits (direction cmpt) const
 Returns the indices of the first and last non-zero entries. More...
 
Type mean () const
 
Type median () const
 
void add (const Type &valueToAdd, const Type &weight=pTraits< Type >::one)
 Add a value to the distribution, optionally specifying a weight. More...
 
List< List< Pair< scalar > > > normalised () const
 Return the normalised distribution (probability density) More...
 
List< List< Pair< scalar > > > raw () const
 Return the distribution of the total bin weights. More...
 
List< List< Pair< scalar > > > cumulativeNormalised () const
 Return the cumulative normalised distribution and. More...
 
List< List< Pair< scalar > > > cumulativeRaw () const
 Return the cumulative total bin weights and integration. More...
 
void clear ()
 Resets the Distribution by clearing the stored lists. More...
 
const Type & binWidth () const
 Return the bin width. More...
 
const List< label > & listStarts () const
 Return the List start bin indices. More...
 
void write (const fileName &filePrefix) const
 Write the distribution to file: key normalised raw. More...
 
void operator= (const Distribution< Type > &)
 

Friends

Istreamoperator>> (Istream &, Distribution< Type > &)
 
Ostreamoperator (Ostream &, const Distribution< Type > &)
 

Detailed Description

template<class Type>
class Foam::Distribution< Type >

Accumulating histogram of component values. Specified bin resolution, automatic generation of bins.

Source files

Definition at line 51 of file Distribution.H.

Member Typedef Documentation

◆ cmptType

typedef pTraits<Type>::cmptType cmptType

Component type.

Definition at line 80 of file Distribution.H.

Constructor & Destructor Documentation

◆ Distribution() [1/3]

Construct null.

Definition at line 36 of file Distribution.C.

◆ Distribution() [2/3]

Distribution ( const Type &  binWidth)

Construct from separate binWidth for each component.

Definition at line 45 of file Distribution.C.

◆ Distribution() [3/3]

Distribution ( const Distribution< Type > &  d)

Construct as copy.

◆ ~Distribution()

Destructor.

Definition at line 65 of file Distribution.C.

Member Function Documentation

◆ totalWeight()

Foam::scalar totalWeight ( direction  cmpt) const

Sum the total weight added to the component in the.

argument

Definition at line 72 of file Distribution.C.

References forAll.

◆ keys()

Foam::List< Foam::label > keys ( direction  cmpt) const

Definition at line 88 of file Distribution.C.

References Foam::identity().

Here is the call graph for this function:

◆ index()

Foam::label index ( direction  cmpt,
label  n 
)

Return the appropriate List index for the given bin index.

Resizes the List if required

Definition at line 96 of file Distribution.C.

References forAll, n, List< T >::setSize(), and Foam::Zero.

Here is the call graph for this function:

◆ validLimits()

Foam::Pair< Foam::label > validLimits ( direction  cmpt) const

Returns the indices of the first and last non-zero entries.

Definition at line 162 of file Distribution.C.

References forAll, and Pair< T >::second().

Here is the call graph for this function:

◆ mean()

Type mean ( ) const

Definition at line 193 of file Distribution.C.

References Foam::component(), forAll, k, Foam::glTF::key(), Foam::setComponent(), and Foam::Zero.

Here is the call graph for this function:

◆ median()

Type median ( ) const

Definition at line 222 of file Distribution.C.

References Foam::component(), forAll, Foam::mag(), Foam::normalised(), Foam::setComponent(), and Foam::Zero.

Here is the call graph for this function:

◆ add()

void add ( const Type &  valueToAdd,
const Type &  weight = pTraits<Type>::one 
)

Add a value to the distribution, optionally specifying a weight.

Definition at line 309 of file Distribution.C.

References Foam::component(), n, and Foam::neg().

Here is the call graph for this function:

◆ normalised()

Foam::List< Foam::List< Foam::Pair< Foam::scalar > > > normalised ( ) const

Return the normalised distribution (probability density)

and bins

Definition at line 331 of file Distribution.C.

References Foam::component(), k, Foam::glTF::key(), Pair< T >::second(), and List< T >::setSize().

Here is the call graph for this function:

◆ raw()

Foam::List< Foam::List< Foam::Pair< Foam::scalar > > > raw ( ) const

Return the distribution of the total bin weights.

Definition at line 379 of file Distribution.C.

References Foam::component(), k, Foam::glTF::key(), Pair< T >::second(), and List< T >::setSize().

Here is the call graph for this function:

◆ cumulativeNormalised()

Foam::List< Foam::List< Foam::Pair< Foam::scalar > > > cumulativeNormalised ( ) const

Return the cumulative normalised distribution and.

integration locations (at end of bins)

Definition at line 421 of file Distribution.C.

References Foam::component(), forAll, Foam::normalised(), and Foam::sum().

Here is the call graph for this function:

◆ cumulativeRaw()

Foam::List< Foam::List< Foam::Pair< Foam::scalar > > > cumulativeRaw ( ) const

Return the cumulative total bin weights and integration.

locations (at end of bins)

Definition at line 457 of file Distribution.C.

References Foam::component(), forAll, and Foam::sum().

Here is the call graph for this function:

◆ clear()

void clear ( )

Resets the Distribution by clearing the stored lists.

Leaves the same number of them and the same binWidth.

Definition at line 488 of file Distribution.C.

◆ binWidth()

const Type & binWidth ( ) const
inline

Return the bin width.

Definition at line 32 of file DistributionI.H.

◆ listStarts()

const Foam::List< Foam::label > & listStarts ( ) const
inline

Return the List start bin indices.

Definition at line 40 of file DistributionI.H.

◆ write()

void write ( const fileName filePrefix) const

Write the distribution to file: key normalised raw.

Produces a separate file for each component.

Definition at line 500 of file Distribution.C.

References Foam::endl(), forAll, Foam::nl, Foam::normalised(), and os().

Here is the call graph for this function:

◆ operator=()

void operator= ( const Distribution< Type > &  rhs)

Definition at line 557 of file Distribution.C.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
Distribution< Type > &   
)
friend

◆ operator

Ostream& operator ( Ostream ,
const Distribution< Type > &   
)
friend

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