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 > &) |
Private Attributes | |
Type | binWidth_ |
Width of the bin for each component. More... | |
List< label > | listStarts_ |
The start bin index of each component. More... | |
Friends | |
Istream & | operator>> (Istream &, Distribution< Type > &) |
Ostream & | operator (Ostream &, const Distribution< Type > &) |
Accumulating histogram of component values. Specified bin resolution, automatic generation of bins.
Definition at line 49 of file Distribution.H.
Component type.
Definition at line 78 of file Distribution.H.
Distribution | ( | ) |
Construct null.
Definition at line 33 of file Distribution.C.
Distribution | ( | const Type & | binWidth | ) |
Construct from separate binWidth for each component.
Definition at line 42 of file Distribution.C.
Distribution | ( | const Distribution & | d | ) |
Construct as copy.
~Distribution | ( | ) |
Destructor.
Definition at line 62 of file Distribution.C.
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.
Foam::List< Foam::label > keys | ( | direction | cmpt | ) | const |
Definition at line 85 of file Distribution.C.
References forAll, Foam::identity(), and k.
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().
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().
Type mean | ( | ) | const |
Definition at line 197 of file Distribution.C.
References Foam::component(), forAll, k, and Foam::setComponent().
Referenced by main().
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().
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().
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().
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().
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().
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().
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.
|
inline |
Return the bin width.
Definition at line 30 of file DistributionI.H.
|
inline |
Return the List start bin indices.
Definition at line 38 of file DistributionI.H.
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().
void operator= | ( | const Distribution< Type > & | rhs | ) |
Definition at line 561 of file Distribution.C.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.
|
friend |
|
friend |
|
private |
Width of the bin for each component.
Definition at line 69 of file Distribution.H.
The start bin index of each component.
Definition at line 72 of file Distribution.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.