AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agxTerrain::TerrainContactGenerator Class Reference

This class has two main responsibilities: More...

#include <TerrainContactGenerator.h>

+ Inheritance diagram for agxTerrain::TerrainContactGenerator:

Classes

class  ContactReplacer
 Internal class that is used to create new geometry contacts between the terrain and the colliding objects. More...
 

Public Member Functions

 TerrainContactGenerator (Terrain *terrain)
 Default constructor. More...
 
 TerrainContactGenerator ()
 
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
 
int getReferenceCount () const
 
const TerrainContactRefVector & getTerrainContacts () const
 
TerrainContactRefVector & getTerrainContacts ()
 
template<typename T >
bool is () const
 Subclass test. More...
 
void onPost (agxSDK::Simulation *simulation)
 Do post updates for the contact generator. More...
 
void onPre (agxSDK::Simulation *simulation)
 Do pre updates for the contact generator. More...
 
void onRemove (agxSDK::Simulation *simulation)
 Do cleanup when removed from the Simulation. More...
 
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 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 Types

typedef agx::observer_ptr
< const ContactReplacer > 
ContactReplacerConstObserver
 
typedef agx::ref_ptr< const
ContactReplacer > 
ContactReplacerConstRef
 
typedef agx::observer_ptr
< ContactReplacer > 
ContactReplacerObserver
 
typedef agx::ref_ptr
< ContactReplacer > 
ContactReplacerRef
 

Protected Member Functions

virtual ~TerrainContactGenerator ()
 Reference counted object - protected destructor. More...
 
void addNeighborIndex (const agx::Vec2i &index, std::queue< agx::Vec2i > &indicesToCheck, agx::HashSet< agx::Vec2i > &visitedIndices) const
 
void allocateObserverVector () const
 
void buildTerrainContacts (agxSDK::Simulation *simulation)
 Build the TerrainContact objects used in compaction calculations. More...
 
void collectTerrainContacts (agxSDK::Simulation *simulation)
 Collect contacts between externally colliding geometries and the terrain (Does not include SoilParticleAggregateContacts). More...
 
void deleteUsingDeleteHandler () const
 
std::tuple
< TerrainIndexToDepthTable,
agx::Bound3 > 
findIntersectingIndexInContact (const agxCollide::GeometryContactPtrVector &contacts)
 Find the terrain grid indices intersecting with the colliding geometry via ray intersection tests. More...
 
TerrainContact * generateTerrainContact (const agxCollide::GeometryContactPtrVector &contacts, agxSDK::Simulation *simulation)
 Get the current generated Terrain contacts. More...
 
const agxCollide::Geometry * getCollider (const agxCollide::GeometryContact *contact) const
 Get the collider geometry in the geometry contact. More...
 
agx::Real getCurrentContactTime (const agxCollide::Geometry *geometry) const
 
bool isSoilAggregateContact (agxCollide::GeometryContact *gc) const
 
bool raycastTerrainVertexToGeometry (const agxCollide::Geometry *collider, const agx::Vec2i &hfIndex, agx::Real &depth)
 Raycast in a terrain index in order to find intersection with a colliding geometry. More...
 
void registerContactingGeometry (const agxCollide::Geometry *geometry, agxSDK::Simulation *simulation)
 
void replaceTerrainGeometryContacts ()
 Replaces current geometry contacts with one new for each contact points containing a new Young's Modulus for each point depending on the compaction of the voxel. More...
 
void unRegisterContactingGeometry (const agxCollide::Geometry *geometry)
 
void unRegisterGeometriesNotInContact (const agxCollide::GeometryHashSet &geometriesInContact)
 
void updateTerrainContactsWithForceData ()
 Update the TerrainContact objects with force data. More...
 

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

This class has two main responsibilities:

  • Generate TerrainContact objects between the terrain and externally colliding geometries. Primary used in compaction calculation.
  • Replace existing geometry contacts with contacts containing modified Young's Modulus depending on compaction of voxel in contact point.

The generated TerrainContact objects contains information about approximative area and volume overlap which is used in compaction and deformation calculations.

Definition at line 60 of file TerrainContactGenerator.h.

Member Typedef Documentation

Constructor & Destructor Documentation

agxTerrain::TerrainContactGenerator::TerrainContactGenerator ( Terrain *  terrain)

Default constructor.

agxTerrain::TerrainContactGenerator::TerrainContactGenerator ( )
virtual agxTerrain::TerrainContactGenerator::~TerrainContactGenerator ( )
protectedvirtual

Reference counted object - protected destructor.

Member Function Documentation

void agxTerrain::TerrainContactGenerator::addNeighborIndex ( const agx::Vec2i &  index,
std::queue< agx::Vec2i > &  indicesToCheck,
agx::HashSet< agx::Vec2i > &  visitedIndices 
) const
protected
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
void agxTerrain::TerrainContactGenerator::buildTerrainContacts ( agxSDK::Simulation *  simulation)
protected

Build the TerrainContact objects used in compaction calculations.

void agxTerrain::TerrainContactGenerator::collectTerrainContacts ( agxSDK::Simulation *  simulation)
protected

Collect contacts between externally colliding geometries and the terrain (Does not include SoilParticleAggregateContacts).

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
std::tuple<TerrainIndexToDepthTable, agx::Bound3> agxTerrain::TerrainContactGenerator::findIntersectingIndexInContact ( const agxCollide::GeometryContactPtrVector &  contacts)
protected

Find the terrain grid indices intersecting with the colliding geometry via ray intersection tests.

Parameters
contacts- The geometry contacts associated with the contact between the collider and the terrain object
Returns
table containing the terrain indices intersecting the geometry volume mapped to the depth of the intersection.
TerrainContact* agxTerrain::TerrainContactGenerator::generateTerrainContact ( const agxCollide::GeometryContactPtrVector &  contacts,
agxSDK::Simulation *  simulation 
)
protected

Get the current generated Terrain contacts.

const agxCollide::Geometry* agxTerrain::TerrainContactGenerator::getCollider ( const agxCollide::GeometryContact *  contact) const
protected

Get the collider geometry in the geometry contact.

agx::Real agxTerrain::TerrainContactGenerator::getCurrentContactTime ( const agxCollide::Geometry *  geometry) const
protected
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
const TerrainContactRefVector& agxTerrain::TerrainContactGenerator::getTerrainContacts ( ) const
Returns
the current generated Terrain contacts.
TerrainContactRefVector& agxTerrain::TerrainContactGenerator::getTerrainContacts ( )
Returns
the current generated Terrain contacts.
template<typename T >
bool agx::Referenced::is ( ) const
inherited
bool agxTerrain::TerrainContactGenerator::isSoilAggregateContact ( agxCollide::GeometryContact *  gc) const
protected
void agxTerrain::TerrainContactGenerator::onPost ( agxSDK::Simulation *  simulation)

Do post updates for the contact generator.

This does the following:

void agxTerrain::TerrainContactGenerator::onPre ( agxSDK::Simulation *  simulation)

Do pre updates for the contact generator.

This does the following:

  • Build Terrain contact objects from colliding objects
  • Generate new geometry contacts between colliders and the Terrain with updated Young's Modulus
void agxTerrain::TerrainContactGenerator::onRemove ( agxSDK::Simulation *  simulation)

Do cleanup when removed from the Simulation.

bool agxTerrain::TerrainContactGenerator::raycastTerrainVertexToGeometry ( const agxCollide::Geometry *  collider,
const agx::Vec2i &  hfIndex,
agx::Real &  depth 
)
protected

Raycast in a terrain index in order to find intersection with a colliding geometry.

Parameters
collider- The colliding geometry to test ray intersection against.
hfIndex- The index to raycast in.
depth- The depth of the intersection of the geometry in the grid point.
Returns
true if the line intersects with the collider below the height field.
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::TerrainContactGenerator::registerContactingGeometry ( const agxCollide::Geometry *  geometry,
agxSDK::Simulation *  simulation 
)
protected
void agxTerrain::TerrainContactGenerator::replaceTerrainGeometryContacts ( )
protected

Replaces current geometry contacts with one new for each contact points containing a new Young's Modulus for each point depending on the compaction of the voxel.

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.

void agxTerrain::TerrainContactGenerator::unRegisterContactingGeometry ( const agxCollide::Geometry *  geometry)
protected
void agxTerrain::TerrainContactGenerator::unRegisterGeometriesNotInContact ( const agxCollide::GeometryHashSet &  geometriesInContact)
protected
void agxTerrain::TerrainContactGenerator::updateTerrainContactsWithForceData ( )
protected

Update the TerrainContact objects with force data.

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: