17#ifndef AGX_PARTICLESYSTEM_H
18#define AGX_PARTICLESYSTEM_H
80 Task* getUpdateTask();
143#if (!defined SWIG ) || ( defined SWIGCSHARP || defined SWIGJAVA)
470 void addCustomBufferReal(
const agx::String& buffername );
493 void addCustomBufferInt(
const agx::String& buffername );
516 void addCustomBufferReal32(
const agx::String& buffername );
539 void addCustomBufferVec3(
const agx::String& buffername );
661 void addCustomBufferT( const
agx::
String& name );
664 void setCustomBufferValueT(
agx::
Index id, const
agx::
String& buffername, const T valueT );
669 agxSDK::Simulation* getSimulation() const;
671 agx::Physics::ParticlePtrVector convertRangeToParticlePtrVector(
agxData::EntityRange& entityRange );
683 void init(
bool createMaterial = true );
684 void setCollisionGroupSet(
agx::Physics::CollisionGroupSetPtr );
685 void invalidLicenseCallback();
687 void setRadiusOnParticles(
agxData::EntityRange& entityRange,
agx::
Real radius );
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGX_TYPE_BINDING(_Type, _Name)
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
The geometry representation used by the collision detection engine.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Type-specific Array used for fast access into the data held by a Buffer.
Abstract representation of a data buffer.
Data storage for a collection of entity instances of a specified EntityModel.
Abstract representation of a value.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
A component is an object containing other objects, enabling hierarchical structuring.
Representation of the CPU.
An agx::Device is an abstract representation of a device on which data can be stored and processed.
friend class DistributionTable
Main material class which acts as a holder of a Surface Material and a Bulk material.
A model is an abstract representation of the class of an agx::Object.
Representation of a name string.
MaterialUuidBufferListener(ParticleSystem *system, agxSDK::Simulation *simulation)
virtual void updateCallback(agxData::Buffer *buffer) override
virtual void updateCallback(agxData::Buffer *buffer, agx::Index index) override
void setSimulation(agxSDK::Simulation *sim)
virtual ~MaterialUuidBufferListener()
virtual void updateCallback(agxData::Buffer *buffer, agxData::Array< agx::Index > indexSet) override
virtual void updateCallback(agxData::Buffer *buffer, agx::IndexRange range) override
virtual void updateCallback(agxData::Buffer *buffer) override
virtual void updateCallback(agxData::Buffer *buffer, agx::Index index) override
virtual ~UpdateRenderingListener()
virtual void updateCallback(agxData::Buffer *buffer, agxData::Array< agx::Index > indexSet) override
UpdateRenderingListener(ParticleSystem *system, agxSDK::Simulation *simulation)
void setSimulation(agxSDK::Simulation *sim)
virtual void updateCallback(agxData::Buffer *buffer, agx::IndexRange range) override
A basic particle system that contains all the storages and buffers required for basic operation and a...
agx::Real getTotalParticleParticleContactForces()
void clearAllParticles()
Utility method for clearing all particles in the particle system.
agx::Index getParticleIdFromIndex(agx::Index index) const
Return the particle id for the specified particle entity array index.
size_t getNumParticleParticleContacts()
Returns the number of particle-particle contacts.
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 (H...
void detach()
Unbinds relevant buffer pointers from objects after removing the particle system into the simulation.
virtual agx::Vec3 getSingleParticleForce(agx::Index particleId)
Get particle velocity with specified id.
virtual agx::Vec3 getSingleParticleVelocity(agx::Index particleId)
Get particle velocity with specified id.
virtual bool setUpdateTask(Task *updateTask)
Set the task that will be executed whenever it is time to step the simulation.
agx::Vector< agx::Physics::ParticleGeometryContactPtr > getParticleGeometryContacts()
Returns the current ParticleGeometryContacts in the simulation.
void setSpace(agxCollide::Space *space)
void destroyParticles(agxData::EntityRange particles)
Destroy a range of particles.
virtual void setParticleMass(Real mass, bool updateExistingParticles=false)
Set particle mass.
virtual void setSingleParticleRadius(agx::Index particleId, agx::Real radius)
Set particle radius with specified id.
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.
virtual agx::Real getSingleParticleRadius(agx::Index particleId)
Get particle radius with specified id.
void removeCollisionGroupParticle(agx::UInt32 id, agx::Physics::ParticlePtr ptr)
Remove a group id from the vector of group ids.
virtual agx::Vec3 getSingleParticlePosition(agx::Index particleId)
Get particle position with specified id.
agx::Real getTotalParticleGeometryContactForces()
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::Real calculateTotalParticleMass() const
Calculates the total particle mass in the particle system.
void attach()
Binds relevant buffer pointers to objects after inserting the particle system into the simulation.
virtual void setSingleParticleMass(agx::Index particleId, agx::Real mass)
Set particle radius with specified id.
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.
Physics::ParticlePtr getParticle(agx::Index particleId)
Returns a particle from the particle system given a particle id.
agx::Vector< agx::Physics::ParticlePairContactPtr > getParticleParticleContacts()
Returns the current ParticleParticle contacts in the simulation.
size_t getNumActiveParticleGeometryContacts()
Returns the number of ACTIVE particle-geometry contacts, after the last conducted contact filtering.
bool removeParticle(Physics::ParticlePtr particle)
Tag a particle for removal at the end of the time step.
bool hasCollisionGroupParticle(agx::UInt32 id, agx::Physics::ParticlePtr ptr) const
This is performing a linear search among the group id for this particle.
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.
static Model * ClassModel()
agx::Physics::ParticlePtrVector removeParticlesOutsideBound(const agx::Bound3 &bound)
Removes and returns particles in the specified particle system outside the given 3D bound.
size_t getNumParticleGeometryContacts()
Returns the number of particle-geometry contacts.
void removeCollisionGroup(agx::UInt32 id, bool updateExistingParticles=true)
Remove a group id from the vector of group ids.
size_t getNumParticles() const
agx::Physics::ParticleGeometryContactPtr createParticleGeometryContact(agx::Physics::ParticlePtr particle, agx::Physics::GeometryPtr geometry)
virtual agx::Vec4f getSingleParticleColor(agx::Index particleId)
Get particle color with specified id.
void addCollisionGroupParticle(const agx::Name &id, agx::Physics::ParticlePtr ptr)
bool hasCollisionGroup(const agx::Name &id) const
void destroyParticles(const agxData::EntityPtrVector &particles)
void removeCollisionGroup(const agx::Name &id, bool updateExistingParticles=true)
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 th...
void addCollisionGroup(const agx::Name &id, bool updateExistingParticles=true)
Real getParticleMass() const
agxData::EntityStorageRef m_particleStorage
void updateShouldRender()
Update the shouldRender variable in particles given renders states such as clipping and filtering.
void removeCollisionGroupParticle(const agx::Name &id, agx::Physics::ParticlePtr ptr)
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.
void commitColorBuffer()
Executes the "commit" command on the buffer so that particle rendering can be updated properly.
void setMaterial(Material *material, bool updateExistingParticles=false)
Set the default particle material.
bool hasCollisionGroup(agx::UInt32 id) const
This is performing a linear search among the group id for this particle.
bool isParticlePairContactValid(Physics::ParticlePairContactPtr contact)
void setEnableCollisions(const agxCollide::Geometry *geometry, bool flag)
Specify whether otherGeometry is allowed to collide with this geometry.
Real getParticleRadius() const
void destroyParticles(const Physics::ParticlePtrVector &particles)
Destroy a list of particles.
virtual void setSingleParticleForce(agx::Index particleId, const agx::Vec3 &force)
Set particle force with specified id.
void setParticleRadius(Real radius, bool updateExistingParticles=false)
Set the default particle radius of created particles, with option of updating existing particles.
bool isParticleGeometryContactValid(Physics::ParticleGeometryContactPtr contact)
virtual void setSingleParticleVelocity(agx::Index particleId, const agx::Vec3 &velocity)
Set particle velocity with specified id.
void evaluateParticleDefaultMass()
This should be called if the density of the bulk material is changed, so the particle default mass is...
void applyAirForceDragSimple(agx::Real cd, agx::Real cr)
Apply air drag to the particles according to formula: cd * velocity^2 + cr * velocity.
void commitAllBuffers()
Executes the "commit" command all buffers in the particle system.
virtual void addNotification(agxSDK::Simulation *simulation)
Triggers when particlesystem is added to the simulation.
bool getEnableCollisions(const agxCollide::Geometry *geometry) const
agx::Physics::ParticlePairContactPtr createParticlePairContact(agx::Physics::ParticlePtr p1, agx::Physics::ParticlePtr p2)
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.
bool particleExistsWithId(agx::Index id)
Check if there is a particle with a specified id.
void colorParticlesWithLevelsInBound(const agx::Bound3 &bound, const agx::Vec4fVector &colors)
Colors particles with different levels in the vertical z-direction inside a specified bound.
agxData::EntityRange spawnParticles(const agx::Vec3Vector &positions)
Spawn particles with defined positions.
Physics::ParticlePtr createParticle()
Create a new particle in the particle system.
agx::Real calculateMeanRadius() const
Returns the calculated mean radius of all the particles. Will return 0 if the system contains no part...
virtual void destroySingleParticle(agx::Index particleId)
Destroy particle with specified id.
bool hasCollisionGroupParticle(const agx::Name &id, agx::Physics::ParticlePtr ptr) const
const agx::Bound3 & getParticleBound()
Vec3 sumForceMagnitudes(RigidBody *body)
Sums force magnitudes from particle system onto rigid body.
agxData::EntityRange createParticles(size_t numParticles)
Create a set of particles in the particle system.
virtual agx::Real getSingleParticleMass(agx::Index particleId)
Get particle radius with specified id.
void _setGravityTask(Task *task)
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.
size_t getNumActiveParticleParticleContacts()
Returns the number of ACTIVE particle-particle contacts, after the last conducted contact filtering.
const Material * getMaterial() const
virtual void setSingleParticleColor(agx::Index particleId, const agx::Vec4f &color)
Set particle color with specified id.
bool isValid(Physics::ParticlePtr particle) const
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.
agx::Real calculateTotalParticleVolume() const
void destroyParticle(Physics::ParticlePtr particle)
Destroy a particle.
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)...
Pointer to a entity instance of type Physics.CollisionGroupSet.
Pointer to a entity instance of type Physics.Geometry.
Pointer to a entity instance of type Physics.ParticleGeometryContact.
Pointer to a entity instance of type Physics.ParticlePairContact.
Pointer to a entity instance of type Physics.Particle.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a)
A representation of a generic task.
A class holding 4 dimensional vectors and providing basic arithmetic.
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Contains classes for low level data storage for AGX.
agx::SymmetricPair< agx::Physics::ParticlePtr > ParticlePair
The agxIO namespace contains classes for reading, writing and finding files.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.