Skip to main content

Rocky Solver SDK 2025 R2

rocky_joint_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 <rocky20/api/rocky_particle_api.hpp>
6#include <rocky20/device/device_joint_api.hpp>
7
8#include "rocky_joint_scalars.hpp"
9
10// ================================================================================================
11// IRockyJoint
12// ================================================================================================
13
33{
34
35 // -----------------------------------------------------------------------
36 // Forces and moments according to the default linear elastic model
37 // -----------------------------------------------------------------------
38
52 inline ROCKY_FUNCTIONS
53 double3 get_elastic_force() const
54 {
55 return this->_impl.get_elastic_force();
56 }
57
58
71 inline ROCKY_FUNCTIONS
72 thrust::tuple<double3, double3> get_moments_due_to_force(double3 force) const
73 {
74 return this->_impl.get_moments_due_to_force(force);
75 }
76
77
94 inline ROCKY_FUNCTIONS
95 double3 get_elastic_moment() const
96 {
97 return this->_impl.get_elastic_moment();
98 }
99
100
114 inline ROCKY_FUNCTIONS
115 double3 get_damping_force() const
116 {
117 return this->_impl.get_damping_force();
118 }
119
120
137 inline ROCKY_FUNCTIONS
138 double3 get_damping_moment() const
139 {
140 return this->_impl.get_damping_moment();
141 }
142
143 // ------------------------------------------------------
144 // Deformations and deformation velocities
145 // ------------------------------------------------------
146
159 inline ROCKY_FUNCTIONS
161 {
162 return this->_impl.state.normal_deformation;
163 }
164
165
176 inline ROCKY_FUNCTIONS
178 {
179 return this->_impl.state.tangential_deformation;
180 }
181
182
197 inline ROCKY_FUNCTIONS
199 {
200 return this->_impl.state.normal_deformation_velocity;
201 }
202
203
218 inline ROCKY_FUNCTIONS
220 {
221 return this->_impl.state.tangential_deformation_velocity;
222 }
223
224
232 inline ROCKY_FUNCTIONS
234 {
235 return this->_impl.state.get_n_angular_deformations();
236 }
237
238
253 inline ROCKY_FUNCTIONS
254 double get_angular_deformation(int deformation_direction) const
255 {
256 return this->_impl.state.angular_deformation[deformation_direction];
257 }
258
259
273 inline ROCKY_FUNCTIONS
274 double get_angular_deformation_velocity(int deformation_direction) const
275 {
276 return this->_impl.state.angular_deformation_velocity[deformation_direction];
277 }
278
279
293 inline ROCKY_FUNCTIONS
294 double3 get_angular_deformation_direction(int deformation_direction) const
295 {
296 return this->_impl.state.local_basis[deformation_direction];
297 }
298
299
300 // ------------------------------------------------------
301 // Stiffnesses and damping coefficients
302 // ------------------------------------------------------
303
314 inline ROCKY_FUNCTIONS
315 double get_normal_stiffness() const
316 {
317 return this->_impl.state.particle_group->joint_elastic_ratio.normal * this->_impl.state.normal_stiffness;
318 }
319
320
331 inline ROCKY_FUNCTIONS
333 {
334 return this->_impl.state.particle_group->joint_elastic_ratio.tangential * this->_impl.state.tangential_stiffness;
335 }
336
337
356 inline ROCKY_FUNCTIONS
357 double get_angular_stiffness(int deformation_direction) const
358 {
359 cu_real geometric_factor = this->get_area_moment_of_inertia(deformation_direction) / this->get_area();
360 return (deformation_direction == 0) ?
361 this->_impl.state.particle_group->joint_elastic_ratio.torsion * this->_impl.state.tangential_stiffness * geometric_factor :
362 this->_impl.state.particle_group->joint_elastic_ratio.bending * this->_impl.state.normal_stiffness * geometric_factor;
363 }
364
365
374 inline ROCKY_FUNCTIONS
376 {
377 return this->_impl.state.particle_group->sqrt_joint_elastic_ratio.normal * this->_impl.state.normal_damping;
378 }
379
380
389 inline ROCKY_FUNCTIONS
391 {
392 return this->_impl.state.particle_group->sqrt_joint_elastic_ratio.tangential * this->_impl.state.tangential_damping;
393 }
394
395
412 inline ROCKY_FUNCTIONS
413 double get_angular_damping_coefficient(int deformation_direction) const
414 {
415 cu_real geometric_factor = this->get_area_moment_of_inertia(deformation_direction) / this->get_area();
416 return (deformation_direction == 0) ?
417 this->_impl.state.particle_group->sqrt_joint_elastic_ratio.torsion * this->_impl.state.tangential_damping * geometric_factor :
418 this->_impl.state.particle_group->sqrt_joint_elastic_ratio.bending * this->_impl.state.normal_damping * geometric_factor;
419 }
420
421 //---------------------------------------------------------------
422 // Low-level parameters
423 //---------------------------------------------------------------
424
431 inline ROCKY_FUNCTIONS
432 double3 get_normal_vector() const { return this->_impl.state.normal_vector; }
433
434
445 inline ROCKY_FUNCTIONS
446 double get_area() const { return this->_impl.state.area; }
447
448
460 inline ROCKY_FUNCTIONS
461 double get_area_moment_of_inertia(int deformation_direction) const
462 {
463 return this->_impl.state.area_moment[deformation_direction];
464 }
465
466
472 inline ROCKY_FUNCTIONS
473 double get_young_modulus() const {
474 int material_index = this->_impl.state.particle_group->get_material_index();
475 return this->_impl.model->get_material(material_index).kn_load;
476 }
477
478
486 inline ROCKY_FUNCTIONS double get_poisson_ratio() const
487 {
488 const SDeviceModel* model = this->_impl.model;
489 if (model->particle_scalars->is_poisson_ratio_enabled())
490 {
491 const cuda_particle_joint& particle_joint = model->jnt_prt[this->_impl.joint_index];
492 const int home_index = particle_joint.nh;
493 const int near_index = particle_joint.nn;
494 return 0.5
495 * (this->_impl.model->particle_scalars->get_poisson_ratio(home_index)
496 + this->_impl.model->particle_scalars->get_poisson_ratio(near_index));
497 }
498 else
499 {
500 int material_index = this->_impl.state.particle_group->get_material_index();
501 return model->get_material(material_index).poisson_ratio;
502 }
503 }
504
505
517 inline ROCKY_FUNCTIONS
519 {
520 return this->_impl.state.particle_group->joint_elastic_ratio.normal;
521 }
522
523
535 inline ROCKY_FUNCTIONS
537 {
538 return this->_impl.state.particle_group->joint_elastic_ratio.tangential;
539 }
540
541
553 inline ROCKY_FUNCTIONS
555 {
556 return this->_impl.state.particle_group->joint_elastic_ratio.torsion;
557 }
558
559
571 inline ROCKY_FUNCTIONS
573 {
574 return this->_impl.state.particle_group->joint_elastic_ratio.bending;
575 }
576
577
585 inline ROCKY_FUNCTIONS
587 {
588 return this->_impl.state.particle_group->joint_damping_ratio;
589 }
590
591
607 inline ROCKY_FUNCTIONS
608 double get_angle_scaling_factor() const { return this->_impl.get_angle_scaling_factor(); }
609
610
617 inline ROCKY_FUNCTIONS
618 double get_equivalent_mass() const
619 {
620 return this->_impl.state.equivalent_mass;
621 }
622
623
631 inline ROCKY_FUNCTIONS
633 {
634 return this->_impl.state.particle_group->kn_dgb;
635 }
636
637
645 inline ROCKY_FUNCTIONS
647 {
648 return this->_impl.state.particle_group->kt_dgb;
649 }
650
651
658 inline ROCKY_FUNCTIONS
659 double get_young_modulus_multiplier() const { return this->_impl.state.stiffness_multiplier; }
660
661 // ---------------------------------------------------------------------
662 // Access to joint scalars
663 // ---------------------------------------------------------------------
664
674 inline ROCKY_FUNCTIONS
676 {
677 return IRockyJointScalars(*this->_impl.model->joint_scalars, this->_impl.joint_index);
678 }
679
680 // ---------------------------------------------------------------------
681 // home and near elements data
682 // ---------------------------------------------------------------------
683
689 ROCKY_FUNCTIONS thrust::tuple<double3, double> get_home_element_orientation() const
690 {
691 return this->_impl.get_home_element_orientation();
692 }
693
699 ROCKY_FUNCTIONS thrust::tuple<double3, double> get_near_element_orientation() const
700 {
701 return this->_impl.get_near_element_orientation();
702 }
703
707 ROCKY_FUNCTIONS double3 get_home_element_centroid_position() const
708 {
709 return this->_impl.get_home_element_centroid_position();
710 }
711
715 ROCKY_FUNCTIONS double3 get_near_element_centroid_position() const
716 {
717 return this->_impl.get_near_element_centroid_position();
718 }
719
723 ROCKY_FUNCTIONS double3 get_home_arm() const
724 {
725 return this->_impl.get_home_arm();
726 }
727
731 ROCKY_FUNCTIONS double3 get_near_arm() const
732 {
733 return this->_impl.get_near_arm();
734 }
735
744 ROCKY_FUNCTIONS thrust::tuple<int, int> get_element_tags() const
745 {
746 return this->_impl.get_element_tags();
747 }
748
749
752 ROCKY_FUNCTIONS IRockyJoint(SDeviceModel *_model, int _device_index) :
753 _impl(_model, _device_index) {}
754
755 device::RockyJoint _impl;
756
758};
759
760// =================================================================================================
761// IRockyJointOutputData
762// =================================================================================================
763
764struct IRockyJointOutputData
765{
766
779 ROCKY_FUNCTIONS void set_force(const double3& value);
780
781
792 ROCKY_FUNCTIONS void set_home_moment(const double3& value);
793
794
805 ROCKY_FUNCTIONS void set_near_moment(const double3& value);
806
807
810 double3 _force{}, _home_moment{}, _near_moment{};
811
813};
814
815inline ROCKY_FUNCTIONS void IRockyJointOutputData::set_force(const double3& value)
816{
817 this->_force = value;
818}
819
820inline ROCKY_FUNCTIONS void IRockyJointOutputData::set_home_moment(const double3& value)
821{
822 this->_home_moment = value;
823}
824
825inline ROCKY_FUNCTIONS void IRockyJointOutputData::set_near_moment(const double3& value)
826{
827 this->_near_moment = value;
828}
Definition rocky_joint_scalars.hpp:54
Definition rocky_joint_api.hpp:33
ROCKY_FUNCTIONS double get_normal_elastic_ratio() const
Definition rocky_joint_api.hpp:518
ROCKY_FUNCTIONS double get_poisson_ratio() const
Definition rocky_joint_api.hpp:486
ROCKY_FUNCTIONS double get_tangential_stiffness_per_area() const
Definition rocky_joint_api.hpp:646
ROCKY_FUNCTIONS double get_angular_deformation_velocity(int deformation_direction) const
Definition rocky_joint_api.hpp:274
ROCKY_FUNCTIONS double get_angle_scaling_factor() const
Definition rocky_joint_api.hpp:608
ROCKY_FUNCTIONS double get_area_moment_of_inertia(int deformation_direction) const
Definition rocky_joint_api.hpp:461
ROCKY_FUNCTIONS double get_torsion_elastic_ratio() const
Definition rocky_joint_api.hpp:554
ROCKY_FUNCTIONS double get_tangential_damping_coefficient() const
Definition rocky_joint_api.hpp:390
ROCKY_FUNCTIONS double get_angular_stiffness(int deformation_direction) const
Definition rocky_joint_api.hpp:357
ROCKY_FUNCTIONS double get_young_modulus() const
Definition rocky_joint_api.hpp:473
ROCKY_FUNCTIONS double get_young_modulus_multiplier() const
Definition rocky_joint_api.hpp:659
ROCKY_FUNCTIONS thrust::tuple< double3, double3 > get_moments_due_to_force(double3 force) const
Definition rocky_joint_api.hpp:72
ROCKY_FUNCTIONS double3 get_tangential_deformation_velocity() const
Definition rocky_joint_api.hpp:219
ROCKY_FUNCTIONS thrust::tuple< int, int > get_element_tags() const
Definition rocky_joint_api.hpp:744
ROCKY_FUNCTIONS double3 get_near_element_centroid_position() const
Definition rocky_joint_api.hpp:715
ROCKY_FUNCTIONS double3 get_tangential_deformation() const
Definition rocky_joint_api.hpp:177
ROCKY_FUNCTIONS double3 get_near_arm() const
Definition rocky_joint_api.hpp:731
ROCKY_FUNCTIONS double3 get_home_element_centroid_position() const
Definition rocky_joint_api.hpp:707
ROCKY_FUNCTIONS double get_angular_deformation(int deformation_direction) const
Definition rocky_joint_api.hpp:254
ROCKY_FUNCTIONS double get_normal_stiffness() const
Definition rocky_joint_api.hpp:315
ROCKY_FUNCTIONS double get_tangential_stiffness() const
Definition rocky_joint_api.hpp:332
ROCKY_FUNCTIONS double get_equivalent_mass() const
Definition rocky_joint_api.hpp:618
ROCKY_FUNCTIONS double3 get_damping_moment() const
Definition rocky_joint_api.hpp:138
ROCKY_FUNCTIONS double3 get_damping_force() const
Definition rocky_joint_api.hpp:115
ROCKY_FUNCTIONS int get_number_angular_deformations() const
Definition rocky_joint_api.hpp:233
ROCKY_FUNCTIONS double get_bending_elastic_ratio() const
Definition rocky_joint_api.hpp:572
ROCKY_FUNCTIONS double get_angular_damping_coefficient(int deformation_direction) const
Definition rocky_joint_api.hpp:413
ROCKY_FUNCTIONS double3 get_home_arm() const
Definition rocky_joint_api.hpp:723
ROCKY_FUNCTIONS double3 get_elastic_moment() const
Definition rocky_joint_api.hpp:95
ROCKY_FUNCTIONS double get_joint_damping_ratio() const
Definition rocky_joint_api.hpp:586
ROCKY_FUNCTIONS double3 get_elastic_force() const
Definition rocky_joint_api.hpp:53
ROCKY_FUNCTIONS double3 get_normal_deformation_velocity() const
Definition rocky_joint_api.hpp:198
ROCKY_FUNCTIONS thrust::tuple< double3, double > get_home_element_orientation() const
Definition rocky_joint_api.hpp:689
ROCKY_FUNCTIONS double get_normal_damping_coefficient() const
Definition rocky_joint_api.hpp:375
ROCKY_FUNCTIONS double get_normal_stiffness_per_area() const
Definition rocky_joint_api.hpp:632
ROCKY_FUNCTIONS double3 get_normal_deformation() const
Definition rocky_joint_api.hpp:160
ROCKY_FUNCTIONS thrust::tuple< double3, double > get_near_element_orientation() const
Definition rocky_joint_api.hpp:699
ROCKY_FUNCTIONS double3 get_angular_deformation_direction(int deformation_direction) const
Definition rocky_joint_api.hpp:294
ROCKY_FUNCTIONS double get_tangential_elastic_ratio() const
Definition rocky_joint_api.hpp:536
ROCKY_FUNCTIONS double get_area() const
Definition rocky_joint_api.hpp:446
ROCKY_FUNCTIONS double3 get_normal_vector() const
Definition rocky_joint_api.hpp:432
ROCKY_FUNCTIONS IRockyJointScalars get_scalars()
Definition rocky_joint_api.hpp:675

Connect with Ansys