AGX Dynamics  2.35.0.1
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, size_t resolutionX, size_t resolutionY, agx::Int depth)
 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...
 
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...
 
BasicGrid * getCompactionGridData () const
 
BasicGrid * 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...
 
Grid * getSolidGridMassData () const
 
size_t getTotalActiveVoxels () const
 
size_t getTotalGridMemoryUsage () const
 
float getTotalMassInVoxel (const Grid::GridCoord &coord) const
 
agx::Vec3f getVelocity (const Grid::GridCoord &coord) const
 
VoxelToVelocityTable & getVelocityTable ()
 
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 setCompaction (const Grid::GridCoord &coord, float value)
 Sets compression data in a voxel in the grid. More...
 
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)
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor. More...
 
 Referenced (const Referenced &)
 
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
 
template<typename T >
bool is () const
 Subclass test. More...
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object. 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...
 

Protected Member Functions

virtual ~TerrainDataAtlas ()
 Reference counted object - protected destructor. More...
 
void fillGridVector ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

BasicGridRef m_compactionGrid
 
BasicGridRef m_fluidMassGrid
 
agx::StackArray< BasicGrid *, 3 > m_gridVector
 
BasicGridRef m_particleMassGrid
 
Grid * m_rawSolidMassGrid
 
BasicGridRef m_solidMassGrid
 
VoxelToVelocityTable m_voxelToVelocityTable
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

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 DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Detailed Description

Definition at line 33 of file TerrainDataAtlas.h.

Member Enumeration Documentation

◆ MassType

Enumerator
SOLID 
PARTICLE 
FLUID 

Definition at line 38 of file TerrainDataAtlas.h.

Constructor & Destructor Documentation

◆ TerrainDataAtlas()

agxTerrain::TerrainDataAtlas::TerrainDataAtlas ( agx::Real  voxelSize,
size_t  resolutionX,
size_t  resolutionY,
agx::Int  depth 
)

Basic Constructor.

Parameters
voxelSize- The uniform voxel dimension used in the internal transformation of the terrain data grids.
resolutionX- The resolution of the voxel grid in X.
resolutionY- The resolution of the voxel grid in Y.

◆ ~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

◆ clearMassGrid()

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

◆ clearVelocityGrid()

void agxTerrain::TerrainDataAtlas::clearVelocityGrid ( )

◆ fillGridVector()

void agxTerrain::TerrainDataAtlas::fillGridVector ( )
protected

◆ 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()

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

◆ getGridMassData()

BasicGrid* 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.

◆ getSolidGridMassData()

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

◆ getTotalActiveVoxels()

size_t agxTerrain::TerrainDataAtlas::getTotalActiveVoxels ( ) const

◆ getTotalGridMemoryUsage()

size_t agxTerrain::TerrainDataAtlas::getTotalGridMemoryUsage ( ) 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 ( )

◆ 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.

◆ 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.

◆ 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 
)

Member Data Documentation

◆ m_compactionGrid

BasicGridRef agxTerrain::TerrainDataAtlas::m_compactionGrid
protected

Definition at line 171 of file TerrainDataAtlas.h.

◆ m_fluidMassGrid

BasicGridRef agxTerrain::TerrainDataAtlas::m_fluidMassGrid
protected

Definition at line 169 of file TerrainDataAtlas.h.

◆ m_gridVector

agx::StackArray<BasicGrid*, 3> agxTerrain::TerrainDataAtlas::m_gridVector
protected

Definition at line 175 of file TerrainDataAtlas.h.

◆ m_particleMassGrid

BasicGridRef agxTerrain::TerrainDataAtlas::m_particleMassGrid
protected

Definition at line 170 of file TerrainDataAtlas.h.

◆ m_rawSolidMassGrid

Grid* agxTerrain::TerrainDataAtlas::m_rawSolidMassGrid
protected

Definition at line 177 of file TerrainDataAtlas.h.

◆ m_solidMassGrid

BasicGridRef agxTerrain::TerrainDataAtlas::m_solidMassGrid
protected

Definition at line 168 of file TerrainDataAtlas.h.

◆ m_voxelToVelocityTable

VoxelToVelocityTable agxTerrain::TerrainDataAtlas::m_voxelToVelocityTable
protected

Definition at line 173 of file TerrainDataAtlas.h.


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