OpenVDB  12.0.0
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Grid< TreeT > Class Template Reference

Highest level of the data structure. Contains a tree and a world->index transform (that currently only supports uniform scaling and translation). More...

#include <nanovdb/NanoVDB.h>

Inherits GridData.

Public Types

using TreeType = TreeT
 
using RootType = typename TreeT::RootType
 
using RootNodeType = RootType
 
using UpperNodeType = typename RootNodeType::ChildNodeType
 
using LowerNodeType = typename UpperNodeType::ChildNodeType
 
using LeafNodeType = typename RootType::LeafNodeType
 
using DataType = GridData
 
using ValueType = typename TreeT::ValueType
 
using BuildType = typename TreeT::BuildType
 
using CoordType = typename TreeT::CoordType
 
using AccessorType = DefaultReadAccessor< BuildType >
 

Public Member Functions

 Grid (const Grid &)=delete
 Disallow constructions, copy and assignment. More...
 
Gridoperator= (const Grid &)=delete
 
 ~Grid ()=delete
 
__hostdev__ Version version () const
 
__hostdev__ DataTypedata ()
 
__hostdev__ const DataTypedata () const
 
__hostdev__ uint64_t gridSize () const
 Return memory usage in bytes for this class only. More...
 
__hostdev__ uint32_t gridIndex () const
 Return index of this grid in the buffer. More...
 
__hostdev__ uint32_t gridCount () const
 Return total number of grids in the buffer. More...
 
template<typename T = BuildType>
__hostdev__ util::enable_if< BuildTraits< T >::is_index, const uint64_t & >::type valueCount () const
 Return the total number of values indexed by this IndexGrid. More...
 
template<typename T = BuildType>
__hostdev__ util::enable_if< util::is_same< T, Point >::value, const uint64_t & >::type pointCount () const
 Return the total number of points indexed by this PointGrid. More...
 
__hostdev__ const TreeT & tree () const
 Return a const reference to the tree. More...
 
__hostdev__ TreeT & tree ()
 Return a non-const reference to the tree. More...
 
__hostdev__ AccessorType getAccessor () const
 Return a new instance of a ReadAccessor used to access values in this grid. More...
 
__hostdev__ const Vec3dvoxelSize () const
 Return a const reference to the size of a voxel in world units. More...
 
__hostdev__ const Mapmap () const
 Return a const reference to the Map for this grid. More...
 
template<typename Vec3T >
__hostdev__ Vec3T worldToIndex (const Vec3T &xyz) const
 world to index space transformation More...
 
template<typename Vec3T >
__hostdev__ Vec3T indexToWorld (const Vec3T &xyz) const
 index to world space transformation More...
 
template<typename Vec3T >
__hostdev__ Vec3T indexToWorldDir (const Vec3T &dir) const
 transformation from index space direction to world space direction More...
 
template<typename Vec3T >
__hostdev__ Vec3T worldToIndexDir (const Vec3T &dir) const
 transformation from world space direction to index space direction More...
 
template<typename Vec3T >
__hostdev__ Vec3T indexToWorldGrad (const Vec3T &grad) const
 transform the gradient from index space to world space. More...
 
template<typename Vec3T >
__hostdev__ Vec3T worldToIndexF (const Vec3T &xyz) const
 world to index space transformation More...
 
template<typename Vec3T >
__hostdev__ Vec3T indexToWorldF (const Vec3T &xyz) const
 index to world space transformation More...
 
template<typename Vec3T >
__hostdev__ Vec3T indexToWorldDirF (const Vec3T &dir) const
 transformation from index space direction to world space direction More...
 
template<typename Vec3T >
__hostdev__ Vec3T worldToIndexDirF (const Vec3T &dir) const
 transformation from world space direction to index space direction More...
 
template<typename Vec3T >
__hostdev__ Vec3T indexToWorldGradF (const Vec3T &grad) const
 Transforms the gradient from index space to world space. More...
 
__hostdev__ uint64_t activeVoxelCount () const
 Computes a AABB of active values in world space. More...
 
__hostdev__ bool isValid () const
 Methods related to the classification of this grid. More...
 
__hostdev__ const GridTypegridType () const
 
__hostdev__ const GridClassgridClass () const
 
__hostdev__ bool isLevelSet () const
 
__hostdev__ bool isFogVolume () const
 
__hostdev__ bool isStaggered () const
 
__hostdev__ bool isPointIndex () const
 
__hostdev__ bool isGridIndex () const
 
__hostdev__ bool isPointData () const
 
__hostdev__ bool isMask () const
 
__hostdev__ bool isUnknown () const
 
__hostdev__ bool hasMinMax () const
 
__hostdev__ bool hasBBox () const
 
__hostdev__ bool hasLongGridName () const
 
__hostdev__ bool hasAverage () const
 
__hostdev__ bool hasStdDeviation () const
 
__hostdev__ bool isBreadthFirst () const
 
template<typename NodeT >
__hostdev__ bool isSequential () const
 return true if the specified node type is layed out breadth-first in memory and has a fixed size. This allows for sequential access to the nodes. More...
 
template<int LEVEL>
__hostdev__ bool isSequential () const
 return true if the specified node level is layed out breadth-first in memory and has a fixed size. This allows for sequential access to the nodes. More...
 
__hostdev__ bool isSequential () const
 return true if nodes at all levels can safely be accessed with simple linear offsets More...
 
__hostdev__ const char * gridName () const
 Return a c-string with the name of this grid. More...
 
__hostdev__ const char * shortGridName () const
 Return a c-string with the name of this grid, truncated to 255 characters. More...
 
__hostdev__ const Checksumchecksum () const
 Return checksum of the grid buffer. More...
 
__hostdev__ uint32_t blindDataCount () const
 Return true if this grid is empty, i.e. contains no values or nodes. More...
 
__hostdev__ int findBlindData (const char *name) const
 Return the index of the first blind data with specified name if found, otherwise -1. More...
 
__hostdev__ int findBlindDataForSemantic (GridBlindDataSemantic semantic) const
 Return the index of the first blind data with specified semantic if found, otherwise -1. More...
 
__hostdev__ const void * blindData (uint32_t n) const
 Returns a const pointer to the blindData at the specified linear offset. More...
 
template<typename BlindDataT >
__hostdev__ const BlindDataT * getBlindData (uint32_t n) const
 
template<typename BlindDataT >
__hostdev__ BlindDataT * getBlindData (uint32_t n)
 
__hostdev__ const GridBlindMetaDatablindMetaData (uint32_t n) const
 
__hostdev__ void init (std::initializer_list< GridFlags > list={GridFlags::IsBreadthFirst}, uint64_t gridSize=0u, const Map &map=Map(), GridType gridType=GridType::Unknown, GridClass gridClass=GridClass::Unknown)
 
__hostdev__ void setMinMaxOn (bool on=true)
 
__hostdev__ void setBBoxOn (bool on=true)
 
__hostdev__ void setLongGridNameOn (bool on=true)
 
__hostdev__ void setAverageOn (bool on=true)
 
__hostdev__ void setStdDeviationOn (bool on=true)
 
__hostdev__ bool setGridName (const char *src)
 
template<typename Vec3T >
__hostdev__ Vec3T applyMap (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyInverseMap (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyJacobian (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyInverseJacobian (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyIJT (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyMapF (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyInverseMapF (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyJacobianF (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyInverseJacobianF (const Vec3T &xyz) const
 
template<typename Vec3T >
__hostdev__ Vec3T applyIJTF (const Vec3T &xyz) const
 
__hostdev__ void * treePtr ()
 
__hostdev__ const void * treePtr () const
 
template<uint32_t LEVEL>
__hostdev__ const void * nodePtr () const
 Return a non-const void pointer to the first node at LEVEL. More...
 
template<uint32_t LEVEL>
__hostdev__ void * nodePtr ()
 Return a non-const void pointer to the first node at LEVEL. More...
 
template<uint32_t LEVEL>
__hostdev__ uint32_t nodeCount () const
 Return number of nodes at LEVEL. More...
 
__hostdev__ const Vec3dBBox & worldBBox () const
 return AABB of active values in world space More...
 
__hostdev__ const CoordBBox & indexBBox () const
 return AABB of active values in index space More...
 
__hostdev__ uint32_t rootTableSize () const
 return the root table has size More...
 
__hostdev__ bool isEmpty () const
 test if the grid is empty, e.i the root table has size 0 More...
 
__hostdev__ bool isRootConnected () const
 return true if RootData follows TreeData in memory without any extra padding More...
 

Static Public Member Functions

static __hostdev__ uint64_t memUsage ()
 Return memory usage in bytes for this class only. More...
 

Public Attributes

uint64_t mMagic
 
Checksum mChecksum
 
Version mVersion
 
BitFlags< 32 > mFlags
 
uint32_t mGridIndex
 
uint32_t mGridCount
 
uint64_t mGridSize
 
char mGridName [MaxNameSize]
 
Map mMap
 
Vec3dBBox mWorldBBox
 
Vec3d mVoxelSize
 
GridClass mGridClass
 
GridType mGridType
 
int64_t mBlindMetadataOffset
 
uint32_t mBlindMetadataCount
 
uint32_t mData0
 
uint64_t mData1
 
uint64_t mData2
 

Static Public Attributes

static const int MaxNameSize = 256
 

Detailed Description

template<typename TreeT>
class nanovdb::Grid< TreeT >

Highest level of the data structure. Contains a tree and a world->index transform (that currently only supports uniform scaling and translation).

Note
This the API of this class to interface with client code

Member Typedef Documentation

using BuildType = typename TreeT::BuildType
using CoordType = typename TreeT::CoordType
using DataType = GridData
using LeafNodeType = typename RootType::LeafNodeType
using LowerNodeType = typename UpperNodeType::ChildNodeType
using RootType = typename TreeT::RootType
using TreeType = TreeT
using UpperNodeType = typename RootNodeType::ChildNodeType
using ValueType = typename TreeT::ValueType

Constructor & Destructor Documentation

Grid ( const Grid< TreeT > &  )
delete

Disallow constructions, copy and assignment.

Note
Only a Serializer, defined elsewhere, can instantiate this class
~Grid ( )
delete

Member Function Documentation

__hostdev__ uint64_t activeVoxelCount ( ) const
inline

Computes a AABB of active values in world space.

Computes a AABB of active values in index space

Note
This method is returning a floating point bounding box and not a CoordBBox. This makes it more useful for clipping rays. Return the total number of active voxels in this tree.
__hostdev__ Vec3T applyIJT ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyIJTF ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyInverseJacobian ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyInverseJacobianF ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyInverseMap ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyInverseMapF ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyJacobian ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyJacobianF ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyMap ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ Vec3T applyMapF ( const Vec3T &  xyz) const
inlineinherited
__hostdev__ const void* blindData ( uint32_t  n) const
inline

Returns a const pointer to the blindData at the specified linear offset.

Warning
Pointer might be NULL and the linear offset is assumed to be in the valid range
__hostdev__ uint32_t blindDataCount ( ) const
inline

Return true if this grid is empty, i.e. contains no values or nodes.

Return the count of blind-data encoded in this grid

__hostdev__ const GridBlindMetaData& blindMetaData ( uint32_t  n) const
inline
__hostdev__ const Checksum& checksum ( ) const
inline

Return checksum of the grid buffer.

__hostdev__ DataType* data ( )
inline
__hostdev__ const DataType* data ( ) const
inline
__hostdev__ int findBlindData ( const char *  name) const

Return the index of the first blind data with specified name if found, otherwise -1.

__hostdev__ int findBlindDataForSemantic ( GridBlindDataSemantic  semantic) const

Return the index of the first blind data with specified semantic if found, otherwise -1.

__hostdev__ AccessorType getAccessor ( ) const
inline

Return a new instance of a ReadAccessor used to access values in this grid.

__hostdev__ const BlindDataT* getBlindData ( uint32_t  n) const
inline
__hostdev__ BlindDataT* getBlindData ( uint32_t  n)
inline
__hostdev__ const GridClass& gridClass ( ) const
inline
__hostdev__ uint32_t gridCount ( ) const
inline

Return total number of grids in the buffer.

__hostdev__ uint32_t gridIndex ( ) const
inline

Return index of this grid in the buffer.

__hostdev__ const char* gridName ( ) const
inline

Return a c-string with the name of this grid.

__hostdev__ uint64_t gridSize ( ) const
inline

Return memory usage in bytes for this class only.

Return the memory footprint of the entire grid, i.e. including all nodes and blind data

__hostdev__ const GridType& gridType ( ) const
inline
__hostdev__ bool hasAverage ( ) const
inline
__hostdev__ bool hasBBox ( ) const
inline
__hostdev__ bool hasLongGridName ( ) const
inline
__hostdev__ bool hasMinMax ( ) const
inline
__hostdev__ bool hasStdDeviation ( ) const
inline
__hostdev__ const CoordBBox& indexBBox ( ) const
inlineinherited

return AABB of active values in index space

__hostdev__ Vec3T indexToWorld ( const Vec3T &  xyz) const
inline

index to world space transformation

__hostdev__ Vec3T indexToWorldDir ( const Vec3T &  dir) const
inline

transformation from index space direction to world space direction

Warning
assumes dir to be normalized
__hostdev__ Vec3T indexToWorldDirF ( const Vec3T &  dir) const
inline

transformation from index space direction to world space direction

Warning
assumes dir to be normalized
__hostdev__ Vec3T indexToWorldF ( const Vec3T &  xyz) const
inline

index to world space transformation

__hostdev__ Vec3T indexToWorldGrad ( const Vec3T &  grad) const
inline

transform the gradient from index space to world space.

Applies the inverse jacobian transform map.

__hostdev__ Vec3T indexToWorldGradF ( const Vec3T &  grad) const
inline

Transforms the gradient from index space to world space.

Applies the inverse jacobian transform map.

__hostdev__ void init ( std::initializer_list< GridFlags list = {GridFlags::IsBreadthFirst},
uint64_t  gridSize = 0u,
const Map map = Map(),
GridType  gridType = GridType::Unknown,
GridClass  gridClass = GridClass::Unknown 
)
inlineinherited
__hostdev__ bool isBreadthFirst ( ) const
inline
__hostdev__ bool isEmpty ( ) const
inlineinherited

test if the grid is empty, e.i the root table has size 0

Returns
true if this grid contains not data whatsoever
__hostdev__ bool isFogVolume ( ) const
inline
__hostdev__ bool isGridIndex ( ) const
inline
__hostdev__ bool isLevelSet ( ) const
inline
__hostdev__ bool isMask ( ) const
inline
__hostdev__ bool isPointData ( ) const
inline
__hostdev__ bool isPointIndex ( ) const
inline
__hostdev__ bool isRootConnected ( ) const
inlineinherited

return true if RootData follows TreeData in memory without any extra padding

TreeData is always following right after GridData, but the same might not be true for RootData

__hostdev__ bool isSequential ( ) const
inline

return true if the specified node type is layed out breadth-first in memory and has a fixed size. This allows for sequential access to the nodes.

__hostdev__ bool isSequential ( ) const
inline

return true if the specified node level is layed out breadth-first in memory and has a fixed size. This allows for sequential access to the nodes.

__hostdev__ bool isSequential ( ) const
inline

return true if nodes at all levels can safely be accessed with simple linear offsets

__hostdev__ bool isStaggered ( ) const
inline
__hostdev__ bool isUnknown ( ) const
inline
__hostdev__ bool isValid ( ) const
inline

Methods related to the classification of this grid.

__hostdev__ const Map& map ( ) const
inline

Return a const reference to the Map for this grid.

static __hostdev__ uint64_t memUsage ( )
inlinestaticinherited

Return memory usage in bytes for this class only.

__hostdev__ uint32_t nodeCount ( ) const
inlineinherited

Return number of nodes at LEVEL.

Template Parameters
Levelof the node. LEVEL 0 means leaf node and LEVEL 2 means upper node
__hostdev__ const void* nodePtr ( ) const
inlineinherited

Return a non-const void pointer to the first node at LEVEL.

Template Parameters
LEVELLevel of the node. LEVEL 0 means leaf node and LEVEL 3 means root node
__hostdev__ void* nodePtr ( )
inlineinherited

Return a non-const void pointer to the first node at LEVEL.

Template Parameters
LEVELof the node. LEVEL 0 means leaf node and LEVEL 3 means root node
Warning
If not nodes exist at LEVEL NULL is returned
Grid& operator= ( const Grid< TreeT > &  )
delete
__hostdev__ util::enable_if<util::is_same<T, Point>::value, const uint64_t&>::type pointCount ( ) const
inline

Return the total number of points indexed by this PointGrid.

Note
This method is only defined for PointGrid = NanoGrid<Point>
__hostdev__ uint32_t rootTableSize ( ) const
inlineinherited

return the root table has size

__hostdev__ void setAverageOn ( bool  on = true)
inlineinherited
__hostdev__ void setBBoxOn ( bool  on = true)
inlineinherited
__hostdev__ bool setGridName ( const char *  src)
inlineinherited
__hostdev__ void setLongGridNameOn ( bool  on = true)
inlineinherited
__hostdev__ void setMinMaxOn ( bool  on = true)
inlineinherited
__hostdev__ void setStdDeviationOn ( bool  on = true)
inlineinherited
__hostdev__ const char* shortGridName ( ) const
inline

Return a c-string with the name of this grid, truncated to 255 characters.

__hostdev__ const TreeT& tree ( ) const
inline

Return a const reference to the tree.

__hostdev__ TreeT& tree ( )
inline

Return a non-const reference to the tree.

__hostdev__ void* treePtr ( )
inlineinherited
__hostdev__ const void* treePtr ( ) const
inlineinherited
__hostdev__ util::enable_if<BuildTraits<T>::is_index, const uint64_t&>::type valueCount ( ) const
inline

Return the total number of values indexed by this IndexGrid.

Note
This method is only defined for IndexGrid = NanoGrid<ValueIndex || ValueOnIndex || ValueIndexMask || ValueOnIndexMask>
__hostdev__ Version version ( ) const
inline
__hostdev__ const Vec3d& voxelSize ( ) const
inline

Return a const reference to the size of a voxel in world units.

__hostdev__ const Vec3dBBox& worldBBox ( ) const
inlineinherited

return AABB of active values in world space

__hostdev__ Vec3T worldToIndex ( const Vec3T &  xyz) const
inline

world to index space transformation

__hostdev__ Vec3T worldToIndexDir ( const Vec3T &  dir) const
inline

transformation from world space direction to index space direction

Warning
assumes dir to be normalized
__hostdev__ Vec3T worldToIndexDirF ( const Vec3T &  dir) const
inline

transformation from world space direction to index space direction

Warning
assumes dir to be normalized
__hostdev__ Vec3T worldToIndexF ( const Vec3T &  xyz) const
inline

world to index space transformation

Member Data Documentation

const int MaxNameSize = 256
staticinherited
uint32_t mBlindMetadataCount
inherited
int64_t mBlindMetadataOffset
inherited
Checksum mChecksum
inherited
uint32_t mData0
inherited
uint64_t mData1
inherited
uint64_t mData2
inherited
BitFlags<32> mFlags
inherited
GridClass mGridClass
inherited
uint32_t mGridCount
inherited
uint32_t mGridIndex
inherited
char mGridName[MaxNameSize]
inherited
uint64_t mGridSize
inherited
GridType mGridType
inherited
uint64_t mMagic
inherited
Map mMap
inherited
Version mVersion
inherited
Vec3d mVoxelSize
inherited
Vec3dBBox mWorldBBox
inherited