SPH
|
Object holding various statistics about current run. More...
#include <Statistics.h>
Public Member Functions | |
Statistics ()=default | |
Statistics (const Statistics &other) | |
Statistics & | operator= (const Statistics &other) |
bool | has (const StatisticsId idx) const |
Checks if the object contains a statistic with given ID. More... | |
template<typename TValue > | |
Statistics & | set (const StatisticsId idx, TValue &&value) |
Sets new values of a statistic. More... | |
void | increment (const StatisticsId idx, const Size amount) |
Increments an integer statistic by given amount. More... | |
void | accumulate (const StatisticsId idx, const Float value) |
Accumulate a value into means of given idx. More... | |
template<typename TValue > | |
TValue | get (const StatisticsId idx) const |
Returns value of a statistic. More... | |
template<typename TValue > | |
TValue | getOr (const StatisticsId idx, const TValue &other) const |
Returns value of a statistic, or a given value if the statistic is not stored. More... | |
Object holding various statistics about current run.
Statistics are stored as key-value pairs, the key being StatisticsId enum defined below. Values are set or accumulated by each component of the running problem (timestepping, solver, ...).
Definition at line 22 of file Statistics.h.
|
default |
|
inline |
Definition at line 33 of file Statistics.h.
|
inline |
Accumulate a value into means of given idx.
Value does not have to be stored. If there is no value of given idx, it is created with default constructor prior to accumulating.
Definition at line 73 of file Statistics.h.
|
inline |
Returns value of a statistic.
The value must be stored in the object and must have type TValue, checked by assert.
Definition at line 88 of file Statistics.h.
|
inline |
Returns value of a statistic, or a given value if the statistic is not stored.
Definition at line 98 of file Statistics.h.
|
inline |
Checks if the object contains a statistic with given ID.
By default, the object is empty, it contains no data.
Definition at line 44 of file Statistics.h.
|
inline |
Increments an integer statistic by given amount.
Syntatic suggar, equivalent to set(idx, get<int>(idx) + amount).
Definition at line 61 of file Statistics.h.
|
inline |
Definition at line 36 of file Statistics.h.
|
inline |
Sets new values of a statistic.
This overrides any previously stored value.
Definition at line 52 of file Statistics.h.