Skip to main content

Rocky Solver SDK 2024 R2

rocky_statistics_data

Last update: 17.07.2025
1#pragma once
2
3#include <rocky20/model/statistics_data.hpp>
4#include <rocky20/api/device/api_backend.hpp>
5
6using IRockyStatisticsAccumulator = rocky20::AAccumulator;
7
20struct IRockyStatisticsAdder : public rocky20::AAdder
21{
22
32 ROCKY_FUNCTIONS void add_value(double new_value)
33 {
34#ifdef __CUDA_ARCH__
35 this->rocky20::AAdder::add_value<CudaBackend>(new_value);
36#else
37 this->rocky20::AAdder::add_value<OMPBackend>(new_value);
38#endif
39 }
40
45 double get_mean() const
46 {
47 return this->rocky20::AAdder::get_mean();
48 }
49
54 double get_std_deviation() const
55 {
56 return this->rocky20::AAdder::get_std_deviation();
57 }
58
64 double get_skewness() const
65 {
66 return this->rocky20::AAdder::get_skewness();
67 }
68
74 double get_kurtosis() const
75 {
76 return this->rocky20::AAdder::get_kurtosis();
77 }
78
83 void reset()
84 {
85 return this->rocky20::AAdder::reset();
86 }
87
98 void join(const IRockyStatisticsAdder& other)
99 {
100 return this->rocky20::AAdder::join(other);
101 }
102
104 /* Deprecated methods */
105
106 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
107 ROCKY_FUNCTIONS void add_value(double new_value, double n_values)
108 {
109 this->add_value(new_value);
110 }
111
112 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
113 double get_std_deviation(double n_values) const
114 {
115 return this->rocky20::AAdder::get_std_deviation();
116 }
117
118 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
119 double get_skewness(double n_values) const
120 {
121 return this->rocky20::AAdder::get_skewness();
122 }
123
124 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
125 double get_kurtosis(double n_values) const
126 {
127 return this->rocky20::AAdder::get_kurtosis();
128 }
129
130 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
131 void join(const IRockyStatisticsAdder& other, double n_values, double other_n_values)
132 {
133 this->rocky20::AAdder::join(other);
134 }
135
137};
138
139
141struct IRockyStatisticsCounter
142{
143 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
144 ROCKY_FUNCTIONS void increment()
145 {
146 backend::atomic_add(&this->count, 1);
147 }
148
149 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
150 ROCKY_FUNCTIONS double get_count() const
151 {
152 return this->count;
153 }
154
155 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
156 void reset()
157 {
158 this->count = 0;
159 }
160
161 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
162 void join(const IRockyStatisticsCounter& other)
163 {
164 this->count += other.count;
165 }
166 int count;
167};
170#ifdef ONLY_FOR_DOXYGEN
171
181{
187 ROCKY_FUNCTIONS void add_value(double value);
188
192 double get_sum() const;
193
197 void reset();
198
208};
209
210#endif
Definition rocky_statistics_data.hpp:181
void join(const IRockyStatisticsAccumulator &other)
ROCKY_FUNCTIONS void add_value(double value)
Definition rocky_statistics_data.hpp:21
ROCKY_FUNCTIONS void add_value(double new_value)
Definition rocky_statistics_data.hpp:32
double get_skewness() const
Definition rocky_statistics_data.hpp:64
void join(const IRockyStatisticsAdder &other)
Definition rocky_statistics_data.hpp:98
double get_mean() const
Definition rocky_statistics_data.hpp:45
double get_kurtosis() const
Definition rocky_statistics_data.hpp:74
double get_std_deviation() const
Definition rocky_statistics_data.hpp:54
void reset()
Definition rocky_statistics_data.hpp:83

Connect with Ansys