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

Pure virtual interface class for the data storage grid classes we have. More...

#include <Grid.h>

+ Inheritance diagram for agxTerrain::Grid:

Classes

struct  GridCoord
 Container for holding a grid coordinate. More...
 

Public Types

using Factory = GridRef(*)(float defaultValue, agx::Real voxelSize)
 
typedef agx::VectorPOD
< Grid::GridCoord > 
GridCoordVector
 

Public Member Functions

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
 
virtual void clearGrid ()=0
 
virtual GridRef clone () const =0
 
virtual void combine (const Grid *other1)=0
 
virtual void combine2 (const Grid *other1, const Grid *other2)=0
 
virtual void deepCopyGrid (const Grid &grid)=0
 
virtual bool empty ()=0
 
virtual agx::HashSet< agx::Vec3i > findGeometryVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, bool onlyOccupiedVoxels=true) const =0
 
virtual bool findMeshVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Mesh *mesh, agx::Real voxelSize, agx::Vec3iVector &result)=0
 
virtual agx::HashSet< agx::Vec3i > findShapeVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Shape *shape, agx::Real voxelSize)=0
 
virtual agx::HashSet< agx::Vec3i > findTriangleListVoxelIntersections (const agx::AffineMatrix4x4 &gridTransform, const TriangleVector &triangles, agx::Real voxelSize)=0
 
virtual bool findTriangleListVoxelIntersectionsParallel (const agx::AffineMatrix4x4 &gridTransform, const agx::Vector< std::array< agx::Vec3, 3 >> &triangles, agx::Real voxelSize, agx::Vec3iVector &result)=0
 
virtual agx::HashSet< agx::Vec3i > findVoxelsAboveTriangles (const agx::AffineMatrix4x4 &gridTransform, const TriangleVector &triangles, agx::Real voxelSize, agx::Real margin)=0
 
virtual agx::Vec3iVector findVoxelsInLineIntersection (const agx::Line &line) const =0
 
virtual bool findVoxelSurfaceFromIndex (const agx::Vec3i &index, agx::Vec3i &result, bool globalSearch=false)=0
 
virtual agx::Vec3iVector getActiveVoxelIndices ()=0
 
virtual agxCollide::BoundingAABB getBoundingBox () const =0
 
virtual agx::Vec3 getElementSize () const =0
 
virtual float getFloatValue (const GridCoord &ijk) const =0
 
virtual size_t getMemoryUsage () const =0
 
virtual size_t getNumActiveVoxels () const =0
 
int getReferenceCount () const
 
virtual float getTotal () const =0
 
virtual std::tuple< float, float > getTotalAndLargest () const =0
 
virtual agx::Real getTotalReal () const =0
 
template<typename T >
bool is () const
 Subclass test. More...
 
virtual bool isActiveVoxel (const GridCoord &ijk) const =0
 
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...
 
virtual ActiveZoneIntersectionData removeVolumeInActiveZone (const agx::AffineMatrix4x4 &gridTransform, const ActiveZoneShapes &activeZoneShapes, const MeshIntersectionTestData &innerShapeInfo, const agx::Plane &innerShapeBoundary, const agx::Vec3 &up, const agx::Bound3 &bound, const agx::Vec3iVector voxelsInPrimaryActiveZoneLastTimeStep, std::function< float(const agx::Vec3i &)> getCompression, std::function< bool(const agx::Vec2i &)> canRemoveIndex, agx::Real voxelSize, agx::Real minOccupancyRemoval, agx::Real minAllowedHeight, bool useParticleFreeDeformers)=0
 
virtual agx::Vec3iVector removeVolumeInGeometry (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Geometry *geometry, agx::Real voxelSize, float emptyValue)=0
 
virtual agx::Vec3iVector removeVolumeInMesh (const agx::AffineMatrix4x4 &gridTransform, const agxCollide::Mesh *mesh, const agx::Vec3 &up, agx::Real voxelSize)=0
 
virtual agx::Vec3iVector removeVolumeInSphere (agx::Real radius, const agx::Vec3 &center, agx::Real voxelSize, float emptyValue)=0
 
virtual void restore (std::istream &in)=0
 
virtual void setFloatValue (const GridCoord &ijk, float value)=0
 
virtual void setValuesBelowHeightField (const agxCollide::HeightField *heightField, agx::Real voxelSize, int lowestAllowedVoxelIndex, Grid *compactionGrid)=0
 
virtual void setValuesBelowPlane (const agx::Plane &plane, const agx::Vec3u &numCells, agx::Real voxelSize)=0
 
virtual void store (std::ostream &out) const =0
 
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

static GridRef createGrid (float defaultValue, agx::Real voxelSize)
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

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

Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Pure virtual interface class for the data storage grid classes we have.

Makes it possible to have multiple implementations for the grid data storage, but the main purpose is to shield the user accessible header files from OpenVDB and it's dependencies.

Provides a number of batch operations that are expected to be faster to implement with knowledge about the underlying data structure instead of through per-cell element access.

Definition at line 55 of file Grid.h.

Member Typedef Documentation

using agxTerrain::Grid::Factory = GridRef(*)( float defaultValue, agx::Real voxelSize )

Definition at line 80 of file Grid.h.

Member Function Documentation

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
virtual void agxTerrain::Grid::clearGrid ( )
pure virtual
virtual GridRef agxTerrain::Grid::clone ( ) const
pure virtual
virtual void agxTerrain::Grid::combine ( const Grid *  other1)
pure virtual
virtual void agxTerrain::Grid::combine2 ( const Grid *  other1,
const Grid *  other2 
)
pure virtual
static GridRef agxTerrain::Grid::createGrid ( float  defaultValue,
agx::Real  voxelSize 
)
static
virtual void agxTerrain::Grid::deepCopyGrid ( const Grid &  grid)
pure virtual
void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
virtual bool agxTerrain::Grid::empty ( )
pure virtual
virtual agx::HashSet<agx::Vec3i> agxTerrain::Grid::findGeometryVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Geometry *  geometry,
agx::Real  voxelSize,
bool  onlyOccupiedVoxels = true 
) const
pure virtual
virtual bool agxTerrain::Grid::findMeshVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Mesh *  mesh,
agx::Real  voxelSize,
agx::Vec3iVector &  result 
)
pure virtual
virtual agx::HashSet<agx::Vec3i> agxTerrain::Grid::findShapeVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Shape *  shape,
agx::Real  voxelSize 
)
pure virtual
virtual agx::HashSet<agx::Vec3i> agxTerrain::Grid::findTriangleListVoxelIntersections ( const agx::AffineMatrix4x4 &  gridTransform,
const TriangleVector &  triangles,
agx::Real  voxelSize 
)
pure virtual
virtual bool agxTerrain::Grid::findTriangleListVoxelIntersectionsParallel ( const agx::AffineMatrix4x4 &  gridTransform,
const agx::Vector< std::array< agx::Vec3, 3 >> &  triangles,
agx::Real  voxelSize,
agx::Vec3iVector &  result 
)
pure virtual
virtual agx::HashSet<agx::Vec3i> agxTerrain::Grid::findVoxelsAboveTriangles ( const agx::AffineMatrix4x4 &  gridTransform,
const TriangleVector &  triangles,
agx::Real  voxelSize,
agx::Real  margin 
)
pure virtual
virtual agx::Vec3iVector agxTerrain::Grid::findVoxelsInLineIntersection ( const agx::Line &  line) const
pure virtual
virtual bool agxTerrain::Grid::findVoxelSurfaceFromIndex ( const agx::Vec3i &  index,
agx::Vec3i &  result,
bool  globalSearch = false 
)
pure virtual
virtual agx::Vec3iVector agxTerrain::Grid::getActiveVoxelIndices ( )
pure virtual
virtual agxCollide::BoundingAABB agxTerrain::Grid::getBoundingBox ( ) const
pure virtual
static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
virtual agx::Vec3 agxTerrain::Grid::getElementSize ( ) const
pure virtual
virtual float agxTerrain::Grid::getFloatValue ( const GridCoord &  ijk) const
pure virtual
virtual size_t agxTerrain::Grid::getMemoryUsage ( ) const
pure virtual
virtual size_t agxTerrain::Grid::getNumActiveVoxels ( ) const
pure virtual
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
virtual float agxTerrain::Grid::getTotal ( ) const
pure virtual
virtual std::tuple<float, float> agxTerrain::Grid::getTotalAndLargest ( ) const
pure virtual
virtual agx::Real agxTerrain::Grid::getTotalReal ( ) const
pure virtual
template<typename T >
bool agx::Referenced::is ( ) const
inherited
virtual bool agxTerrain::Grid::isActiveVoxel ( const GridCoord &  ijk) const
pure virtual
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().

virtual ActiveZoneIntersectionData agxTerrain::Grid::removeVolumeInActiveZone ( const agx::AffineMatrix4x4 &  gridTransform,
const ActiveZoneShapes &  activeZoneShapes,
const MeshIntersectionTestData &  innerShapeInfo,
const agx::Plane &  innerShapeBoundary,
const agx::Vec3 &  up,
const agx::Bound3 &  bound,
const agx::Vec3iVector  voxelsInPrimaryActiveZoneLastTimeStep,
std::function< float(const agx::Vec3i &)>  getCompression,
std::function< bool(const agx::Vec2i &)>  canRemoveIndex,
agx::Real  voxelSize,
agx::Real  minOccupancyRemoval,
agx::Real  minAllowedHeight,
bool  useParticleFreeDeformers 
)
pure virtual
virtual agx::Vec3iVector agxTerrain::Grid::removeVolumeInGeometry ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Geometry *  geometry,
agx::Real  voxelSize,
float  emptyValue 
)
pure virtual
virtual agx::Vec3iVector agxTerrain::Grid::removeVolumeInMesh ( const agx::AffineMatrix4x4 &  gridTransform,
const agxCollide::Mesh *  mesh,
const agx::Vec3 &  up,
agx::Real  voxelSize 
)
pure virtual
virtual agx::Vec3iVector agxTerrain::Grid::removeVolumeInSphere ( agx::Real  radius,
const agx::Vec3 &  center,
agx::Real  voxelSize,
float  emptyValue 
)
pure virtual
virtual void agxTerrain::Grid::restore ( std::istream &  in)
pure virtual
static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

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

virtual void agxTerrain::Grid::setFloatValue ( const GridCoord &  ijk,
float  value 
)
pure virtual
virtual void agxTerrain::Grid::setValuesBelowHeightField ( const agxCollide::HeightField *  heightField,
agx::Real  voxelSize,
int  lowestAllowedVoxelIndex,
Grid *  compactionGrid 
)
pure virtual
virtual void agxTerrain::Grid::setValuesBelowPlane ( const agx::Plane &  plane,
const agx::Vec3u &  numCells,
agx::Real  voxelSize 
)
pure virtual
virtual void agxTerrain::Grid::store ( std::ostream &  out) const
pure virtual
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: