Skip to main content

Rocky Solver SDK 2024 R2

rocky_particle_api

Last update: 08.07.2024
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
373
374inline
375IRockyParticle::IRockyParticle(int _index, SDeviceModel *_model)
376{
377 this->_impl.particle_index = _index;
378 this->_impl.particle = _model->prt + _index;
379 this->_impl.model = _model;
380}
381
382inline ROCKY_FUNCTIONS IRockyMaterial IRockyParticle::get_material() const
383{
384 return IRockyMaterial(this->_impl.get_material());
385}
386
387inline ROCKY_FUNCTIONS double3 IRockyParticle::get_centroid_position() const
388{
389 return double3{ this->_impl.particle->x, this->_impl.particle->y, this->_impl.particle->z };
390}
391
392inline ROCKY_FUNCTIONS double IRockyParticle::get_mass() const
393{
394 return this->_impl.get_mass();
395}
396
397inline ROCKY_FUNCTIONS double IRockyParticle::get_original_mass() const
398{
399 return this->_impl.get_original_mass();
400}
401
402inline ROCKY_FUNCTIONS double IRockyParticle::get_size() const
403{
404 return this->_impl.get_size();
405}
406
407inline ROCKY_FUNCTIONS double IRockyParticle::get_release_time() const
408{
409 return this->_impl.get_release_time();
410}
411
412inline ROCKY_FUNCTIONS double IRockyParticle::get_cgm_scale_factor() const
413{
414 return this->_impl.get_cgm_scale_factor();
415}
416
417inline ROCKY_FUNCTIONS double3 IRockyParticle::get_translational_velocity() const
418{
419 return this->_impl.get_translational_velocity();
420}
421
422inline ROCKY_FUNCTIONS double3 IRockyParticle::get_rotational_velocity() const
423{
424 return this->_impl.get_rotational_velocity();
425}
426
427inline ROCKY_FUNCTIONS double3 IRockyParticle::get_gravity() const
428{
429 return this->_impl.get_gravity();
430}
431
432inline ROCKY_FUNCTIONS double IRockyParticle::get_volume() const
433{
434 return this->_impl.get_bulk_volume();
435}
436
437inline ROCKY_FUNCTIONS double IRockyParticle::get_solid_volume() const
438{
439 return this->_impl.get_solid_volume();
440}
441
442inline ROCKY_FUNCTIONS double IRockyParticle::get_surface_area() const
443{
444 return this->_impl.get_area();
445}
446
447inline ROCKY_FUNCTIONS double IRockyParticle::get_impact_energy() const
448{
449 return this->_impl.get_impact_energy();
450}
451
452inline ROCKY_FUNCTIONS double IRockyParticle::get_strength() const
453{
454 return this->_impl.get_strength();
455}
456
457inline ROCKY_FUNCTIONS double IRockyParticle::get_equivalent_diameter() const
458{
459 return this->_impl.get_equivalent_diameter();
460}
461
462inline ROCKY_FUNCTIONS double IRockyParticle::get_sphericity() const
463{
464 return this->_impl.get_sphericity();
465}
466
467inline ROCKY_FUNCTIONS int IRockyParticle::get_particle_group_index() const
468{
469 return this->_impl.get_particle_group_index();
470}
471
472inline ROCKY_FUNCTIONS int IRockyParticle::get_material_index() const {
473 return this->_impl.get_group().get_material_index();
474}
475
476inline ROCKY_FUNCTIONS double IRockyParticle::get_rolling_resistance_coefficient() const {
477 return this->_impl.get_group().rol;
478}
479
480inline ROCKY_FUNCTIONS double4 IRockyParticle::get_orientation_quaternion() const
481{
482 return this->_impl.get_orientation_quaternion();
483}
484
485inline ROCKY_FUNCTIONS double3 IRockyParticle::get_resultant_force() const
486{
487 return this->_impl.get_resultant_force();
488}
489
490inline ROCKY_FUNCTIONS double3 IRockyParticle::get_resultant_moment() const
491{
492 return this->_impl.get_resultant_moment();
493}
494
495inline ROCKY_FUNCTIONS thrust::tuple<double3, double> IRockyParticle::get_orientation_axis_angle() const
496{
497 return this->_impl.get_orientation_axis_angle();
498}
499
500inline ROCKY_FUNCTIONS double IRockyParticle::get_thermal_conductivity() const
501{
502 return this->_impl.get_thermal_conductivity();
503}
504
505inline ROCKY_FUNCTIONS void IRockyParticle::set_thermal_conductivity(double value)
506{
507 this->_impl.set_thermal_conductivity(value);
508}
509
510inline ROCKY_FUNCTIONS double IRockyParticle::get_poisson_ratio() const
511{
512 return this->_impl.get_poisson_ratio();
513}
514
515inline ROCKY_FUNCTIONS void IRockyParticle::set_poisson_ratio(double value)
516{
517 this->_impl.set_poisson_ratio(value);
518}
519
520inline ROCKY_FUNCTIONS double IRockyParticle::get_specific_heat() const
521{
522 return this->_impl.get_specific_heat();
523}
524
525inline ROCKY_FUNCTIONS void IRockyParticle::set_specific_heat(double value)
526{
527 this->_impl.set_specific_heat(value);
528}
529
530inline ROCKY_FUNCTIONS int IRockyParticle::get_tag() const
531{
532 return this->_impl.get_tag();
533}
534
535// Scalars
536
538{
539 return this->_impl.get_scalars();
540}
541
542inline ROCKY_FUNCTIONS const IRockyParticleScalars IRockyParticle::get_scalars() const
543{
544 return this->_impl.get_scalars();
545}
546
548{
549 return this->_impl.get_transfer_scalars();
550}
551
553{
554 return this->_impl.get_breakage_scalars();
555}
556
557// Operations
558
559inline ROCKY_FUNCTIONS void IRockyParticle::remove()
560{
561 this->_impl.remove();
562}
563
564// Output
565
566inline ROCKY_FUNCTIONS void IRockyParticle::add_force(const double3 &force)
567{
568 this->_impl.add_forces(force.x, force.y, force.z);
569}
570
571inline ROCKY_FUNCTIONS void IRockyParticle::add_moment(const double3& moment)
572{
573 this->_impl.add_moments(moment.x, moment.y, moment.z);
574}
575
576inline ROCKY_FUNCTIONS void IRockyParticle::set_frozen(bool frozen)
577{
578 this->_impl.particle->set_frozen(frozen);
579}
580
582{
583 this->_impl.particle->set_particle_contact_disabled(true);
584}
585
587{
588 this->_impl.particle->set_particle_contact_disabled(false);
589}
590
592{
593 this->_impl.particle->set_triangle_contact_disabled(true);
594}
595
597{
598 this->_impl.particle->set_triangle_contact_disabled(false);
599}
600
601inline ROCKY_FUNCTIONS const double3 IRockyParticle::get_moment_of_inertia() const
602{
603 return this->_impl.get_moment_of_inertia();
604}
605
606inline ROCKY_FUNCTIONS bool IRockyParticle::is_element() const
607{
608 return this->_impl.is_element();
609}
610
611inline ROCKY_FUNCTIONS bool IRockyParticle::is_assembly() const
612{
613 return this->_impl.is_assembly();
614}
615
616inline ROCKY_FUNCTIONS size_t IRockyParticle::get_number_of_assembly_parts() const
617{
618 return this->_impl.get_number_of_assembly_parts();
619}
620
621inline ROCKY_FUNCTIONS
623{
624 return IRockyMaterial { this->_impl.get_assembly_part_material(part_id) };
625}
626
628{
629 this->_impl.particle->set_remove_from_contacts_search(true);
630}
631
632inline ROCKY_FUNCTIONS void IRockyParticle::add_to_contacts_search()
633{
634 this->_impl.particle->set_remove_from_contacts_search(false);
635}
636
637// ================================================================================================
638// IRockyBreakableParticle
639// ================================================================================================
640
649{
655 double get_minimum_fragment_size() const;
656
660 double get_original_volume() const;
661
666 int get_particle_group_index() const;
667
673 double get_strength() const;
674
678 double get_original_size() const;
679
685 void set_as_unbreakable() const;
686
692
698
699
701 IRockyBreakableParticle(int _index, RockyModel* _model);
702
703 RockyParticleHost _impl;
705};
706
707inline IRockyBreakableParticle::IRockyBreakableParticle(int _index, RockyModel* _model)
708 : _impl(RockyParticleHost(_index, _model)) { }
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
871
873 IRockyParticleHost(int _index, RockyModel* _model);
874
875 RockyParticleHost _impl;
878};
879
880inline IRockyParticleHost::IRockyParticleHost(int _index, RockyModel* _model)
881 : _impl(RockyParticleHost(_index, _model)) { }
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:649
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:20
Definition rocky_particle_scalars.hpp:543
Definition rocky_particle_api.hpp:766
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
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
IRockyParticleScalars get_scalars()
Definition rocky_particle_api.hpp:893
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:397
ROCKY_FUNCTIONS int get_particle_group_index() const
Definition rocky_particle_api.hpp:467
ROCKY_FUNCTIONS const double3 get_moment_of_inertia() const
Definition rocky_particle_api.hpp:601
ROCKY_FUNCTIONS bool is_element() const
Definition rocky_particle_api.hpp:606
ROCKY_FUNCTIONS double get_solid_volume() const
Definition rocky_particle_api.hpp:437
ROCKY_FUNCTIONS double3 get_rotational_velocity() const
Definition rocky_particle_api.hpp:422
ROCKY_FUNCTIONS IRockyMaterial get_assembly_part_material(size_t part_id) const
Definition rocky_particle_api.hpp:622
ROCKY_FUNCTIONS void disable_related_triangle_contacts()
Definition rocky_particle_api.hpp:591
ROCKY_FUNCTIONS double get_surface_area() const
Definition rocky_particle_api.hpp:442
ROCKY_FUNCTIONS int get_tag() const
Definition rocky_particle_api.hpp:530
ROCKY_FUNCTIONS void remove()
Definition rocky_particle_api.hpp:559
ROCKY_FUNCTIONS IRockyParticleScalars get_scalars()
Definition rocky_particle_api.hpp:537
ROCKY_FUNCTIONS double get_strength() const
Definition rocky_particle_api.hpp:452
ROCKY_FUNCTIONS double get_impact_energy() const
Definition rocky_particle_api.hpp:447
ROCKY_FUNCTIONS double3 get_translational_velocity() const
Definition rocky_particle_api.hpp:417
ROCKY_FUNCTIONS IRockyMaterial get_material() const
Definition rocky_particle_api.hpp:382
ROCKY_FUNCTIONS double3 get_gravity() const
Definition rocky_particle_api.hpp:427
ROCKY_FUNCTIONS int get_material_index() const
Definition rocky_particle_api.hpp:472
ROCKY_FUNCTIONS double get_specific_heat() const
Definition rocky_particle_api.hpp:520
ROCKY_FUNCTIONS double3 get_resultant_moment() const
Definition rocky_particle_api.hpp:490
ROCKY_FUNCTIONS double get_equivalent_diameter() const
Definition rocky_particle_api.hpp:457
ROCKY_FUNCTIONS double get_poisson_ratio() const
Definition rocky_particle_api.hpp:510
ROCKY_FUNCTIONS void enable_related_triangle_contacts()
Definition rocky_particle_api.hpp:596
ROCKY_FUNCTIONS void set_specific_heat(double value)
Definition rocky_particle_api.hpp:525
ROCKY_FUNCTIONS double get_size() const
Definition rocky_particle_api.hpp:402
ROCKY_FUNCTIONS size_t get_number_of_assembly_parts() const
Definition rocky_particle_api.hpp:616
ROCKY_FUNCTIONS void set_poisson_ratio(double value)
Definition rocky_particle_api.hpp:515
ROCKY_FUNCTIONS bool is_assembly() const
Definition rocky_particle_api.hpp:611
ROCKY_FUNCTIONS void set_thermal_conductivity(double value)
Definition rocky_particle_api.hpp:505
ROCKY_FUNCTIONS void add_moment(const double3 &moment)
Definition rocky_particle_api.hpp:571
ROCKY_FUNCTIONS double get_thermal_conductivity() const
Definition rocky_particle_api.hpp:500
ROCKY_FUNCTIONS void enable_related_particle_contacts()
Definition rocky_particle_api.hpp:586
ROCKY_FUNCTIONS void disable_related_particle_contacts()
Definition rocky_particle_api.hpp:581
ROCKY_FUNCTIONS double get_volume() const
Definition rocky_particle_api.hpp:432
ROCKY_FUNCTIONS double get_mass() const
Definition rocky_particle_api.hpp:392
ROCKY_FUNCTIONS IRockyParticleBreakageScalars get_breakage_scalars()
Definition rocky_particle_api.hpp:552
ROCKY_FUNCTIONS double3 get_centroid_position() const
Definition rocky_particle_api.hpp:387
ROCKY_FUNCTIONS double3 get_resultant_force() const
Definition rocky_particle_api.hpp:485
ROCKY_FUNCTIONS double get_sphericity() const
Definition rocky_particle_api.hpp:462
ROCKY_FUNCTIONS double get_cgm_scale_factor() const
Definition rocky_particle_api.hpp:412
ROCKY_FUNCTIONS double get_rolling_resistance_coefficient() const
Definition rocky_particle_api.hpp:476
ROCKY_FUNCTIONS thrust::tuple< double3, double > get_orientation_axis_angle() const
Definition rocky_particle_api.hpp:495
ROCKY_FUNCTIONS void set_frozen(bool frozen)
Definition rocky_particle_api.hpp:576
ROCKY_FUNCTIONS void add_force(const double3 &force)
Definition rocky_particle_api.hpp:566
ROCKY_FUNCTIONS IRockyParticleTransferScalars get_transfer_scalars()
Definition rocky_particle_api.hpp:547
ROCKY_FUNCTIONS double get_release_time() const
Definition rocky_particle_api.hpp:407
ROCKY_FUNCTIONS void remove_from_contacts_search()
Definition rocky_particle_api.hpp:627
ROCKY_FUNCTIONS double4 get_orientation_quaternion() const
Definition rocky_particle_api.hpp:480
ROCKY_FUNCTIONS void add_to_contacts_search()
Definition rocky_particle_api.hpp:632