Skip to main content

Rocky Solver SDK 2025 R2

rocky_sph_element_api

Last update: 16.07.2025
1// (C) 2024 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
2#pragma once
3
4// Includes =======================================================================================
5#include "rocky_sph_element.hpp"
6#include "rocky_sph_element_scalars.hpp"
7#include <rocky20/api/rocky_particle_api.hpp>
8
9// ================================================================================================
10// IRockySPHElement
11// ================================================================================================
12
21{
24 RockySPHElement _impl;
25 double current_time;
26
27 ROCKY_FUNCTIONS IRockySPHElement(RockySPHElement impl, const double current_time)
28 : _impl(impl)
29 , current_time(current_time)
30 {
31 }
32
38 {
39 return { this->_impl.get_linked_dem_index(), model._impl };
40 }
41
49 {
50 return { this->_impl.get_linked_dem_index(), model._impl.model };
51 }
52
58 ROCKY_FUNCTIONS void add_force(const float3& force)
59 {
60 this->_impl.add_force(force);
61 }
62
69 ROCKY_FUNCTIONS void add_acceleration(const float3& acceleration)
70 {
71 this->_impl.add_acceleration(acceleration);
72 }
73
77 ROCKY_FUNCTIONS bool is_enabled() const
78 {
79 return this->_impl.is_enabled();
80 }
81
88 ROCKY_FUNCTIONS void set_frozen(bool frozen)
89 {
90 this->_impl.set_frozen(frozen);
91 }
92
96 ROCKY_FUNCTIONS bool is_frozen() const
97 {
98 return this->_impl.is_frozen();
99 }
100
105 ROCKY_FUNCTIONS bool is_dem_coupled() const
106 {
107 return this->_impl.is_dem_coupled();
108 }
109
113 ROCKY_FUNCTIONS float get_density() const
114 {
115 return this->_impl.get_density();
116 }
117
121 ROCKY_FUNCTIONS float get_pressure() const
122 {
123 return this->_impl.get_pressure();
124 }
128 ROCKY_FUNCTIONS float get_temperature() const
129 {
130 return this->_impl.get_temperature();
131 }
132
136 ROCKY_FUNCTIONS float get_release_time() const
137 {
138 return this->_impl.get_release_time();
139 }
140
144 ROCKY_FUNCTIONS float3 get_position() const
145 {
146 return this->_impl.get_adjusted_coordinates(this->current_time);
147 }
148
153 ROCKY_FUNCTIONS float3 get_velocity() const
154 {
155 return this->_impl.get_velocity();
156 }
157
171 ROCKY_FUNCTIONS float3 get_normal() const
172 {
173 return this->_impl.get_normal();
174 }
175
181 ROCKY_FUNCTIONS float3 get_force() const
182 {
183 return this->_impl.get_force();
184 }
185
191 ROCKY_FUNCTIONS float3 get_acceleration() const
192 {
193 return this->_impl.get_acceleration();
194 }
206 ROCKY_FUNCTIONS float get_kernel
207 (const float distance, const IRockySPHElement& near_element) const
208 {
209 return this->_impl.get_kernel(distance,near_element._impl);
210 }
211
223 ROCKY_FUNCTIONS float get_kernel_derivative
224 (const float distance, const IRockySPHElement& near_element) const
225 {
226 return this->_impl.get_kernel_derivative(distance,near_element._impl);
227 }
228
232 ROCKY_FUNCTIONS float get_mass() const
233 {
234 return this->_impl.get_mass();
235 }
236
242 inline ROCKY_FUNCTIONS float get_smoothing_length() const
243 {
244 return this->_impl.get_kernel_base();
245 }
246
251 inline ROCKY_FUNCTIONS float get_size() const
252 {
253 return this->_impl.get_size();
254 }
255
261 {
262 return { *this->_impl.get_scalars(), this->_impl.element_index };
263 }
264
270 ROCKY_FUNCTIONS SymmetricTensor<float> get_strain_rate_tensor()
271 {
272 return this->_impl.get_strain_rate_tensor();
273 }
277 ROCKY_FUNCTIONS float get_molecular_viscosity() const
278 {
279 return this->_impl.get_molecular_viscosity();
280 }
284 ROCKY_FUNCTIONS void set_molecular_viscosity(const float molecular_viscosity)
285 {
286 this->_impl.set_molecular_viscosity(molecular_viscosity);
287 }
288};
289
290// ================================================================================================
291// IRockySPHElementHost
292// ================================================================================================
293
294#ifdef ONLY_FOR_DOXYGEN
305{
311
313 bool is_dem_coupled() const;
314
316 float get_density() const;
317
319 float get_pressure() const;
320
322 float get_release_time() const;
323
325 float3 get_position() const;
326
328 float3 get_velocity() const;
329
331 float3 get_normal() const;
332
334 float3 get_force() const;
335
337 float3 get_acceleration() const;
338
341
343 ROCKY_FUNCTIONS SymmetricTensor<float> get_strain_rate_tensor();
344};
345#else
347#endif
Definition rocky_model_api.hpp:20
Definition rocky_api.h:58
Definition rocky_particle_api.hpp:766
Definition rocky_particle_api.hpp:28
Definition rocky_sph_element_api.hpp:305
ROCKY_FUNCTIONS SymmetricTensor< float > get_strain_rate_tensor()
float3 get_velocity() const
float get_pressure() const
float get_density() const
float get_release_time() const
IRockySPHElementScalars get_scalars()
float3 get_position() const
float3 get_acceleration() const
float3 get_normal() const
float3 get_force() const
bool is_dem_coupled() const
IRockyParticleHost get_linked_dem_particle(IRockyModel &model) const
Definition rocky_sph_element_scalars.hpp:136
Definition rocky_sph_element_api.hpp:21
ROCKY_FUNCTIONS float get_smoothing_length() const
Definition rocky_sph_element_api.hpp:242
ROCKY_FUNCTIONS float get_kernel(const float distance, const IRockySPHElement &near_element) const
Definition rocky_sph_element_api.hpp:207
ROCKY_FUNCTIONS void add_force(const float3 &force)
Definition rocky_sph_element_api.hpp:58
ROCKY_FUNCTIONS void set_frozen(bool frozen)
Definition rocky_sph_element_api.hpp:88
ROCKY_FUNCTIONS void add_acceleration(const float3 &acceleration)
Definition rocky_sph_element_api.hpp:69
ROCKY_FUNCTIONS IRockySPHElementScalars get_scalars()
Definition rocky_sph_element_api.hpp:260
ROCKY_FUNCTIONS float get_size() const
Definition rocky_sph_element_api.hpp:251
ROCKY_FUNCTIONS bool is_dem_coupled() const
Definition rocky_sph_element_api.hpp:105
ROCKY_FUNCTIONS float get_kernel_derivative(const float distance, const IRockySPHElement &near_element) const
Definition rocky_sph_element_api.hpp:224
ROCKY_FUNCTIONS float get_pressure() const
Definition rocky_sph_element_api.hpp:121
ROCKY_FUNCTIONS float get_density() const
Definition rocky_sph_element_api.hpp:113
ROCKY_FUNCTIONS float3 get_position() const
Definition rocky_sph_element_api.hpp:144
ROCKY_FUNCTIONS IRockyParticle get_linked_dem_particle(IRockyDeviceModel &model) const
Definition rocky_sph_element_api.hpp:48
ROCKY_FUNCTIONS bool is_frozen() const
Definition rocky_sph_element_api.hpp:96
ROCKY_FUNCTIONS float3 get_acceleration() const
Definition rocky_sph_element_api.hpp:191
ROCKY_FUNCTIONS float get_release_time() const
Definition rocky_sph_element_api.hpp:136
ROCKY_FUNCTIONS float3 get_velocity() const
Definition rocky_sph_element_api.hpp:153
ROCKY_FUNCTIONS float3 get_force() const
Definition rocky_sph_element_api.hpp:181
ROCKY_FUNCTIONS void set_molecular_viscosity(const float molecular_viscosity)
Definition rocky_sph_element_api.hpp:284
ROCKY_FUNCTIONS SymmetricTensor< float > get_strain_rate_tensor()
Definition rocky_sph_element_api.hpp:270
ROCKY_FUNCTIONS float get_mass() const
Definition rocky_sph_element_api.hpp:232
ROCKY_FUNCTIONS float get_molecular_viscosity() const
Definition rocky_sph_element_api.hpp:277
ROCKY_FUNCTIONS float get_temperature() const
Definition rocky_sph_element_api.hpp:128
ROCKY_FUNCTIONS float3 get_normal() const
Definition rocky_sph_element_api.hpp:171
ROCKY_FUNCTIONS bool is_enabled() const
Definition rocky_sph_element_api.hpp:77

Connect with Ansys