AGX Dynamics  2.37.3.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 
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 
139 
140  protected:
141  void invalidLicenseCallback();
142  void init();
143 
144  virtual ~GranularBodySystem();
145 
146  private:
147  };
148 
149 
153  }
154 }
155 
156 
157 #endif /* AGX_PHYSICS_GRANULARBODYSYSTEM_H */
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
Pointer to a entity instance of type Physics.GranularBody.
const agx::Physics::GranularBodyPtrArray getParticles() const
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
A representation of a generic task.
Definition: Task.h:57
#define AGX_FORCE_INLINE
Definition: Object.h:59
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
static CpuDevice * instance()
A basic particle system that contains all the storages and buffers required for basic operation and a...
uint32_t UInt
Definition: Integer.h:34
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 Index
Definition: Integer.h:52
Physics::GranularBodyPtr createParticle()
Create a new particle in the particle system.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
#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
double Real
Definition: Real.h:42
An agx::Device is an abstract representation of a device on which data can be stored and processed...
Definition: Device.h:57
Physics::ParticlePtr createParticle()
Create a new particle in the particle system.
MotionControl
The MotionControl enumeration indicates what makes a GranularBody in the GranularBodySystem move...