AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agx::Physics::GranularBodySystem Class Reference

#include <GranularBodySystem.h>

+ Inheritance diagram for agx::Physics::GranularBodySystem:

Public Types

enum  MotionControl { KINEMATICS = 2 , DYNAMICS = 3 }
 The MotionControl enumeration indicates what makes a GranularBody in the GranularBodySystem move. More...
 
- Public Types inherited from agx::Component
typedef Event2< Component *, Object * > ObjectEvent
 Event when adding removing child objects.
 
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
 

Public Member Functions

 GranularBodySystem (Device *device=CpuDevice::instance())
 
 AGXSTREAM_DECLARE_SERIALIZABLE_BASE (agx::Physics::GranularBodySystem)
 
agx::Real calculateTotalKineticEnergy () const
 calculate total kinetic energy of the granular body system
 
Physics::GranularBodyPtr createParticle ()
 Create a new particle in the particle system.
 
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.
 
GranularBodyPtrVector getGranularBodiesInsideGeometry (const agxCollide::Geometry *geometry, bool onlyCheckForMidPoint) const
 Return all granular bodies that intersect with a specified geometry.
 
agx::Physics::GranularBodyPtrVector getGranularBodyPtrVector ()
 
agx::Physics::GranularBodyPtrVector getGranularBodyPtrVector () const
 
MotionControl getMotionControl (agx::Physics::GranularBodyPtr gptr) const
 Get the motion control of a granular body.
 
agx::Physics::GranularBodyPtrArray getParticles ()
 
const agx::Physics::GranularBodyPtrArray getParticles () const
 
agx::Vec3 getSingleParticleAngularVelocity (agx::Index particleId)
 Get angular velocity for a single particle.
 
void preAllocateParticleGeometryContactStorage (size_t numElements)
 Pre-allocate memory for elements via the reserve function in the storages related to particle-geometry contact and constraint data with specified number of elements.
 
void preAllocateParticlePairContactStorage (size_t numElements)
 Pre-allocate memory for elements via the reserve function in the storages related to particle-particle contact and constraint data with specified number of elements.
 
void preAllocateParticleStorage (size_t numElements)
 Pre-allocate memory for elements via the reserve function in the particle data storage with specified number of elements.
 
void setContactMode (agx::UInt contactMode)
 Set the contact mode of the GranularBodySystem.
 
void setMotionControl (agx::Physics::GranularBodyPtr gptr, MotionControl motionControl)
 Set motion control of the granular body.
 
virtual void setParticleMass (Real mass, bool updateExistingParticles=false) override
 Set granular body mass and inertia.
 
void setSingleParticleAngularVelocity (agx::Index particleId, const agx::Vec3 &angularVelocity)
 Set angular velocity for a single particle.
 
virtual void setSingleParticleRadius (agx::Index particleId, agx::Real radius) override
 Set single particle radius given a specified id.
 
virtual bool setUpdateTask (Task *updateTask) override
 Set the task that will be executed whenever it is time to step the simulation.
 
- 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.
 
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.
 
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.
 
void addCustomBufferReal (const agx::String &buffername)
 Adds a custom attribute Real buffer for the particle system.
 
void addCustomBufferReal32 (const agx::String &buffername)
 Adds a custom attribute Real32 buffer for the particle system.
 
void addCustomBufferVec3 (const agx::String &buffername)
 Adds a custom attribute Vec3 buffer for the particle system.
 
virtual void addNotification (agxSDK::Simulation *simulation)
 Triggers when particlesystem is added to the simulation.
 
void applyAirForceDragSimple (agx::Real cd, agx::Real cr)
 Apply air drag to the particles according to formula: cd * velocity^2 + cr * velocity.
 
void attach ()
 Binds relevant buffer pointers to objects after inserting the particle system into the simulation.
 
agx::Real calculateMeanRadius () const
 Returns the calculated mean radius of all the particles. Will return 0 if the system contains no particles.
 
agx::Real calculateTotalParticleMass () const
 Calculates the total particle mass in the particle system.
 
agx::Real calculateTotalParticleVolume () const
 
void clearAllParticles ()
 Utility method for clearing all particles in the particle system.
 
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.
 
void commitAllBuffers ()
 Executes the "commit" command all buffers in the particle system.
 
void commitColorBuffer ()
 Executes the "commit" command on the buffer so that particle rendering can be updated properly.
 
Physics::ParticlePtr createParticle ()
 Create a new particle in the particle system.
 
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.
 
void destroyParticle (Physics::ParticlePtr particle)
 Destroy a particle.
 
void destroyParticles (agxData::EntityRange particles)
 Destroy a range of particles.
 
void destroyParticles (const agxData::EntityPtrVector &particles)
 
void destroyParticles (const Physics::ParticlePtrVector &particles)
 Destroy a list of particles.
 
virtual void destroySingleParticle (agx::Index particleId)
 Destroy particle with specified id.
 
void detach ()
 Unbinds relevant buffer pointers from objects after removing the particle system into the simulation.
 
void evaluateParticleDefaultMass ()
 This should be called if the density of the bulk material is changed, so the particle default mass is updated accordingly.
 
agx::Physics::CollisionGroupSetPtr getCollisionGroupSet () const
 
agx::Int getCustomBufferValueInt (agx::Index id, const agx::String &buffername)
 Returns a custom Int buffer value from a particle.
 
agx::Real getCustomBufferValueReal (agx::Index id, const agx::String &buffername)
 Returns a custom Real buffer value from a particle.
 
agx::Real32 getCustomBufferValueReal32 (agx::Index id, const agx::String &buffername)
 Returns a custom Real32 buffer value from a particle.
 
agx::Vec3 getCustomBufferValueVec3 (agx::Index id, const agx::String &buffername)
 Returns a custom Vec3 buffer value from a particle.
 
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.
 
size_t getNumActiveParticleParticleContacts ()
 Returns the number of ACTIVE particle-particle contacts, after the last conducted contact filtering.
 
size_t getNumParticleGeometryContacts ()
 Returns the number of particle-geometry contacts.
 
size_t getNumParticleParticleContacts ()
 Returns the number of particle-particle contacts.
 
size_t getNumParticles () const
 
Physics::ParticlePtr getParticle (agx::Index particleId)
 Returns a particle from the particle system given a particle id.
 
const agx::Bound3 & getParticleBound ()
 
agx::Vector< agx::Physics::ParticleGeometryContactPtr > getParticleGeometryContacts ()
 Returns the current ParticleGeometryContacts in the simulation.
 
agxData::EntityStorage * getParticleGeometryContactStorage ()
 
agx::Index getParticleIdFromIndex (agx::Index index) const
 Return the particle id for the specified particle entity array index.
 
Real getParticleMass () const
 
agxData::EntityStorage * getParticlePairContactStorage ()
 
agx::Vector< agx::Physics::ParticlePairContactPtr > getParticleParticleContacts ()
 Returns the current ParticleParticle contacts in the simulation.
 
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.
 
virtual agx::Vec3 getSingleParticleForce (agx::Index particleId)
 Get particle velocity with specified id.
 
virtual agx::Real getSingleParticleMass (agx::Index particleId)
 Get particle radius with specified id.
 
virtual agx::Vec3 getSingleParticlePosition (agx::Index particleId)
 Get particle position with specified id.
 
virtual agx::Real getSingleParticleRadius (agx::Index particleId)
 Get particle radius with specified id.
 
virtual agx::Vec3 getSingleParticleVelocity (agx::Index particleId)
 Get particle velocity with specified id.
 
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.
 
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.
 
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.
 
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.
 
void removeCollisionGroup (agx::UInt32 id, bool updateExistingParticles=true)
 Remove a group id from the vector of group ids.
 
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.
 
void removeCollisionGroupParticle (const agx::Name &id, agx::Physics::ParticlePtr ptr)
 
bool removeParticle (Physics::ParticlePtr particle)
 Tag a particle for removal at the end of the time step.
 
agx::Physics::ParticlePtrVector removeParticlesOutsideBound (const agx::Bound3 &bound)
 Removes and returns particles in the specified particle system outside the given 3D bound.
 
void setCustomBufferValueInt (agx::Index id, const agx::String &buffername, agx::Int val)
 Sets a custom Int buffer value to a particle.
 
void setCustomBufferValueReal (agx::Index id, const agx::String &buffername, agx::Real val)
 Sets a custom Real buffer value to a particle.
 
void setCustomBufferValueReal32 (agx::Index id, const agx::String &buffername, agx::Real32 val)
 Sets a custom Real32 buffer value to a particle.
 
void setCustomBufferValueVec3 (agx::Index id, const agx::String &buffername, agx::Vec3 val)
 Sets a custom Vec3 buffer value to a particle.
 
void setEnableCollisions (const agxCollide::Geometry *geometry, bool flag)
 Specify whether otherGeometry is allowed to collide with this geometry.
 
void setMaterial (Material *material, bool updateExistingParticles=false)
 Set the default particle material.
 
virtual void setParticleMass (Real mass, bool updateExistingParticles=false)
 Set particle mass.
 
void setParticleRadius (Real radius, bool updateExistingParticles=false)
 Set the default particle radius of created particles, with option of updating existing particles.
 
virtual void setSingleParticleColor (agx::Index particleId, const agx::Vec4f &color)
 Set particle color with specified id.
 
virtual void setSingleParticleForce (agx::Index particleId, const agx::Vec3 &force)
 Set particle force with specified id.
 
virtual void setSingleParticleMass (agx::Index particleId, agx::Real mass)
 Set particle radius with specified id.
 
virtual void setSingleParticleRadius (agx::Index particleId, agx::Real radius)
 Set particle radius with specified id.
 
virtual void setSingleParticleVelocity (agx::Index particleId, const agx::Vec3 &velocity)
 Set particle velocity with specified id.
 
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.
 
agxData::EntityRange spawnParticles (const agx::Vec3Vector &positions)
 Spawn particles with defined positions.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
Vec3 sumForceMagnitudes (RigidBody *body)
 Sums force magnitudes from particle system onto rigid body.
 
void updateShouldRender ()
 Update the shouldRender variable in particles given renders states such as clipping and filtering.
 
- 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.
 
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
 Returns All child objects of a specified type in the result container.
 
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.
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component.
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component.
 
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)
 
virtual void buildNavigationTree (agxJson::Value &eNode) const
 
virtual void configure (TiXmlElement *)
 
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
 
virtual agx::Object * getResourceImpl (const agx::Path &path, agx::Model *model)
 
agx::Object * getRootContext ()
 
const agx::Object * getRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
virtual void printSubtree () const
 
virtual void rebind ()
 
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).
 
void setName (const agx::Name &name)
 Set the name of the object.
 
virtual void snapshot (TiXmlNode *, const String &) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
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.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

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.
 
static void copyGranularBodyData (agx::Physics::GranularBodyPtr target, agx::Physics::GranularBodyPtr source, bool copyMaterial=true)
 Copy data from GranularBody source to target body.
 
static agxStream::Serializable * create (agxStream::InputArchive &)
 
static bool isGranularBodySystem (agx::ParticleSystem *system)
 Checks if a particle system is a granular body system by either class or by internal models.
 
- 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.
 
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).
 
- 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.
 

Protected Member Functions

virtual ~GranularBodySystem ()
 
void init ()
 
void invalidLicenseCallback ()
 
- 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.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Additional Inherited Members

- 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
 
- 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.
 
- 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

Definition at line 32 of file GranularBodySystem.h.

Member Enumeration Documentation

◆ MotionControl

The MotionControl enumeration indicates what makes a GranularBody in the GranularBodySystem move.

There are two forms of motion allowed:

  • KINEMATICS means that motion is scripted;
  • DYNAMICS means that motion results from forces;
Enumerator
KINEMATICS 

This Granular Body's motion is scripted.

(Position/velocity set by the user)

DYNAMICS 

This Granular Body moves from the influence of forces.

(Position/velocity updated by the system)

Definition at line 42 of file GranularBodySystem.h.

Constructor & Destructor Documentation

◆ GranularBodySystem()

agx::Physics::GranularBodySystem::GranularBodySystem ( Device *  device = CpuDevice::instance())

◆ ~GranularBodySystem()

virtual agx::Physics::GranularBodySystem::~GranularBodySystem ( )
protectedvirtual

Member Function Documentation

◆ AGXSTREAM_DECLARE_SERIALIZABLE_BASE()

agx::Physics::GranularBodySystem::AGXSTREAM_DECLARE_SERIALIZABLE_BASE ( agx::Physics::GranularBodySystem  )

◆ applyTransform()

static void agx::Physics::GranularBodySystem::applyTransform ( agx::Physics::GranularBodyPtr  gptr,
const agx::AffineMatrix4x4 &  transform,
bool  includeVelocity = false 
)
static

Apply a 4x4 transform on a particle.

◆ calculateTotalKineticEnergy()

agx::Real agx::Physics::GranularBodySystem::calculateTotalKineticEnergy ( ) const

calculate total kinetic energy of the granular body system

◆ convertGranularBodyToRigidBody()

static agx::RigidBody * agx::Physics::GranularBodySystem::convertGranularBodyToRigidBody ( agx::Physics::GranularBodyPtr  gptr)
static

Convert a granular body to a rigid body.

◆ copyGranularBodyData()

static void agx::Physics::GranularBodySystem::copyGranularBodyData ( agx::Physics::GranularBodyPtr  target,
agx::Physics::GranularBodyPtr  source,
bool  copyMaterial = true 
)
static

Copy data from GranularBody source to target body.

◆ create()

static agxStream::Serializable * agx::Physics::GranularBodySystem::create ( agxStream::InputArchive &  )
inlinestatic

Definition at line 170 of file GranularBodySystem.h.

◆ createParticle()

Physics::GranularBodyPtr agx::Physics::GranularBodySystem::createParticle ( )

Create a new particle in the particle system.

Definition at line 182 of file GranularBodySystem.h.

References agx::ParticleSystem::createParticle().

◆ filterBodiesInGeometry()

GranularBodyPtrVector agx::Physics::GranularBodySystem::filterBodiesInGeometry ( const agxCollide::Geometry *  geometry,
const GranularBodyPtrVector &  granularBodies,
bool  onlyCheckForMidPoint 
) const

Return a subset of specified granular bodies that intersect with a specified geometry.

Parameters
geometry- The geometry that will be used in the intersection test.
granularBodies- vector containing all granular bodies that should be tested against the specified geometry.
onlyCheckForMidPoint- True if only the midpoint of the granular body should be used in the intersection test, false if the radius should be included.
Returns
vector containing the subset of the specified granular bodies that intersect with the specified geometry.

◆ getGranularBodiesInsideGeometry()

GranularBodyPtrVector agx::Physics::GranularBodySystem::getGranularBodiesInsideGeometry ( const agxCollide::Geometry *  geometry,
bool  onlyCheckForMidPoint 
) const

Return all granular bodies that intersect with a specified geometry.

Parameters
geometry- The geometry that will be used in the intersection test.
onlyCheckForMidPoint- True if only the midpoint of the granular body should be used in the intersection test, false if the radius should be included.
Returns
vector containing the subset of the specified granular bodies that are inside the specified geometry.

◆ getGranularBodyPtrVector() [1/2]

agx::Physics::GranularBodyPtrVector agx::Physics::GranularBodySystem::getGranularBodyPtrVector ( )

◆ getGranularBodyPtrVector() [2/2]

agx::Physics::GranularBodyPtrVector agx::Physics::GranularBodySystem::getGranularBodyPtrVector ( ) const

◆ getMotionControl()

MotionControl agx::Physics::GranularBodySystem::getMotionControl ( agx::Physics::GranularBodyPtr  gptr) const

Get the motion control of a granular body.

◆ getParticles() [1/2]

agx::Physics::GranularBodyPtrArray agx::Physics::GranularBodySystem::getParticles ( )

◆ getParticles() [2/2]

const agx::Physics::GranularBodyPtrArray agx::Physics::GranularBodySystem::getParticles ( ) const
Returns
All active particles in the particle system (only valid until storage is modified, e.g. by deleting a particle).

Definition at line 184 of file GranularBodySystem.h.

References getParticles().

Referenced by getParticles().

◆ getSingleParticleAngularVelocity()

agx::Vec3 agx::Physics::GranularBodySystem::getSingleParticleAngularVelocity ( agx::Index  particleId)

Get angular velocity for a single particle.

◆ init()

void agx::Physics::GranularBodySystem::init ( )
protected

◆ invalidLicenseCallback()

void agx::Physics::GranularBodySystem::invalidLicenseCallback ( )
protected

◆ isGranularBodySystem()

static bool agx::Physics::GranularBodySystem::isGranularBodySystem ( agx::ParticleSystem *  system)
static

Checks if a particle system is a granular body system by either class or by internal models.

◆ preAllocateParticleGeometryContactStorage()

void agx::Physics::GranularBodySystem::preAllocateParticleGeometryContactStorage ( size_t  numElements)

Pre-allocate memory for elements via the reserve function in the storages related to particle-geometry contact and constraint data with specified number of elements.

Parameters
numElements- the number of elements to pre-allocate in the storage.

◆ preAllocateParticlePairContactStorage()

void agx::Physics::GranularBodySystem::preAllocateParticlePairContactStorage ( size_t  numElements)

Pre-allocate memory for elements via the reserve function in the storages related to particle-particle contact and constraint data with specified number of elements.

Parameters
numElements- the number of elements to pre-allocate in the storage.

◆ preAllocateParticleStorage()

void agx::Physics::GranularBodySystem::preAllocateParticleStorage ( size_t  numElements)

Pre-allocate memory for elements via the reserve function in the particle data storage with specified number of elements.

Parameters
numElements- the number of elements to pre-allocate in the particle storage.

◆ setContactMode()

void agx::Physics::GranularBodySystem::setContactMode ( agx::UInt  contactMode)

Set the contact mode of the GranularBodySystem.

(Default is 4) 2 - Only friction and normal forces are calculated in the granular contacts. 3 - Normal, friction and rolling resistance forces are calculated in the granular contacts. 4 - Normal, friction, rolling resistance and twisting resistance forces are calculated in the granular contacts.

◆ setMotionControl()

void agx::Physics::GranularBodySystem::setMotionControl ( agx::Physics::GranularBodyPtr  gptr,
MotionControl  motionControl 
)

Set motion control of the granular body.

◆ setParticleMass()

virtual void agx::Physics::GranularBodySystem::setParticleMass ( Real  mass,
bool  updateExistingParticles = false 
)
overridevirtual

Set granular body mass and inertia.

Note that the default mass is normally derived from the default material of the granular system when granular bodies are created. This function is used to set the default value of the mass and inertia buffers and also to manually set the mass and inertia on all granular bodies.

Note
- Setting a material on either the granular system or an individual granular bodies will override this mass value.
Parameters
mass- the specified mass to set as default and to all existing granular bodies if that option is used.
updateExistingParticles- true if the mass and inertia of all existing bodies should be updated, false otherwise. ( Default: false )

Reimplemented from agx::ParticleSystem.

◆ setSingleParticleAngularVelocity()

void agx::Physics::GranularBodySystem::setSingleParticleAngularVelocity ( agx::Index  particleId,
const agx::Vec3 &  angularVelocity 
)

Set angular velocity for a single particle.

◆ setSingleParticleRadius()

virtual void agx::Physics::GranularBodySystem::setSingleParticleRadius ( agx::Index  particleId,
agx::Real  radius 
)
overridevirtual

Set single particle radius given a specified id.

Reimplemented from agx::ParticleSystem.

◆ setUpdateTask()

virtual bool agx::Physics::GranularBodySystem::setUpdateTask ( Task *  updateTask)
overridevirtual

Set the task that will be executed whenever it is time to step the simulation.

Reimplemented from agx::ParticleSystem.


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