AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 Member Functions

 SoilSimulationInterface (Terrain *terrain)
 Construct given terrain instance. More...
 
 SoilSimulationInterface ()
 
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. More...
 
void addCollisionGroup (const agx::Name &name)
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
agx::Real calculateSoilParticleBulkVolume () const
 
agx::Real calculateSoilParticleSpecificVolume () const
 
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. More...
 
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. More...
 
agx::Physics::GranularBodySystem * getGranularBodySystem () const
 Returns the internal GranularBodySystem used to simulate the soil particles. More...
 
size_t getNumSoilParticles () const
 Get the number of soil particles active in the soil simulation. More...
 
const
agxCollide::ParticleGeometryContactVector & 
getParticleGeometryContacts () const
 Returns the particle-geometry contacts in the internal soil simulation. More...
 
const
agxCollide::ParticlePairContactVector & 
getParticleParticleContacts () const
 Returns the particle-particle contacts in the internal soil simulation. More...
 
int getReferenceCount () const
 
agx::Bound3 getSoilParticleBound () const
 Get the complete bound of the soil particle system active in the simulation. More...
 
SoilParticleArray getSoilParticles () const
 Get the soil particles active in the simulation. More...
 
template<typename T >
bool is () const
 Subclass test. More...
 
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 reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void removeCollisionGroup (agx::UInt32 id)
 Remove a group id from the vector of group ids. More...
 
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. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

 ~SoilSimulationInterface ()
 
agx::Physics::GranularBodyPtr _createSoilParticle (agx::Real radius, const agx::Vec3 &position, const agx::Vec3 &velocity, agx::Material *material)
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void initGranularBodySystem ()
 
bool isLastTerrain ()
 
bool isTerrainPagerActive ()
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

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.

Constructor & Destructor Documentation

agxTerrain::SoilSimulationInterface::SoilSimulationInterface ( Terrain *  terrain)

Construct given terrain instance.

Parameters
terrain- terrain instance
agxTerrain::SoilSimulationInterface::SoilSimulationInterface ( )
agxTerrain::SoilSimulationInterface::~SoilSimulationInterface ( )
protected

Member Function Documentation

agx::Physics::GranularBodyPtr agxTerrain::SoilSimulationInterface::_createSoilParticle ( agx::Real  radius,
const agx::Vec3 &  position,
const agx::Vec3 &  velocity,
agx::Material *  material 
)
protected
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);

void agxTerrain::SoilSimulationInterface::addCollisionGroup ( const agx::Name &  name)
void agx::Referenced::allocateObserverVector ( ) const
protectedinherited
template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), and agx::InternalData::getOrCreate().

template<typename T >
const T* agx::Referenced::as ( ) const
inherited
template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited
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)
agx::Real agxTerrain::SoilSimulationInterface::calculateSoilParticleSpecificVolume ( ) const
Returns
soil particle specific volume (m3) active in the simulation.
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.
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.
void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
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.
size_t agxTerrain::SoilSimulationInterface::getNumSoilParticles ( ) const

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

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

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

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

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

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
agx::Bound3 agxTerrain::SoilSimulationInterface::getSoilParticleBound ( ) const

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

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.
void agxTerrain::SoilSimulationInterface::initGranularBodySystem ( )
protected
template<typename T >
bool agx::Referenced::is ( ) const
inherited
bool agxTerrain::SoilSimulationInterface::isGeometryPtrValid ( agx::Physics::GeometryPtr  geometry) const
Returns
true if the Geometry ptr is valid
bool agxTerrain::SoilSimulationInterface::isLastTerrain ( )
protected
bool agxTerrain::SoilSimulationInterface::isParticleGeometryContactValid ( agx::Physics::ParticleGeometryContactPtr  contact)
Returns
true if particle geometry contact is valid
bool agxTerrain::SoilSimulationInterface::isParticlePairContactValid ( agx::Physics::ParticlePairContactPtr  contact)
Returns
true if particle-particle contact is valid
bool agxTerrain::SoilSimulationInterface::isTerrainPagerActive ( )
protected
bool agxTerrain::SoilSimulationInterface::isValid ( agx::Physics::GranularBodyPtr  ptr) const
Returns
true if particle is valid, i.e., not removed

Definition at line 179 of file SoilSimulationInterface.h.

References agx::ref_ptr< T >::isValid().

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

Referenced by agxData::Val< UInt >::Val().

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
void agxTerrain::SoilSimulationInterface::removeCollisionGroup ( const agx::Name &  name)
void agxTerrain::SoilSimulationInterface::removeSoilParticle ( agx::Physics::GranularBodyPtr  ptr)

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

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.


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