Public Types | Public Member Functions | Private Attributes | Friends
Distribution Class Reference

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

Collaboration diagram for Distribution:
Collaboration graph
[legend]

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< labelkeys (direction cmpt) const
 
label index (direction cmpt, label n)
 Return the appropriate List index for the given bin index. More...
 
Pair< labelvalidLimits (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 > &)
 

Private Attributes

Type binWidth_
 Width of the bin for each component. More...
 
List< labellistStarts_
 The start bin index of each component. More...
 

Friends

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

Detailed Description

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

Source files

Definition at line 49 of file Distribution.H.

Member Typedef Documentation

◆ cmptType

typedef pTraits<Type>::cmptType cmptType

Component type.

Definition at line 78 of file Distribution.H.

Constructor & Destructor Documentation

◆ Distribution() [1/3]

Construct null.

Definition at line 33 of file Distribution.C.

◆ Distribution() [2/3]

Distribution ( const Type &  binWidth)

Construct from separate binWidth for each component.

Definition at line 42 of file Distribution.C.

◆ Distribution() [3/3]

Distribution ( const Distribution d)

Construct as copy.

◆ ~Distribution()

Destructor.

Definition at line 62 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 69 of file Distribution.C.

References forAll.

◆ keys()

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

Definition at line 85 of file Distribution.C.

References forAll, Foam::identity(), and k.

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 100 of file Distribution.C.

References forAll, n, List::setSize(), and List::size().

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 166 of file Distribution.C.

References Pair::first(), forAll, and Pair::second().

Here is the call graph for this function:

◆ mean()

Type mean ( ) const

Definition at line 197 of file Distribution.C.

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

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ median()

Type median ( ) const

Definition at line 226 of file Distribution.C.

References Foam::component(), forAll, Foam::mag(), Foam::setComponent(), and List::size().

Referenced by main().

Here is the call graph for this function:
Here is the caller 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 313 of file Distribution.C.

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

Referenced by main().

Here is the call graph for this function:
Here is the caller 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 335 of file Distribution.C.

References Foam::component(), Pair::first(), k, Pair::second(), and List::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 383 of file Distribution.C.

References Foam::component(), Pair::first(), k, Pair::second(), and List::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 425 of file Distribution.C.

References Foam::component(), forAll, 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 461 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 492 of file Distribution.C.

◆ binWidth()

const Type & binWidth ( ) const
inline

Return the bin width.

Definition at line 30 of file DistributionI.H.

◆ listStarts()

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

Return the List start bin indices.

Definition at line 38 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 504 of file Distribution.C.

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

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

Definition at line 561 of file Distribution.C.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator>>

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

◆ operator

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

Field Documentation

◆ binWidth_

Type binWidth_
private

Width of the bin for each component.

Definition at line 69 of file Distribution.H.

◆ listStarts_

List<label> listStarts_
private

The start bin index of each component.

Definition at line 72 of file Distribution.H.


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