Skip to main content

Rocky Solver SDK 2024 R2

rocky_contact_api

Last update: 17.07.2025
1#pragma once
2
3// Includes =======================================================================================
4#include <rocky20/api/rocky_contact.hpp>
5#include <rocky20/api/rocky_material_api.hpp>
6#include <rocky20/device/device_contact.hpp>
7
8
9// ================================================================================================
10// IRockyContact
11// ================================================================================================
12
46{
52 ROCKY_FUNCTIONS IRockyMaterial get_home_material() const;
53
59 ROCKY_FUNCTIONS IRockyMaterial get_near_material() const;
60
67
74 ROCKY_FUNCTIONS int get_material_interaction_index() const;
75
81 ROCKY_FUNCTIONS IRockyParticle get_home_particle() const;
82
87 ROCKY_FUNCTIONS int get_home_particle_group_index() const;
88
94 ROCKY_FUNCTIONS IRockyParticle get_near_particle() const;
95
100 ROCKY_FUNCTIONS int get_near_particle_group_index() const;
101
107 ROCKY_FUNCTIONS IRockyGeometryTriangle get_near_triangle() const;
108
113 ROCKY_FUNCTIONS int get_near_geometry_index() const;
114
118 ROCKY_FUNCTIONS bool is_particle_particle_contact() const;
119
123 ROCKY_FUNCTIONS bool is_particle_triangle_contact() const;
124
129 ROCKY_FUNCTIONS bool is_frictional() const;
130
135 ROCKY_FUNCTIONS bool is_adhesive() const;
136
140 ROCKY_FUNCTIONS double get_previous_overlap() const;
141
155 ROCKY_FUNCTIONS double get_overlap() const;
156
161 ROCKY_FUNCTIONS double3 get_normal_unit_vector() const;
162
167 ROCKY_FUNCTIONS double3 get_contact_position() const;
168
176 ROCKY_FUNCTIONS double get_scale_factor() const;
177
182 ROCKY_FUNCTIONS bool just_started_frictional() const;
183
188 ROCKY_FUNCTIONS bool just_started_adhesive() const;
189
197 ROCKY_FUNCTIONS bool just_finished_frictional() const;
198
206 ROCKY_FUNCTIONS bool just_finished_adhesive() const;
207
212 ROCKY_FUNCTIONS bool is_loading() const;
213
218 ROCKY_FUNCTIONS bool is_unloading() const;
219
224 ROCKY_FUNCTIONS bool is_positive_oriented() const;
225
229 ROCKY_FUNCTIONS double get_current_time() const;
230
234 ROCKY_FUNCTIONS double get_timestep() const;
235
241
247
255 ROCKY_FUNCTIONS double get_home_stiffness() const;
256
264 ROCKY_FUNCTIONS double get_near_stiffness() const;
265
272 ROCKY_FUNCTIONS double get_equivalent_stiffness() const;
273
280 ROCKY_FUNCTIONS double get_home_stiffness_fraction() const;
281
289 ROCKY_FUNCTIONS double get_reduced_young_modulus() const;
290
295 ROCKY_FUNCTIONS double get_equivalent_mass() const;
296
301 ROCKY_FUNCTIONS double get_equivalent_radius() const;
302
315 ROCKY_FUNCTIONS double get_normal_contact_force() const;
316
336 ROCKY_FUNCTIONS double3 get_tangential_contact_force() const;
337
357 ROCKY_FUNCTIONS double3 calculate_relative_velocity() const;
358
365 ROCKY_FUNCTIONS double get_restitution_coefficient() const;
366
378 ROCKY_FUNCTIONS void set_restitution_coefficient(double value);
379
386 ROCKY_FUNCTIONS double get_dynamic_friction_coefficient() const;
387
399 ROCKY_FUNCTIONS void set_dynamic_friction_coefficient(double value);
400
407 ROCKY_FUNCTIONS double get_static_friction_coefficient() const;
408
420 ROCKY_FUNCTIONS void set_static_friction_coefficient(double value);
421
429 ROCKY_FUNCTIONS double get_sliding_distance() const;
430
438 ROCKY_FUNCTIONS bool get_is_sliding_marker() const;
439
447 ROCKY_FUNCTIONS double get_normal_relative_velocity() const;
448
456 ROCKY_FUNCTIONS double3 get_tangential_relative_velocity() const;
457
465 ROCKY_FUNCTIONS double get_normal_adhesion_force() const;
466
474 ROCKY_FUNCTIONS double3 get_tangential_adhesion_force() const;
475
482 ROCKY_FUNCTIONS double3 get_previous_normal_vector() const;
483
492 ROCKY_FUNCTIONS double3 get_previous_moment_vector() const;
493
506 ROCKY_FUNCTIONS void set_previous_moment_vector(double3 value);
507
509 RockyContact *_impl;
510 double current_time;
512};
513
515{
516 return IRockyMaterial(this->_impl->get_home_material());
517}
518
520{
521 return IRockyMaterial(this->_impl->get_near_material());
522}
523
525{
526 return IRockyMaterialInteraction(this->_impl->get_material_interaction());
527}
528
529inline ROCKY_FUNCTIONS int IRockyContact::get_material_interaction_index() const
530{
531 return this->_impl->get_material_interaction_index();
532}
533
534inline ROCKY_FUNCTIONS bool IRockyContact::is_particle_particle_contact() const
535{
536 return this->_impl->is_particle_particle();
537}
538
539inline ROCKY_FUNCTIONS bool IRockyContact::is_particle_triangle_contact() const
540{
541 return this->_impl->is_particle_triangle();
542}
543
544inline ROCKY_FUNCTIONS bool IRockyContact::is_frictional() const
545{
546 return this->_impl->is_frictional();
547}
548
549inline ROCKY_FUNCTIONS bool IRockyContact::is_adhesive() const
550{
551 return this->_impl->is_adhesive();
552}
553
555{
556 return IRockyParticle(this->_impl->get_home_particle_index(), this->_impl->model);
557}
558
559inline ROCKY_FUNCTIONS int IRockyContact::get_home_particle_group_index() const
560{
561 return this->_impl->get_home_particle_base_group_index();
562}
563
565{
566 return IRockyParticle(this->_impl->get_near_particle_index(), this->_impl->model);
567}
568
569inline ROCKY_FUNCTIONS int IRockyContact::get_near_particle_group_index() const
570{
571 return this->_impl->get_near_particle_base_group_index();
572}
573
575{
576 return IRockyGeometryTriangle(this->_impl->get_near_triangle_index(), this->_impl->model);
577}
578
579inline ROCKY_FUNCTIONS int IRockyContact::get_near_geometry_index() const
580{
581 return this->_impl->get_near_boundary_index();
582}
583
584inline ROCKY_FUNCTIONS double IRockyContact::get_overlap() const
585{
586 return this->_impl->get_overlap();
587}
588
589inline ROCKY_FUNCTIONS double IRockyContact::get_previous_overlap() const
590{
591 return this->_impl->get_previous_overlap();
592}
593
594inline ROCKY_FUNCTIONS double3 IRockyContact::get_normal_unit_vector() const
595{
596 return this->_impl->get_normal_unit_vector();
597}
598
599inline ROCKY_FUNCTIONS double3 IRockyContact::get_contact_position() const
600{
601 return this->_impl->get_contact_position();
602}
603
604inline ROCKY_FUNCTIONS double IRockyContact::get_scale_factor() const
605{
606 return this->_impl->get_scale_factor();
607}
608
609inline ROCKY_FUNCTIONS double IRockyContact::get_current_time() const
610{
611 return this->current_time;
612}
613
614inline ROCKY_FUNCTIONS double IRockyContact::get_timestep() const
615{
616 return this->_impl->get_timestep();
617}
618
619inline ROCKY_FUNCTIONS bool IRockyContact::just_started_frictional() const
620{
621 return this->_impl->just_started_frictional();
622}
623
624inline ROCKY_FUNCTIONS bool IRockyContact::just_started_adhesive() const
625{
626 return this->_impl->just_started_adhesive();
627}
628
629inline ROCKY_FUNCTIONS bool IRockyContact::just_finished_frictional() const
630{
631 return this->_impl->just_finished_frictional();
632}
633
634inline ROCKY_FUNCTIONS bool IRockyContact::just_finished_adhesive() const
635{
636 return this->_impl->just_finished_adhesive();
637}
638
639inline ROCKY_FUNCTIONS bool IRockyContact::is_loading() const
640{
641 return this->_impl->is_loading();
642}
643
644inline ROCKY_FUNCTIONS bool IRockyContact::is_unloading() const
645{
646 return this->_impl->is_unloading();
647}
648
649inline ROCKY_FUNCTIONS double IRockyContact::get_normal_contact_force() const
650{
651 return this->_impl->get_scaled_normal_force();
652}
653
654inline ROCKY_FUNCTIONS double3 IRockyContact::get_tangential_contact_force() const
655{
656 if (this->_impl->get_scalars().has_tangential_force_enabled())
657 return this->_impl->get_scaled_tangential_force();
658 else
659 return double3{};
660}
661
662inline ROCKY_FUNCTIONS bool IRockyContact::is_positive_oriented() const
663{
664 return this->_impl->is_positive_oriented();
665}
666
667// Composite properties
668
669inline ROCKY_FUNCTIONS double IRockyContact::get_home_stiffness() const
670{
671 return this->_impl->get_home_stiffness();
672}
673
674inline ROCKY_FUNCTIONS double IRockyContact::get_near_stiffness() const
675{
676 return this->_impl->get_near_stiffness();
677}
678
679inline ROCKY_FUNCTIONS double IRockyContact::get_equivalent_stiffness() const
680{
681 return this->_impl->get_equivalent_stiffness();
682}
683
684inline ROCKY_FUNCTIONS double IRockyContact::get_home_stiffness_fraction() const
685{
686 return this->_impl->get_home_stiffness_fraction();
687}
688
689inline ROCKY_FUNCTIONS double IRockyContact::get_reduced_young_modulus() const
690{
691 return this->_impl->get_reduced_young_modulus();
692}
693
694inline ROCKY_FUNCTIONS double IRockyContact::get_equivalent_mass() const
695{
696 return this->_impl->get_equivalent_mass();
697}
698
699inline ROCKY_FUNCTIONS double IRockyContact::get_equivalent_radius() const
700{
701 return this->_impl->get_equivalent_radius();
702}
703
704inline ROCKY_FUNCTIONS double3 IRockyContact::calculate_relative_velocity() const
705{
706 double3 home_trans_velocity, near_trans_velocity;
707 double3 home_rotat_velocity, near_rotat_velocity;
708 double3 home_arm, near_arm;
709
710 device::calculate_contact_velocities(
711 *this->_impl,
712 home_trans_velocity, near_trans_velocity,
713 home_rotat_velocity, near_rotat_velocity,
714 home_arm, near_arm,
715 this->current_time
716 );
717
719 {
720 return device::get_relative_velocity_particle_particle(
721 home_trans_velocity, near_trans_velocity,
722 home_rotat_velocity, near_rotat_velocity,
723 home_arm, near_arm
724 );
725 }
726 else
727 {
728 return device::get_relative_velocity_particle_triangle(
729 home_trans_velocity, near_trans_velocity,
730 home_rotat_velocity, home_arm
731 );
732 }
733}
734
735// Scalars
736
738{
739 return this->_impl->get_particle_contact_scalars();
740}
741
743{
744 return this->_impl->get_triangle_contact_scalars();
745}
746
747inline ROCKY_FUNCTIONS double3 IRockyContact::get_previous_normal_vector() const
748{
749 return this->_impl->get_previous_normal_vector();
750}
751
752inline ROCKY_FUNCTIONS double3 IRockyContact::get_previous_moment_vector() const
753{
754 return this->_impl->get_previous_moment_vector();
755}
756
757inline ROCKY_FUNCTIONS void IRockyContact::set_previous_moment_vector(double3 value)
758{
759 this->_impl->set_previous_moment_vector(value);
760}
761
762// Variable Properties
763inline ROCKY_FUNCTIONS double IRockyContact::get_dynamic_friction_coefficient() const
764{
765 return this->_impl->get_dynamic_friction_coefficient();
766}
767
768inline ROCKY_FUNCTIONS double IRockyContact::get_static_friction_coefficient() const
769{
770 return this->_impl->get_static_friction_coefficient();
771}
772
773inline ROCKY_FUNCTIONS void IRockyContact::set_dynamic_friction_coefficient(double value)
774{
775 this->_impl->set_dynamic_friction_coefficient(value);
776}
777
778inline ROCKY_FUNCTIONS void IRockyContact::set_static_friction_coefficient(double value)
779{
780 this->_impl->set_static_friction_coefficient(value);
781}
782
783inline ROCKY_FUNCTIONS double IRockyContact::get_restitution_coefficient() const
784{
785 return this->_impl->get_restitution_coefficient();
786}
787
788inline ROCKY_FUNCTIONS void IRockyContact::set_restitution_coefficient(double value)
789{
790 this->_impl->set_restitution_coefficient(value);
791}
792
793inline ROCKY_FUNCTIONS double IRockyContact::get_sliding_distance() const
794{
795 return this->_impl->get_sliding_distance();
796}
797
798inline ROCKY_FUNCTIONS bool IRockyContact::get_is_sliding_marker() const
799{
800 return this->_impl->get_is_sliding_marker();
801}
802
803inline ROCKY_FUNCTIONS double IRockyContact::get_normal_relative_velocity() const
804{
805 return this->_impl->get_normal_relative_velocity();
806}
807
808inline ROCKY_FUNCTIONS double3 IRockyContact::get_tangential_relative_velocity() const
809{
810 return this->_impl->get_tangential_relative_velocity();
811}
812
813inline ROCKY_FUNCTIONS double IRockyContact::get_normal_adhesion_force() const
814{
815 return this->_impl->get_normal_adhesion_force();
816}
817
818inline ROCKY_FUNCTIONS double3 IRockyContact::get_tangential_adhesion_force() const
819{
820 return this->_impl->get_tangential_adhesion_force();
821}
Definition rocky_contact_scalars.hpp:278
Definition rocky_contact_api.hpp:46
ROCKY_FUNCTIONS double get_dynamic_friction_coefficient() const
Definition rocky_contact_api.hpp:763
ROCKY_FUNCTIONS double3 get_normal_unit_vector() const
Definition rocky_contact_api.hpp:594
ROCKY_FUNCTIONS bool is_particle_particle_contact() const
Definition rocky_contact_api.hpp:534
ROCKY_FUNCTIONS double get_home_stiffness() const
Definition rocky_contact_api.hpp:669
ROCKY_FUNCTIONS bool get_is_sliding_marker() const
Definition rocky_contact_api.hpp:798
ROCKY_FUNCTIONS double3 get_tangential_adhesion_force() const
Definition rocky_contact_api.hpp:818
ROCKY_FUNCTIONS double get_normal_adhesion_force() const
Definition rocky_contact_api.hpp:813
ROCKY_FUNCTIONS int get_near_particle_group_index() const
Definition rocky_contact_api.hpp:569
ROCKY_FUNCTIONS double get_overlap() const
Definition rocky_contact_api.hpp:584
ROCKY_FUNCTIONS int get_home_particle_group_index() const
Definition rocky_contact_api.hpp:559
ROCKY_FUNCTIONS void set_previous_moment_vector(double3 value)
Definition rocky_contact_api.hpp:757
ROCKY_FUNCTIONS bool just_started_adhesive() const
Definition rocky_contact_api.hpp:624
ROCKY_FUNCTIONS double get_normal_relative_velocity() const
Definition rocky_contact_api.hpp:803
ROCKY_FUNCTIONS bool is_loading() const
Definition rocky_contact_api.hpp:639
ROCKY_FUNCTIONS int get_near_geometry_index() const
Definition rocky_contact_api.hpp:579
ROCKY_FUNCTIONS bool is_adhesive() const
Definition rocky_contact_api.hpp:549
ROCKY_FUNCTIONS double get_equivalent_radius() const
Definition rocky_contact_api.hpp:699
ROCKY_FUNCTIONS double get_timestep() const
Definition rocky_contact_api.hpp:614
ROCKY_FUNCTIONS double3 get_previous_moment_vector() const
Definition rocky_contact_api.hpp:752
ROCKY_FUNCTIONS bool just_finished_adhesive() const
Definition rocky_contact_api.hpp:634
ROCKY_FUNCTIONS void set_static_friction_coefficient(double value)
Definition rocky_contact_api.hpp:778
ROCKY_FUNCTIONS IRockyParticle get_near_particle() const
Definition rocky_contact_api.hpp:564
ROCKY_FUNCTIONS double get_current_time() const
Definition rocky_contact_api.hpp:609
ROCKY_FUNCTIONS double get_restitution_coefficient() const
Definition rocky_contact_api.hpp:783
ROCKY_FUNCTIONS bool is_positive_oriented() const
Definition rocky_contact_api.hpp:662
ROCKY_FUNCTIONS IRockyMaterial get_near_material() const
Definition rocky_contact_api.hpp:519
ROCKY_FUNCTIONS double get_static_friction_coefficient() const
Definition rocky_contact_api.hpp:768
ROCKY_FUNCTIONS bool is_particle_triangle_contact() const
Definition rocky_contact_api.hpp:539
ROCKY_FUNCTIONS double get_normal_contact_force() const
Definition rocky_contact_api.hpp:649
ROCKY_FUNCTIONS double3 get_tangential_relative_velocity() const
Definition rocky_contact_api.hpp:808
ROCKY_FUNCTIONS IRockyGeometryTriangle get_near_triangle() const
Definition rocky_contact_api.hpp:574
ROCKY_FUNCTIONS double get_equivalent_stiffness() const
Definition rocky_contact_api.hpp:679
ROCKY_FUNCTIONS double get_near_stiffness() const
Definition rocky_contact_api.hpp:674
ROCKY_FUNCTIONS void set_dynamic_friction_coefficient(double value)
Definition rocky_contact_api.hpp:773
ROCKY_FUNCTIONS double3 get_contact_position() const
Definition rocky_contact_api.hpp:599
ROCKY_FUNCTIONS int get_material_interaction_index() const
Definition rocky_contact_api.hpp:529
ROCKY_FUNCTIONS IRockyContactScalars get_triangle_contact_scalars() const
Definition rocky_contact_api.hpp:742
ROCKY_FUNCTIONS bool just_started_frictional() const
Definition rocky_contact_api.hpp:619
ROCKY_FUNCTIONS double get_previous_overlap() const
Definition rocky_contact_api.hpp:589
ROCKY_FUNCTIONS bool is_unloading() const
Definition rocky_contact_api.hpp:644
ROCKY_FUNCTIONS double3 get_tangential_contact_force() const
Definition rocky_contact_api.hpp:654
ROCKY_FUNCTIONS double get_reduced_young_modulus() const
Definition rocky_contact_api.hpp:689
ROCKY_FUNCTIONS double get_scale_factor() const
Definition rocky_contact_api.hpp:604
ROCKY_FUNCTIONS void set_restitution_coefficient(double value)
Definition rocky_contact_api.hpp:788
ROCKY_FUNCTIONS IRockyMaterial get_home_material() const
Definition rocky_contact_api.hpp:514
ROCKY_FUNCTIONS double get_equivalent_mass() const
Definition rocky_contact_api.hpp:694
ROCKY_FUNCTIONS bool is_frictional() const
Definition rocky_contact_api.hpp:544
ROCKY_FUNCTIONS IRockyParticle get_home_particle() const
Definition rocky_contact_api.hpp:554
ROCKY_FUNCTIONS double3 calculate_relative_velocity() const
Definition rocky_contact_api.hpp:704
ROCKY_FUNCTIONS IRockyContactScalars get_particle_contact_scalars() const
Definition rocky_contact_api.hpp:737
ROCKY_FUNCTIONS double3 get_previous_normal_vector() const
Definition rocky_contact_api.hpp:747
ROCKY_FUNCTIONS bool just_finished_frictional() const
Definition rocky_contact_api.hpp:629
ROCKY_FUNCTIONS double get_sliding_distance() const
Definition rocky_contact_api.hpp:793
ROCKY_FUNCTIONS IRockyMaterialInteraction get_material_interaction() const
Definition rocky_contact_api.hpp:524
ROCKY_FUNCTIONS double get_home_stiffness_fraction() const
Definition rocky_contact_api.hpp:684
Definition rocky_boundary_api.hpp:134
Definition rocky_material_api.hpp:71
Definition rocky_material_api.hpp:20
Definition rocky_particle_api.hpp:27

Connect with Ansys