ls1-MarDyn
ls1-MarDyn molecular dynamics code
Public Member Functions | List of all members
Accumulator< T > Class Template Reference

#include <Accumulator.h>

Public Member Functions

 Accumulator (bool accX, bool accY, bool accZ)
 
double CalcKineticEnergyContribution (Molecule *mol)
 
void ScaleVelocityComponents (Molecule *mol, double vcorr)
 
 Accumulator (size_t windowLength=100)
 
 ~Accumulator ()
 
getAverage ()
 
getStddev ()
 
getPercentile (double p)
 
getInterPercentileRange (double pmin, double pmax)
 
void addEntry (T value)
 
getLastEntry ()
 
getEntry (size_t id)
 
size_t getWindowLength ()
 
size_t getSize ()
 

Detailed Description

template<typename T>
class Accumulator< T >

A generalized Accumlator for scalar values.

The accumulator uses a sliding window to calculate average values.

Constructor & Destructor Documentation

◆ Accumulator()

template<typename T >
Accumulator< T >::Accumulator ( size_t  windowLength = 100)
inline

Constructor creating new Accumlator

Parameters
[in]windowLengthNumber of elements in the sliding window.

◆ ~Accumulator()

template<typename T >
Accumulator< T >::~Accumulator ( )
inline

Destructor

Member Function Documentation

◆ addEntry()

template<typename T >
void Accumulator< T >::addEntry ( value)
inline

Move sliding window forward by adding a new value replacing the oldest entry.

Parameters
[in]valuevalue to be inserted at the begin of the moved window.

◆ getAverage()

template<typename T >
T Accumulator< T >::getAverage ( )
inline

Return the average of the values in the sliding window.

Returns
Average of the sliding window.

◆ getEntry()

template<typename T >
T Accumulator< T >::getEntry ( size_t  id)
inline

Return the entry added id times before.

Parameters
[in]idID of element, 1 gives the last added element.
Returns
value added id times before

◆ getInterPercentileRange()

template<typename T >
T Accumulator< T >::getInterPercentileRange ( double  pmin,
double  pmax 
)
inline

Return inter percentile range

Parameters
[in]pminlower percentile as real, e.g. 0.25 for the median (25%)
[in]pmaxupper percentile as real, e.g. 0.75 for the median (75%)
Returns
Requested inter percentile range of the sliding window

◆ getLastEntry()

template<typename T >
T Accumulator< T >::getLastEntry ( )
inline

Return the last added value.

Returns
Last value added to accumulator.

◆ getPercentile()

template<typename T >
T Accumulator< T >::getPercentile ( double  p)
inline

Return percentile

Parameters
[in]ppercentile as real, e.g. 0.5 for the median (50%)
Returns
Requested percentile of the sliding window

◆ getSize()

template<typename T >
size_t Accumulator< T >::getSize ( )
inline

Get the number of elements within the sliding window. The number of elements can be less than the window length as long as not enough elements were added to the accumulator. This method allows to query for the number of elements in the window.

Returns
Number of elements in the sliding window.

◆ getStddev()

template<typename T >
T Accumulator< T >::getStddev ( )
inline

Return the standard deviation of the values in the sliding window.

Returns
Standard deviation of the sliding window

◆ getWindowLength()

template<typename T >
size_t Accumulator< T >::getWindowLength ( )
inline

Get the size of the sliding window.

Returns
Size of the sliding window

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