AGX Dynamics  2.37.3.2
ParticleEntity.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
18 // AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20 
21 #ifndef GENERATED_AGX_PHYSICS_PARTICLE_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_PARTICLE_H_PLUGIN
23 
24 #define AGX_ENTITY_WRAPPER 1
25 
26 
27 #ifdef _MSC_VER
28 # pragma warning(push)
29 // warning C4505: 'agxData::VectorAttributeT<T>::print' : unreferenced local function has been removed
30 # pragma warning( disable : 4505 )
31 // warning C4251: 'X' : class 'Y' needs to have dll-interface to be used by clients of class 'Z'
32 # pragma warning( disable : 4251 )
33 // warning C4355: 'this' : used in base member initializer list
34 # pragma warning( disable : 4355 )
35 // marked as __forceinline not inlined
36 # pragma warning( disable: 4714 )
37 #endif
38 
39 #include <agxData/EntityModel.h>
40 #include <agxData/EntityStorage.h>
41 #include <agxData/EntityRef.h>
42 #include <agxData/EntityPtr.h>
43 #include <agxData/EntityInstance.h>
44 #include <agx/Integer.h>
45 #include <agx/Real.h>
46 #include <agx/macros.h>
47 #include <agx/ParticleState.h>
48 #include <agx/Real.h>
51 #include <agx/Vec3.h>
52 #include <agx/Uuid.h>
53 #include <agx/Integer.h>
55 #include <agx/Vec4.h>
56 
57 namespace agx { namespace Physics { class MaterialPtr; }}
58 namespace agx { namespace Physics { class CollisionGroupSetPtr; }}
59 namespace agx { namespace Physics { class GraphNodePtr; }}
60 
61 namespace agx
62 {
63  namespace Physics
64  {
65 
66  class ParticleModel;
67  class ParticleData;
68  class ParticlePtr;
69  class ParticleInstance;
70  class ParticleSemantics;
71 
72 
74 
79  {
80  public:
81  typedef ParticlePtr PtrT;
82 
83  ParticleModel(const agx::String& name = "Particle");
84 
86  static ParticleModel* instance();
87 
89  static ParticlePtr createInstance();
90 
92  static agxData::EntityStorage* defaultStorage();
93 
95  virtual void shutdownCleanup() override;
96 
97 
98 
99  /* Attributes */
127 
128  protected:
129  virtual ~ParticleModel();
130  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
131  virtual void configure(agx::TiXmlElement* eEntity) override;
132  virtual void initAttributeAccessors() override;
133  virtual void construct(agxData::EntityPtr instance) override;
134  void construct(agx::Physics::ParticlePtr particle);
135  };
136 
137 
139  #ifndef AGX_PHYSICS_PARTICLE_DATA_SET_OVERRIDE
140  #define AGX_PHYSICS_PARTICLE_DATA_SET
141  class AGXPHYSICS_EXPORT ParticleData : public agxData::EntityData
142  {
143  public:
144  ParticleInstance operator[] (size_t index);
145 
146  public:
149  agx::Real defaultRadius;
150  agx::Real defaultMass;
151  agx::Physics::MaterialPtr defaultMaterial;
152  agx::Physics::CollisionGroupSetPtr defaultCollisionGroupSet;
153  agx::Real defaultInvMass;
156  agxData::Array< agx::Vec3 > oldVelocity;
163  agxData::Array< agx::Uuid > materialUuid;
169  agxData::Array< agx::UInt32 > geometryContactList;
170  agxData::Array< agx::UInt32 > solveBodyIndex;
173  agxData::Array< agx::Vec3 > geometryContactVector;
174  agxData::Array< agx::Real32 > enableRendering;
175 
176  public:
177  typedef agx::ParticleState stateType;
178  typedef agx::Real defaultRadiusType;
179  typedef agx::Real defaultMassType;
180  typedef agx::Physics::MaterialPtr defaultMaterialType;
181  typedef agx::Physics::CollisionGroupSetPtr defaultCollisionGroupSetType;
182  typedef agx::Real defaultInvMassType;
183  typedef agx::Vec3 positionType;
184  typedef agx::Vec3 velocityType;
185  typedef agx::Vec3 oldVelocityType;
186  typedef agx::Vec3 forceType;
187  typedef agx::Real lifeType;
188  typedef agx::Real radiusType;
189  typedef agx::Real massType;
190  typedef agx::Real invMassType;
191  typedef agx::Physics::MaterialPtr materialType;
192  typedef agx::Uuid materialUuidType;
193  typedef agx::Physics::CollisionGroupSetPtr collisionGroupSetType;
194  typedef agx::UInt8 tierType;
195  typedef agx::UInt32 cellIndexType;
196  typedef agx::UInt16 cellSlotType;
197  typedef agx::UInt32 oldCellType;
198  typedef agx::UInt32 geometryContactListType;
199  typedef agx::UInt32 solveBodyIndexType;
200  typedef agx::Physics::GraphNodePtr graphNodeType;
201  typedef agx::Vec4f colorType;
202  typedef agx::Vec3 geometryContactVectorType;
203  typedef agx::Real32 enableRenderingType;
204 
205  public:
206  ParticleData(agxData::EntityStorage* storage);
207  ParticleData();
208 
209  protected:
210  virtual ~ParticleData() {}
211  virtual void setNumElements(agx::Index numElements) override;
212  virtual void synchronizeSharedAttribute(agxData::Value* value) override;
213 
214  private:
215  ParticleData& operator= (const ParticleData&) { return *this; }
216 
217  };
218  #endif
220 
221 
223  class AGXPHYSICS_EXPORT ParticleSemantics : protected agxData::EntityPtr
224  {
225  public:
226 
227  // Automatic getters
228  agx::ParticleState const& getState() const;
229  agx::Vec3 const& getPosition() const;
230  agx::Vec3 const& getVelocity() const;
231  agx::Vec3 const& getOldVelocity() const;
232  agx::Vec3 const& getForce() const;
233  agx::Real const& getLife() const;
234  agx::Real const& getRadius() const;
235  agx::Real const& getMass() const;
236  agx::Real const& getInvMass() const;
237  agx::Physics::MaterialPtr const& getMaterial() const;
238  agx::Uuid const& getMaterialUuid() const;
239  agx::Physics::CollisionGroupSetPtr const& getCollisionGroupSet() const;
240  agx::UInt8 const& getTier() const;
241  agx::UInt32 const& getCellIndex() const;
242  agx::UInt16 const& getCellSlot() const;
243  agx::UInt32 const& getOldCell() const;
244  agx::UInt32 const& getGeometryContactList() const;
245  agx::UInt32 const& getSolveBodyIndex() const;
246  agx::Physics::GraphNodePtr const& getGraphNode() const;
247  agx::Vec4f const& getColor() const;
248  agx::Vec3 const& getGeometryContactVector() const;
249  agx::Real32 const& getEnableRendering() const;
250 
251  // Semantics defined by explicit kernels
252  void integrate(const agx::Real& clock_timeStep);
253  void integratePosition(const agx::Real& clock_timeStep);
254  void integrateVelocity(const agx::Real& clock_timeStep);
255  void setColor(const agx::Vec4f& color);
256  void setMass(const agx::Real& mass);
257  void setMaterial(const agx::Physics::MaterialPtr& material);
258  void setPosition(const agx::Vec3& position);
259  void setRadius(const agx::Real& radius);
260  void setVelocity(const agx::Vec3& velocity);
261 
262  // Automatic setters
263  void setState(agx::ParticleState const& value);
264  void setOldVelocity(agx::Vec3 const& value);
265  void setForce(agx::Vec3 const& value);
266  void setLife(agx::Real const& value);
267  void setInvMass(agx::Real const& value);
268  void setMaterialUuid(agx::Uuid const& value);
269  void setCollisionGroupSet(agx::Physics::CollisionGroupSetPtr const& value);
270  void setTier(agx::UInt8 const& value);
271  void setCellIndex(agx::UInt32 const& value);
272  void setCellSlot(agx::UInt16 const& value);
273  void setOldCell(agx::UInt32 const& value);
274  void setGeometryContactList(agx::UInt32 const& value);
275  void setSolveBodyIndex(agx::UInt32 const& value);
276  void setGraphNode(agx::Physics::GraphNodePtr const& value);
277  void setGeometryContactVector(agx::Vec3 const& value);
278  void setEnableRendering(agx::Real32 const& value);
279 
280 
281  protected:
282  friend class ParticlePtr;
283  friend class ParticleInstance;
284  ParticleSemantics();
285  };
287 
288 
289 
292  class CALLABLE ParticlePtr : public agxData::EntityPtr
293  {
294  public:
296  typedef ParticleData DataType;
297  typedef ParticleInstance InstanceType;
298 
299  public:
304  AGXPHYSICS_EXPORT ParticlePtr& operator= (const agxData::EntityPtr& ptr);
305  AGXPHYSICS_EXPORT ParticlePtr& operator= (const agxData::EntityInstance& instance);
306  AGXPHYSICS_EXPORT ParticleInstance instance();
307  AGXPHYSICS_EXPORT const ParticleInstance instance() const;
308 
309  AGXPHYSICS_EXPORT ParticleSemantics* operator->();
310  AGXPHYSICS_EXPORT const ParticleSemantics* operator->() const;
311 
312  ParticleData* getData();
313  const ParticleData* getData() const;
314 
315 
317  AGXPHYSICS_EXPORT agx::ParticleState& state();
319  AGXPHYSICS_EXPORT agx::ParticleState const& state() const;
320 
322  AGXPHYSICS_EXPORT agx::Real& defaultRadius();
324  AGXPHYSICS_EXPORT agx::Real const& defaultRadius() const;
325 
327  AGXPHYSICS_EXPORT agx::Real& defaultMass();
329  AGXPHYSICS_EXPORT agx::Real const& defaultMass() const;
330 
332  AGXPHYSICS_EXPORT agx::Physics::MaterialPtr& defaultMaterial();
334  AGXPHYSICS_EXPORT agx::Physics::MaterialPtr const& defaultMaterial() const;
335 
337  AGXPHYSICS_EXPORT agx::Physics::CollisionGroupSetPtr& defaultCollisionGroupSet();
339  AGXPHYSICS_EXPORT agx::Physics::CollisionGroupSetPtr const& defaultCollisionGroupSet() const;
340 
342  AGXPHYSICS_EXPORT agx::Real& defaultInvMass();
344  AGXPHYSICS_EXPORT agx::Real const& defaultInvMass() const;
345 
347  AGXPHYSICS_EXPORT agx::Vec3& position();
349  AGXPHYSICS_EXPORT agx::Vec3 const& position() const;
350 
352  AGXPHYSICS_EXPORT agx::Vec3& velocity();
354  AGXPHYSICS_EXPORT agx::Vec3 const& velocity() const;
355 
357  AGXPHYSICS_EXPORT agx::Vec3& oldVelocity();
359  AGXPHYSICS_EXPORT agx::Vec3 const& oldVelocity() const;
360 
362  AGXPHYSICS_EXPORT agx::Vec3& force();
364  AGXPHYSICS_EXPORT agx::Vec3 const& force() const;
365 
369  AGXPHYSICS_EXPORT agx::Real const& life() const;
370 
372  AGXPHYSICS_EXPORT agx::Real& radius();
374  AGXPHYSICS_EXPORT agx::Real const& radius() const;
375 
379  AGXPHYSICS_EXPORT agx::Real const& mass() const;
380 
382  AGXPHYSICS_EXPORT agx::Real& invMass();
384  AGXPHYSICS_EXPORT agx::Real const& invMass() const;
385 
389  AGXPHYSICS_EXPORT agx::Physics::MaterialPtr const& material() const;
390 
392  AGXPHYSICS_EXPORT agx::Uuid& materialUuid();
394  AGXPHYSICS_EXPORT agx::Uuid const& materialUuid() const;
395 
399  AGXPHYSICS_EXPORT agx::Physics::CollisionGroupSetPtr const& collisionGroupSet() const;
400 
404  AGXPHYSICS_EXPORT agx::UInt8 const& tier() const;
405 
407  AGXPHYSICS_EXPORT agx::UInt32& cellIndex();
409  AGXPHYSICS_EXPORT agx::UInt32 const& cellIndex() const;
410 
412  AGXPHYSICS_EXPORT agx::UInt16& cellSlot();
414  AGXPHYSICS_EXPORT agx::UInt16 const& cellSlot() const;
415 
417  AGXPHYSICS_EXPORT agx::UInt32& oldCell();
419  AGXPHYSICS_EXPORT agx::UInt32 const& oldCell() const;
420 
422  AGXPHYSICS_EXPORT agx::UInt32& geometryContactList();
424  AGXPHYSICS_EXPORT agx::UInt32 const& geometryContactList() const;
425 
427  AGXPHYSICS_EXPORT agx::UInt32& solveBodyIndex();
429  AGXPHYSICS_EXPORT agx::UInt32 const& solveBodyIndex() const;
430 
434  AGXPHYSICS_EXPORT agx::Physics::GraphNodePtr const& graphNode() const;
435 
437  AGXPHYSICS_EXPORT agx::Vec4f& color();
439  AGXPHYSICS_EXPORT agx::Vec4f const& color() const;
440 
442  AGXPHYSICS_EXPORT agx::Vec3& geometryContactVector();
444  AGXPHYSICS_EXPORT agx::Vec3 const& geometryContactVector() const;
445 
447  AGXPHYSICS_EXPORT agx::Real32& enableRendering();
449  AGXPHYSICS_EXPORT agx::Real32 const& enableRendering() const;
450 
451  };
452 
453 
455  class AGXPHYSICS_EXPORT ParticleInstance : public agxData::EntityInstance
456  {
457  public:
458  ParticleInstance();
459  ParticleInstance(ParticleData* data, agx::Index index);
460  ParticleInstance(agxData::EntityStorage *storage, agx::Index index);
461  ParticleInstance(const agxData::EntityInstance& other);
462  ParticleInstance(const agxData::EntityPtr& ptr);
463 
464  ParticleData* getData();
465  const ParticleData* getData() const;
466 
467  public:
469  agx::ParticleState& state();
471  agx::ParticleState const& state() const;
472 
474  agx::Real& defaultRadius();
476  agx::Real const& defaultRadius() const;
477 
479  agx::Real& defaultMass();
481  agx::Real const& defaultMass() const;
482 
484  agx::Physics::MaterialPtr& defaultMaterial();
486  agx::Physics::MaterialPtr const& defaultMaterial() const;
487 
489  agx::Physics::CollisionGroupSetPtr& defaultCollisionGroupSet();
491  agx::Physics::CollisionGroupSetPtr const& defaultCollisionGroupSet() const;
492 
494  agx::Real& defaultInvMass();
496  agx::Real const& defaultInvMass() const;
497 
499  agx::Vec3& position();
501  agx::Vec3 const& position() const;
502 
504  agx::Vec3& velocity();
506  agx::Vec3 const& velocity() const;
507 
509  agx::Vec3& oldVelocity();
511  agx::Vec3 const& oldVelocity() const;
512 
514  agx::Vec3& force();
516  agx::Vec3 const& force() const;
517 
519  agx::Real& life();
521  agx::Real const& life() const;
522 
524  agx::Real& radius();
526  agx::Real const& radius() const;
527 
529  agx::Real& mass();
531  agx::Real const& mass() const;
532 
534  agx::Real& invMass();
536  agx::Real const& invMass() const;
537 
539  agx::Physics::MaterialPtr& material();
541  agx::Physics::MaterialPtr const& material() const;
542 
544  agx::Uuid& materialUuid();
546  agx::Uuid const& materialUuid() const;
547 
549  agx::Physics::CollisionGroupSetPtr& collisionGroupSet();
551  agx::Physics::CollisionGroupSetPtr const& collisionGroupSet() const;
552 
554  agx::UInt8& tier();
556  agx::UInt8 const& tier() const;
557 
559  agx::UInt32& cellIndex();
561  agx::UInt32 const& cellIndex() const;
562 
564  agx::UInt16& cellSlot();
566  agx::UInt16 const& cellSlot() const;
567 
569  agx::UInt32& oldCell();
571  agx::UInt32 const& oldCell() const;
572 
574  agx::UInt32& geometryContactList();
576  agx::UInt32 const& geometryContactList() const;
577 
579  agx::UInt32& solveBodyIndex();
581  agx::UInt32 const& solveBodyIndex() const;
582 
584  agx::Physics::GraphNodePtr& graphNode();
586  agx::Physics::GraphNodePtr const& graphNode() const;
587 
589  agx::Vec4f& color();
591  agx::Vec4f const& color() const;
592 
594  agx::Vec3& geometryContactVector();
596  agx::Vec3 const& geometryContactVector() const;
597 
599  agx::Real32& enableRendering();
601  agx::Real32 const& enableRendering() const;
602 
603  };
605 
606 
607 
610 
611 
612 
614  /* Implementation */
615  //-----------------------------------------------------------------------------------------------------
616  //-----------------------------------------------------------------------------------------------------
617  inline ParticleInstance agx::Physics::ParticleData::operator[] (size_t index) { return ParticleInstance(this, (agx::Index)index); }
618  //-----------------------------------------------------------------------------------------------------
622  {
624  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
625  EntityPtr::getModel()->fullPath().c_str(), ParticleModel::instance()->fullPath().c_str());
626  }
627 
629  {
630  agxAssertN(!instance || instance.isInstanceOf(ParticleModel::instance()),
631  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
632  EntityPtr::getModel()->fullPath().c_str(), ParticleModel::instance()->fullPath().c_str());
633  }
634 
636  {
639  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
640  EntityPtr::getModel()->fullPath().c_str(), ParticleModel::instance()->fullPath().c_str());
641  return *this;
642  }
643 
645  {
647  agxAssertN(!instance || instance.isInstanceOf(ParticleModel::instance()),
648  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
649  EntityPtr::getModel()->fullPath().c_str(), ParticleModel::instance()->fullPath().c_str());
650  return *this;
651  }
652 
653  inline ParticleInstance ParticlePtr::instance() { return agxData::EntityPtr::instance(); }
654  inline const ParticleInstance ParticlePtr::instance() const { return agxData::EntityPtr::instance(); }
655  AGX_FORCE_INLINE ParticleSemantics* ParticlePtr::operator->() { return (ParticleSemantics* )this; }
656  AGX_FORCE_INLINE const ParticleSemantics* ParticlePtr::operator->() const { return (const ParticleSemantics* )this; }
657  AGX_FORCE_INLINE ParticleData* ParticlePtr::getData() { return static_cast<ParticleData* >(agxData::EntityPtr::getData()); }
658  AGX_FORCE_INLINE const ParticleData* ParticlePtr::getData() const { return static_cast<const ParticleData* >(agxData::EntityPtr::getData()); }
659 
660  AGX_FORCE_INLINE agx::ParticleState& ParticlePtr::state() { verifyIndex(); return getData()->state[calculateIndex()]; }
661  AGX_FORCE_INLINE agx::ParticleState const& ParticlePtr::state() const { verifyIndex(); return getData()->state[calculateIndex()]; }
662 
663  AGX_FORCE_INLINE agx::Real& ParticlePtr::defaultRadius() { verifyIndex(); return getData()->defaultRadius; }
664  AGX_FORCE_INLINE agx::Real const& ParticlePtr::defaultRadius() const { verifyIndex(); return getData()->defaultRadius; }
665 
666  AGX_FORCE_INLINE agx::Real& ParticlePtr::defaultMass() { verifyIndex(); return getData()->defaultMass; }
667  AGX_FORCE_INLINE agx::Real const& ParticlePtr::defaultMass() const { verifyIndex(); return getData()->defaultMass; }
668 
669  AGX_FORCE_INLINE agx::Physics::MaterialPtr& ParticlePtr::defaultMaterial() { verifyIndex(); return getData()->defaultMaterial; }
670  AGX_FORCE_INLINE agx::Physics::MaterialPtr const& ParticlePtr::defaultMaterial() const { verifyIndex(); return getData()->defaultMaterial; }
671 
672  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr& ParticlePtr::defaultCollisionGroupSet() { verifyIndex(); return getData()->defaultCollisionGroupSet; }
673  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr const& ParticlePtr::defaultCollisionGroupSet() const { verifyIndex(); return getData()->defaultCollisionGroupSet; }
674 
675  AGX_FORCE_INLINE agx::Real& ParticlePtr::defaultInvMass() { verifyIndex(); return getData()->defaultInvMass; }
676  AGX_FORCE_INLINE agx::Real const& ParticlePtr::defaultInvMass() const { verifyIndex(); return getData()->defaultInvMass; }
677 
678  AGX_FORCE_INLINE agx::Vec3& ParticlePtr::position() { verifyIndex(); return getData()->position[calculateIndex()]; }
679  AGX_FORCE_INLINE agx::Vec3 const& ParticlePtr::position() const { verifyIndex(); return getData()->position[calculateIndex()]; }
680 
681  AGX_FORCE_INLINE agx::Vec3& ParticlePtr::velocity() { verifyIndex(); return getData()->velocity[calculateIndex()]; }
682  AGX_FORCE_INLINE agx::Vec3 const& ParticlePtr::velocity() const { verifyIndex(); return getData()->velocity[calculateIndex()]; }
683 
684  AGX_FORCE_INLINE agx::Vec3& ParticlePtr::oldVelocity() { verifyIndex(); return getData()->oldVelocity[calculateIndex()]; }
685  AGX_FORCE_INLINE agx::Vec3 const& ParticlePtr::oldVelocity() const { verifyIndex(); return getData()->oldVelocity[calculateIndex()]; }
686 
687  AGX_FORCE_INLINE agx::Vec3& ParticlePtr::force() { verifyIndex(); return getData()->force[calculateIndex()]; }
688  AGX_FORCE_INLINE agx::Vec3 const& ParticlePtr::force() const { verifyIndex(); return getData()->force[calculateIndex()]; }
689 
690  AGX_FORCE_INLINE agx::Real& ParticlePtr::life() { verifyIndex(); return getData()->life[calculateIndex()]; }
691  AGX_FORCE_INLINE agx::Real const& ParticlePtr::life() const { verifyIndex(); return getData()->life[calculateIndex()]; }
692 
693  AGX_FORCE_INLINE agx::Real& ParticlePtr::radius() { verifyIndex(); return getData()->radius[calculateIndex()]; }
694  AGX_FORCE_INLINE agx::Real const& ParticlePtr::radius() const { verifyIndex(); return getData()->radius[calculateIndex()]; }
695 
696  AGX_FORCE_INLINE agx::Real& ParticlePtr::mass() { verifyIndex(); return getData()->mass[calculateIndex()]; }
697  AGX_FORCE_INLINE agx::Real const& ParticlePtr::mass() const { verifyIndex(); return getData()->mass[calculateIndex()]; }
698 
699  AGX_FORCE_INLINE agx::Real& ParticlePtr::invMass() { verifyIndex(); return getData()->invMass[calculateIndex()]; }
700  AGX_FORCE_INLINE agx::Real const& ParticlePtr::invMass() const { verifyIndex(); return getData()->invMass[calculateIndex()]; }
701 
702  AGX_FORCE_INLINE agx::Physics::MaterialPtr& ParticlePtr::material() { verifyIndex(); return getData()->material[calculateIndex()]; }
703  AGX_FORCE_INLINE agx::Physics::MaterialPtr const& ParticlePtr::material() const { verifyIndex(); return getData()->material[calculateIndex()]; }
704 
705  AGX_FORCE_INLINE agx::Uuid& ParticlePtr::materialUuid() { verifyIndex(); return getData()->materialUuid[calculateIndex()]; }
706  AGX_FORCE_INLINE agx::Uuid const& ParticlePtr::materialUuid() const { verifyIndex(); return getData()->materialUuid[calculateIndex()]; }
707 
708  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr& ParticlePtr::collisionGroupSet() { verifyIndex(); return getData()->collisionGroupSet[calculateIndex()]; }
709  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr const& ParticlePtr::collisionGroupSet() const { verifyIndex(); return getData()->collisionGroupSet[calculateIndex()]; }
710 
711  AGX_FORCE_INLINE agx::UInt8& ParticlePtr::tier() { verifyIndex(); return getData()->tier[calculateIndex()]; }
712  AGX_FORCE_INLINE agx::UInt8 const& ParticlePtr::tier() const { verifyIndex(); return getData()->tier[calculateIndex()]; }
713 
714  AGX_FORCE_INLINE agx::UInt32& ParticlePtr::cellIndex() { verifyIndex(); return getData()->cellIndex[calculateIndex()]; }
715  AGX_FORCE_INLINE agx::UInt32 const& ParticlePtr::cellIndex() const { verifyIndex(); return getData()->cellIndex[calculateIndex()]; }
716 
717  AGX_FORCE_INLINE agx::UInt16& ParticlePtr::cellSlot() { verifyIndex(); return getData()->cellSlot[calculateIndex()]; }
718  AGX_FORCE_INLINE agx::UInt16 const& ParticlePtr::cellSlot() const { verifyIndex(); return getData()->cellSlot[calculateIndex()]; }
719 
720  AGX_FORCE_INLINE agx::UInt32& ParticlePtr::oldCell() { verifyIndex(); return getData()->oldCell[calculateIndex()]; }
721  AGX_FORCE_INLINE agx::UInt32 const& ParticlePtr::oldCell() const { verifyIndex(); return getData()->oldCell[calculateIndex()]; }
722 
723  AGX_FORCE_INLINE agx::UInt32& ParticlePtr::geometryContactList() { verifyIndex(); return getData()->geometryContactList[calculateIndex()]; }
724  AGX_FORCE_INLINE agx::UInt32 const& ParticlePtr::geometryContactList() const { verifyIndex(); return getData()->geometryContactList[calculateIndex()]; }
725 
726  AGX_FORCE_INLINE agx::UInt32& ParticlePtr::solveBodyIndex() { verifyIndex(); return getData()->solveBodyIndex[calculateIndex()]; }
727  AGX_FORCE_INLINE agx::UInt32 const& ParticlePtr::solveBodyIndex() const { verifyIndex(); return getData()->solveBodyIndex[calculateIndex()]; }
728 
729  AGX_FORCE_INLINE agx::Physics::GraphNodePtr& ParticlePtr::graphNode() { verifyIndex(); return getData()->graphNode[calculateIndex()]; }
730  AGX_FORCE_INLINE agx::Physics::GraphNodePtr const& ParticlePtr::graphNode() const { verifyIndex(); return getData()->graphNode[calculateIndex()]; }
731 
732  AGX_FORCE_INLINE agx::Vec4f& ParticlePtr::color() { verifyIndex(); return getData()->color[calculateIndex()]; }
733  AGX_FORCE_INLINE agx::Vec4f const& ParticlePtr::color() const { verifyIndex(); return getData()->color[calculateIndex()]; }
734 
735  AGX_FORCE_INLINE agx::Vec3& ParticlePtr::geometryContactVector() { verifyIndex(); return getData()->geometryContactVector[calculateIndex()]; }
736  AGX_FORCE_INLINE agx::Vec3 const& ParticlePtr::geometryContactVector() const { verifyIndex(); return getData()->geometryContactVector[calculateIndex()]; }
737 
738  AGX_FORCE_INLINE agx::Real32& ParticlePtr::enableRendering() { verifyIndex(); return getData()->enableRendering[calculateIndex()]; }
739  AGX_FORCE_INLINE agx::Real32 const& ParticlePtr::enableRendering() const { verifyIndex(); return getData()->enableRendering[calculateIndex()]; }
740 
741  //-----------------------------------------------------------------------------------------------------
742  AGX_FORCE_INLINE ParticleInstance::ParticleInstance() {}
743  AGX_FORCE_INLINE ParticleInstance::ParticleInstance(ParticleData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
744  AGX_FORCE_INLINE ParticleInstance::ParticleInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
745  AGX_FORCE_INLINE ParticleInstance::ParticleInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
746  {
748  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
750  }
751 
752  AGX_FORCE_INLINE ParticleInstance::ParticleInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
753  {
755  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
757  }
758 
759 
760  AGX_FORCE_INLINE ParticleData* ParticleInstance::getData() { return static_cast<ParticleData* >(agxData::EntityInstance::getData()); }
761  AGX_FORCE_INLINE const ParticleData* ParticleInstance::getData() const { return static_cast<const ParticleData* >(agxData::EntityInstance::getData()); }
762 
763  AGX_FORCE_INLINE agx::ParticleState& ParticleInstance::state() { verifyIndex(); return getData()->state[getIndex()]; }
764  AGX_FORCE_INLINE agx::ParticleState const& ParticleInstance::state() const { verifyIndex(); return getData()->state[getIndex()]; }
765 
766  AGX_FORCE_INLINE agx::Real& ParticleInstance::defaultRadius() { verifyIndex(); return getData()->defaultRadius; }
767  AGX_FORCE_INLINE agx::Real const& ParticleInstance::defaultRadius() const { verifyIndex(); return getData()->defaultRadius; }
768 
769  AGX_FORCE_INLINE agx::Real& ParticleInstance::defaultMass() { verifyIndex(); return getData()->defaultMass; }
770  AGX_FORCE_INLINE agx::Real const& ParticleInstance::defaultMass() const { verifyIndex(); return getData()->defaultMass; }
771 
772  AGX_FORCE_INLINE agx::Physics::MaterialPtr& ParticleInstance::defaultMaterial() { verifyIndex(); return getData()->defaultMaterial; }
773  AGX_FORCE_INLINE agx::Physics::MaterialPtr const& ParticleInstance::defaultMaterial() const { verifyIndex(); return getData()->defaultMaterial; }
774 
775  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr& ParticleInstance::defaultCollisionGroupSet() { verifyIndex(); return getData()->defaultCollisionGroupSet; }
776  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr const& ParticleInstance::defaultCollisionGroupSet() const { verifyIndex(); return getData()->defaultCollisionGroupSet; }
777 
778  AGX_FORCE_INLINE agx::Real& ParticleInstance::defaultInvMass() { verifyIndex(); return getData()->defaultInvMass; }
779  AGX_FORCE_INLINE agx::Real const& ParticleInstance::defaultInvMass() const { verifyIndex(); return getData()->defaultInvMass; }
780 
781  AGX_FORCE_INLINE agx::Vec3& ParticleInstance::position() { verifyIndex(); return getData()->position[getIndex()]; }
782  AGX_FORCE_INLINE agx::Vec3 const& ParticleInstance::position() const { verifyIndex(); return getData()->position[getIndex()]; }
783 
784  AGX_FORCE_INLINE agx::Vec3& ParticleInstance::velocity() { verifyIndex(); return getData()->velocity[getIndex()]; }
785  AGX_FORCE_INLINE agx::Vec3 const& ParticleInstance::velocity() const { verifyIndex(); return getData()->velocity[getIndex()]; }
786 
787  AGX_FORCE_INLINE agx::Vec3& ParticleInstance::oldVelocity() { verifyIndex(); return getData()->oldVelocity[getIndex()]; }
788  AGX_FORCE_INLINE agx::Vec3 const& ParticleInstance::oldVelocity() const { verifyIndex(); return getData()->oldVelocity[getIndex()]; }
789 
790  AGX_FORCE_INLINE agx::Vec3& ParticleInstance::force() { verifyIndex(); return getData()->force[getIndex()]; }
791  AGX_FORCE_INLINE agx::Vec3 const& ParticleInstance::force() const { verifyIndex(); return getData()->force[getIndex()]; }
792 
793  AGX_FORCE_INLINE agx::Real& ParticleInstance::life() { verifyIndex(); return getData()->life[getIndex()]; }
794  AGX_FORCE_INLINE agx::Real const& ParticleInstance::life() const { verifyIndex(); return getData()->life[getIndex()]; }
795 
796  AGX_FORCE_INLINE agx::Real& ParticleInstance::radius() { verifyIndex(); return getData()->radius[getIndex()]; }
797  AGX_FORCE_INLINE agx::Real const& ParticleInstance::radius() const { verifyIndex(); return getData()->radius[getIndex()]; }
798 
799  AGX_FORCE_INLINE agx::Real& ParticleInstance::mass() { verifyIndex(); return getData()->mass[getIndex()]; }
800  AGX_FORCE_INLINE agx::Real const& ParticleInstance::mass() const { verifyIndex(); return getData()->mass[getIndex()]; }
801 
802  AGX_FORCE_INLINE agx::Real& ParticleInstance::invMass() { verifyIndex(); return getData()->invMass[getIndex()]; }
803  AGX_FORCE_INLINE agx::Real const& ParticleInstance::invMass() const { verifyIndex(); return getData()->invMass[getIndex()]; }
804 
805  AGX_FORCE_INLINE agx::Physics::MaterialPtr& ParticleInstance::material() { verifyIndex(); return getData()->material[getIndex()]; }
806  AGX_FORCE_INLINE agx::Physics::MaterialPtr const& ParticleInstance::material() const { verifyIndex(); return getData()->material[getIndex()]; }
807 
808  AGX_FORCE_INLINE agx::Uuid& ParticleInstance::materialUuid() { verifyIndex(); return getData()->materialUuid[getIndex()]; }
809  AGX_FORCE_INLINE agx::Uuid const& ParticleInstance::materialUuid() const { verifyIndex(); return getData()->materialUuid[getIndex()]; }
810 
811  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr& ParticleInstance::collisionGroupSet() { verifyIndex(); return getData()->collisionGroupSet[getIndex()]; }
812  AGX_FORCE_INLINE agx::Physics::CollisionGroupSetPtr const& ParticleInstance::collisionGroupSet() const { verifyIndex(); return getData()->collisionGroupSet[getIndex()]; }
813 
814  AGX_FORCE_INLINE agx::UInt8& ParticleInstance::tier() { verifyIndex(); return getData()->tier[getIndex()]; }
815  AGX_FORCE_INLINE agx::UInt8 const& ParticleInstance::tier() const { verifyIndex(); return getData()->tier[getIndex()]; }
816 
817  AGX_FORCE_INLINE agx::UInt32& ParticleInstance::cellIndex() { verifyIndex(); return getData()->cellIndex[getIndex()]; }
818  AGX_FORCE_INLINE agx::UInt32 const& ParticleInstance::cellIndex() const { verifyIndex(); return getData()->cellIndex[getIndex()]; }
819 
820  AGX_FORCE_INLINE agx::UInt16& ParticleInstance::cellSlot() { verifyIndex(); return getData()->cellSlot[getIndex()]; }
821  AGX_FORCE_INLINE agx::UInt16 const& ParticleInstance::cellSlot() const { verifyIndex(); return getData()->cellSlot[getIndex()]; }
822 
823  AGX_FORCE_INLINE agx::UInt32& ParticleInstance::oldCell() { verifyIndex(); return getData()->oldCell[getIndex()]; }
824  AGX_FORCE_INLINE agx::UInt32 const& ParticleInstance::oldCell() const { verifyIndex(); return getData()->oldCell[getIndex()]; }
825 
826  AGX_FORCE_INLINE agx::UInt32& ParticleInstance::geometryContactList() { verifyIndex(); return getData()->geometryContactList[getIndex()]; }
827  AGX_FORCE_INLINE agx::UInt32 const& ParticleInstance::geometryContactList() const { verifyIndex(); return getData()->geometryContactList[getIndex()]; }
828 
829  AGX_FORCE_INLINE agx::UInt32& ParticleInstance::solveBodyIndex() { verifyIndex(); return getData()->solveBodyIndex[getIndex()]; }
830  AGX_FORCE_INLINE agx::UInt32 const& ParticleInstance::solveBodyIndex() const { verifyIndex(); return getData()->solveBodyIndex[getIndex()]; }
831 
832  AGX_FORCE_INLINE agx::Physics::GraphNodePtr& ParticleInstance::graphNode() { verifyIndex(); return getData()->graphNode[getIndex()]; }
833  AGX_FORCE_INLINE agx::Physics::GraphNodePtr const& ParticleInstance::graphNode() const { verifyIndex(); return getData()->graphNode[getIndex()]; }
834 
835  AGX_FORCE_INLINE agx::Vec4f& ParticleInstance::color() { verifyIndex(); return getData()->color[getIndex()]; }
836  AGX_FORCE_INLINE agx::Vec4f const& ParticleInstance::color() const { verifyIndex(); return getData()->color[getIndex()]; }
837 
838  AGX_FORCE_INLINE agx::Vec3& ParticleInstance::geometryContactVector() { verifyIndex(); return getData()->geometryContactVector[getIndex()]; }
839  AGX_FORCE_INLINE agx::Vec3 const& ParticleInstance::geometryContactVector() const { verifyIndex(); return getData()->geometryContactVector[getIndex()]; }
840 
841  AGX_FORCE_INLINE agx::Real32& ParticleInstance::enableRendering() { verifyIndex(); return getData()->enableRendering[getIndex()]; }
842  AGX_FORCE_INLINE agx::Real32 const& ParticleInstance::enableRendering() const { verifyIndex(); return getData()->enableRendering[getIndex()]; }
843 
844  //-----------------------------------------------------------------------------------------------------
845  AGX_FORCE_INLINE ParticleSemantics::ParticleSemantics() {}
846  //-----------------------------------------------------------------------------------------------------
848  }
849 }
850 
851 AGX_TYPE_BINDING(agx::Physics::ParticlePtr, "Physics.ParticlePtr")
852 AGX_TYPE_BINDING(agx::Physics::ParticleInstance, "Physics.ParticleInstance")
853 
854 #ifdef _MSC_VER
855 # pragma warning(pop)
856 #endif
857 
858 #undef AGX_ENTITY_WRAPPER
859 #undef AGX_ENTITY_NAMESPACE
860 #endif
861 
static agxData::ScalarAttributeT< agx::UInt8 > * tierAttribute
AGXPHYSICS_EXPORT agx::ParticleState & state()
static agxData::ScalarAttributeT< agx::Uuid > * materialUuidAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * geometryContactVectorAttribute
float Real32
Definition: Real.h:44
static agxData::ScalarAttributeT< agx::Vec4f > * colorAttribute
ParticleData * getData()
agxData::EntityData * getData()
static agxData::ScalarAttributeT< agx::UInt32 > * oldCellAttribute
static agxData::SharedAttributeT< agx::Physics::CollisionGroupSetPtr > * defaultCollisionGroupSetAttribute
AGXPHYSICS_EXPORT agx::Vec3 & force()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
AGXPHYSICS_EXPORT agx::UInt32 & oldCell()
AGXPHYSICS_EXPORT agx::Real & radius()
static agxData::SharedAttributeT< agx::Real > * defaultRadiusAttribute
static agxData::ScalarAttributeT< agx::UInt16 > * cellSlotAttribute
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
static agxData::ScalarAttributeT< agx::Real > * massAttribute
Abstract representation of a value.
Definition: Value.h:48
Pointer to a entity instance of type Physics.Material.
#define agxAssertN(expr, format,...)
Definition: debug.h:145
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:34
agxData::EntityData * getData()
agx::String fullPath() const
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363
uint8_t UInt8
Definition: Integer.h:38
static agxData::SharedAttributeT< agx::Physics::MaterialPtr > * defaultMaterialAttribute
#define AGXPHYSICS_EXPORT
AGXPHYSICS_EXPORT agx::Uuid & materialUuid()
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
AGXPHYSICS_EXPORT ParticleSemantics * operator->()
AGXPHYSICS_EXPORT ParticlePtr()
AGXPHYSICS_EXPORT agx::Physics::GraphNodePtr & graphNode()
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
AGXPHYSICS_EXPORT agx::Physics::MaterialPtr & material()
#define AGX_FORCE_INLINE
Definition: Object.h:59
static agxData::SharedAttributeT< agx::Real > * defaultInvMassAttribute
AGXPHYSICS_EXPORT agx::Physics::CollisionGroupSetPtr & defaultCollisionGroupSet()
static agxData::ScalarAttributeT< agx::Physics::GraphNodePtr > * graphNodeAttribute
AGXPHYSICS_EXPORT agx::Vec3 & position()
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
AGXPHYSICS_EXPORT agx::Real & defaultRadius()
static agxData::ScalarAttributeT< agx::Vec3 > * forceAttribute
Pointer to a entity instance of type Physics.CollisionGroupSet.
AGXPHYSICS_EXPORT agx::Vec4f & color()
AGXPHYSICS_EXPORT ParticleInstance instance()
AGXPHYSICS_EXPORT agx::Physics::MaterialPtr & defaultMaterial()
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
static agxData::ScalarAttributeT< agx::Vec3 > * oldVelocityAttribute
Abstract description of the data attributes for the Physics.Particle entity.
Pointer to a entity instance of type Physics.GraphNode.
static agxData::ScalarAttributeT< agx::Real > * invMassAttribute
static agxData::ScalarAttributeT< agx::UInt32 > * geometryContactListAttribute
AGXPHYSICS_EXPORT agx::Real & defaultInvMass()
static agxData::ScalarAttributeT< agx::Physics::MaterialPtr > * materialAttribute
AGXPHYSICS_EXPORT agx::Vec3 & oldVelocity()
AGXPHYSICS_EXPORT ParticlePtr & operator=(const agxData::EntityPtr &ptr)
static agxData::ScalarAttributeT< agx::Vec3 > * positionAttribute
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
AGXPHYSICS_EXPORT agx::Vec3 & velocity()
AGXPHYSICS_EXPORT agx::Real & mass()
AGXPHYSICS_EXPORT agx::Real & defaultMass()
AGXPHYSICS_EXPORT agx::Real & invMass()
AGXPHYSICS_EXPORT agx::UInt8 & tier()
static agxData::ScalarAttributeT< agx::Real32 > * enableRenderingAttribute
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:63
#define CALLABLE
Definition: Object.h:73
ParticleInstance InstanceType
static agxData::ScalarAttributeT< agx::UInt32 > * cellIndexAttribute
static agxData::ScalarAttributeT< agx::Real > * radiusAttribute
static agxData::SharedAttributeT< agx::Real > * defaultMassAttribute
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:41
bool isInstanceOf(agxData::EntityModel *model) const
AGXPHYSICS_EXPORT agx::UInt32 & geometryContactList()
static agxData::ScalarAttributeT< agx::Vec3 > * velocityAttribute
AGXPHYSICS_EXPORT agx::UInt32 & solveBodyIndex()
uint16_t UInt16
Definition: Integer.h:39
static ParticleModel * instance()
AGXPHYSICS_EXPORT agx::UInt32 & cellIndex()
double Real
Definition: Real.h:42
static agxData::ScalarAttributeT< agx::Real > * lifeAttribute
AGXPHYSICS_EXPORT agx::Real & life()
static agxData::ScalarAttributeT< agx::Physics::CollisionGroupSetPtr > * collisionGroupSetAttribute
AGXPHYSICS_EXPORT agx::Physics::CollisionGroupSetPtr & collisionGroupSet()
AGXPHYSICS_EXPORT agx::Real32 & enableRendering()
Pointer to a entity instance of type Physics.Particle.
static agxData::ScalarAttributeT< agx::ParticleState > * stateAttribute
uint32_t UInt32
Definition: Integer.h:40
static agxData::ScalarAttributeT< agx::UInt32 > * solveBodyIndexAttribute
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
AGXPHYSICS_EXPORT agx::UInt16 & cellSlot()
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
AGXPHYSICS_EXPORT agx::Vec3 & geometryContactVector()