Skip to main content

Rocky Solver SDK 2025 R2

rocky_particle_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_particle.hpp"
6
7#include "rocky_material_api.hpp"
8#include "rocky_particle_scalars.hpp"
9
10
11// ================================================================================================
12// IRockyParticle
13// ================================================================================================
14
28{
38 ROCKY_FUNCTIONS IRockyMaterial get_material() const;
39
44 ROCKY_FUNCTIONS double3 get_centroid_position() const;
45
51 ROCKY_FUNCTIONS double get_mass() const;
52
57 ROCKY_FUNCTIONS double get_original_mass() const;
58
62 ROCKY_FUNCTIONS double get_size() const;
63
67 ROCKY_FUNCTIONS double get_release_time() const;
68
72 ROCKY_FUNCTIONS double get_cgm_scale_factor() const;
73
79 ROCKY_FUNCTIONS double get_volume() const;
80
87 ROCKY_FUNCTIONS double get_solid_volume() const;
88
92 ROCKY_FUNCTIONS double get_surface_area() const;
93
98 ROCKY_FUNCTIONS double get_equivalent_diameter() const;
99
107 ROCKY_FUNCTIONS double get_sphericity() const;
108
113 ROCKY_FUNCTIONS double3 get_translational_velocity() const;
114
119 ROCKY_FUNCTIONS double3 get_rotational_velocity() const;
120
128 ROCKY_FUNCTIONS double get_impact_energy() const;
129
135 ROCKY_FUNCTIONS double get_strength() const;
136
140 [[deprecated("Use IRockyDeviceModel::get_gravity() or IRockyModel::get_gravity() instead.")]]
141 ROCKY_FUNCTIONS double3 get_gravity() const;
142
147 ROCKY_FUNCTIONS int get_particle_group_index() const;
148
152 ROCKY_FUNCTIONS int get_material_index() const;
153
157 ROCKY_FUNCTIONS double get_rolling_resistance_coefficient() const;
158
164 ROCKY_FUNCTIONS thrust::tuple<double3, double> get_orientation_axis_angle() const;
165
170 ROCKY_FUNCTIONS double4 get_orientation_quaternion() const;
171
181 ROCKY_FUNCTIONS double3 get_resultant_force() const;
182
189 ROCKY_FUNCTIONS double3 get_resultant_moment() const;
190
197 ROCKY_FUNCTIONS double get_thermal_conductivity() const;
198
206 ROCKY_FUNCTIONS void set_thermal_conductivity(double value);
207
214 ROCKY_FUNCTIONS double get_poisson_ratio() const;
215
223 ROCKY_FUNCTIONS void set_poisson_ratio(double value);
224
231 ROCKY_FUNCTIONS double get_specific_heat() const;
232
242 ROCKY_FUNCTIONS int get_tag() const;
243
251 ROCKY_FUNCTIONS void set_specific_heat(double value);
252
257 ROCKY_FUNCTIONS IRockyParticleScalars get_scalars();
258
263 ROCKY_FUNCTIONS const IRockyParticleScalars get_scalars() const;
264
270
276
280 ROCKY_FUNCTIONS void remove();
281
288 ROCKY_FUNCTIONS void add_force(const double3 &force);
289
296 ROCKY_FUNCTIONS void add_moment(const double3& moment);
297
305 ROCKY_FUNCTIONS void set_frozen(bool frozen);
306
312 ROCKY_FUNCTIONS void disable_related_particle_contacts();
313
318 ROCKY_FUNCTIONS void enable_related_particle_contacts();
319
323 ROCKY_FUNCTIONS void disable_related_triangle_contacts();
324
328 ROCKY_FUNCTIONS void enable_related_triangle_contacts();
329
333 ROCKY_FUNCTIONS const double3 get_moment_of_inertia() const;
334
338 ROCKY_FUNCTIONS bool is_element() const;
339
343 ROCKY_FUNCTIONS bool is_assembly() const;
344
348 ROCKY_FUNCTIONS size_t get_number_of_assembly_parts() const;
349
356 ROCKY_FUNCTIONS IRockyMaterial get_assembly_part_material(size_t part_id) const;
357
361 ROCKY_FUNCTIONS void remove_from_contacts_search();
362
366 ROCKY_FUNCTIONS void add_to_contacts_search();
367
369 ROCKY_FUNCTIONS IRockyParticle(int _index, SDeviceModel *_model);
370
371 RockyParticle _impl;
373};
374
375inline ROCKY_FUNCTIONS IRockyParticle::IRockyParticle(int _index, SDeviceModel* _model)
376 : _impl(_model, _index)
377{
378}
379
380inline ROCKY_FUNCTIONS IRockyMaterial IRockyParticle::get_material() const
381{
382 return IRockyMaterial(this->_impl.get_material());
383}
384
385inline ROCKY_FUNCTIONS double3 IRockyParticle::get_centroid_position() const
386{
387 return double3{ this->_impl.particle->x, this->_impl.particle->y, this->_impl.particle->z };
388}
389
390inline ROCKY_FUNCTIONS double IRockyParticle::get_mass() const
391{
392 return this->_impl.get_mass();
393}
394
395inline ROCKY_FUNCTIONS double IRockyParticle::get_original_mass() const
396{
397 return this->_impl.get_original_mass();
398}
399
400inline ROCKY_FUNCTIONS double IRockyParticle::get_size() const
401{
402 return this->_impl.get_size();
403}
404
405inline ROCKY_FUNCTIONS double IRockyParticle::get_release_time() const
406{
407 return this->_impl.get_release_time();
408}
409
410inline ROCKY_FUNCTIONS double IRockyParticle::get_cgm_scale_factor() const
411{
412 return this->_impl.get_cgm_scale_factor();
413}
414
415inline ROCKY_FUNCTIONS double3 IRockyParticle::get_translational_velocity() const
416{
417 return this->_impl.get_translational_velocity();
418}
419
420inline ROCKY_FUNCTIONS double3 IRockyParticle::get_rotational_velocity() const
421{
422 return this->_impl.get_rotational_velocity();
423}
424
425inline ROCKY_FUNCTIONS double3 IRockyParticle::get_gravity() const
426{
427 return { this->_impl.model->gen->gx, this->_impl.model->gen->gy, this->_impl.model->gen->gz };
428}
429
430inline ROCKY_FUNCTIONS double IRockyParticle::get_volume() const
431{
432 return this->_impl.get_bulk_volume();
433}
434
435inline ROCKY_FUNCTIONS double IRockyParticle::get_solid_volume() const
436{
437 return this->_impl.get_solid_volume();
438}
439
440inline ROCKY_FUNCTIONS double IRockyParticle::get_surface_area() const
441{
442 return this->_impl.get_area();
443}
444
445inline ROCKY_FUNCTIONS double IRockyParticle::get_impact_energy() const
446{
447 return this->_impl.get_impact_energy();
448}
449
450inline ROCKY_FUNCTIONS double IRockyParticle::get_strength() const
451{
452 return this->_impl.get_strength();
453}
454
455inline ROCKY_FUNCTIONS double IRockyParticle::get_equivalent_diameter() const
456{
457 return this->_impl.get_equivalent_diameter();
458}
459
460inline ROCKY_FUNCTIONS double IRockyParticle::get_sphericity() const
461{
462 return this->_impl.get_sphericity();
463}
464
465inline ROCKY_FUNCTIONS int IRockyParticle::get_particle_group_index() const
466{
467 return this->_impl.get_particle_group_index();
468}
469
470inline ROCKY_FUNCTIONS int IRockyParticle::get_material_index() const {
471 return this->_impl.get_group().get_material_index();
472}
473
474inline ROCKY_FUNCTIONS double IRockyParticle::get_rolling_resistance_coefficient() const {
475 return this->_impl.get_group().rol;
476}
477
478inline ROCKY_FUNCTIONS double4 IRockyParticle::get_orientation_quaternion() const
479{
480 return this->_impl.get_orientation_quaternion();
481}
482
483inline ROCKY_FUNCTIONS double3 IRockyParticle::get_resultant_force() const
484{
485 return this->_impl.get_forces();
486}
487
488inline ROCKY_FUNCTIONS double3 IRockyParticle::get_resultant_moment() const
489{
490 return this->_impl.get_moments();
491}
492
493inline ROCKY_FUNCTIONS thrust::tuple<double3, double> IRockyParticle::get_orientation_axis_angle() const
494{
495 const SVectorAngleD _va = this->_impl.get_orientation_axis_angle();
496 return thrust::make_tuple(double3 { _va.x, _va.y, _va.z }, _va.angle);
497}
498
499inline ROCKY_FUNCTIONS double IRockyParticle::get_thermal_conductivity() const
500{
501 return this->_impl.get_thermal_conductivity();
502}
503
504inline ROCKY_FUNCTIONS void IRockyParticle::set_thermal_conductivity(double value)
505{
506 this->_impl.set_thermal_conductivity(value);
507}
508
509inline ROCKY_FUNCTIONS double IRockyParticle::get_poisson_ratio() const
510{
511 return this->_impl.get_poisson_ratio();
512}
513
514inline ROCKY_FUNCTIONS void IRockyParticle::set_poisson_ratio(double value)
515{
516 this->_impl.set_poisson_ratio(value);
517}
518
519inline ROCKY_FUNCTIONS double IRockyParticle::get_specific_heat() const
520{
521 return this->_impl.get_specific_heat();
522}
523
524inline ROCKY_FUNCTIONS void IRockyParticle::set_specific_heat(double value)
525{
526 this->_impl.set_specific_heat(value);
527}
528
529inline ROCKY_FUNCTIONS int IRockyParticle::get_tag() const
530{
531 return this->_impl.get_tag();
532}
533
534// Scalars
535
537{
538 return this->_impl.get_scalars();
539}
540
541inline ROCKY_FUNCTIONS const IRockyParticleScalars IRockyParticle::get_scalars() const
542{
543 return this->_impl.get_scalars();
544}
545
547{
548 return this->_impl.get_transfer_scalars();
549}
550
552{
553 return this->_impl.get_breakage_scalars();
554}
555
556// Operations
557
558inline ROCKY_FUNCTIONS void IRockyParticle::remove()
559{
560 this->_impl.remove();
561}
562
563// Output
564
565inline ROCKY_FUNCTIONS void IRockyParticle::add_force(const double3 &force)
566{
567 this->_impl.add_forces(force);
568}
569
570inline ROCKY_FUNCTIONS void IRockyParticle::add_moment(const double3& moment)
571{
572 this->_impl.add_moments(moment);
573}
574
575inline ROCKY_FUNCTIONS void IRockyParticle::set_frozen(bool frozen)
576{
577 this->_impl.particle->set_frozen(frozen);
578}
579
581{
582 this->_impl.particle->set_particle_contact_disabled(true);
583}
584
586{
587 this->_impl.particle->set_particle_contact_disabled(false);
588}
589
591{
592 this->_impl.particle->set_triangle_contact_disabled(true);
593}
594
596{
597 this->_impl.particle->set_triangle_contact_disabled(false);
598}
599
600inline ROCKY_FUNCTIONS const double3 IRockyParticle::get_moment_of_inertia() const
601{
602 return this->_impl.get_moment_of_inertia();
603}
604
605inline ROCKY_FUNCTIONS bool IRockyParticle::is_element() const
606{
607 return this->_impl.is_element();
608}
609
610inline ROCKY_FUNCTIONS bool IRockyParticle::is_assembly() const
611{
612 return this->_impl.is_assembly();
613}
614
615inline ROCKY_FUNCTIONS size_t IRockyParticle::get_number_of_assembly_parts() const
616{
617 return this->_impl.get_number_of_assembly_parts();
618}
619
620inline ROCKY_FUNCTIONS
622{
623 return IRockyMaterial { this->_impl.get_assembly_part_material(part_id) };
624}
625
627{
628 this->_impl.particle->set_remove_from_contacts_search(true);
629}
630
631inline ROCKY_FUNCTIONS void IRockyParticle::add_to_contacts_search()
632{
633 this->_impl.particle->set_remove_from_contacts_search(false);
634}
635
636// ================================================================================================
637// IRockyBreakableParticle
638// ================================================================================================
639
648{
654 double get_minimum_fragment_size() const;
655
659 double get_original_volume() const;
660
665 int get_particle_group_index() const;
666
672 double get_strength() const;
673
677 double get_original_size() const;
678
684 void set_as_unbreakable() const;
685
691
697
698
700 IRockyBreakableParticle(int _index, RockyModel* _model);
701
702 RockyParticleHost _impl;
704};
705
706inline IRockyBreakableParticle::IRockyBreakableParticle(int _index, RockyModel* _model)
707 : _impl(RockyParticleHost(_model, _index))
708{
709}
710
712{
713 return this->_impl.get_minimum_fragment_size();
714}
715
717{
718 return this->_impl.get_original_bulk_volume();
719}
720
722{
723 return this->_impl.get_particle_group_index();
724}
725
727{
728 return this->_impl.get_strength();
729}
730
732{
733 return this->_impl.get_original_size();
734}
735
737{
738 this->_impl.set_as_unbreakable();
739}
740
742{
743 return this->_impl.get_scalars();
744}
745
747{
748 return this->_impl.get_breakage_scalars();
749}
750
751// ================================================================================================
752// IRockyParticleHost
753// ================================================================================================
754
766{
772 double get_original_volume() const;
773
779 double get_original_solid_volume() const;
780
784 int get_material_index() const;
785
790 double get_equivalent_diameter() const;
791
798
803 double3 get_centroid_position() const;
804
808 double get_original_mass() const;
809
813 double get_size() const;
814
818 double get_release_time() const;
819
823 double get_cgm_scale_factor() const;
824
834 int get_tag() const;
835
840 bool is_released() const;
841
845 bool is_element() const;
846
850 bool is_assembly() const;
851
855 size_t get_number_of_assembly_parts() const;
856
863 IRockyMaterial get_assembly_part_material(size_t part_id) const;
864
870
875 int get_particle_group_index() const;
876
878 IRockyParticleHost(int _index, RockyModel* _model);
879
880 RockyParticleHost _impl;
883};
884
885inline IRockyParticleHost::IRockyParticleHost(int _index, RockyModel* _model)
886 : _impl(RockyParticleHost(_model, _index))
887{
888}
889
891{
892 return this->_impl.get_original_bulk_volume();
893}
894
896{
897 return this->_impl.get_original_solid_volume();
898}
899
901{
902 return this->_impl.get_scalars();
903}
904
906{
907 return this->_impl.get_group().get_material_index();
908}
909
911{
912 return this->_impl.get_equivalent_diameter();
913}
914
916{
917 return IRockyMaterial(this->_impl.get_material());
918}
919
921{
922 return double3{ this->_impl.particle->x, this->_impl.particle->y, this->_impl.particle->z };
923}
924
926{
927 return this->_impl.get_original_mass();
928}
929
930inline double IRockyParticleHost::get_size() const
931{
932 return this->_impl.get_size();
933}
934
936{
937 return this->_impl.get_release_time();
938}
939
941{
942 return this->_impl.get_cgm_scale_factor();
943}
944
946{
947 return this->_impl.is_released();
948}
949
951{
952 return this->_impl.is_assembly();
953}
954
956{
957 return this->_impl.is_element();
958}
959
961{
962 return this->_impl.get_number_of_assembly_parts();
963}
964
966{
967 return IRockyMaterial { this->_impl.get_assembly_part_material(part_id) };
968}
969
971{
972 return this->_impl.get_tag();
973}
975{
976 return this->_impl.get_particle_group_index();
977}
Definition rocky_particle_api.hpp:648
double get_original_volume() const
Definition rocky_particle_api.hpp:716
double get_minimum_fragment_size() const
Definition rocky_particle_api.hpp:711
IRockyParticleBreakageScalars get_breakage_scalars()
Definition rocky_particle_api.hpp:746
IRockyParticleScalars get_scalars()
Definition rocky_particle_api.hpp:741
void set_as_unbreakable() const
Definition rocky_particle_api.hpp:736
int get_particle_group_index() const
Definition rocky_particle_api.hpp:721
double get_strength() const
Definition rocky_particle_api.hpp:726
double get_original_size() const
Definition rocky_particle_api.hpp:731
Definition rocky_material_api.hpp:21
Definition rocky_particle_scalars.hpp:544
Definition rocky_particle_api.hpp:766
size_t get_number_of_assembly_parts() const
Definition rocky_particle_api.hpp:960
int get_particle_group_index() const
Definition rocky_particle_api.hpp:974
int get_tag() const
Definition rocky_particle_api.hpp:970
double get_cgm_scale_factor() const
Definition rocky_particle_api.hpp:940
IRockyParticleScalars get_scalars() const
Definition rocky_particle_api.hpp:900
double get_equivalent_diameter() const
Definition rocky_particle_api.hpp:910
IRockyMaterial get_material() const
Definition rocky_particle_api.hpp:915
bool is_assembly() const
Definition rocky_particle_api.hpp:950
IRockyMaterial get_assembly_part_material(size_t part_id) const
Definition rocky_particle_api.hpp:965
double3 get_centroid_position() const
Definition rocky_particle_api.hpp:920
double get_size() const
Definition rocky_particle_api.hpp:930
double get_release_time() const
Definition rocky_particle_api.hpp:935
bool is_released() const
Definition rocky_particle_api.hpp:945
double get_original_mass() const
Definition rocky_particle_api.hpp:925
double get_original_volume() const
Definition rocky_particle_api.hpp:890
int get_material_index() const
Definition rocky_particle_api.hpp:905
double get_original_solid_volume() const
Definition rocky_particle_api.hpp:895
bool is_element() const
Definition rocky_particle_api.hpp:955
Definition rocky_particle_scalars.hpp:105
Definition rocky_particle_scalars.hpp:407
Definition rocky_particle_api.hpp:28
ROCKY_FUNCTIONS double get_original_mass() const
Definition rocky_particle_api.hpp:395
ROCKY_FUNCTIONS int get_particle_group_index() const
Definition rocky_particle_api.hpp:465
ROCKY_FUNCTIONS const double3 get_moment_of_inertia() const
Definition rocky_particle_api.hpp:600
ROCKY_FUNCTIONS bool is_element() const
Definition rocky_particle_api.hpp:605
ROCKY_FUNCTIONS double get_solid_volume() const
Definition rocky_particle_api.hpp:435
ROCKY_FUNCTIONS double3 get_rotational_velocity() const
Definition rocky_particle_api.hpp:420
ROCKY_FUNCTIONS IRockyMaterial get_assembly_part_material(size_t part_id) const
Definition rocky_particle_api.hpp:621
ROCKY_FUNCTIONS void disable_related_triangle_contacts()
Definition rocky_particle_api.hpp:590
ROCKY_FUNCTIONS double get_surface_area() const
Definition rocky_particle_api.hpp:440
ROCKY_FUNCTIONS int get_tag() const
Definition rocky_particle_api.hpp:529
ROCKY_FUNCTIONS void remove()
Definition rocky_particle_api.hpp:558
ROCKY_FUNCTIONS IRockyParticleScalars get_scalars()
Definition rocky_particle_api.hpp:536
ROCKY_FUNCTIONS double get_strength() const
Definition rocky_particle_api.hpp:450
ROCKY_FUNCTIONS double get_impact_energy() const
Definition rocky_particle_api.hpp:445
ROCKY_FUNCTIONS double3 get_translational_velocity() const
Definition rocky_particle_api.hpp:415
ROCKY_FUNCTIONS IRockyMaterial get_material() const
Definition rocky_particle_api.hpp:380
ROCKY_FUNCTIONS double3 get_gravity() const
Definition rocky_particle_api.hpp:425
ROCKY_FUNCTIONS int get_material_index() const
Definition rocky_particle_api.hpp:470
ROCKY_FUNCTIONS double get_specific_heat() const
Definition rocky_particle_api.hpp:519
ROCKY_FUNCTIONS double3 get_resultant_moment() const
Definition rocky_particle_api.hpp:488
ROCKY_FUNCTIONS double get_equivalent_diameter() const
Definition rocky_particle_api.hpp:455
ROCKY_FUNCTIONS double get_poisson_ratio() const
Definition rocky_particle_api.hpp:509
ROCKY_FUNCTIONS void enable_related_triangle_contacts()
Definition rocky_particle_api.hpp:595
ROCKY_FUNCTIONS void set_specific_heat(double value)
Definition rocky_particle_api.hpp:524
ROCKY_FUNCTIONS double get_size() const
Definition rocky_particle_api.hpp:400
ROCKY_FUNCTIONS size_t get_number_of_assembly_parts() const
Definition rocky_particle_api.hpp:615
ROCKY_FUNCTIONS void set_poisson_ratio(double value)
Definition rocky_particle_api.hpp:514
ROCKY_FUNCTIONS bool is_assembly() const
Definition rocky_particle_api.hpp:610
ROCKY_FUNCTIONS void set_thermal_conductivity(double value)
Definition rocky_particle_api.hpp:504
ROCKY_FUNCTIONS void add_moment(const double3 &moment)
Definition rocky_particle_api.hpp:570
ROCKY_FUNCTIONS double get_thermal_conductivity() const
Definition rocky_particle_api.hpp:499
ROCKY_FUNCTIONS void enable_related_particle_contacts()
Definition rocky_particle_api.hpp:585
ROCKY_FUNCTIONS void disable_related_particle_contacts()
Definition rocky_particle_api.hpp:580
ROCKY_FUNCTIONS double get_volume() const
Definition rocky_particle_api.hpp:430
ROCKY_FUNCTIONS double get_mass() const
Definition rocky_particle_api.hpp:390
ROCKY_FUNCTIONS IRockyParticleBreakageScalars get_breakage_scalars()
Definition rocky_particle_api.hpp:551
ROCKY_FUNCTIONS double3 get_centroid_position() const
Definition rocky_particle_api.hpp:385
ROCKY_FUNCTIONS double3 get_resultant_force() const
Definition rocky_particle_api.hpp:483
ROCKY_FUNCTIONS double get_sphericity() const
Definition rocky_particle_api.hpp:460
ROCKY_FUNCTIONS double get_cgm_scale_factor() const
Definition rocky_particle_api.hpp:410
ROCKY_FUNCTIONS double get_rolling_resistance_coefficient() const
Definition rocky_particle_api.hpp:474
ROCKY_FUNCTIONS thrust::tuple< double3, double > get_orientation_axis_angle() const
Definition rocky_particle_api.hpp:493
ROCKY_FUNCTIONS void set_frozen(bool frozen)
Definition rocky_particle_api.hpp:575
ROCKY_FUNCTIONS void add_force(const double3 &force)
Definition rocky_particle_api.hpp:565
ROCKY_FUNCTIONS IRockyParticleTransferScalars get_transfer_scalars()
Definition rocky_particle_api.hpp:546
ROCKY_FUNCTIONS double get_release_time() const
Definition rocky_particle_api.hpp:405
ROCKY_FUNCTIONS void remove_from_contacts_search()
Definition rocky_particle_api.hpp:626
ROCKY_FUNCTIONS double4 get_orientation_quaternion() const
Definition rocky_particle_api.hpp:478
ROCKY_FUNCTIONS void add_to_contacts_search()
Definition rocky_particle_api.hpp:631

Connect with Ansys