Skip to main content

Rocky Solver SDK 2025 R1

rocky_sph_element_api

Last update: 17.07.2025
1#pragma once
2
3// Includes =======================================================================================
4#include "rocky_sph_element.hpp"
5#include "rocky_sph_element_scalars.hpp"
6#include <rocky20/api/rocky_particle_api.hpp>
7
8// ================================================================================================
9// IRockySPHElement
10// ================================================================================================
11
20{
23 RockySPHElement _impl;
24 double current_time;
25
26 ROCKY_FUNCTIONS IRockySPHElement(RockySPHElement impl, const double current_time)
27 : _impl(impl)
28 , current_time(current_time)
29 {
30 }
31
37 {
38 return { this->_impl.get_linked_dem_index(), model._impl };
39 }
40
48 {
49 return { this->_impl.get_linked_dem_index(), model._impl.model };
50 }
51
57 ROCKY_FUNCTIONS void add_force(const float3& force)
58 {
59 this->_impl.add_force(force);
60 }
61
68 ROCKY_FUNCTIONS void add_acceleration(const float3& acceleration)
69 {
70 this->_impl.add_acceleration(acceleration);
71 }
72
76 ROCKY_FUNCTIONS bool is_enabled() const
77 {
78 return this->_impl.is_enabled();
79 }
80
87 ROCKY_FUNCTIONS void set_frozen(bool frozen)
88 {
89 this->_impl.set_frozen(frozen);
90 }
91
95 ROCKY_FUNCTIONS bool is_frozen() const
96 {
97 return this->_impl.is_frozen();
98 }
99
104 ROCKY_FUNCTIONS bool is_dem_coupled() const
105 {
106 return this->_impl.is_dem_coupled();
107 }
108
112 ROCKY_FUNCTIONS float get_density() const
113 {
114 return this->_impl.get_density();
115 }
116
120 ROCKY_FUNCTIONS float get_pressure() const
121 {
122 return this->_impl.get_pressure();
123 }
124
128 ROCKY_FUNCTIONS float get_release_time() const
129 {
130 return this->_impl.get_release_time();
131 }
132
136 ROCKY_FUNCTIONS float3 get_position() const
137 {
138 return this->_impl.get_adjusted_coordinates(this->current_time);
139 }
140
145 ROCKY_FUNCTIONS float3 get_velocity() const
146 {
147 return this->_impl.get_velocity();
148 }
149
163 ROCKY_FUNCTIONS float3 get_normal() const
164 {
165 return this->_impl.get_normal();
166 }
167
173 ROCKY_FUNCTIONS float3 get_force() const
174 {
175 return this->_impl.get_force();
176 }
177
183 ROCKY_FUNCTIONS float3 get_acceleration() const
184 {
185 return this->_impl.get_acceleration();
186 }
187
193 {
194 return { *this->_impl.get_scalars(), this->_impl.element_index };
195 }
196
202 ROCKY_FUNCTIONS SymmetricTensor<float> get_strain_rate_tensor()
203 {
204 return this->_impl.get_strain_rate_tensor();
205 }
206};
207
208// ================================================================================================
209// IRockySPHElementHost
210// ================================================================================================
211
212#ifdef ONLY_FOR_DOXYGEN
223{
229
231 bool is_dem_coupled() const;
232
234 float get_density() const;
235
237 float get_pressure() const;
238
240 float get_release_time() const;
241
243 float3 get_position() const;
244
246 float3 get_velocity() const;
247
249 float3 get_normal() const;
250
252 float3 get_force() const;
253
255 float3 get_acceleration() const;
256
259
261 ROCKY_FUNCTIONS SymmetricTensor<float> get_strain_rate_tensor();
262};
263#else
265#endif
Definition rocky_model_api.hpp:19
Definition rocky_api.h:57
Definition rocky_particle_api.hpp:764
Definition rocky_particle_api.hpp:27
Definition rocky_sph_element_api.hpp:223
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:127
Definition rocky_sph_element_api.hpp:20
ROCKY_FUNCTIONS void add_force(const float3 &force)
Definition rocky_sph_element_api.hpp:57
ROCKY_FUNCTIONS void set_frozen(bool frozen)
Definition rocky_sph_element_api.hpp:87
ROCKY_FUNCTIONS void add_acceleration(const float3 &acceleration)
Definition rocky_sph_element_api.hpp:68
ROCKY_FUNCTIONS IRockySPHElementScalars get_scalars()
Definition rocky_sph_element_api.hpp:192
ROCKY_FUNCTIONS bool is_dem_coupled() const
Definition rocky_sph_element_api.hpp:104
ROCKY_FUNCTIONS float get_pressure() const
Definition rocky_sph_element_api.hpp:120
ROCKY_FUNCTIONS float get_density() const
Definition rocky_sph_element_api.hpp:112
ROCKY_FUNCTIONS float3 get_position() const
Definition rocky_sph_element_api.hpp:136
ROCKY_FUNCTIONS IRockyParticle get_linked_dem_particle(IRockyDeviceModel &model) const
Definition rocky_sph_element_api.hpp:47
ROCKY_FUNCTIONS bool is_frozen() const
Definition rocky_sph_element_api.hpp:95
ROCKY_FUNCTIONS float3 get_acceleration() const
Definition rocky_sph_element_api.hpp:183
ROCKY_FUNCTIONS float get_release_time() const
Definition rocky_sph_element_api.hpp:128
ROCKY_FUNCTIONS float3 get_velocity() const
Definition rocky_sph_element_api.hpp:145
ROCKY_FUNCTIONS float3 get_force() const
Definition rocky_sph_element_api.hpp:173
ROCKY_FUNCTIONS SymmetricTensor< float > get_strain_rate_tensor()
Definition rocky_sph_element_api.hpp:202
ROCKY_FUNCTIONS float3 get_normal() const
Definition rocky_sph_element_api.hpp:163
ROCKY_FUNCTIONS bool is_enabled() const
Definition rocky_sph_element_api.hpp:76

Connect with Ansys