AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
GranularBodySystem.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#ifndef AGX_PHYSICS_GRANULARBODYSYSTEM_H
18#define AGX_PHYSICS_GRANULARBODYSYSTEM_H
19
20#include <agx/ParticleSystem.h>
23
24namespace agx
25{
26 namespace Physics
27 {
33 {
34 public:
43 {
44 KINEMATICS = 2,
45 DYNAMICS = 3
46 };
47
48 public:
49 GranularBodySystem(Device *device = CpuDevice::instance());
50
54 Physics::GranularBodyPtr createParticle();
55
59 virtual bool setUpdateTask(Task* updateTask) override;
60
61#if (!defined SWIG ) || ( defined SWIGCSHARP || defined SWIGJAVA)
65 const agx::Physics::GranularBodyPtrArray getParticles() const;
67
70#endif
71
74
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
89
92
94 static void applyTransform( agx::Physics::GranularBodyPtr gptr, const agx::AffineMatrix4x4& transform, bool includeVelocity = false );
95
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
130
136 void preAllocateParticleStorage( size_t numElements );
137
138
151 const GranularBodyPtrVector& granularBodies,
152 bool onlyCheckForMidPoint) const;
153
164 bool onlyCheckForMidPoint) const;
165
167
168 protected:
170 void init();
171
173
174 private:
175 };
176
177
181 }
182}
183
184
185#endif /* AGX_PHYSICS_GRANULARBODYSYSTEM_H */
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
const agxData::Array< EntityPtr > getInstances() const
Only use as member allocated variable.
Definition Value.h:285
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Definition Device.h:58
A basic particle system that contains all the storages and buffers required for basic operation and a...
agxData::EntityStorage * getParticleStorage()
Physics::ParticlePtr createParticle()
Create a new particle in the particle system.
Pointer to a entity instance of type Physics.GranularBody.
agx::Physics::GranularBodyPtrVector getGranularBodyPtrVector() const
void setSingleParticleAngularVelocity(agx::Index particleId, const agx::Vec3 &angularVelocity)
Set angular velocity for a single particle.
virtual bool setUpdateTask(Task *updateTask) override
Set the task that will be executed whenever it is time to step the simulation.
GranularBodySystem(Device *device=CpuDevice::instance())
virtual void setParticleMass(Real mass, bool updateExistingParticles=false) override
Set granular body mass and inertia.
GranularBodyPtrVector filterBodiesInGeometry(const agxCollide::Geometry *geometry, const GranularBodyPtrVector &granularBodies, bool onlyCheckForMidPoint) const
Return a subset of specified granular bodies that intersect with a specified geometry.
void setMotionControl(agx::Physics::GranularBodyPtr gptr, MotionControl motionControl)
Set motion control of the granular body.
void preAllocateParticleGeometryContactStorage(size_t numElements)
Pre-allocate memory for elements via the reserve function in the storages related to particle-geometr...
agx::Vec3 getSingleParticleAngularVelocity(agx::Index particleId)
Get angular velocity for a single particle.
virtual void setSingleParticleRadius(agx::Index particleId, agx::Real radius) override
Set single particle radius given a specified id.
static bool isGranularBodySystem(agx::ParticleSystem *system)
Checks if a particle system is a granular body system by either class or by internal models.
MotionControl getMotionControl(agx::Physics::GranularBodyPtr gptr) const
Get the motion control of a granular body.
GranularBodyPtrVector getGranularBodiesInsideGeometry(const agxCollide::Geometry *geometry, bool onlyCheckForMidPoint) const
Return all granular bodies that intersect with a specified geometry.
void setContactMode(agx::UInt contactMode)
Set the contact mode of the GranularBodySystem.
agx::Physics::GranularBodyPtrVector getGranularBodyPtrVector()
Physics::GranularBodyPtr createParticle()
Create a new particle in the particle system.
MotionControl
The MotionControl enumeration indicates what makes a GranularBody in the GranularBodySystem move.
static void copyGranularBodyData(agx::Physics::GranularBodyPtr target, agx::Physics::GranularBodyPtr source, bool copyMaterial=true)
Copy data from GranularBody source to target body.
const agx::Physics::GranularBodyPtrArray getParticles() const
static void applyTransform(agx::Physics::GranularBodyPtr gptr, const agx::AffineMatrix4x4 &transform, bool includeVelocity=false)
Apply a 4x4 transform on a particle.
static agx::RigidBody * convertGranularBodyToRigidBody(agx::Physics::GranularBodyPtr gptr)
Convert a granular body to a rigid body.
void preAllocateParticlePairContactStorage(size_t numElements)
Pre-allocate memory for elements via the reserve function in the storages related to particle-particl...
void preAllocateParticleStorage(size_t numElements)
Pre-allocate memory for elements via the reserve function in the particle data storage with specified...
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
A representation of a generic task.
Definition Task.h:58
Vector containing 'raw' data.
Definition agx/Vector.h:246
#define AGX_FORCE_INLINE
Definition macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
UInt32 Index
Definition Integer.h:44