> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Structure IRockyStatisticsAccumulator

![][C++]
![][public]

**#include \<rocky\_statistics\_data.hpp>**

`IRockyStatisticsAccumulator` is an auxiliary struct that can be used to sum a set of values generated during a period of time in a simulation. That sum may be an approximation of the value of an integral, needed for calculating integral-based statistics. Such integral can represent a physical magnitude, for instance, an impulse or a work. Please refer to the DEM Technical Manual for a complete description of integral-based statistics.

## Members

* [add\_value](#structIRockyStatisticsAccumulator_1aa6f9107d44777f2914054a2567018438)
* [get\_sum](#structIRockyStatisticsAccumulator_1a465ef9a481493da8c59e760a3f37e3e6)
* [join](#structIRockyStatisticsAccumulator_1a6a0a426d29d79255741700958cdc9511)
* [reset](#structIRockyStatisticsAccumulator_1acb15234baa81417b3382410594d7150b)

## Public functions

### Function add\_value

![][public]

```cpp theme={null}
ROCKY_FUNCTIONS void IRockyStatisticsAccumulator::add_value(double value)
```

**This method adds a new value to the current sum.**:

**Parameters**:

* **value**: The value that must be added.

**Parameters**:

* double **value**

**Return type**: ROCKY\_FUNCTIONS void

### Function get\_sum

![][public]
![][const]

```cpp theme={null}
double IRockyStatisticsAccumulator::get_sum() const
```

**Returns**:

The value of the sum accumulated so far.

**Return type**: double

### Function reset

![][public]

```cpp theme={null}
void IRockyStatisticsAccumulator::reset()
```

**This method resets to zero the sum in order to start a new accumulation round.**:

**Return type**: void

### Function join

![][public]

```cpp theme={null}
void IRockyStatisticsAccumulator::join(const IRockyStatisticsAccumulator &other)
```

**This method sums the values accumulated by two instances of**:

`IRockyStatisticsAccumulator` associated to two separate sets of values. After calling this method, the value returned by `get_sum` will be the resulting sum.

**Parameters**:

* **other**: The instance of `IRockyStatisticsAccumulator` that accumulated the second set of values.

**Parameters**:

* const [IRockyStatisticsAccumulator](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/structIRockyStatisticsAccumulator.md) & **other**

**Return type**: void

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[C++]: https://img.shields.io/badge/language-C%2B%2B-blue "C++"

[const]: https://img.shields.io/badge/-const-lightblue "const"
