Skip to main content

Rocky Solver SDK 2025 R1

rocky_particle_api

Last update: 17.07.2025
1#pragma once
2
3// Includes =======================================================================================
4#include "rocky_particle.hpp"
5
6#include "rocky_material_api.hpp"
7#include "rocky_particle_scalars.hpp"
8
9
10// ================================================================================================
11// IRockyParticle
12// ================================================================================================
13
27{
37 ROCKY_FUNCTIONS IRockyMaterial get_material() const;
38
43 ROCKY_FUNCTIONS double3 get_centroid_position() const;
44
50 ROCKY_FUNCTIONS double get_mass() const;
51
56 ROCKY_FUNCTIONS double get_original_mass() const;
57
61 ROCKY_FUNCTIONS double get_size() const;
62
66 ROCKY_FUNCTIONS double get_release_time() const;
67
71 ROCKY_FUNCTIONS double get_cgm_scale_factor() const;
72
78 ROCKY_FUNCTIONS double get_volume() const;
79
86 ROCKY_FUNCTIONS double get_solid_volume() const;
87
91 ROCKY_FUNCTIONS double get_surface_area() const;
92
97 ROCKY_FUNCTIONS double get_equivalent_diameter() const;
98
106 ROCKY_FUNCTIONS double get_sphericity() const;
107
112 ROCKY_FUNCTIONS double3 get_translational_velocity() const;
113
118 ROCKY_FUNCTIONS double3 get_rotational_velocity() const;
119
127 ROCKY_FUNCTIONS double get_impact_energy() const;
128
134 ROCKY_FUNCTIONS double get_strength() const;
135
139 ROCKY_FUNCTIONS double3 get_gravity() const;
140
145 ROCKY_FUNCTIONS int get_particle_group_index() const;
146
150 ROCKY_FUNCTIONS int get_material_index() const;
151
155 ROCKY_FUNCTIONS double get_rolling_resistance_coefficient() const;
156
162 ROCKY_FUNCTIONS thrust::tuple<double3, double> get_orientation_axis_angle() const;
163
168 ROCKY_FUNCTIONS double4 get_orientation_quaternion() const;
169
179 ROCKY_FUNCTIONS double3 get_resultant_force() const;
180
187 ROCKY_FUNCTIONS double3 get_resultant_moment() const;
188
195 ROCKY_FUNCTIONS double get_thermal_conductivity() const;
196
204 ROCKY_FUNCTIONS void set_thermal_conductivity(double value);
205
212 ROCKY_FUNCTIONS double get_poisson_ratio() const;
213
221 ROCKY_FUNCTIONS void set_poisson_ratio(double value);
222
229 ROCKY_FUNCTIONS double get_specific_heat() const;
230
240 ROCKY_FUNCTIONS int get_tag() const;
241
249 ROCKY_FUNCTIONS void set_specific_heat(double value);
250
255 ROCKY_FUNCTIONS IRockyParticleScalars get_scalars();
256
261 ROCKY_FUNCTIONS const IRockyParticleScalars get_scalars() const;
262
268
274
278 ROCKY_FUNCTIONS void remove();
279
286 ROCKY_FUNCTIONS void add_force(const double3 &force);
287
294 ROCKY_FUNCTIONS void add_moment(const double3& moment);
295
303 ROCKY_FUNCTIONS void set_frozen(bool frozen);
304
310 ROCKY_FUNCTIONS void disable_related_particle_contacts();
311
316 ROCKY_FUNCTIONS void enable_related_particle_contacts();
317
321 ROCKY_FUNCTIONS void disable_related_triangle_contacts();
322
326 ROCKY_FUNCTIONS void enable_related_triangle_contacts();
327
331 ROCKY_FUNCTIONS const double3 get_moment_of_inertia() const;
332
336 ROCKY_FUNCTIONS bool is_element() const;
337
341 ROCKY_FUNCTIONS bool is_assembly() const;
342
346 ROCKY_FUNCTIONS size_t get_number_of_assembly_parts() const;
347
354 ROCKY_FUNCTIONS IRockyMaterial get_assembly_part_material(size_t part_id) const;
355
359 ROCKY_FUNCTIONS void remove_from_contacts_search();
360
364 ROCKY_FUNCTIONS void add_to_contacts_search();
365
367 ROCKY_FUNCTIONS IRockyParticle(int _index, SDeviceModel *_model);
368
369 RockyParticle _impl;
371};
372
373inline ROCKY_FUNCTIONS IRockyParticle::IRockyParticle(int _index, SDeviceModel* _model)
374 : _impl(_model, _index)
375{
376}
377
378inline ROCKY_FUNCTIONS IRockyMaterial IRockyParticle::get_material() const
379{
380 return IRockyMaterial(this->_impl.get_material());
381}
382
383inline ROCKY_FUNCTIONS double3 IRockyParticle::get_centroid_position() const
384{
385 return double3{ this->_impl.particle->x, this->_impl.particle->y, this->_impl.particle->z };
386}
387
388inline ROCKY_FUNCTIONS double IRockyParticle::get_mass() const
389{
390 return this->_impl.get_mass();
391}
392
393inline ROCKY_FUNCTIONS double IRockyParticle::get_original_mass() const
394{
395 return this->_impl.get_original_mass();
396}
397
398inline ROCKY_FUNCTIONS double IRockyParticle::get_size() const
399{
400 return this->_impl.get_size();
401}
402
403inline ROCKY_FUNCTIONS double IRockyParticle::get_release_time() const
404{
405 return this->_impl.get_release_time();
406}
407
408inline ROCKY_FUNCTIONS double IRockyParticle::get_cgm_scale_factor() const
409{
410 return this->_impl.get_cgm_scale_factor();
411}
412
413inline ROCKY_FUNCTIONS double3 IRockyParticle::get_translational_velocity() const
414{
415 return this->_impl.get_translational_velocity();
416}
417
418inline ROCKY_FUNCTIONS double3 IRockyParticle::get_rotational_velocity() const
419{
420 return this->_impl.get_rotational_velocity();
421}
422
423inline ROCKY_FUNCTIONS double3 IRockyParticle::get_gravity() const
424{
425 return { this->_impl.model->gen->gx, this->_impl.model->gen->gy, this->_impl.model->gen->gz };
426}
427
428inline ROCKY_FUNCTIONS double IRockyParticle::get_volume() const
429{
430 return this->_impl.get_bulk_volume();
431}
432
433inline ROCKY_FUNCTIONS double IRockyParticle::get_solid_volume() const
434{
435 return this->_impl.get_solid_volume();
436}
437
438inline ROCKY_FUNCTIONS double IRockyParticle::get_surface_area() const
439{
440 return this->_impl.get_area();
441}
442
443inline ROCKY_FUNCTIONS double IRockyParticle::get_impact_energy() const
444{
445 return this->_impl.get_impact_energy();
446}
447
448inline ROCKY_FUNCTIONS double IRockyParticle::get_strength() const
449{
450 return this->_impl.get_strength();
451}
452
453inline ROCKY_FUNCTIONS double IRockyParticle::get_equivalent_diameter() const
454{
455 return this->_impl.get_equivalent_diameter();
456}
457
458inline ROCKY_FUNCTIONS double IRockyParticle::get_sphericity() const
459{
460 return this->_impl.get_sphericity();
461}
462
463inline ROCKY_FUNCTIONS int IRockyParticle::get_particle_group_index() const
464{
465 return this->_impl.get_particle_group_index();
466}
467
468inline ROCKY_FUNCTIONS int IRockyParticle::get_material_index() const {
469 return this->_impl.get_group().get_material_index();
470}
471
472inline ROCKY_FUNCTIONS double IRockyParticle::get_rolling_resistance_coefficient() const {
473 return this->_impl.get_group().rol;
474}
475
476inline ROCKY_FUNCTIONS double4 IRockyParticle::get_orientation_quaternion() const
477{
478 return this->_impl.get_orientation_quaternion();
479}
480
481inline ROCKY_FUNCTIONS double3 IRockyParticle::get_resultant_force() const
482{
483 return this->_impl.get_forces();
484}
485
486inline ROCKY_FUNCTIONS double3 IRockyParticle::get_resultant_moment() const
487{
488 return this->_impl.get_moments();
489}
490
491inline ROCKY_FUNCTIONS thrust::tuple<double3, double> IRockyParticle::get_orientation_axis_angle() const
492{
493 const SVectorAngleD _va = this->_impl.get_orientation_axis_angle();
494 return thrust::make_tuple(double3 { _va.x, _va.y, _va.z }, _va.angle);
495}
496
497inline ROCKY_FUNCTIONS double IRockyParticle::get_thermal_conductivity() const
498{
499 return this->_impl.get_thermal_conductivity();
500}
501
502inline ROCKY_FUNCTIONS void IRockyParticle::set_thermal_conductivity(double value)
503{
504 this->_impl.set_thermal_conductivity(value);
505}
506
507inline ROCKY_FUNCTIONS double IRockyParticle::get_poisson_ratio() const
508{
509 return this->_impl.get_poisson_ratio();
510}
511
512inline ROCKY_FUNCTIONS void IRockyParticle::set_poisson_ratio(double value)
513{
514 this->_impl.set_poisson_ratio(value);
515}
516
517inline ROCKY_FUNCTIONS double IRockyParticle::get_specific_heat() const
518{
519 return this->_impl.get_specific_heat();
520}
521
522inline ROCKY_FUNCTIONS void IRockyParticle::set_specific_heat(double value)
523{
524 this->_impl.set_specific_heat(value);
525}
526
527inline ROCKY_FUNCTIONS int IRockyParticle::get_tag() const
528{
529 return this->_impl.get_tag();
530}
531
532// Scalars
533
535{
536 return this->_impl.get_scalars();
537}
538
539inline ROCKY_FUNCTIONS const IRockyParticleScalars IRockyParticle::get_scalars() const
540{
541 return this->_impl.get_scalars();
542}
543
545{
546 return this->_impl.get_transfer_scalars();
547}
548
550{
551 return this->_impl.get_breakage_scalars();
552}
553
554// Operations
555
556inline ROCKY_FUNCTIONS void IRockyParticle::remove()
557{
558 this->_impl.remove();
559}
560
561// Output
562
563inline ROCKY_FUNCTIONS void IRockyParticle::add_force(const double3 &force)
564{
565 this->_impl.add_forces(force);
566}
567
568inline ROCKY_FUNCTIONS void IRockyParticle::add_moment(const double3& moment)
569{
570 this->_impl.add_moments(moment);
571}
572
573inline ROCKY_FUNCTIONS void IRockyParticle::set_frozen(bool frozen)
574{
575 this->_impl.particle->set_frozen(frozen);
576}
577
579{
580 this->_impl.particle->set_particle_contact_disabled(true);
581}
582
584{
585 this->_impl.particle->set_particle_contact_disabled(false);
586}
587
589{
590 this->_impl.particle->set_triangle_contact_disabled(true);
591}
592
594{
595 this->_impl.particle->set_triangle_contact_disabled(false);
596}
597
598inline ROCKY_FUNCTIONS const double3 IRockyParticle::get_moment_of_inertia() const
599{
600 return this->_impl.get_moment_of_inertia();
601}
602
603inline ROCKY_FUNCTIONS bool IRockyParticle::is_element() const
604{
605 return this->_impl.is_element();
606}
607
608inline ROCKY_FUNCTIONS bool IRockyParticle::is_assembly() const
609{
610 return this->_impl.is_assembly();
611}
612
613inline ROCKY_FUNCTIONS size_t IRockyParticle::get_number_of_assembly_parts() const
614{
615 return this->_impl.get_number_of_assembly_parts();
616}
617
618inline ROCKY_FUNCTIONS
620{
621 return IRockyMaterial { this->_impl.get_assembly_part_material(part_id) };
622}
623
625{
626 this->_impl.particle->set_remove_from_contacts_search(true);
627}
628
629inline ROCKY_FUNCTIONS void IRockyParticle::add_to_contacts_search()
630{
631 this->_impl.particle->set_remove_from_contacts_search(false);
632}
633
634// ================================================================================================
635// IRockyBreakableParticle
636// ================================================================================================
637
646{
652 double get_minimum_fragment_size() const;
653
657 double get_original_volume() const;
658
663 int get_particle_group_index() const;
664
670 double get_strength() const;
671
675 double get_original_size() const;
676
682 void set_as_unbreakable() const;
683
689
695
696
698 IRockyBreakableParticle(int _index, RockyModel* _model);
699
700 RockyParticleHost _impl;
702};
703
704inline IRockyBreakableParticle::IRockyBreakableParticle(int _index, RockyModel* _model)
705 : _impl(RockyParticleHost(_model, _index))
706{
707}
708
710{
711 return this->_impl.get_minimum_fragment_size();
712}
713
715{
716 return this->_impl.get_original_bulk_volume();
717}
718
720{
721 return this->_impl.get_particle_group_index();
722}
723
725{
726 return this->_impl.get_strength();
727}
728
730{
731 return this->_impl.get_original_size();
732}
733
735{
736 this->_impl.set_as_unbreakable();
737}
738
740{
741 return this->_impl.get_scalars();
742}
743
745{
746 return this->_impl.get_breakage_scalars();
747}
748
749// ================================================================================================
750// IRockyParticleHost
751// ================================================================================================
752
764{
770 double get_original_volume() const;
771
777 double get_original_solid_volume() const;
778
782 int get_material_index() const;
783
788 double get_equivalent_diameter() const;
789
796
801 double3 get_centroid_position() const;
802
806 double get_original_mass() const;
807
811 double get_size() const;
812
816 double get_release_time() const;
817
821 double get_cgm_scale_factor() const;
822
832 int get_tag() const;
833
838 bool is_released() const;
839
843 bool is_element() const;
844
848 bool is_assembly() const;
849
853 size_t get_number_of_assembly_parts() const;
854
861 IRockyMaterial get_assembly_part_material(size_t part_id) const;
862
868
869
871 IRockyParticleHost(int _index, RockyModel* _model);
872
873 RockyParticleHost _impl;
876};
877
878inline IRockyParticleHost::IRockyParticleHost(int _index, RockyModel* _model)
879 : _impl(RockyParticleHost(_model, _index))
880{
881}
882
884{
885 return this->_impl.get_original_bulk_volume();
886}
887
889{
890 return this->_impl.get_original_solid_volume();
891}
892
894{
895 return this->_impl.get_scalars();
896}
897
899{
900 return this->_impl.get_group().get_material_index();
901}
902
904{
905 return this->_impl.get_equivalent_diameter();
906}
907
909{
910 return IRockyMaterial(this->_impl.get_material());
911}
912
914{
915 return double3{ this->_impl.particle->x, this->_impl.particle->y, this->_impl.particle->z };
916}
917
919{
920 return this->_impl.get_original_mass();
921}
922
923inline double IRockyParticleHost::get_size() const
924{
925 return this->_impl.get_size();
926}
927
929{
930 return this->_impl.get_release_time();
931}
932
934{
935 return this->_impl.get_cgm_scale_factor();
936}
937
939{
940 return this->_impl.is_released();
941}
942
944{
945 return this->_impl.is_assembly();
946}
947
949{
950 return this->_impl.is_element();
951}
952
954{
955 return this->_impl.get_number_of_assembly_parts();
956}
957
959{
960 return IRockyMaterial { this->_impl.get_assembly_part_material(part_id) };
961}
962
964{
965 return this->_impl.get_tag();
966}
Definition rocky_particle_api.hpp:646
double get_original_volume() const
Definition rocky_particle_api.hpp:714
double get_minimum_fragment_size() const
Definition rocky_particle_api.hpp:709
IRockyParticleBreakageScalars get_breakage_scalars()
Definition rocky_particle_api.hpp:744
IRockyParticleScalars get_scalars()
Definition rocky_particle_api.hpp:739
void set_as_unbreakable() const
Definition rocky_particle_api.hpp:734
int get_particle_group_index() const
Definition rocky_particle_api.hpp:719
double get_strength() const
Definition rocky_particle_api.hpp:724
double get_original_size() const
Definition rocky_particle_api.hpp:729
Definition rocky_material_api.hpp:20
Definition rocky_particle_scalars.hpp:543
Definition rocky_particle_api.hpp:764
size_t get_number_of_assembly_parts() const
Definition rocky_particle_api.hpp:953
int get_tag() const
Definition rocky_particle_api.hpp:963
double get_cgm_scale_factor() const
Definition rocky_particle_api.hpp:933
IRockyParticleScalars get_scalars() const
Definition rocky_particle_api.hpp:893
double get_equivalent_diameter() const
Definition rocky_particle_api.hpp:903
IRockyMaterial get_material() const
Definition rocky_particle_api.hpp:908
bool is_assembly() const
Definition rocky_particle_api.hpp:943
IRockyMaterial get_assembly_part_material(size_t part_id) const
Definition rocky_particle_api.hpp:958
double3 get_centroid_position() const
Definition rocky_particle_api.hpp:913
double get_size() const
Definition rocky_particle_api.hpp:923
double get_release_time() const
Definition rocky_particle_api.hpp:928
bool is_released() const
Definition rocky_particle_api.hpp:938
double get_original_mass() const
Definition rocky_particle_api.hpp:918
double get_original_volume() const
Definition rocky_particle_api.hpp:883
int get_material_index() const
Definition rocky_particle_api.hpp:898
double get_original_solid_volume() const
Definition rocky_particle_api.hpp:888
bool is_element() const
Definition rocky_particle_api.hpp:948
Definition rocky_particle_scalars.hpp:104
Definition rocky_particle_scalars.hpp:406
Definition rocky_particle_api.hpp:27
ROCKY_FUNCTIONS double get_original_mass() const
Definition rocky_particle_api.hpp:393
ROCKY_FUNCTIONS int get_particle_group_index() const
Definition rocky_particle_api.hpp:463
ROCKY_FUNCTIONS const double3 get_moment_of_inertia() const
Definition rocky_particle_api.hpp:598
ROCKY_FUNCTIONS bool is_element() const
Definition rocky_particle_api.hpp:603
ROCKY_FUNCTIONS double get_solid_volume() const
Definition rocky_particle_api.hpp:433
ROCKY_FUNCTIONS double3 get_rotational_velocity() const
Definition rocky_particle_api.hpp:418
ROCKY_FUNCTIONS IRockyMaterial get_assembly_part_material(size_t part_id) const
Definition rocky_particle_api.hpp:619
ROCKY_FUNCTIONS void disable_related_triangle_contacts()
Definition rocky_particle_api.hpp:588
ROCKY_FUNCTIONS double get_surface_area() const
Definition rocky_particle_api.hpp:438
ROCKY_FUNCTIONS int get_tag() const
Definition rocky_particle_api.hpp:527
ROCKY_FUNCTIONS void remove()
Definition rocky_particle_api.hpp:556
ROCKY_FUNCTIONS IRockyParticleScalars get_scalars()
Definition rocky_particle_api.hpp:534
ROCKY_FUNCTIONS double get_strength() const
Definition rocky_particle_api.hpp:448
ROCKY_FUNCTIONS double get_impact_energy() const
Definition rocky_particle_api.hpp:443
ROCKY_FUNCTIONS double3 get_translational_velocity() const
Definition rocky_particle_api.hpp:413
ROCKY_FUNCTIONS IRockyMaterial get_material() const
Definition rocky_particle_api.hpp:378
ROCKY_FUNCTIONS double3 get_gravity() const
Definition rocky_particle_api.hpp:423
ROCKY_FUNCTIONS int get_material_index() const
Definition rocky_particle_api.hpp:468
ROCKY_FUNCTIONS double get_specific_heat() const
Definition rocky_particle_api.hpp:517
ROCKY_FUNCTIONS double3 get_resultant_moment() const
Definition rocky_particle_api.hpp:486
ROCKY_FUNCTIONS double get_equivalent_diameter() const
Definition rocky_particle_api.hpp:453
ROCKY_FUNCTIONS double get_poisson_ratio() const
Definition rocky_particle_api.hpp:507
ROCKY_FUNCTIONS void enable_related_triangle_contacts()
Definition rocky_particle_api.hpp:593
ROCKY_FUNCTIONS void set_specific_heat(double value)
Definition rocky_particle_api.hpp:522
ROCKY_FUNCTIONS double get_size() const
Definition rocky_particle_api.hpp:398
ROCKY_FUNCTIONS size_t get_number_of_assembly_parts() const
Definition rocky_particle_api.hpp:613
ROCKY_FUNCTIONS void set_poisson_ratio(double value)
Definition rocky_particle_api.hpp:512
ROCKY_FUNCTIONS bool is_assembly() const
Definition rocky_particle_api.hpp:608
ROCKY_FUNCTIONS void set_thermal_conductivity(double value)
Definition rocky_particle_api.hpp:502
ROCKY_FUNCTIONS void add_moment(const double3 &moment)
Definition rocky_particle_api.hpp:568
ROCKY_FUNCTIONS double get_thermal_conductivity() const
Definition rocky_particle_api.hpp:497
ROCKY_FUNCTIONS void enable_related_particle_contacts()
Definition rocky_particle_api.hpp:583
ROCKY_FUNCTIONS void disable_related_particle_contacts()
Definition rocky_particle_api.hpp:578
ROCKY_FUNCTIONS double get_volume() const
Definition rocky_particle_api.hpp:428
ROCKY_FUNCTIONS double get_mass() const
Definition rocky_particle_api.hpp:388
ROCKY_FUNCTIONS IRockyParticleBreakageScalars get_breakage_scalars()
Definition rocky_particle_api.hpp:549
ROCKY_FUNCTIONS double3 get_centroid_position() const
Definition rocky_particle_api.hpp:383
ROCKY_FUNCTIONS double3 get_resultant_force() const
Definition rocky_particle_api.hpp:481
ROCKY_FUNCTIONS double get_sphericity() const
Definition rocky_particle_api.hpp:458
ROCKY_FUNCTIONS double get_cgm_scale_factor() const
Definition rocky_particle_api.hpp:408
ROCKY_FUNCTIONS double get_rolling_resistance_coefficient() const
Definition rocky_particle_api.hpp:472
ROCKY_FUNCTIONS thrust::tuple< double3, double > get_orientation_axis_angle() const
Definition rocky_particle_api.hpp:491
ROCKY_FUNCTIONS void set_frozen(bool frozen)
Definition rocky_particle_api.hpp:573
ROCKY_FUNCTIONS void add_force(const double3 &force)
Definition rocky_particle_api.hpp:563
ROCKY_FUNCTIONS IRockyParticleTransferScalars get_transfer_scalars()
Definition rocky_particle_api.hpp:544
ROCKY_FUNCTIONS double get_release_time() const
Definition rocky_particle_api.hpp:403
ROCKY_FUNCTIONS void remove_from_contacts_search()
Definition rocky_particle_api.hpp:624
ROCKY_FUNCTIONS double4 get_orientation_quaternion() const
Definition rocky_particle_api.hpp:476
ROCKY_FUNCTIONS void add_to_contacts_search()
Definition rocky_particle_api.hpp:629

Connect with Ansys