IRockyStatisticsAdder Struct Reference
Last update: 08.07.2024
IRockyStatisticsAdder Struct Reference
#include <rocky_statistics_data.hpp>
Inherits rocky20::AAdder.
Public Member Functions | |
ROCKY_FUNCTIONS void | add_value (double new_value) |
double | get_mean () const |
double | get_std_deviation () const |
double | get_skewness () const |
double | get_kurtosis () const |
void | reset () |
void | join (const IRockyStatisticsAdder &other) |
Detailed Description
IRockyStatisticsAdder
is an auxiliary struct used to calculate the mean, standard deviation, skewness and kurtosis of a set of values. Rocky uses it in the collision statistics modules for calculating statistics of sets of collision values associated to specific entities. However, it could be used to calculate the statistics of any set of values generated during a simulation. The mean and the statistical moments up to fourth order are calculated using a one-pass algorithm, therefore, their values are updated internally every time a new value is added to the set with the add_value
method.
For the mathematical definitions of the statistics calculated by this struct, please refer to the DEM Technical Manual.
Member Function Documentation
◆ add_value()
ROCKY_FUNCTIONS void IRockyStatisticsAdder::add_value | ( | double | new_value | ) |
- This method must be used to supply each one of the values of the set for
- which
IRockyStatisticsAdder
must calculate statistics.
- Parameters
-
new_value A new value that belong to the set. n_values The number of values of the set, including the one added by this method. A companion IRockyStatisticsCounter
object can be used to keep track of that number.
◆ get_kurtosis()
double IRockyStatisticsAdder::get_kurtosis | ( | ) | const |
- Returns
- The kurtosis of the set of values successively supplied with the
add_value
method up to the point where this method is called. The kurtosis is defined in the DEM Technical Manual.
◆ get_mean()
double IRockyStatisticsAdder::get_mean | ( | ) | const |
- Returns
- The mean value of the set of values successively supplied with the
add_value
method up to the point where this method is called.
◆ get_skewness()
double IRockyStatisticsAdder::get_skewness | ( | ) | const |
- Returns
- The skewness of the set of values successively supplied with the
add_value
method up to the point where this method is called. The skewness is defined in the DEM Technical Manual.
◆ get_std_deviation()
double IRockyStatisticsAdder::get_std_deviation | ( | ) | const |
- Returns
- The standard deviation of the set of values successively supplied with the
add_value
method up to the point where this method is called.
◆ join()
void IRockyStatisticsAdder::join | ( | const IRockyStatisticsAdder & | other | ) |
- This method calculates the mean and the statistical moments for a set of values
- formed by the union of two sets of values whose statistics were calculated by two separate instances of
IRockyStatisticsAdder
. After executing this method, the statistics for the compound set will be available through the methodsget_mean
,get_std_deviation
, etc.
- Parameters
-
other The instance of IRockyStatisticsAdder
that calculated the statistics of the second set of values.
◆ reset()
void IRockyStatisticsAdder::reset | ( | ) |
- This method resets all internal variables in order to start the calculation
- of statistics for a new set of values.