AGX Dynamics  2.35.0.1
agx::RigidParticleSystem Class Reference

A specialization of the particle system that simulates the particles as a set of hard core spheres. More...

#include <RigidParticleSystem.h>

+ Inheritance diagram for agx::RigidParticleSystem:

Public Member Functions

 RigidParticleSystem (Device *device=CpuDevice::instance())
 
- Public Member Functions inherited from agx::ParticleSystem
void _setGravityTask (Task *task)
 
void addCollisionGroup (agx::UInt32 id, bool updateExistingParticles=true)
 Add the specified id to a vector of group id, this will make a all newly created particles part of the group id. More...
 
void addCollisionGroup (const agx::Name &id, bool updateExistingParticles=true)
 
void addCollisionGroupParticle (agx::UInt32 id, agx::Physics::ParticlePtr ptr)
 Add the specified id to a vector of group id, this make the specific particle part of the group id. More...
 
void addCollisionGroupParticle (const agx::Name &id, agx::Physics::ParticlePtr ptr)
 
void addCustomBufferInt (const agx::String &buffername)
 Adds a custom attribute Int buffer for the particle system. More...
 
void addCustomBufferReal (const agx::String &buffername)
 Adds a custom attribute Real buffer for the particle system. More...
 
void addCustomBufferReal32 (const agx::String &buffername)
 Adds a custom attribute Real32 buffer for the particle system. More...
 
void addCustomBufferVec3 (const agx::String &buffername)
 Adds a custom attribute Vec3 buffer for the particle system. More...
 
virtual void addNotification (agxSDK::Simulation *simulation)
 Triggers when particlesystem is added to the simulation. More...
 
void applyAirForceDragSimple (agx::Real cd, agx::Real cr)
 Apply air drag to the particles according to formula: cd * velocity^2 + cr * velocity. More...
 
void attach ()
 Binds relevant buffer pointers to objects after inserting the particle system into the simulation. More...
 
agx::Real calculateTotalParticleMass () const
 Calculates the total particle mass in the particle system. More...
 
agx::Real calculateTotalParticleVolume () const
 
void clearAllParticles ()
 Utility method for clearing all particles in the particle system. More...
 
void clearContactData ()
 
void colorParticlesWithLevelsInBound (const agx::Bound3 &bound, const agx::Vec4fVector &colors)
 Colors particles with different levels in the vertical z-direction inside a specified bound. More...
 
void commitAllBuffers ()
 Executes the "commit" command all buffers in the particle system. More...
 
void commitColorBuffer ()
 Executes the "commit" command on the buffer so that particle rendering can be updated properly. More...
 
Physics::ParticlePtr createParticle ()
 Create a new particle in the particle system. More...
 
agx::Physics::ParticleGeometryContactPtr createParticleGeometryContact (agx::Physics::ParticlePtr particle, agx::Physics::GeometryPtr geometry)
 
agx::Physics::ParticlePairContactPtr createParticlePairContact (agx::Physics::ParticlePtr p1, agx::Physics::ParticlePtr p2)
 
agxData::EntityRange createParticles (size_t numParticles)
 Create a set of particles in the particle system. More...
 
void destroyParticle (Physics::ParticlePtr particle)
 Destroy a particle. More...
 
void destroyParticles (agxData::EntityRange particles)
 Destroy a range of particles. More...
 
void destroyParticles (const agxData::EntityPtrVector &particles)
 
void destroyParticles (const Physics::ParticlePtrVector &particles)
 Destroy a list of particles. More...
 
virtual void destroySingleParticle (agx::Index particleId)
 Destroy particle with specified id. More...
 
void detach ()
 Unbinds relevant buffer pointers from objects after removing the particle system into the simulation. More...
 
void evaluateParticleDefaultMass ()
 This should be called if the density of the bulk material is changed, so the particle default mass is updated accordingly. More...
 
agx::Physics::CollisionGroupSetPtr getCollisionGroupSet () const
 
agx::Int getCustomBufferValueInt (agx::Index id, const agx::String &buffername)
 Returns a custom Int buffer value from a particle. More...
 
agx::Real getCustomBufferValueReal (agx::Index id, const agx::String &buffername)
 Returns a custom Real buffer value from a particle. More...
 
agx::Real32 getCustomBufferValueReal32 (agx::Index id, const agx::String &buffername)
 Returns a custom Real32 buffer value from a particle. More...
 
agx::Vec3 getCustomBufferValueVec3 (agx::Index id, const agx::String &buffername)
 Returns a custom Vec3 buffer value from a particle. More...
 
const agxCollide::GeometryHashVector & getDisabledCollisions () const
 
bool getEnableCollisions (const agxCollide::Geometry *geometry) const
 
agxData::EntityStorage * getGeometryParticleContactListStorage ()
 
Material * getMaterial ()
 
const Material * getMaterial () const
 
size_t getNumActiveParticleGeometryContacts ()
 Returns the number of ACTIVE particle-geometry contacts, after the last conducted contact filtering. More...
 
size_t getNumActiveParticleParticleContacts ()
 Returns the number of ACTIVE particle-particle contacts, after the last conducted contact filtering. More...
 
size_t getNumParticleGeometryContacts ()
 Returns the number of particle-geometry contacts. More...
 
size_t getNumParticleParticleContacts ()
 Returns the number of particle-particle contacts. More...
 
size_t getNumParticles () const
 
Physics::ParticlePtr getParticle (agx::Index particleId)
 Returns a particle from the particle system given a particle id. More...
 
const agx::Bound3 & getParticleBound ()
 
agx::Vector< agx::Physics::ParticleGeometryContactPtr > getParticleGeometryContacts ()
 Returns the current ParticleGeometryContacts in the simulation. More...
 
agxData::EntityStorage * getParticleGeometryContactStorage ()
 
agx::Index getParticleIdFromIndex (agx::Index index) const
 Return the particle id for the specified particle entity array index. More...
 
Real getParticleMass () const
 
agxData::EntityStorage * getParticlePairContactStorage ()
 
agx::Vector< agx::Physics::ParticlePairContactPtr > getParticleParticleContacts ()
 Returns the current ParticleParticle contacts in the simulation. More...
 
Real getParticleRadius () const
 
agx::Physics::ParticlePtrArray getParticles ()
 
const agx::Physics::ParticlePtrArray getParticles () const
 
agxData::EntityStorage * getParticleStorage ()
 
const agxData::EntityStorage * getParticleStorage () const
 
virtual agx::Vec4f getSingleParticleColor (agx::Index particleId)
 Get particle color with specified id. More...
 
virtual agx::Vec3 getSingleParticleForce (agx::Index particleId)
 Get particle velocity with specified id. More...
 
virtual agx::Real getSingleParticleMass (agx::Index particleId)
 Get particle radius with specified id. More...
 
virtual agx::Vec3 getSingleParticlePosition (agx::Index particleId)
 Get particle position with specified id. More...
 
virtual agx::Real getSingleParticleRadius (agx::Index particleId)
 Get particle radius with specified id. More...
 
virtual agx::Vec3 getSingleParticleVelocity (agx::Index particleId)
 Get particle velocity with specified id. More...
 
agx::Real getTotalParticleGeometryContactForces ()
 
agx::Real getTotalParticleParticleContactForces ()
 
Task * getUpdateTask ()
 
bool hasCollisionGroup (agx::UInt32 id) const
 This is performing a linear search among the group id for this particle. More...
 
bool hasCollisionGroup (const agx::Name &id) const
 
bool hasCollisionGroupParticle (agx::UInt32 id, agx::Physics::ParticlePtr ptr) const
 This is performing a linear search among the group id for this particle. More...
 
bool hasCollisionGroupParticle (const agx::Name &id, agx::Physics::ParticlePtr ptr) const
 
bool hasCustomBuffer (const agx::String &buffername, const agx::String &formatName)
 Returns true if the particle system has a buffer with the specified name and format. More...
 
bool isParticleGeometryContactValid (Physics::ParticleGeometryContactPtr contact)
 
bool isParticlePairContactValid (Physics::ParticlePairContactPtr contact)
 
bool isValid (Physics::ParticlePtr particle) const
 
bool particleExistsWithId (agx::Index id)
 Check if there is a particle with a specified id. More...
 
void removeCollisionGroup (agx::UInt32 id, bool updateExistingParticles=true)
 Remove a group id from the vector of group ids. More...
 
void removeCollisionGroup (const agx::Name &id, bool updateExistingParticles=true)
 
void removeCollisionGroupParticle (agx::UInt32 id, agx::Physics::ParticlePtr ptr)
 Remove a group id from the vector of group ids. More...
 
void removeCollisionGroupParticle (const agx::Name &id, agx::Physics::ParticlePtr ptr)
 
void removeParticle (Physics::ParticlePtr particle)
 Tag a particle for removal at the end of the time step. More...
 
void setCustomBufferValueInt (agx::Index id, const agx::String &buffername, agx::Int val)
 Sets a custom Int buffer value to a particle. More...
 
void setCustomBufferValueReal (agx::Index id, const agx::String &buffername, agx::Real val)
 Sets a custom Real buffer value to a particle. More...
 
void setCustomBufferValueReal32 (agx::Index id, const agx::String &buffername, agx::Real32 val)
 Sets a custom Real32 buffer value to a particle. More...
 
void setCustomBufferValueVec3 (agx::Index id, const agx::String &buffername, agx::Vec3 val)
 Sets a custom Vec3 buffer value to a particle. More...
 
void setEnableCollisions (const agxCollide::Geometry *geometry, bool flag)
 Specify whether otherGeometry is allowed to collide with this geometry. More...
 
void setMaterial (Material *material, bool updateExistingParticles=false)
 Set the default particle material. More...
 
virtual void setParticleMass (Real mass, bool updateExistingParticles=false)
 Set particle mass. More...
 
void setParticleRadius (Real radius, bool updateExistingParticles=false)
 Set the default particle radius of created particles, with option of updating existing particles. More...
 
virtual void setSingleParticleColor (agx::Index particleId, const agx::Vec4f &color)
 Set particle color with specified id. More...
 
virtual void setSingleParticleForce (agx::Index particleId, const agx::Vec3 &force)
 Set particle force with specified id. More...
 
virtual void setSingleParticleMass (agx::Index particleId, agx::Real mass)
 Set particle radius with specified id. More...
 
virtual void setSingleParticleRadius (agx::Index particleId, agx::Real radius)
 Set particle radius with specified id. More...
 
virtual void setSingleParticleVelocity (agx::Index particleId, const agx::Vec3 &velocity)
 Set particle velocity with specified id. More...
 
void setSpace (agxCollide::Space *space)
 
virtual bool setUpdateTask (Task *updateTask)
 Set the task that will be executed whenever it is time to step the simulation. More...
 
agxData::EntityRange spawnParticles (const agx::Vec3Vector &positions)
 Spawn particles with defined positions. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInBound (const agx::Bound3 &bound, agx::Emitter::DistributionTable *sourceTable, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles In a specified bound from a distribution table. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInBound (const agx::Bound3 &bound, Real radius, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles in a specified bound. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInBoundHCP (const agx::Bound3 &bound, agx::Emitter::DistributionTable *sourceTable, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles in a specified bound from a distribution table using a Hexagonal-Close-Packing (HCP) lattice. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInBoundHCP (const agx::Bound3 &bound, Real radius, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles In a specified bound using a Hexagonal-Close-Packing (HCP) lattice. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInGeometry (agxCollide::Geometry *geometry, agx::Emitter::DistributionTable *sourceTable, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles In a specified geometry from a distribution table. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInGeometry (agxCollide::Geometry *geometry, Real radius, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles In a specified geometry. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInGeometryHCP (agxCollide::Geometry *geometry, agx::Emitter::DistributionTable *sourceTable, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles In a specified geometry from a distribution table using a Hexagonal-Close-Packing (HCP) lattice. More...
 
agx::Physics::ParticlePtrVector spawnParticlesInGeometryHCP (agxCollide::Geometry *geometry, Real radius, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0))
 Spawns particles In a specified geometry using a Hexagonal-Close-Packing (HCP) lattice. More...
 
Vec3 sumForceMagnitudes (RigidBody *body)
 Sums force magnitudes from particle system onto rigid body. More...
 
void updateShouldRender ()
 Update the shouldRender variable in particles given renders states such as clipping and filtering. More...
 
- Public Member Functions inherited from agx::Component
 Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr)
 
virtual void addObject (agx::Object *object, bool assignContext=true)
 Add an object to the component. More...
 
virtual String autoComplete (const String &partialName, StringVector &matchingNames) const
 
virtual void buildNavigationTree (agxJson::Value &eNode) const override
 
void configure (Model *model)
 
virtual void configure (TiXmlElement *eComponent) override
 
agx::Device * getDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::Device * getDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::Object * getObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::Object * getObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::Object * getObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::Object * getObject (const agx::Name &name, size_t index=0) const
 
template<typename T >
const T * getObject (const agx::Name &name, size_t index=0) const
 
const agx::ObjectRefVector & getObjects () const
 
template<typename T >
void getObjects (agx::ObjectPtrVector &result, bool recursive=false) const
 
void getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const
 
virtual Object * getResourceImpl (const Path &path, agx::Model *model) override
 
virtual void printSubtree () const override
 
void printSubtree (std::ostream &stream, int depth=0) const
 
virtual void rebind () override
 
void removeAllObjects ()
 Remove all components. More...
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component. More...
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component. More...
 
virtual void snapshot (TiXmlNode *eParent, const String &directory) const override
 
void traverse (ComponentVisitor *)
 
void traverse (const TraverseCallback &callback)
 
- Public Member Functions inherited from agx::Object
 Object (const Name &name=Name(), Model *model=Object::ClassModel())
 
void addListener (EventListener *listener)
 
agx::String fullName () const
 
agx::String fullPath () const
 
agx::String fullPath (const agx::Object *root) const
 
template<typename T >
T * getAutoScopedResource (const agx::Path &path)
 
template<typename T >
const T * getAutoScopedResource (const agx::Path &path) const
 
agx::Object * getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::Object * getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::Object * getContext ()
 
template<typename T >
T * getContext ()
 
const agx::Object * getContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::Name & getImplementationName () const
 
agx::Model * getModel ()
 
const agx::Model * getModel () const
 
const agx::Name & getName () const
 
agx::Object * getNextSibling ()
 
const agx::Object * getNextSibling () const
 
agx::Path getPath () const
 
agx::Path getPath (const agx::Object *root) const
 
template<typename T >
T * getResource (const agx::Path &path)
 
template<typename T >
const T * getResource (const agx::Path &path) const
 
agx::Object * getResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::Object * getResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::Object * getRootContext ()
 
const agx::Object * getRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
void removeListener (EventListener *listener)
 
virtual void save (TiXmlElement *) const
 
virtual void setContext (agx::Object *context)
 
void setId (UInt32 id)
 
void setModel (agx::Model *model)
 Set the object model (handled automatically). More...
 
void setName (const agx::Name &name)
 Set the name of the object. More...
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings. More...
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object. More...
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object. More...
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More...
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object. More...
 

Additional Inherited Members

- Public Types inherited from agx::Component
typedef Event2< Component *, Object * > ObjectEvent
 Event when adding removing child objects. More...
 
typedef Callback1< Object * > TraverseCallback
 
- Public Types inherited from agx::Object
typedef agx::observer_ptr< const Event > EventConstObserver
 
typedef agx::ref_ptr< const Event > EventConstRef
 
typedef agx::observer_ptr< Event > EventObserver
 
typedef agx::Vector< EventObserver > EventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< Event > EventRef
 
typedef agx::Vector< EventRef > EventRefVector
 
- Static Public Member Functions inherited from agx::ParticleSystem
static Model * ClassModel ()
 
- Static Public Member Functions inherited from agx::Component
static Component * _load (TiXmlElement *eComponent, Device *device)
 
static agx::Model * ClassModel ()
 
static Component * load (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Component * load (const String &path, const Path &_namespace=Path())
 
static Component * load (const String &path, Device *device, const Path &_namespace=Path())
 
static Component * load (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::Model * ClassModel ()
 
static agx::String generateName (const agx::String &bindPath)
 
static const HashSet< Object * > & getActiveObjects ()
 
static bool getEnableRebind ()
 Should rebinding be allowed? Right now a global setting. More...
 
static Object * load (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
static Object * load (const String &path, Device *device, const String &type="", size_t instance=0)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type="", size_t instance=0)
 
static void load (const String &path, Device *device, ObjectPtrVector &loadedObjects)
 
static Object * load (TiXmlElement *eObject, Device *device)
 
template<typename T >
static T * load (TiXmlElement *eObject, Device *device)
 
static TiXmlDocument openDocument (const String &path)
 
static void setEnableRebind (bool flag)
 Sets if rebinding of objects should be allowed (Right now a global setting). More...
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More...
 
- Public Attributes inherited from agx::Component
ObjectEvent addObjectEvent
 
ObjectEvent removeObjectEvent
 
- Protected Types inherited from agx::ParticleSystem
typedef agx::observer_ptr< const MaterialUuidBufferListener > MaterialUuidBufferListenerConstObserver
 
typedef agx::ref_ptr< const MaterialUuidBufferListener > MaterialUuidBufferListenerConstRef
 
typedef agx::observer_ptr< MaterialUuidBufferListener > MaterialUuidBufferListenerObserver
 
typedef agx::ref_ptr< MaterialUuidBufferListener > MaterialUuidBufferListenerRef
 
typedef agx::observer_ptr< const UpdateRenderingListener > UpdateRenderingListenerConstObserver
 
typedef agx::ref_ptr< const UpdateRenderingListener > UpdateRenderingListenerConstRef
 
typedef agx::observer_ptr< UpdateRenderingListener > UpdateRenderingListenerObserver
 
typedef agx::ref_ptr< UpdateRenderingListener > UpdateRenderingListenerRef
 
- Protected Member Functions inherited from agx::ParticleSystem
 ParticleSystem ()
 
 ParticleSystem (const String &model, Device *device=CpuDevice::instance())
 
virtual ~ParticleSystem ()
 
void init (bool createMaterial=true)
 
void invalidLicenseCallback ()
 
void setCollisionGroupSet (agx::Physics::CollisionGroupSetPtr)
 
void setRadiusOnParticles (agxData::EntityRange &entityRange, agx::Real radius)
 
- Protected Member Functions inherited from agx::Component
virtual ~Component ()
 
String expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const
 
void setDevice (Device *device)
 
- Protected Member Functions inherited from agx::Object
virtual ~Object ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor. More...
 
 Serializable (const Serializable &other)
 Copy constructor. More...
 
void generateUuid ()
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 
- Protected Attributes inherited from agx::ParticleSystem
agxData::EntityStorageRef m_particleStorage
 
TaskGroupRef m_updateTask
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

A specialization of the particle system that simulates the particles as a set of hard core spheres.

Definition at line 31 of file RigidParticleSystem.h.

Constructor & Destructor Documentation

◆ RigidParticleSystem()

agx::RigidParticleSystem::RigidParticleSystem ( Device *  device = CpuDevice::instance())

The documentation for this class was generated from the following file: