OpenVDB 11.0.0

Loading...
Searching...
No Matches
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>`

Inheritance diagram for Grid< TreeT >:

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

## Static Public Member Functions
static uint64_t | memUsage ()
| Return memory usage in bytes for this class only.

## Public Attributes
uint64_t | mMagic
uint64_t | mChecksum
Version | mVersion
BitFlags< 32 > | mFlags
uint32_t | mGridIndex
uint32_t | mGridCount
uint64_t | mGridSize
char | mGridName [MaxNameSize]
Map | mMap
BBox< Vec3d > | 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

## ◆ AccessorType

template<typename TreeT>

using AccessorType = DefaultReadAccessor<BuildType>

## ◆ BuildType

template<typename TreeT>

using BuildType = typename TreeT::BuildType

## ◆ CoordType

template<typename TreeT>

using CoordType = typename TreeT::CoordType

## ◆ DataType

template<typename TreeT>

using DataType = GridData

## ◆ LeafNodeType

template<typename TreeT>

using LeafNodeType = typename RootType::LeafNodeType

## ◆ LowerNodeType

template<typename TreeT>

using LowerNodeType = typename UpperNodeType::ChildNodeType

## ◆ RootNodeType

template<typename TreeT>

using RootNodeType = RootType

## ◆ RootType

template<typename TreeT>

using RootType = typename TreeT::RootType

## ◆ TreeType

template<typename TreeT>

using TreeType = TreeT

## ◆ UpperNodeType

template<typename TreeT>

using UpperNodeType = typename RootNodeType::ChildNodeType

## ◆ ValueType

template<typename TreeT>

using ValueType = typename TreeT::ValueType

## Constructor & Destructor Documentation

## ◆ Grid()

template<typename TreeT>

Grid | ( | const Grid< TreeT > & |  | ) |
| delete

Disallow constructions, copy and assignment.

Note
  Only a Serializer, defined elsewhere, can instantiate this class

## ◆ ~Grid()

template<typename TreeT>

~Grid | ( |  | ) |
| delete

## Member Function Documentation

## ◆ activeVoxelCount()

template<typename TreeT>

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.

## ◆ applyIJT()

template<typename Vec3T>

Vec3T applyIJT | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyIJTF()

template<typename Vec3T>

Vec3T applyIJTF | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyInverseJacobian()

template<typename Vec3T>

Vec3T applyInverseJacobian | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyInverseJacobianF()

template<typename Vec3T>

Vec3T applyInverseJacobianF | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyInverseMap()

template<typename Vec3T>

Vec3T applyInverseMap | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyInverseMapF()

template<typename Vec3T>

Vec3T applyInverseMapF | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyJacobian()

template<typename Vec3T>

Vec3T applyJacobian | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyJacobianF()

template<typename Vec3T>

Vec3T applyJacobianF | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyMap()

template<typename Vec3T>

Vec3T applyMap | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ applyMapF()

template<typename Vec3T>

Vec3T applyMapF | ( | const Vec3T & | xyz | ) | const
| inline inherited

## ◆ blindData()

template<typename TreeT>

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

## ◆ blindDataCount()

template<typename TreeT>

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

## ◆ blindMetaData()

template<typename TreeT>

const GridBlindMetaData & blindMetaData | ( | uint32_t | n | ) | const
| inline

## ◆ checksum()

template<typename TreeT>

uint64_t checksum | ( |  | ) | const
| inline

Return checksum of the grid buffer.

## ◆ data() [1/2]

template<typename TreeT>

DataType * data | ( |  | ) |
| inline

## ◆ data() [2/2]

template<typename TreeT>

const DataType * data | ( |  | ) | const
| inline

## ◆ findBlindData()

template<typename TreeT>

int findBlindData | ( | const char * | name | ) | const

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

## ◆ findBlindDataForSemantic()

template<typename TreeT>

int findBlindDataForSemantic | ( | GridBlindDataSemantic | semantic | ) | const

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

## ◆ getAccessor()

template<typename TreeT>

AccessorType getAccessor | ( |  | ) | const
| inline

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

## ◆ getBlindData() [1/2]

template<typename TreeT>
template<typename BlindDataT>

BlindDataT * getBlindData | ( | uint32_t | n | ) |
| inline

## ◆ getBlindData() [2/2]

template<typename TreeT>
template<typename BlindDataT>

const BlindDataT * getBlindData | ( | uint32_t | n | ) | const
| inline

## ◆ gridClass()

template<typename TreeT>

const GridClass & gridClass | ( |  | ) | const
| inline

## ◆ gridCount()

template<typename TreeT>

uint32_t gridCount | ( |  | ) | const
| inline

Return total number of grids in the buffer.

## ◆ gridIndex()

template<typename TreeT>

uint32_t gridIndex | ( |  | ) | const
| inline

Return index of this grid in the buffer.

## ◆ gridName()

template<typename TreeT>

const char * gridName | ( |  | ) | const
| inline

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

## ◆ gridSize()

template<typename TreeT>

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

## ◆ gridType()

template<typename TreeT>

const GridType & gridType | ( |  | ) | const
| inline

## ◆ hasAverage()

template<typename TreeT>

bool hasAverage | ( |  | ) | const
| inline

## ◆ hasBBox()

template<typename TreeT>

bool hasBBox | ( |  | ) | const
| inline

## ◆ hasLongGridName()

template<typename TreeT>

bool hasLongGridName | ( |  | ) | const
| inline

## ◆ hasMinMax()

template<typename TreeT>

bool hasMinMax | ( |  | ) | const
| inline

## ◆ hasStdDeviation()

template<typename TreeT>

bool hasStdDeviation | ( |  | ) | const
| inline

## ◆ indexBBox()

const CoordBBox & indexBBox | ( |  | ) | const
| inline inherited

return AABB of active values in index space

## ◆ indexToWorld()

template<typename TreeT>
template<typename Vec3T>

Vec3T indexToWorld | ( | const Vec3T & | xyz | ) | const
| inline

index to world space transformation

## ◆ indexToWorldDir()

template<typename TreeT>
template<typename Vec3T>

Vec3T indexToWorldDir | ( | const Vec3T & | dir | ) | const
| inline

transformation from index space direction to world space direction

Warning
  assumes dir to be normalized

## ◆ indexToWorldDirF()

template<typename TreeT>
template<typename Vec3T>

Vec3T indexToWorldDirF | ( | const Vec3T & | dir | ) | const
| inline

transformation from index space direction to world space direction

Warning
  assumes dir to be normalized

## ◆ indexToWorldF()

template<typename TreeT>
template<typename Vec3T>

Vec3T indexToWorldF | ( | const Vec3T & | xyz | ) | const
| inline

index to world space transformation

## ◆ indexToWorldGrad()

template<typename TreeT>
template<typename Vec3T>

Vec3T indexToWorldGrad | ( | const Vec3T & | grad | ) | const
| inline

transform the gradient from index space to world space.

Applies the inverse jacobian transform map.

## ◆ indexToWorldGradF()

template<typename TreeT>
template<typename Vec3T>

Vec3T indexToWorldGradF | ( | const Vec3T & | grad | ) | const
| inline

Transforms the gradient from index space to world space.

Applies the inverse jacobian transform map.

## ◆ init()

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 )
| inline inherited

## ◆ isBreadthFirst()

template<typename TreeT>

bool isBreadthFirst | ( |  | ) | const
| inline

## ◆ isEmpty()

bool isEmpty | ( |  | ) | const
| inline inherited

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

Returns
  true if this grid contains not data whatsoever

## ◆ isFogVolume()

template<typename TreeT>

bool isFogVolume | ( |  | ) | const
| inline

## ◆ isGridIndex()

template<typename TreeT>

bool isGridIndex | ( |  | ) | const
| inline

## ◆ isLevelSet()

template<typename TreeT>

bool isLevelSet | ( |  | ) | const
| inline

## ◆ isMask()

template<typename TreeT>

bool isMask | ( |  | ) | const
| inline

## ◆ isPointData()

template<typename TreeT>

bool isPointData | ( |  | ) | const
| inline

## ◆ isPointIndex()

template<typename TreeT>

bool isPointIndex | ( |  | ) | const
| inline

## ◆ isRootConnected()

bool isRootConnected | ( |  | ) | const
| inline inherited

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

## ◆ isSequential() [1/3]

template<typename TreeT>
template<typename NodeT>

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.

## ◆ isSequential() [2/3]

template<typename TreeT>
template<int LEVEL>

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.

## ◆ isSequential() [3/3]

template<typename TreeT>

bool isSequential | ( |  | ) | const
| inline

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

## ◆ isStaggered()

template<typename TreeT>

bool isStaggered | ( |  | ) | const
| inline

## ◆ isUnknown()

template<typename TreeT>

bool isUnknown | ( |  | ) | const
| inline

## ◆ isValid()

template<typename TreeT>

bool isValid | ( |  | ) | const
| inline

Methods related to the classification of this grid.

## ◆ map()

template<typename TreeT>

const Map & map | ( |  | ) | const
| inline

Return a const reference to the Map for this grid.

## ◆ memUsage()

uint64_t memUsage | ( |  | ) |
| inline static inherited

Return memory usage in bytes for this class only.

## ◆ nodePtr() [1/2]

template<uint32_t LEVEL>

uint8_t * nodePtr | ( |  | ) |
| inline inherited

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

Template Parameters

  LEVEL | of the node. LEVEL 0 means leaf node and LEVEL 3 means root node

Warning
  If not nodes exist at `LEVEL` NULL is returned

## ◆ nodePtr() [2/2]

template<uint32_t LEVEL>

const uint8_t * nodePtr | ( |  | ) | const
| inline inherited

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

Template Parameters

  LEVEL | of the node. LEVEL 0 means leaf node and LEVEL 3 means root node

Warning
  If not nodes exist at `LEVEL` NULL is returned

## ◆ operator=()

template<typename TreeT>

Grid & operator= | ( | const Grid< TreeT > & |  | ) |
| delete

## ◆ pointCount()

template<typename TreeT>
template<typename T = BuildType>

enable_if< is_same< T, Point >::value, constuint64_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>

## ◆ rootTableSize()

uint32_t rootTableSize | ( |  | ) | const
| inline inherited

return the root table has size

## ◆ setAverageOn()

void setAverageOn | ( | bool | on = true | ) |
| inline inherited

## ◆ setBBoxOn()

void setBBoxOn | ( | bool | on = true | ) |
| inline inherited

## ◆ setGridName()

bool setGridName | ( | const char * | src | ) |
| inline inherited

## ◆ setLongGridNameOn()

void setLongGridNameOn | ( | bool | on = true | ) |
| inline inherited

## ◆ setMinMaxOn()

void setMinMaxOn | ( | bool | on = true | ) |
| inline inherited

## ◆ setStdDeviationOn()

void setStdDeviationOn | ( | bool | on = true | ) |
| inline inherited

## ◆ shortGridName()

template<typename TreeT>

const char * shortGridName | ( |  | ) | const
| inline

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

## ◆ tree() [1/2]

template<typename TreeT>

TreeT & tree | ( |  | ) |
| inline

Return a non-const reference to the tree.

## ◆ tree() [2/2]

template<typename TreeT>

const TreeT & tree | ( |  | ) | const
| inline

Return a const reference to the tree.

## ◆ treePtr() [1/2]

uint8_t * treePtr | ( |  | ) |
| inline inherited

## ◆ treePtr() [2/2]

const uint8_t * treePtr | ( |  | ) | const
| inline inherited

## ◆ valueCount()

template<typename TreeT>
template<typename T = BuildType>

enable_if< BuildTraits< T >::is_index, constuint64_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>

## ◆ version()

template<typename TreeT>

Version version | ( |  | ) | const
| inline

## ◆ voxelSize()

template<typename TreeT>

const Vec3d & voxelSize | ( |  | ) | const
| inline

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

## ◆ worldBBox()

const BBox< Vec3d > & worldBBox | ( |  | ) | const
| inline inherited

return AABB of active values in world space

## ◆ worldToIndex()

template<typename TreeT>
template<typename Vec3T>

Vec3T worldToIndex | ( | const Vec3T & | xyz | ) | const
| inline

world to index space transformation

## ◆ worldToIndexDir()

template<typename TreeT>
template<typename Vec3T>

Vec3T worldToIndexDir | ( | const Vec3T & | dir | ) | const
| inline

transformation from world space direction to index space direction

Warning
  assumes dir to be normalized

## ◆ worldToIndexDirF()

template<typename TreeT>
template<typename Vec3T>

Vec3T worldToIndexDirF | ( | const Vec3T & | dir | ) | const
| inline

transformation from world space direction to index space direction

Warning
  assumes dir to be normalized

## ◆ worldToIndexF()

template<typename TreeT>
template<typename Vec3T>

Vec3T worldToIndexF | ( | const Vec3T & | xyz | ) | const
| inline

world to index space transformation

## Member Data Documentation

## ◆ MaxNameSize

const int MaxNameSize = 256
| static inherited

## ◆ mBlindMetadataCount

uint32_t mBlindMetadataCount
| inherited

## ◆ mBlindMetadataOffset

int64_t mBlindMetadataOffset
| inherited

## ◆ mChecksum

uint64_t mChecksum
| inherited

## ◆ mData0

uint32_t mData0
| inherited

## ◆ mData1

uint64_t mData1
| inherited

## ◆ mData2

uint64_t mData2
| inherited

## ◆ mFlags

BitFlags<32> mFlags
| inherited

## ◆ mGridClass

GridClass mGridClass
| inherited

## ◆ mGridCount

uint32_t mGridCount
| inherited

## ◆ mGridIndex

uint32_t mGridIndex
| inherited

## ◆ mGridName

char mGridName[MaxNameSize]
| inherited

## ◆ mGridSize

uint64_t mGridSize
| inherited

## ◆ mGridType

GridType mGridType
| inherited

## ◆ mMagic

uint64_t mMagic
| inherited

## ◆ mMap

Map mMap
| inherited

## ◆ mVersion

Version mVersion
| inherited

## ◆ mVoxelSize

Vec3d mVoxelSize
| inherited

## ◆ mWorldBBox

BBox<Vec3d> mWorldBBox
| inherited