AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
agxTerrain::SoilSimulationInterface Class Reference

Interface class for accessing data and functions for the internal soil particle simulation used in agxTerrain. More...

#include <SoilSimulationInterface.h>

+ Inheritance diagram for agxTerrain::SoilSimulationInterface:

Public Types

enum  PACKING_TYPE { SQUARE_LATTICE_PACK = 0 , HEXAGONAL_CLOSE_PACK = 1 }
 Packing type when generating. More...
 

Public Member Functions

 SoilSimulationInterface ()
 
 SoilSimulationInterface (Terrain *terrain)
 Construct given terrain instance.
 
void addCollisionGroup (agx::UInt32 id)
 Add the specified id to a vector of group id, this will make the created soil particles part of the group id.
 
void addCollisionGroup (const agx::Name &name)
 
agx::Real calculateSoilParticleBulkVolume () const
 
agx::Real calculateSoilParticleSpecificVolume () const
 
agx::Physics::GranularBodyPtr createSoilParticle (agx::Real radius, const agx::Vec3 &position=agx::Vec3(), const agx::Vec3 &velocity=agx::Vec3())
 Create a soil particle with specified radius and material in the internal soil simulation.
 
agx::Physics::GranularBodyPtr createSoilParticle (const agx::Vec3 &position=agx::Vec3(), const agx::Vec3 &velocity=agx::Vec3())
 Create a soil particle with nominal radius and material in the internal soil simulation.
 
agx::Physics::GranularBodySystemgetGranularBodySystem () const
 Returns the internal GranularBodySystem used to simulate the soil particles.
 
size_t getNumSoilParticles () const
 Get the number of soil particles active in the soil simulation.
 
const agxCollide::ParticleGeometryContactVectorgetParticleGeometryContacts () const
 Returns the particle-geometry contacts in the internal soil simulation.
 
const agxCollide::ParticlePairContactVectorgetParticleParticleContacts () const
 Returns the particle-particle contacts in the internal soil simulation.
 
agx::Bound3 getSoilParticleBound () const
 Get the complete bound of the soil particle system active in the simulation.
 
SoilParticleArray getSoilParticles () const
 Get the soil particles active in the simulation.
 
bool isGeometryPtrValid (agx::Physics::GeometryPtr geometry) const
 
bool isParticleGeometryContactValid (agx::Physics::ParticleGeometryContactPtr contact)
 
bool isParticlePairContactValid (agx::Physics::ParticlePairContactPtr contact)
 
bool isValid (agx::Physics::GranularBodyPtr ptr) const
 
void removeCollisionGroup (agx::UInt32 id)
 Remove a group id from the vector of group ids.
 
void removeCollisionGroup (const agx::Name &name)
 
void removeSoilParticle (agx::Physics::GranularBodyPtr ptr)
 Tag a soil particle for removal at the last stages of the current time step.
 
agx::Physics::ParticlePtrVector spawnSoilParticlesInGeometry (agxCollide::Geometry *geometry, agx::Real radius, const agx::Vec3 &spacing, agx::Real jitterFactor=agx::Real(0), PACKING_TYPE packingType=PACKING_TYPE::SQUARE_LATTICE_PACK)
 Spawns soil particles with the soil material from this terrain in a specified geometry.
 
void tagParticlesAsSoilParticles (agx::Physics::ParticlePtrVector &particles)
 Tag specified particles as soil particles with material from this terrain.
 
- 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.
 

Protected Member Functions

 ~SoilSimulationInterface ()
 
agx::Physics::GranularBodyPtr _createSoilParticle (agx::Real radius, const agx::Vec3 &position, const agx::Vec3 &velocity, agx::Material *material)
 
void initGranularBodySystem ()
 
bool isLastTerrain ()
 
bool isTerrainPagerActive ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- 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.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Interface class for accessing data and functions for the internal soil particle simulation used in agxTerrain.

Note
Observe that editing the internal granular data structure might break the terrain algorithm.

Definition at line 36 of file SoilSimulationInterface.h.

Member Enumeration Documentation

◆ PACKING_TYPE

Packing type when generating.

Enumerator
SQUARE_LATTICE_PACK 
HEXAGONAL_CLOSE_PACK 

Definition at line 42 of file SoilSimulationInterface.h.

Constructor & Destructor Documentation

◆ SoilSimulationInterface() [1/2]

agxTerrain::SoilSimulationInterface::SoilSimulationInterface ( Terrain terrain)

Construct given terrain instance.

Parameters
terrain- terrain instance

◆ SoilSimulationInterface() [2/2]

agxTerrain::SoilSimulationInterface::SoilSimulationInterface ( )

◆ ~SoilSimulationInterface()

agxTerrain::SoilSimulationInterface::~SoilSimulationInterface ( )
protected

Member Function Documentation

◆ _createSoilParticle()

agx::Physics::GranularBodyPtr agxTerrain::SoilSimulationInterface::_createSoilParticle ( agx::Real  radius,
const agx::Vec3 position,
const agx::Vec3 velocity,
agx::Material material 
)
protected

◆ addCollisionGroup() [1/2]

void agxTerrain::SoilSimulationInterface::addCollisionGroup ( agx::UInt32  id)

Add the specified id to a vector of group id, this will make the created soil particles part of the group id.

By default, the created soil 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);

◆ addCollisionGroup() [2/2]

void agxTerrain::SoilSimulationInterface::addCollisionGroup ( const agx::Name name)

◆ calculateSoilParticleBulkVolume()

agx::Real agxTerrain::SoilSimulationInterface::calculateSoilParticleBulkVolume ( ) const
Returns
soil particle bulk volume (m3) active in the simulation.
Note
- the bulk volume is the specific volume of all particles divided with the estimated particle packing fraction (0.67)

◆ calculateSoilParticleSpecificVolume()

agx::Real agxTerrain::SoilSimulationInterface::calculateSoilParticleSpecificVolume ( ) const
Returns
soil particle specific volume (m3) active in the simulation.

◆ createSoilParticle() [1/2]

agx::Physics::GranularBodyPtr agxTerrain::SoilSimulationInterface::createSoilParticle ( agx::Real  radius,
const agx::Vec3 position = agx::Vec3(),
const agx::Vec3 velocity = agx::Vec3() 
)

Create a soil particle with specified radius and material in the internal soil simulation.

Parameters
radius- radius of the created soil particle. If negative, no particle will be created.
position- initial position of the created soil particle in world space.
velocity- initial velocity of the created soil particle in world space.
Returns
the created soil particle.

◆ createSoilParticle() [2/2]

agx::Physics::GranularBodyPtr agxTerrain::SoilSimulationInterface::createSoilParticle ( const agx::Vec3 position = agx::Vec3(),
const agx::Vec3 velocity = agx::Vec3() 
)

Create a soil particle with nominal radius and material in the internal soil simulation.

Parameters
position- initial position of the created soil particle in world space.
velocity- initial velocity of the created soil particle in world space.
Returns
the created soil particle.

◆ getGranularBodySystem()

agx::Physics::GranularBodySystem * agxTerrain::SoilSimulationInterface::getGranularBodySystem ( ) const

Returns the internal GranularBodySystem used to simulate the soil particles.

Note
Observe that editing or otherwise change the internal particle data might break the terrain algorithm.

◆ getNumSoilParticles()

size_t agxTerrain::SoilSimulationInterface::getNumSoilParticles ( ) const

Get the number of soil particles active in the soil simulation.

◆ getParticleGeometryContacts()

const agxCollide::ParticleGeometryContactVector & agxTerrain::SoilSimulationInterface::getParticleGeometryContacts ( ) const

Returns the particle-geometry contacts in the internal soil simulation.

◆ getParticleParticleContacts()

const agxCollide::ParticlePairContactVector & agxTerrain::SoilSimulationInterface::getParticleParticleContacts ( ) const

Returns the particle-particle contacts in the internal soil simulation.

◆ getSoilParticleBound()

agx::Bound3 agxTerrain::SoilSimulationInterface::getSoilParticleBound ( ) const

Get the complete bound of the soil particle system active in the simulation.

◆ getSoilParticles()

SoilParticleArray agxTerrain::SoilSimulationInterface::getSoilParticles ( ) const

Get the soil particles active in the simulation.

Note
Observe that editing the internal granular data structure might break the terrain algorithm.

◆ initGranularBodySystem()

void agxTerrain::SoilSimulationInterface::initGranularBodySystem ( )
protected

◆ isGeometryPtrValid()

bool agxTerrain::SoilSimulationInterface::isGeometryPtrValid ( agx::Physics::GeometryPtr  geometry) const
Returns
true if the Geometry ptr is valid

◆ isLastTerrain()

bool agxTerrain::SoilSimulationInterface::isLastTerrain ( )
protected

◆ isParticleGeometryContactValid()

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

◆ isParticlePairContactValid()

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

◆ isTerrainPagerActive()

bool agxTerrain::SoilSimulationInterface::isTerrainPagerActive ( )
protected

◆ isValid()

bool agxTerrain::SoilSimulationInterface::isValid ( agx::Physics::GranularBodyPtr  ptr) const
Returns
true if particle is valid, i.e., not removed

Definition at line 210 of file SoilSimulationInterface.h.

References isValid().

Referenced by isValid().

◆ removeCollisionGroup() [1/2]

void agxTerrain::SoilSimulationInterface::removeCollisionGroup ( agx::UInt32  id)

Remove a group id from the vector of group ids.

Parameters
id- The group id to be removed

◆ removeCollisionGroup() [2/2]

void agxTerrain::SoilSimulationInterface::removeCollisionGroup ( const agx::Name name)

◆ removeSoilParticle()

void agxTerrain::SoilSimulationInterface::removeSoilParticle ( agx::Physics::GranularBodyPtr  ptr)

Tag a soil particle for removal at the last stages of the current time step.

◆ spawnSoilParticlesInGeometry()

agx::Physics::ParticlePtrVector agxTerrain::SoilSimulationInterface::spawnSoilParticlesInGeometry ( agxCollide::Geometry geometry,
agx::Real  radius,
const agx::Vec3 spacing,
agx::Real  jitterFactor = agx::Real(0),
PACKING_TYPE  packingType = PACKING_TYPE::SQUARE_LATTICE_PACK 
)

Spawns soil particles with the soil material from this terrain in a specified geometry.

Parameters
geometry- The specified geometry to spawn particles in
radius- The specified geometry to spawn particles in
spacing- Spacing between the particle center points that are spawned
jitterFactor- The factor of the distance that is used to randomize particle positions
packingType- the packing type of the created soil particles
Returns
A vector containing the created soil particles.

◆ tagParticlesAsSoilParticles()

void agxTerrain::SoilSimulationInterface::tagParticlesAsSoilParticles ( agx::Physics::ParticlePtrVector particles)

Tag specified particles as soil particles with material from this terrain.

Parameters
particles- the particles to tag as terrain particles

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