Skip to main content

Rocky Solver SDK 2024 R2

rocky_sph_interaction_api

Last update: 17.07.2025
1#pragma once
2
3// Includes =======================================================================================
4#include "rocky_sph_element_api.hpp"
5#include "rocky_sph_interaction.hpp"
6#include <rocky20/api/rocky_boundary_api.hpp>
7
8// ================================================================================================
9// IRockySPHElementInteraction
10// ================================================================================================
11
18{
22 ROCKY_FUNCTIONS float3 calculate_elements_distance() const;
23
27 ROCKY_FUNCTIONS float3 calculate_elements_relative_velocity() const;
28
32 ROCKY_FUNCTIONS float3 get_home_element_velocity() const;
33
37 ROCKY_FUNCTIONS float3 get_near_element_velocity() const;
38
43 ROCKY_FUNCTIONS IRockySPHElement get_home_element() const;
44
49 ROCKY_FUNCTIONS IRockySPHElement get_near_element() const;
50
58 ROCKY_FUNCTIONS void add_force(float3 force);
59
68 ROCKY_FUNCTIONS void add_acceleration(float3 acceleration);
69
72 ROCKY_FUNCTIONS explicit IRockySPHElementInteraction(
73 RockySPHElementInteraction* interaction_impl);
74
75 RockySPHElementInteraction* _impl;
76
78};
79
80inline ROCKY_FUNCTIONS IRockySPHElementInteraction::IRockySPHElementInteraction(
81 RockySPHElementInteraction* interaction_impl)
82 : _impl(interaction_impl)
83{
84}
85
87{
88 return this->_impl->get_distance_vector();
89}
90
91inline ROCKY_FUNCTIONS float3
93{
94 return this->_impl->calculate_elements_relative_velocity();
95}
96
97inline ROCKY_FUNCTIONS float3 IRockySPHElementInteraction::get_home_element_velocity() const
98{
99 return this->_impl->get_home_velocity();
100}
101
103{
104 return this->_impl->get_near_velocity();
105}
106
108{
109 return IRockySPHElement { this->_impl->get_home_element() };
110}
111
113{
114 return IRockySPHElement { this->_impl->get_near_element() };
115}
116
117inline ROCKY_FUNCTIONS void IRockySPHElementInteraction::add_force(float3 force)
118{
119 this->_impl->add_force(force);
120}
121
122inline ROCKY_FUNCTIONS void IRockySPHElementInteraction::add_acceleration(float3 acceleration)
123{
124 this->_impl->add_acceleration(acceleration);
125}
126
127// ================================================================================================
128// IRockySPHTriangleInteraction
129// ================================================================================================
130
137{
142 ROCKY_FUNCTIONS IRockySPHElement get_home_element() const;
143
148 ROCKY_FUNCTIONS IRockyGeometryTriangle get_near_triangle() const;
149
154 ROCKY_FUNCTIONS float calculate_element_triangle_distance() const;
155
160 ROCKY_FUNCTIONS float3 get_orthogonal_projection() const;
161
166 ROCKY_FUNCTIONS float3 get_unit_vector() const;
167
171 ROCKY_FUNCTIONS float3 get_home_element_velocity() const;
172
177 ROCKY_FUNCTIONS float3 get_boundary_velocity() const;
178
183 ROCKY_FUNCTIONS real_sph get_normal_relative_velocity() const;
184
189 ROCKY_FUNCTIONS real_sph get_tangential_relative_velocity() const;
190
199 ROCKY_FUNCTIONS void add_force(float3 force);
200
209 ROCKY_FUNCTIONS void add_acceleration(float3 acceleration);
210
213 ROCKY_FUNCTIONS explicit IRockySPHTriangleInteraction(
214 RockySPHTriangleInteraction* interaction_impl);
215
216 RockySPHTriangleInteraction* _impl;
217
218 [[deprecated]]
219 ROCKY_FUNCTIONS float3 get_distance_to_home_vector() const;
220
221 [[deprecated("Use IRockySPHTriangleInteraction::get_orthogonal_projection() instead.")]]
222 ROCKY_FUNCTIONS float3 get_nearest_point_to_home() const;
223
224 [[deprecated("Use IRockySPHTriangleInteraction::calculate_element_triangle_distance() instead.")]]
225 ROCKY_FUNCTIONS float get_distance_to_home() const;
226
228};
229
230inline ROCKY_FUNCTIONS IRockySPHTriangleInteraction::IRockySPHTriangleInteraction(
231 RockySPHTriangleInteraction* interaction_impl)
232 : _impl(interaction_impl)
233{
234}
235
237{
238 return this->_impl->get_home_velocity();
239}
240
242{
243 return IRockySPHElement { this->_impl->get_home_element() };
244}
245
246inline ROCKY_FUNCTIONS void IRockySPHTriangleInteraction::add_force(float3 force)
247{
248 this->_impl->add_force(force);
249}
250
251inline ROCKY_FUNCTIONS void IRockySPHTriangleInteraction::add_acceleration(float3 acceleration)
252{
253 this->_impl->add_acceleration(acceleration);
254}
255
256inline ROCKY_FUNCTIONS IRockyGeometryTriangle
258{
259 return { this->_impl->near_index, this->_impl->rocky_model };
260}
261
263{
264 return this->_impl->get_distance();
265}
266
268{
269 return this->_impl->get_nearest_point_to_home();
270}
271
272inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_boundary_velocity() const
273{
274 return this->_impl->get_near_velocity();
275}
276
277inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_unit_vector() const
278{
279 return this->_impl->get_unit_vector();
280}
281
283{
284 return this->_impl->normal_velocity;
285}
286
288{
289 return this->_impl->tangential_velocity;
290}
291
292// deprecated
293inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_distance_to_home_vector() const
294{
295 return this->_impl->get_unit_vector() * this->_impl->get_distance();
296}
297
298inline ROCKY_FUNCTIONS float IRockySPHTriangleInteraction::get_distance_to_home() const
299{
300 return this->_impl->get_distance();
301}
302
303inline ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_nearest_point_to_home() const
304{
305 return this->_impl->get_nearest_point_to_home();
306}
307
Definition rocky_boundary_api.hpp:134
Definition rocky_sph_interaction_api.hpp:18
ROCKY_FUNCTIONS IRockySPHElement get_near_element() const
Definition rocky_sph_interaction_api.hpp:112
ROCKY_FUNCTIONS float3 calculate_elements_relative_velocity() const
Definition rocky_sph_interaction_api.hpp:92
ROCKY_FUNCTIONS void add_force(float3 force)
Definition rocky_sph_interaction_api.hpp:117
ROCKY_FUNCTIONS void add_acceleration(float3 acceleration)
Definition rocky_sph_interaction_api.hpp:122
ROCKY_FUNCTIONS float3 calculate_elements_distance() const
Definition rocky_sph_interaction_api.hpp:86
ROCKY_FUNCTIONS IRockySPHElement get_home_element() const
Definition rocky_sph_interaction_api.hpp:107
ROCKY_FUNCTIONS float3 get_near_element_velocity() const
Definition rocky_sph_interaction_api.hpp:102
ROCKY_FUNCTIONS float3 get_home_element_velocity() const
Definition rocky_sph_interaction_api.hpp:97
Definition rocky_sph_element_api.hpp:106
ROCKY_FUNCTIONS void add_force(const float3 &force) const
Definition rocky_sph_element_api.hpp:135
Definition rocky_sph_interaction_api.hpp:137
ROCKY_FUNCTIONS void add_acceleration(float3 acceleration)
Definition rocky_sph_interaction_api.hpp:251
ROCKY_FUNCTIONS float3 get_unit_vector() const
Definition rocky_sph_interaction_api.hpp:277
ROCKY_FUNCTIONS IRockyGeometryTriangle get_near_triangle() const
Definition rocky_sph_interaction_api.hpp:257
ROCKY_FUNCTIONS real_sph get_tangential_relative_velocity() const
Definition rocky_sph_interaction_api.hpp:287
ROCKY_FUNCTIONS float3 get_orthogonal_projection() const
Definition rocky_sph_interaction_api.hpp:267
ROCKY_FUNCTIONS float calculate_element_triangle_distance() const
Definition rocky_sph_interaction_api.hpp:262
ROCKY_FUNCTIONS void add_force(float3 force)
Definition rocky_sph_interaction_api.hpp:246
ROCKY_FUNCTIONS real_sph get_normal_relative_velocity() const
Definition rocky_sph_interaction_api.hpp:282
ROCKY_FUNCTIONS float3 get_boundary_velocity() const
Definition rocky_sph_interaction_api.hpp:272
ROCKY_FUNCTIONS IRockySPHElement get_home_element() const
Definition rocky_sph_interaction_api.hpp:241
ROCKY_FUNCTIONS float3 get_home_element_velocity() const
Definition rocky_sph_interaction_api.hpp:236

Connect with Ansys