AGX Dynamics  2.38.0.2
GranularBodySystem.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 having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 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 
17 #ifndef AGX_PHYSICS_GRANULARBODYSYSTEM_H
18 #define AGX_PHYSICS_GRANULARBODYSYSTEM_H
19 
20 #include <agx/ParticleSystem.h>
23 
24 namespace agx
25 {
26  namespace Physics
27  {
33  {
34  public:
43  {
44  KINEMATICS = 2,
45  DYNAMICS = 3
46  };
47 
48  public:
50 
54  Physics::GranularBodyPtr createParticle();
55 
59  virtual bool setUpdateTask(Task* updateTask) override;
60 
61 #if (!defined SWIG ) || ( defined SWIGCSHARP || defined SWIGJAVA)
62 
65  const agx::Physics::GranularBodyPtrArray getParticles() const;
67 
68  agx::Physics::GranularBodyPtrVector getGranularBodyPtrVector() const;
69  agx::Physics::GranularBodyPtrVector getGranularBodyPtrVector();
70 #endif
71 
73  void setMotionControl( agx::Physics::GranularBodyPtr gptr, MotionControl motionControl );
74 
76  MotionControl getMotionControl( agx::Physics::GranularBodyPtr gptr ) const;
77 
79  static void copyGranularBodyData( agx::Physics::GranularBodyPtr target, agx::Physics::GranularBodyPtr source, bool copyMaterial=true );
80 
82  virtual void setSingleParticleRadius(agx::Index particleId, agx::Real radius) override;
83 
85  void setSingleParticleAngularVelocity(agx::Index particleId, const agx::Vec3& angularVelocity );
86 
88  agx::Vec3 getSingleParticleAngularVelocity(agx::Index particleId);
89 
91  static agx::RigidBody* convertGranularBodyToRigidBody(agx::Physics::GranularBodyPtr gptr);
92 
94  static void applyTransform( agx::Physics::GranularBodyPtr gptr, const agx::AffineMatrix4x4& transform, bool includeVelocity = false );
95 
97  static bool isGranularBodySystem(agx::ParticleSystem* system);
98 
107  virtual void setParticleMass( Real mass, bool updateExistingParticles = false ) override;
108 
115  void setContactMode(agx::UInt contactMode);
116 
122  void preAllocateParticlePairContactStorage( size_t numElements );
123 
129  void preAllocateParticleGeometryContactStorage( size_t numElements );
130 
136  void preAllocateParticleStorage( size_t numElements );
137 
138 
150  GranularBodyPtrVector filterBodiesInGeometry( const agxCollide::Geometry* geometry,
151  const GranularBodyPtrVector& granularBodies,
152  bool onlyCheckForMidPoint) const;
153 
163  GranularBodyPtrVector getGranularBodiesInsideGeometry(const agxCollide::Geometry* geometry,
164  bool onlyCheckForMidPoint) const;
165 
167 
168  protected:
169  void invalidLicenseCallback();
170  void init();
171 
172  virtual ~GranularBodySystem();
173 
174  private:
175  };
176 
177 
181  }
182 }
183 
184 
185 #endif /* AGX_PHYSICS_GRANULARBODYSYSTEM_H */
agx::Physics::GranularBodyPtr
Pointer to a entity instance of type Physics.GranularBody.
Definition: GranularBodyEntity.h:190
agx::UInt
uint64_t UInt
Definition: Integer.h:27
agx::Real
double Real
Definition: Real.h:42
agxData::transform
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agx::AffineMatrix4x4T< Real >
agx::CpuDevice::instance
static CpuDevice * instance()
agx::ParticleSystem::createParticle
Physics::ParticlePtr createParticle()
Create a new particle in the particle system.
ParticleSystem.h
AGXSTREAM_DECLARE_SERIALIZABLE
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
agx::VectorPOD
Vector containing 'raw' data.
Definition: Vector.h:245
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxData::Array
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
agx::Task
A representation of a generic task.
Definition: Task.h:57
agx::ParticleSystem
A basic particle system that contains all the storages and buffers required for basic operation and a...
Definition: ParticleSystem.h:67
agxUtil::setMotionControl
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
agx::Index
UInt32 Index
Definition: Integer.h:44
CachedContact.h
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
agx::Physics::GranularBodySystem
Definition: GranularBodySystem.h:32
agx::Physics::GranularBodySystem::getParticles
const agx::Physics::GranularBodyPtrArray getParticles() const
Definition: GranularBodySystem.h:179
agx::Physics::GranularBodySystem::MotionControl
MotionControl
The MotionControl enumeration indicates what makes a GranularBody in the GranularBodySystem move.
Definition: GranularBodySystem.h:42
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agxData::EntityStorage::getInstances
const agxData::Array< EntityPtr > getInstances() const
Definition: EntityStorage.h:454
agx::Device
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Definition: Device.h:57
agx::Physics::GranularBodySystem::createParticle
Physics::GranularBodyPtr createParticle()
Create a new particle in the particle system.
Definition: GranularBodySystem.h:178
agx::init
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.
agx::Vec3T< Real >
GranularBodyEntity.h
agx::ParticleSystem::getParticleStorage
agxData::EntityStorage * getParticleStorage()
Definition: ParticleSystem.h:801
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58