AGXDynamics  2.31.1.0
agxTerrain::TerrainDataAtlas Class Reference

#include <TerrainDataAtlas.h>

+ Inheritance diagram for agxTerrain::TerrainDataAtlas:

Classes

struct  MassTypeHash
 

Public Types

enum  MassType { SOLID, PARTICLE, FLUID }
 

Public Member Functions

 TerrainDataAtlas (agx::Real voxelSize)
 Basic Constructor. More...
 
float addMass (const Grid::GridCoord &coord, MassType massType, float value)
 Adds occupancy mass of specific mass type in a voxel with specified 3D-coordinate in voxel index space. More...
 
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
 
void clearMassGrid (MassType massType)
 
void clearVelocityGrid ()
 
float getCompactedSolidMass (const Grid::GridCoord &coord) const
 Get the occupancy mass in a voxel modified by the compaction grid with specified 3D-coordinate in voxel index space. More...
 
float getCompaction (const Grid::GridCoord &coord) const
 Gets the compression data from a voxel in the grid. More...
 
Grid * getCompactionGridData () const
 
Grid * getGridMassData (MassType massType) const
 
agx::Vec3iVector getIndicesWithMass (MassType massType) const
 Returns the active indices in voxel index space which contains occupancy mass of a specific mass type. More...
 
float getMass (const Grid::GridCoord &coord, MassType massType) const
 Get the occupancy mass of specific mass type in a voxel with specified 3D-coordinate in voxel index space. More...
 
agx::Real getMassInTerrain (MassType massType) const
 
float getMaximumAllowedSolidMassInVoxel (const Grid::GridCoord &coord) const
 Returns the maximum allowed solid mass in the voxel. More...
 
int getReferenceCount () const
 
size_t getTotalActiveVoxels () const
 
size_t getTotalGridMemoryUsage () const
 
agx::Real getTotalMassInTerrain () const
 
float getTotalMassInVoxel (const Grid::GridCoord &coord) const
 
agx::Vec3f getVelocity (const Grid::GridCoord &coord) const
 
VoxelToVelocityTable & getVelocityTable ()
 
template<typename T >
bool is () const
 Subclass test. More...
 
bool isActiveVoxel (const Grid::GridCoord &coord, MassType massType) const
 Checks if a voxel is active in data grid of a specific mass type. 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 setCompaction (const Grid::GridCoord &coord, float value)
 Sets compression data in a voxel in the grid. More...
 
void setData (const Grid &grid, MassType massType)
 
void setMass (const Grid::GridCoord &coord, MassType massType, float value)
 Sets the occupancy mass of specific mass type in a voxel with specified 3D-coordinate in voxel index space. More...
 
void setVelocity (const Grid::GridCoord &coord, const agx::Vec3f &value)
 
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

virtual ~TerrainDataAtlas ()
 Reference counted object - protected destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

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

GridRef m_compactionGrid
 
GridRef m_fluidMassGrid
 
agx::HashTable< MassType, Grid *, MassTypeHash > m_massGridTable
 
Mutex m_mutex
 
ObserverContainer m_observers
 
GridRef m_particleMassGrid
 
AtomicValue m_refCount
 
GridRef m_solidMassGrid
 
VoxelToVelocityTable m_voxelToVelocityTable
 

Detailed Description

Definition at line 32 of file TerrainDataAtlas.h.

Member Enumeration Documentation

◆ MassType

Enumerator
SOLID 
PARTICLE 
FLUID 

Definition at line 37 of file TerrainDataAtlas.h.

Constructor & Destructor Documentation

◆ TerrainDataAtlas()

agxTerrain::TerrainDataAtlas::TerrainDataAtlas ( agx::Real  voxelSize)

Basic Constructor.

Parameters
voxelSize- The uniform voxel dimension used in the internal transformation of the terrain data grids.

◆ ~TerrainDataAtlas()

virtual agxTerrain::TerrainDataAtlas::~TerrainDataAtlas ( )
protectedvirtual

Reference counted object - protected destructor.

Member Function Documentation

◆ addMass()

float agxTerrain::TerrainDataAtlas::addMass ( const Grid::GridCoord &  coord,
MassType  massType,
float  value 
)

Adds occupancy mass of specific mass type in a voxel with specified 3D-coordinate in voxel index space.

Setting a mass to the voxel with activate it in the specified mass grid.

Parameters
coord- The 3D coordiante of the voxel in the voxel index space.
massType- The type of mass data that should be inserted into the voxel.
value- The occupancy value of the specific type that should be added to the voxel.
Returns
the new total occupancy mass in the voxel

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

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(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

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

◆ asSafe() [1/2]

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

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

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

◆ asSafe() [2/2]

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

◆ clearMassGrid()

void agxTerrain::TerrainDataAtlas::clearMassGrid ( MassType  massType)

◆ clearVelocityGrid()

void agxTerrain::TerrainDataAtlas::clearVelocityGrid ( )

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ getCompactedSolidMass()

float agxTerrain::TerrainDataAtlas::getCompactedSolidMass ( const Grid::GridCoord &  coord) const

Get the occupancy mass in a voxel modified by the compaction grid with specified 3D-coordinate in voxel index space.

The returned mass is modified by the following formula: return = occupancyMass / compaction. This is mainly used when trying to sum compacted soild mass with particle and fluid mass in the same voxel. Particle and fluid occupancy is always defined in nominal compression.

Parameters
coord- The 3D index coordinate in voxel space.
Returns
The occupancy mass at the specified coordinate, modified my the compaction grid. Will return zero if the specified voxel at the coordinate is inactive.

◆ getCompaction()

float agxTerrain::TerrainDataAtlas::getCompaction ( const Grid::GridCoord &  coord) const

Gets the compression data from a voxel in the grid.

The compression determines how much solid occupancy can exist in a voxel. by the following relation: MAX_SOILD_VOLUME = compression * NOMINAL_MAX_VOLUME

Parameters
coord- The 3D voxel coordinate of the voxel in the voxel index space.

◆ getCompactionGridData()

Grid* agxTerrain::TerrainDataAtlas::getCompactionGridData ( ) const

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getGridMassData()

Grid* agxTerrain::TerrainDataAtlas::getGridMassData ( MassType  massType) const

◆ getIndicesWithMass()

agx::Vec3iVector agxTerrain::TerrainDataAtlas::getIndicesWithMass ( MassType  massType) const

Returns the active indices in voxel index space which contains occupancy mass of a specific mass type.

Parameters
massType- the specific mass type
Returns
all the active voxel indices which contains occupancy of the specified mass type.

◆ getMass()

float agxTerrain::TerrainDataAtlas::getMass ( const Grid::GridCoord &  coord,
MassType  massType 
) const

Get the occupancy mass of specific mass type in a voxel with specified 3D-coordinate in voxel index space.

Parameters
coord- The 3D index coordinate in voxel space.
massType- The type of mass data that should be extracted from the voxel.
Returns
The occupancy mass of the specified type at the specified coordinate. Will return zero if the specified voxel at the coordinate is inactive.

◆ getMassInTerrain()

agx::Real agxTerrain::TerrainDataAtlas::getMassInTerrain ( MassType  massType) const

◆ getMaximumAllowedSolidMassInVoxel()

float agxTerrain::TerrainDataAtlas::getMaximumAllowedSolidMassInVoxel ( const Grid::GridCoord &  coord) const

Returns the maximum allowed solid mass in the voxel.

This is a function of the current compression in the voxel.

Parameters
coord- The 3D voxel coordinate of the voxel in the voxel index space.
Returns
the maximum allowed solid mass in the terrain.

◆ getReferenceCount()

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

◆ getTotalActiveVoxels()

size_t agxTerrain::TerrainDataAtlas::getTotalActiveVoxels ( ) const

◆ getTotalGridMemoryUsage()

size_t agxTerrain::TerrainDataAtlas::getTotalGridMemoryUsage ( ) const

◆ getTotalMassInTerrain()

agx::Real agxTerrain::TerrainDataAtlas::getTotalMassInTerrain ( ) const

◆ getTotalMassInVoxel()

float agxTerrain::TerrainDataAtlas::getTotalMassInVoxel ( const Grid::GridCoord &  coord) const

◆ getVelocity()

agx::Vec3f agxTerrain::TerrainDataAtlas::getVelocity ( const Grid::GridCoord &  coord) const

◆ getVelocityTable()

VoxelToVelocityTable& agxTerrain::TerrainDataAtlas::getVelocityTable ( )

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ isActiveVoxel()

bool agxTerrain::TerrainDataAtlas::isActiveVoxel ( const Grid::GridCoord &  coord,
MassType  massType 
) const

Checks if a voxel is active in data grid of a specific mass type.

Parameters
coord- The 3D coordiante of the voxel in the voxel index space.
massType- The specified mass type.

◆ reference()

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.

◆ setCompaction()

void agxTerrain::TerrainDataAtlas::setCompaction ( const Grid::GridCoord &  coord,
float  value 
)

Sets compression data in a voxel in the grid.

The compression determines how much solid occupancy can exist in a voxel. by the following relation: MAX_SOILD_VOLUME = compression * NOMINAL_MAX_VOLUME

Parameters
coord- The 3D voxel coordinate of the voxel in voxel index space.
value- The compression value to set to the voxel.

◆ setData()

void agxTerrain::TerrainDataAtlas::setData ( const Grid &  grid,
MassType  massType 
)

◆ setDeleteHandler()

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

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

◆ setMass()

void agxTerrain::TerrainDataAtlas::setMass ( const Grid::GridCoord &  coord,
MassType  massType,
float  value 
)

Sets the occupancy mass of specific mass type in a voxel with specified 3D-coordinate in voxel index space.

Setting a mass to the voxel with activate it in the specified mass grid.

Parameters
coord- The 3D coordinate of the voxel in the voxel index space.
massType- The type of mass data that should be inserted into the voxel.
value- the occupancy value, which can range from [0.0 - 1.0] of the specified mass type that should inserted.

◆ setVelocity()

void agxTerrain::TerrainDataAtlas::setVelocity ( const Grid::GridCoord &  coord,
const agx::Vec3f &  value 
)

◆ unreference()

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.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

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.

◆ ValidateCast()

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

Member Data Documentation

◆ m_compactionGrid

GridRef agxTerrain::TerrainDataAtlas::m_compactionGrid
protected

Definition at line 169 of file TerrainDataAtlas.h.

◆ m_fluidMassGrid

GridRef agxTerrain::TerrainDataAtlas::m_fluidMassGrid
protected

Definition at line 167 of file TerrainDataAtlas.h.

◆ m_massGridTable

agx::HashTable<MassType, Grid*, MassTypeHash> agxTerrain::TerrainDataAtlas::m_massGridTable
protected

Definition at line 173 of file TerrainDataAtlas.h.

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_particleMassGrid

GridRef agxTerrain::TerrainDataAtlas::m_particleMassGrid
protected

Definition at line 168 of file TerrainDataAtlas.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.

◆ m_solidMassGrid

GridRef agxTerrain::TerrainDataAtlas::m_solidMassGrid
protected

Definition at line 166 of file TerrainDataAtlas.h.

◆ m_voxelToVelocityTable

VoxelToVelocityTable agxTerrain::TerrainDataAtlas::m_voxelToVelocityTable
protected

Definition at line 171 of file TerrainDataAtlas.h.


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