walberla::math::DistributedSample Class Reference

Detailed Description

Class describing a distributed statistical sample.

#include <DistributedSample.h>

Public Member Functions

 DistributedSample ()
 
void insert (const real_t val)
 
template<class InputIterator >
void insert (InputIterator first, InputIterator last)
 
template<typename T >
void castToRealAndInsert (const T &val)
 
template<class InputIterator >
void castToRealAndInsert (InputIterator first, InputIterator last)
 
void clear ()
 
void mpiAllGather ()
 Combines the samples from all processes and stores the result on each process. More...
 
void mpiGather (int rank)
 Combines the samples from all processes and stores the result on process 'rank'. More...
 
void mpiGatherRoot ()
 Combines the samples from all processes and stores the result on the root process. More...
 
real_t sum () const
 
real_t min () const
 
real_t max () const
 
real_t range () const
 
real_t mean () const
 
real_t avg () const
 
real_t variance () const
 
real_t stdDeviation () const
 
real_t relativeStdDeviation () const
 
uint_t size ()
 
std::string format (const std::string &formatString=DEFAULT_FORMAT_STRING) const
 Generates a string with attributes of the sample. More...
 

Private Attributes

std::vector< real_tdata_
 
real_t sum_
 
real_t min_
 
real_t max_
 
uint_t size_
 
real_t mean_
 
real_t variance_
 

Static Private Attributes

static const std::string DEFAULT_FORMAT_STRING
 

Constructor & Destructor Documentation

◆ DistributedSample()

walberla::math::DistributedSample::DistributedSample ( )
inline

Member Function Documentation

◆ avg()

real_t walberla::math::DistributedSample::avg ( ) const
inline

◆ castToRealAndInsert() [1/2]

template<typename T >
void walberla::math::DistributedSample::castToRealAndInsert ( const T &  val)

◆ castToRealAndInsert() [2/2]

template<class InputIterator >
void walberla::math::DistributedSample::castToRealAndInsert ( InputIterator  first,
InputIterator  last 
)

◆ clear()

void walberla::math::DistributedSample::clear ( )
inline

◆ format()

std::string walberla::math::DistributedSample::format ( const std::string &  formatString = DEFAULT_FORMAT_STRING) const

Generates a string with attributes of the sample.

The following patters are replaced in the format string:

min by min() max by max() sum by sum() mean by mean() var by variance() stddev by stdDeviation() relstddev by relativeStdDeviation() size by size()

Returns
The formatted string.

◆ insert() [1/2]

void walberla::math::DistributedSample::insert ( const real_t  val)
inline

◆ insert() [2/2]

template<class InputIterator >
void walberla::math::DistributedSample::insert ( InputIterator  first,
InputIterator  last 
)
inline

◆ max()

real_t walberla::math::DistributedSample::max ( ) const
inline

◆ mean()

real_t walberla::math::DistributedSample::mean ( ) const
inline

◆ min()

real_t walberla::math::DistributedSample::min ( ) const
inline

◆ mpiAllGather()

void walberla::math::DistributedSample::mpiAllGather ( )

Combines the samples from all processes and stores the result on each process.

Note that this is a collective MPI operation. It has to be called by all processes!

◆ mpiGather()

void walberla::math::DistributedSample::mpiGather ( int  rank)

Combines the samples from all processes and stores the result on process 'rank'.

Note that this is a collective MPI operation. It has to be called by all processes!

Parameters
rankThe rank of the process the combined sample is stored on.

◆ mpiGatherRoot()

void walberla::math::DistributedSample::mpiGatherRoot ( )

Combines the samples from all processes and stores the result on the root process.

Note that this is a collective MPI operation. It has to be called by all processes!

◆ range()

real_t walberla::math::DistributedSample::range ( ) const
inline

◆ relativeStdDeviation()

real_t walberla::math::DistributedSample::relativeStdDeviation ( ) const
inline

◆ size()

uint_t walberla::math::DistributedSample::size ( )
inline

◆ stdDeviation()

real_t walberla::math::DistributedSample::stdDeviation ( ) const
inline

◆ sum()

real_t walberla::math::DistributedSample::sum ( ) const
inline

◆ variance()

real_t walberla::math::DistributedSample::variance ( ) const
inline

Member Data Documentation

◆ data_

std::vector< real_t > walberla::math::DistributedSample::data_
private

◆ DEFAULT_FORMAT_STRING

const std::string walberla::math::DistributedSample::DEFAULT_FORMAT_STRING
staticprivate
Initial value:
= "Sample has %size values in [%min, %max], "
"sum = %sum, mean = %mean, "
"stddev = %stddev (relative: %relstddev)"

◆ max_

real_t walberla::math::DistributedSample::max_
private

◆ mean_

real_t walberla::math::DistributedSample::mean_
private

◆ min_

real_t walberla::math::DistributedSample::min_
private

◆ size_

uint_t walberla::math::DistributedSample::size_
private

◆ sum_

real_t walberla::math::DistributedSample::sum_
private

◆ variance_

real_t walberla::math::DistributedSample::variance_
private

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