Skip to main content

Rocky Solver SDK 2025 R2

rocky_statistics_data

Last update: 16.07.2025
1// (C) 2024 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
2#pragma once
3
4#include <rocky20/model/statistics_data.hpp>
5#include <rocky20/api/device/api_backend.hpp>
6
7using IRockyStatisticsAccumulator = rocky20::AAccumulator;
8
21struct IRockyStatisticsAdder : public rocky20::AAdder
22{
23
33 ROCKY_FUNCTIONS void add_value(double new_value)
34 {
35#ifdef GPU_KERNEL_COMPILING_STAGE
36 this->rocky20::AAdder::add_value<CudaBackend>(new_value);
37#else
38 this->rocky20::AAdder::add_value<OMPBackend>(new_value);
39#endif
40 }
41
46 double get_mean() const
47 {
48 return this->rocky20::AAdder::get_mean();
49 }
50
55 double get_std_deviation() const
56 {
57 return this->rocky20::AAdder::get_std_deviation();
58 }
59
65 double get_skewness() const
66 {
67 return this->rocky20::AAdder::get_skewness();
68 }
69
75 double get_kurtosis() const
76 {
77 return this->rocky20::AAdder::get_kurtosis();
78 }
79
84 void reset()
85 {
86 return this->rocky20::AAdder::reset();
87 }
88
99 void join(const IRockyStatisticsAdder& other)
100 {
101 return this->rocky20::AAdder::join(other);
102 }
103
105 /* Deprecated methods */
106
107 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
108 ROCKY_FUNCTIONS void add_value(double new_value, double n_values)
109 {
110 this->add_value(new_value);
111 }
112
113 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
114 double get_std_deviation(double n_values) const
115 {
116 return this->rocky20::AAdder::get_std_deviation();
117 }
118
119 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
120 double get_skewness(double n_values) const
121 {
122 return this->rocky20::AAdder::get_skewness();
123 }
124
125 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
126 double get_kurtosis(double n_values) const
127 {
128 return this->rocky20::AAdder::get_kurtosis();
129 }
130
131 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
132 void join(const IRockyStatisticsAdder& other, double n_values, double other_n_values)
133 {
134 this->rocky20::AAdder::join(other);
135 }
136
138};
139
140
142struct IRockyStatisticsCounter
143{
144 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
145 ROCKY_FUNCTIONS void increment()
146 {
147 backend::atomic_add(&this->count, 1);
148 }
149
150 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
151 ROCKY_FUNCTIONS double get_count() const
152 {
153 return this->count;
154 }
155
156 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
157 void reset()
158 {
159 this->count = 0;
160 }
161
162 [[deprecated("IRockyStatisticsCounter is no longer needed for statistics")]]
163 void join(const IRockyStatisticsCounter& other)
164 {
165 this->count += other.count;
166 }
167 int count;
168};
171#ifdef ONLY_FOR_DOXYGEN
172
182{
188 ROCKY_FUNCTIONS void add_value(double value);
189
193 double get_sum() const;
194
198 void reset();
199
209};
210
211#endif
Definition rocky_statistics_data.hpp:182
void join(const IRockyStatisticsAccumulator &other)
ROCKY_FUNCTIONS void add_value(double value)
Definition rocky_statistics_data.hpp:22
ROCKY_FUNCTIONS void add_value(double new_value)
Definition rocky_statistics_data.hpp:33
double get_skewness() const
Definition rocky_statistics_data.hpp:65
void join(const IRockyStatisticsAdder &other)
Definition rocky_statistics_data.hpp:99
double get_mean() const
Definition rocky_statistics_data.hpp:46
double get_kurtosis() const
Definition rocky_statistics_data.hpp:75
double get_std_deviation() const
Definition rocky_statistics_data.hpp:55
void reset()
Definition rocky_statistics_data.hpp:84

Connect with Ansys