AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
agx::ParticleSystem Class Reference

A basic particle system that contains all the storages and buffers required for basic operation and also a rendering task. More...

#include <ParticleSystem.h>

+ Inheritance diagram for agx::ParticleSystem:

Classes

class  MaterialUuidBufferListener
 
class  UpdateRenderingListener
 

Public Member Functions

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::GeometryHashVectorgetDisabledCollisions () const
 
bool getEnableCollisions (const agxCollide::Geometry *geometry) const
 
agxData::EntityStoragegetGeometryParticleContactListStorage ()
 
MaterialgetMaterial ()
 
const MaterialgetMaterial () 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::Bound3getParticleBound ()
 
agx::Vector< agx::Physics::ParticleGeometryContactPtrgetParticleGeometryContacts ()
 Returns the current ParticleGeometryContacts in the simulation.
 
agxData::EntityStoragegetParticleGeometryContactStorage ()
 
agx::Index getParticleIdFromIndex (agx::Index index) const
 Return the particle id for the specified particle entity array index.
 
Real getParticleMass () const
 
agxData::EntityStoragegetParticlePairContactStorage ()
 
agx::Vector< agx::Physics::ParticlePairContactPtrgetParticleParticleContacts ()
 Returns the current ParticleParticle contacts in the simulation.
 
Real getParticleRadius () const
 
agx::Physics::ParticlePtrArray getParticles ()
 
const agx::Physics::ParticlePtrArray getParticles () const
 
agxData::EntityStoragegetParticleStorage ()
 
const agxData::EntityStoragegetParticleStorage () 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 ()
 
TaskgetUpdateTask ()
 
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::DevicegetDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::DevicegetDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::ObjectgetObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::ObjectgetObject (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::ObjectRefVectorgetObjects () 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 ObjectgetResourceImpl (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::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::ObjectgetContext ()
 
template<typename T >
T * getContext ()
 
const agx::ObjectgetContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::NamegetImplementationName () const
 
agx::ModelgetModel ()
 
const agx::ModelgetModel () const
 
const agx::NamegetName () const
 
agx::ObjectgetNextSibling ()
 
const agx::ObjectgetNextSibling () 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::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr) const
 
virtual agx::ObjectgetResourceImpl (const agx::Path &path, agx::Model *model)
 
agx::ObjectgetRootContext ()
 
const agx::ObjectgetRootContext () 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.
 
Referencedoperator= (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 ModelClassModel ()
 
- Static Public Member Functions inherited from agx::Component
static Component_load (TiXmlElement *eComponent, Device *device)
 
static agx::ModelClassModel ()
 
static Componentload (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Componentload (const String &path, const Path &_namespace=Path())
 
static Componentload (const String &path, Device *device, const Path &_namespace=Path())
 
static Componentload (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::ModelClassModel ()
 
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 Objectload (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 Objectload (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 Objectload (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 Types

typedef agx::observer_ptr< const MaterialUuidBufferListenerMaterialUuidBufferListenerConstObserver
 
typedef agx::ref_ptr< const MaterialUuidBufferListenerMaterialUuidBufferListenerConstRef
 
typedef agx::observer_ptr< MaterialUuidBufferListenerMaterialUuidBufferListenerObserver
 
typedef agx::ref_ptr< MaterialUuidBufferListenerMaterialUuidBufferListenerRef
 
typedef agx::observer_ptr< const UpdateRenderingListenerUpdateRenderingListenerConstObserver
 
typedef agx::ref_ptr< const UpdateRenderingListenerUpdateRenderingListenerConstRef
 
typedef agx::observer_ptr< UpdateRenderingListenerUpdateRenderingListenerObserver
 
typedef agx::ref_ptr< UpdateRenderingListenerUpdateRenderingListenerRef
 

Protected Member Functions

 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 ()
 

Protected Attributes

agxData::EntityStorageRef m_particleStorage
 
TaskGroupRef m_updateTask
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- 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 EventEventConstObserver
 
typedef agx::ref_ptr< const EventEventConstRef
 
typedef agx::observer_ptr< EventEventObserver
 
typedef agx::Vector< EventObserverEventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< EventEventRef
 
typedef agx::Vector< EventRefEventRefVector
 
- Public Attributes inherited from agx::Component
ObjectEvent addObjectEvent
 
ObjectEvent removeObjectEvent
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

A basic particle system that contains all the storages and buffers required for basic operation and also a rendering task.

It does not contain any update task. A simulated particle system is created by either adding an update task using setUpdateTask(Task*), or by creating one of the pre-configured particle systems available as sub-classes. Currently available are RigidParticleSystem and GranularBodySystem.

ConstraintFluid is currently disabled.

Definition at line 67 of file ParticleSystem.h.

Member Typedef Documentation

◆ MaterialUuidBufferListenerConstObserver

◆ MaterialUuidBufferListenerConstRef

◆ MaterialUuidBufferListenerObserver

◆ MaterialUuidBufferListenerRef

◆ UpdateRenderingListenerConstObserver

◆ UpdateRenderingListenerConstRef

◆ UpdateRenderingListenerObserver

◆ UpdateRenderingListenerRef

Constructor & Destructor Documentation

◆ ParticleSystem() [1/2]

agx::ParticleSystem::ParticleSystem ( const String model,
Device device = CpuDevice::instance() 
)
protected

◆ ParticleSystem() [2/2]

agx::ParticleSystem::ParticleSystem ( )
protected

◆ ~ParticleSystem()

virtual agx::ParticleSystem::~ParticleSystem ( )
protectedvirtual

Member Function Documentation

◆ _setGravityTask()

void agx::ParticleSystem::_setGravityTask ( Task task)

◆ addCollisionGroup() [1/2]

void agx::ParticleSystem::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.

Returns
true if the ParticleSystem can collide with a specified geometry.

Following has to be true to make this method return true.

  • if they belong to a group pair that is not disabled
  • collisions for g1 is not disabled against g2 (g1->setEnableCollisions(g2, false) By default the particles are not part of any group.

This can be used to partition the simulation where some groups cannot collide with other groups. Which groups that can collide or not is determined by Space and can be set using the method agxCollide::Space::setEnablePair( id1, id2, enable );

◆ addCollisionGroup() [2/2]

void agx::ParticleSystem::addCollisionGroup ( const agx::Name id,
bool  updateExistingParticles = true 
)

◆ addCollisionGroupParticle() [1/2]

void agx::ParticleSystem::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.

By default the specific particle is not part of any group.

This can be used to partition the simulation where some groups cannot collide with other groups. Which groups that can collide or not is determined by Space and can be set using the method agxCollide::Space::setEnablePair( id1, id2, enable );

◆ addCollisionGroupParticle() [2/2]

void agx::ParticleSystem::addCollisionGroupParticle ( const agx::Name id,
agx::Physics::ParticlePtr  ptr 
)

◆ addCustomBufferInt()

void agx::ParticleSystem::addCustomBufferInt ( const agx::String buffername)

Adds a custom attribute Int buffer for the particle system.

Allows for setting custom properties of type Int for each particle in the particle system.

Parameters
buffernameThe name of the attribute buffer

Definition at line 825 of file ParticleSystem.h.

◆ addCustomBufferReal()

void agx::ParticleSystem::addCustomBufferReal ( const agx::String buffername)

Adds a custom attribute Real buffer for the particle system.

Allows for setting custom properties of type Real for each particle in the particle system.

Parameters
buffernameThe name of the attribute buffer

Definition at line 820 of file ParticleSystem.h.

◆ addCustomBufferReal32()

void agx::ParticleSystem::addCustomBufferReal32 ( const agx::String buffername)

Adds a custom attribute Real32 buffer for the particle system.

Allows for setting custom properties of type Real32 for each particle in the particle system.

Parameters
buffernameThe name of the attribute buffer

Definition at line 830 of file ParticleSystem.h.

◆ addCustomBufferVec3()

void agx::ParticleSystem::addCustomBufferVec3 ( const agx::String buffername)

Adds a custom attribute Vec3 buffer for the particle system.

Allows for setting custom properties of type Vec3 for each particle in the particle system.

Parameters
buffernameThe name of the Vec3 attribute buffer to add

Definition at line 835 of file ParticleSystem.h.

◆ addNotification()

virtual void agx::ParticleSystem::addNotification ( agxSDK::Simulation simulation)
virtual

Triggers when particlesystem is added to the simulation.

◆ applyAirForceDragSimple()

void agx::ParticleSystem::applyAirForceDragSimple ( agx::Real  cd,
agx::Real  cr 
)

Apply air drag to the particles according to formula: cd * velocity^2 + cr * velocity.

◆ attach()

void agx::ParticleSystem::attach ( )

Binds relevant buffer pointers to objects after inserting the particle system into the simulation.

◆ calculateMeanRadius()

agx::Real agx::ParticleSystem::calculateMeanRadius ( ) const

Returns the calculated mean radius of all the particles. Will return 0 if the system contains no particles.

◆ calculateTotalParticleMass()

agx::Real agx::ParticleSystem::calculateTotalParticleMass ( ) const

Calculates the total particle mass in the particle system.

◆ calculateTotalParticleVolume()

agx::Real agx::ParticleSystem::calculateTotalParticleVolume ( ) const

◆ ClassModel()

static Model * agx::ParticleSystem::ClassModel ( )
static

◆ clearAllParticles()

void agx::ParticleSystem::clearAllParticles ( )

Utility method for clearing all particles in the particle system.

◆ clearContactData()

void agx::ParticleSystem::clearContactData ( )

◆ colorParticlesWithLevelsInBound()

void agx::ParticleSystem::colorParticlesWithLevelsInBound ( const agx::Bound3 bound,
const agx::Vec4fVector colors 
)

Colors particles with different levels in the vertical z-direction inside a specified bound.

Parameters
boundThe bound that is used to color the particles
colorsVector containing the colors that will be used in the coloring

◆ commitAllBuffers()

void agx::ParticleSystem::commitAllBuffers ( )

Executes the "commit" command all buffers in the particle system.

This is necessary if the raw data buffers been modified during a simulation where a journal is recorded.

◆ commitColorBuffer()

void agx::ParticleSystem::commitColorBuffer ( )

Executes the "commit" command on the buffer so that particle rendering can be updated properly.

◆ createParticle()

Physics::ParticlePtr agx::ParticleSystem::createParticle ( )

Create a new particle in the particle system.

Referenced by agx::Physics::GranularBodySystem::createParticle().

◆ createParticleGeometryContact()

agx::Physics::ParticleGeometryContactPtr agx::ParticleSystem::createParticleGeometryContact ( agx::Physics::ParticlePtr  particle,
agx::Physics::GeometryPtr  geometry 
)

◆ createParticlePairContact()

agx::Physics::ParticlePairContactPtr agx::ParticleSystem::createParticlePairContact ( agx::Physics::ParticlePtr  p1,
agx::Physics::ParticlePtr  p2 
)

◆ createParticles()

agxData::EntityRange agx::ParticleSystem::createParticles ( size_t  numParticles)

Create a set of particles in the particle system.

◆ destroyParticle()

void agx::ParticleSystem::destroyParticle ( Physics::ParticlePtr  particle)

Destroy a particle.

◆ destroyParticles() [1/3]

void agx::ParticleSystem::destroyParticles ( agxData::EntityRange  particles)

Destroy a range of particles.

◆ destroyParticles() [2/3]

void agx::ParticleSystem::destroyParticles ( const agxData::EntityPtrVector particles)

◆ destroyParticles() [3/3]

void agx::ParticleSystem::destroyParticles ( const Physics::ParticlePtrVector particles)

Destroy a list of particles.

◆ destroySingleParticle()

virtual void agx::ParticleSystem::destroySingleParticle ( agx::Index  particleId)
virtual

Destroy particle with specified id.

◆ detach()

void agx::ParticleSystem::detach ( )

Unbinds relevant buffer pointers from objects after removing the particle system into the simulation.

◆ evaluateParticleDefaultMass()

void agx::ParticleSystem::evaluateParticleDefaultMass ( )

This should be called if the density of the bulk material is changed, so the particle default mass is updated accordingly.

◆ getCollisionGroupSet()

agx::Physics::CollisionGroupSetPtr agx::ParticleSystem::getCollisionGroupSet ( ) const
inline
Returns
a GroupSet with all the group id:s for the particle system

Definition at line 817 of file ParticleSystem.h.

◆ getCustomBufferValueInt()

agx::Int agx::ParticleSystem::getCustomBufferValueInt ( agx::Index  id,
const agx::String buffername 
)

Returns a custom Int buffer value from a particle.

Parameters
idId of the particle
buffernameThe name of the custom Int attribute buffer
Returns
The custom Int value of the particle.

Definition at line 827 of file ParticleSystem.h.

◆ getCustomBufferValueReal()

agx::Real agx::ParticleSystem::getCustomBufferValueReal ( agx::Index  id,
const agx::String buffername 
)

Returns a custom Real buffer value from a particle.

Parameters
idId of the particle
buffernameThe name of the custom Real attribute buffer
Returns
The custom Real value of the particle.

Definition at line 822 of file ParticleSystem.h.

◆ getCustomBufferValueReal32()

agx::Real32 agx::ParticleSystem::getCustomBufferValueReal32 ( agx::Index  id,
const agx::String buffername 
)

Returns a custom Real32 buffer value from a particle.

Parameters
idId of the particle
buffernameThe name of the custom Real32 attribute buffer
Returns
The custom Real value of the particle.

Definition at line 832 of file ParticleSystem.h.

◆ getCustomBufferValueVec3()

agx::Vec3 agx::ParticleSystem::getCustomBufferValueVec3 ( agx::Index  id,
const agx::String buffername 
)

Returns a custom Vec3 buffer value from a particle.

Parameters
idId of the particle
buffernameThe name of the custom Vec3 attribute buffer
Returns
The custom Vec3 value of the particle.

Definition at line 837 of file ParticleSystem.h.

◆ getDisabledCollisions()

const agxCollide::GeometryHashVector & agx::ParticleSystem::getDisabledCollisions ( ) const
Returns
The set of disabled geometry collisions.

Definition at line 815 of file ParticleSystem.h.

◆ getEnableCollisions()

bool agx::ParticleSystem::getEnableCollisions ( const agxCollide::Geometry geometry) const
Returns
true if this geometry is allowed to collide with geometry.

◆ getGeometryParticleContactListStorage()

agxData::EntityStorage * agx::ParticleSystem::getGeometryParticleContactListStorage ( )
Returns
The storage for Geometry-Particle contact lists.

Definition at line 812 of file ParticleSystem.h.

◆ getMaterial() [1/2]

Material * agx::ParticleSystem::getMaterial ( )
Returns
The default particle material of created particles.

◆ getMaterial() [2/2]

const Material * agx::ParticleSystem::getMaterial ( ) const

◆ getNumActiveParticleGeometryContacts()

size_t agx::ParticleSystem::getNumActiveParticleGeometryContacts ( )

Returns the number of ACTIVE particle-geometry contacts, after the last conducted contact filtering.

◆ getNumActiveParticleParticleContacts()

size_t agx::ParticleSystem::getNumActiveParticleParticleContacts ( )

Returns the number of ACTIVE particle-particle contacts, after the last conducted contact filtering.

◆ getNumParticleGeometryContacts()

size_t agx::ParticleSystem::getNumParticleGeometryContacts ( )

Returns the number of particle-geometry contacts.

◆ getNumParticleParticleContacts()

size_t agx::ParticleSystem::getNumParticleParticleContacts ( )

Returns the number of particle-particle contacts.

◆ getNumParticles()

size_t agx::ParticleSystem::getNumParticles ( ) const
Returns
The current number of particles in the system.

◆ getParticle()

Physics::ParticlePtr agx::ParticleSystem::getParticle ( agx::Index  particleId)

Returns a particle from the particle system given a particle id.

◆ getParticleBound()

const agx::Bound3 & agx::ParticleSystem::getParticleBound ( )

◆ getParticleGeometryContacts()

agx::Vector< agx::Physics::ParticleGeometryContactPtr > agx::ParticleSystem::getParticleGeometryContacts ( )

Returns the current ParticleGeometryContacts in the simulation.

◆ getParticleGeometryContactStorage()

agxData::EntityStorage * agx::ParticleSystem::getParticleGeometryContactStorage ( )
Returns
The storage for Particle-Geometry contacts.

Definition at line 811 of file ParticleSystem.h.

◆ getParticleIdFromIndex()

agx::Index agx::ParticleSystem::getParticleIdFromIndex ( agx::Index  index) const

Return the particle id for the specified particle entity array index.

Parameters
index- specified entity array index.
Returns
the particle id given a specified entity array index. Will return InvalidIndex if index is outside array range.

◆ getParticleMass()

Real agx::ParticleSystem::getParticleMass ( ) const
Returns
The default particle mass. By default, the mass is derived from the assigned default agx::Material of the system.

◆ getParticlePairContactStorage()

agxData::EntityStorage * agx::ParticleSystem::getParticlePairContactStorage ( )
Returns
The storage for the particle pair contacts.

Definition at line 813 of file ParticleSystem.h.

◆ getParticleParticleContacts()

agx::Vector< agx::Physics::ParticlePairContactPtr > agx::ParticleSystem::getParticleParticleContacts ( )

Returns the current ParticleParticle contacts in the simulation.

◆ getParticleRadius()

Real agx::ParticleSystem::getParticleRadius ( ) const
Returns
The default particle radius of created particles.

◆ getParticles() [1/2]

agx::Physics::ParticlePtrArray agx::ParticleSystem::getParticles ( )

Definition at line 804 of file ParticleSystem.h.

◆ getParticles() [2/2]

const agx::Physics::ParticlePtrArray agx::ParticleSystem::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 799 of file ParticleSystem.h.

◆ getParticleStorage() [1/2]

agxData::EntityStorage * agx::ParticleSystem::getParticleStorage ( )
Returns
The storage where the particle data is stored.

Definition at line 809 of file ParticleSystem.h.

Referenced by agx::Physics::GranularBodySystem::getParticles().

◆ getParticleStorage() [2/2]

const agxData::EntityStorage * agx::ParticleSystem::getParticleStorage ( ) const
Returns
The storage where the particle data is stored.

Definition at line 810 of file ParticleSystem.h.

◆ getSingleParticleColor()

virtual agx::Vec4f agx::ParticleSystem::getSingleParticleColor ( agx::Index  particleId)
virtual

Get particle color with specified id.

◆ getSingleParticleForce()

virtual agx::Vec3 agx::ParticleSystem::getSingleParticleForce ( agx::Index  particleId)
virtual

Get particle velocity with specified id.

◆ getSingleParticleMass()

virtual agx::Real agx::ParticleSystem::getSingleParticleMass ( agx::Index  particleId)
virtual

Get particle radius with specified id.

◆ getSingleParticlePosition()

virtual agx::Vec3 agx::ParticleSystem::getSingleParticlePosition ( agx::Index  particleId)
virtual

Get particle position with specified id.

◆ getSingleParticleRadius()

virtual agx::Real agx::ParticleSystem::getSingleParticleRadius ( agx::Index  particleId)
virtual

Get particle radius with specified id.

◆ getSingleParticleVelocity()

virtual agx::Vec3 agx::ParticleSystem::getSingleParticleVelocity ( agx::Index  particleId)
virtual

Get particle velocity with specified id.

◆ getTotalParticleGeometryContactForces()

agx::Real agx::ParticleSystem::getTotalParticleGeometryContactForces ( )

◆ getTotalParticleParticleContactForces()

agx::Real agx::ParticleSystem::getTotalParticleParticleContactForces ( )

◆ getUpdateTask()

Task * agx::ParticleSystem::getUpdateTask ( )
Returns
The current update task.

Definition at line 797 of file ParticleSystem.h.

◆ hasCollisionGroup() [1/2]

bool agx::ParticleSystem::hasCollisionGroup ( agx::UInt32  id) const

This is performing a linear search among the group id for this particle.

Parameters
id- The group id we are looking for.
Returns
true if the Geometry is part of the group id

◆ hasCollisionGroup() [2/2]

bool agx::ParticleSystem::hasCollisionGroup ( const agx::Name id) const

◆ hasCollisionGroupParticle() [1/2]

bool agx::ParticleSystem::hasCollisionGroupParticle ( agx::UInt32  id,
agx::Physics::ParticlePtr  ptr 
) const

This is performing a linear search among the group id for this particle.

Parameters
id- The group id we are looking for.
Returns
true if the Geometry is part of the group id

◆ hasCollisionGroupParticle() [2/2]

bool agx::ParticleSystem::hasCollisionGroupParticle ( const agx::Name id,
agx::Physics::ParticlePtr  ptr 
) const

◆ hasCustomBuffer()

bool agx::ParticleSystem::hasCustomBuffer ( const agx::String buffername,
const agx::String formatName 
)

Returns true if the particle system has a buffer with the specified name and format.

◆ init()

void agx::ParticleSystem::init ( bool  createMaterial = true)
protected

◆ invalidLicenseCallback()

void agx::ParticleSystem::invalidLicenseCallback ( )
protected

◆ isParticleGeometryContactValid()

bool agx::ParticleSystem::isParticleGeometryContactValid ( Physics::ParticleGeometryContactPtr  contact)
Returns
true if particle geometry contact is valid

◆ isParticlePairContactValid()

bool agx::ParticleSystem::isParticlePairContactValid ( Physics::ParticlePairContactPtr  contact)
Returns
true if particle-particle contact is valid

◆ isValid()

bool agx::ParticleSystem::isValid ( Physics::ParticlePtr  particle) const
Returns
true if particle is not destroyed or marked to be removed

◆ particleExistsWithId()

bool agx::ParticleSystem::particleExistsWithId ( agx::Index  id)

Check if there is a particle with a specified id.

◆ removeCollisionGroup() [1/2]

void agx::ParticleSystem::removeCollisionGroup ( agx::UInt32  id,
bool  updateExistingParticles = true 
)

Remove a group id from the vector of group ids.

Parameters
id- The group id to be removed

◆ removeCollisionGroup() [2/2]

void agx::ParticleSystem::removeCollisionGroup ( const agx::Name id,
bool  updateExistingParticles = true 
)

◆ removeCollisionGroupParticle() [1/2]

void agx::ParticleSystem::removeCollisionGroupParticle ( agx::UInt32  id,
agx::Physics::ParticlePtr  ptr 
)

Remove a group id from the vector of group ids.

Parameters
id- The group id to be removed

◆ removeCollisionGroupParticle() [2/2]

void agx::ParticleSystem::removeCollisionGroupParticle ( const agx::Name id,
agx::Physics::ParticlePtr  ptr 
)

◆ removeParticle()

bool agx::ParticleSystem::removeParticle ( Physics::ParticlePtr  particle)

Tag a particle for removal at the end of the time step.

Parameters
particle- the specified particlePtr to mark for removal.
Returns
- true if particle was successfully removed, false otherwise.
Note
- This is a more preferable way to remove particles than destroyParticle since it will not change the internal particle data structure during the time step

◆ removeParticlesOutsideBound()

agx::Physics::ParticlePtrVector agx::ParticleSystem::removeParticlesOutsideBound ( const agx::Bound3 bound)

Removes and returns particles in the specified particle system outside the given 3D bound.

Parameters
bound- the specified 3D bound which all particle center positions will be tested against.
Returns
a vector with the successfully removed particles.

◆ setCollisionGroupSet()

void agx::ParticleSystem::setCollisionGroupSet ( agx::Physics::CollisionGroupSetPtr  )
protected

◆ setCustomBufferValueInt()

void agx::ParticleSystem::setCustomBufferValueInt ( agx::Index  id,
const agx::String buffername,
agx::Int  val 
)

Sets a custom Int buffer value to a particle.

Parameters
idId of the particle
buffernameThe name of the custom Int attribute buffer
valThe Int value to be set on the particle

Definition at line 826 of file ParticleSystem.h.

◆ setCustomBufferValueReal()

void agx::ParticleSystem::setCustomBufferValueReal ( agx::Index  id,
const agx::String buffername,
agx::Real  val 
)

Sets a custom Real buffer value to a particle.

Parameters
idId of the particle
buffernameThe name of the custom Real attribute buffer
valThe Real value to be set on the particle

Definition at line 821 of file ParticleSystem.h.

◆ setCustomBufferValueReal32()

void agx::ParticleSystem::setCustomBufferValueReal32 ( agx::Index  id,
const agx::String buffername,
agx::Real32  val 
)

Sets a custom Real32 buffer value to a particle.

Parameters
idId of the particle
buffernameThe name of the custom Real attribute buffer
valThe Real32 value to be set on the particle

Definition at line 831 of file ParticleSystem.h.

◆ setCustomBufferValueVec3()

void agx::ParticleSystem::setCustomBufferValueVec3 ( agx::Index  id,
const agx::String buffername,
agx::Vec3  val 
)

Sets a custom Vec3 buffer value to a particle.

Parameters
idId of the particle
buffernameThe name of the custom Vec3 attribute buffer
valThe Vec3 value to be set on the particle

Definition at line 836 of file ParticleSystem.h.

◆ setEnableCollisions()

void agx::ParticleSystem::setEnableCollisions ( const agxCollide::Geometry geometry,
bool  flag 
)

Specify whether otherGeometry is allowed to collide with this geometry.

◆ setMaterial()

void agx::ParticleSystem::setMaterial ( Material material,
bool  updateExistingParticles = false 
)

Set the default particle material.

The default particle mass is derived from the density of the default material.

Note
- When updating the material of existing particles, their mass properties will be updated according to the radius of each individual particle. This will override any manual mass value that has been set to the particles.
Parameters
material- the specific material to set as the default particle material.
updateExistingParticles- true if existing particles should be updated, false otherwise. ( Default: false )

◆ setParticleMass()

virtual void agx::ParticleSystem::setParticleMass ( Real  mass,
bool  updateExistingParticles = false 
)
virtual

Set particle mass.

Note that the default particle mass is normally derived from the default material of the particle system when particles are created. This function is used to set the default value of the mass buffer and also to manually set the mass on all particles.

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

Reimplemented in agx::Physics::GranularBodySystem.

◆ setParticleRadius()

void agx::ParticleSystem::setParticleRadius ( Real  radius,
bool  updateExistingParticles = false 
)

Set the default particle radius of created particles, with option of updating existing particles.

Note
- When updating the radius of existing particles, their mass properties will be updated according to the density of each individual particle material. This will override any manual mass value that has been set to the particles.
Parameters
radius- the specified default radius to set to the particle system.
updateExistingParticles- true if the existing particles should be updated, false otherwise. ( Default: false )

◆ setRadiusOnParticles()

void agx::ParticleSystem::setRadiusOnParticles ( agxData::EntityRange entityRange,
agx::Real  radius 
)
protected

◆ setSingleParticleColor()

virtual void agx::ParticleSystem::setSingleParticleColor ( agx::Index  particleId,
const agx::Vec4f color 
)
virtual

Set particle color with specified id.

◆ setSingleParticleForce()

virtual void agx::ParticleSystem::setSingleParticleForce ( agx::Index  particleId,
const agx::Vec3 force 
)
virtual

Set particle force with specified id.

◆ setSingleParticleMass()

virtual void agx::ParticleSystem::setSingleParticleMass ( agx::Index  particleId,
agx::Real  mass 
)
virtual

Set particle radius with specified id.

◆ setSingleParticleRadius()

virtual void agx::ParticleSystem::setSingleParticleRadius ( agx::Index  particleId,
agx::Real  radius 
)
virtual

Set particle radius with specified id.

Reimplemented in agx::Physics::GranularBodySystem.

◆ setSingleParticleVelocity()

virtual void agx::ParticleSystem::setSingleParticleVelocity ( agx::Index  particleId,
const agx::Vec3 velocity 
)
virtual

Set particle velocity with specified id.

◆ setSpace()

void agx::ParticleSystem::setSpace ( agxCollide::Space space)

◆ setUpdateTask()

virtual bool agx::ParticleSystem::setUpdateTask ( Task updateTask)
virtual

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

Reimplemented in agx::Physics::GranularBodySystem.

◆ spawnParticles()

agxData::EntityRange agx::ParticleSystem::spawnParticles ( const agx::Vec3Vector positions)

Spawn particles with defined positions.

◆ spawnParticlesInBound() [1/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::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.

Parameters
boundThe specified bound to spawn in
sourceTableThe particle model distribution table used to spawn particles
spacingspacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInBound() [2/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::spawnParticlesInBound ( const agx::Bound3 bound,
Real  radius,
const agx::Vec3 spacing,
agx::Real  jitterFactor = agx::Real(0) 
)

Spawns particles in a specified bound.

Parameters
boundthe specified bound to spawn in
radiusThe radius for the new particles
spacingspacing between the particle center points that are spawned
jitterFactorthe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInBoundHCP() [1/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::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.

Parameters
boundThe specified bound to spawn in
sourceTableThe particle model distribution table used to spawn particles
spacingSpacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInBoundHCP() [2/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::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.

Parameters
boundThe specified bound to spawn in
radiusThe radius for the new particles
spacingSpacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInGeometry() [1/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::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.

Parameters
geometryThe specified geometry to spawn particles in
sourceTableThe particle model distribution table used to spawn particles
spacingSpacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInGeometry() [2/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::spawnParticlesInGeometry ( agxCollide::Geometry geometry,
Real  radius,
const agx::Vec3 spacing,
agx::Real  jitterFactor = agx::Real(0) 
)

Spawns particles In a specified geometry.

Parameters
geometryThe specified geometry to spawn particles in
radiusThe radius for the new particles
spacingSpacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInGeometryHCP() [1/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::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.

Parameters
geometryThe specified geometry to spawn particles in
sourceTableThe particle model distribution table used to spawn particles
spacingSpacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ spawnParticlesInGeometryHCP() [2/2]

agx::Physics::ParticlePtrVector agx::ParticleSystem::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.

Parameters
geometryThe specified geometry to spawn particles in
radiusThe radius for the new particles
spacingSpacing between the particle center points that are spawned
jitterFactorThe factor of the distance that is used to randomize particle positions
Returns
A vector containing the created particles.

◆ sumForceMagnitudes()

Vec3 agx::ParticleSystem::sumForceMagnitudes ( RigidBody body)

Sums force magnitudes from particle system onto rigid body.

Only valid for iterative solver.

Parameters
bodyThe rigid body.

◆ updateShouldRender()

void agx::ParticleSystem::updateShouldRender ( )

Update the shouldRender variable in particles given renders states such as clipping and filtering.

This determines if an individual particle should be rendered or not.

Member Data Documentation

◆ m_particleStorage

agxData::EntityStorageRef agx::ParticleSystem::m_particleStorage
protected

Definition at line 756 of file ParticleSystem.h.

◆ m_updateTask

TaskGroupRef agx::ParticleSystem::m_updateTask
protected

Definition at line 696 of file ParticleSystem.h.


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