OpenVDB  7.0.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Grid< _TreeType > Class Template Reference

Container class that associates a tree with a transform and metadata. More...

#include <Grid.h>

Classes

struct  ValueConverter
 ValueConverter<T>::Type is the type of a grid having the same hierarchy as this grid but a different value type, T. More...
 

Public Types

using Ptr = SharedPtr< Grid >
 
using ConstPtr = SharedPtr< const Grid >
 
using TreeType = _TreeType
 
using TreePtrType = typename _TreeType::Ptr
 
using ConstTreePtrType = typename _TreeType::ConstPtr
 
using ValueType = typename _TreeType::ValueType
 
using BuildType = typename _TreeType::BuildType
 
using ValueOnIter = typename _TreeType::ValueOnIter
 
using ValueOnCIter = typename _TreeType::ValueOnCIter
 
using ValueOffIter = typename _TreeType::ValueOffIter
 
using ValueOffCIter = typename _TreeType::ValueOffCIter
 
using ValueAllIter = typename _TreeType::ValueAllIter
 
using ValueAllCIter = typename _TreeType::ValueAllCIter
 
using Accessor = typename tree::ValueAccessor< _TreeType, true >
 
using ConstAccessor = typename tree::ValueAccessor< const _TreeType, true >
 
using UnsafeAccessor = typename tree::ValueAccessor< _TreeType, false >
 
using ConstUnsafeAccessor = typename tree::ValueAccessor< const _TreeType, false >
 

Public Member Functions

 Grid ()
 Construct a new grid with background value zero. More...
 
 Grid (const ValueType &background)
 Construct a new grid with the given background value. More...
 
 Grid (TreePtrType)
 Construct a new grid that shares the given tree and associates with it an identity linear transform. More...
 
 Grid (const Grid &)
 Deep copy another grid's metadata, transform and tree. More...
 
template<typename OtherTreeType >
 Grid (const Grid< OtherTreeType > &)
 Deep copy the metadata, transform and tree of another grid whose tree configuration is the same as this grid's but whose value type is different. Cast the other grid's values to this grid's value type. More...
 
 Grid (Grid &, ShallowCopy)
 Deep copy another grid's metadata and transform, but share its tree. More...
 
 Grid (const GridBase &)
 Deep copy another grid's metadata and transform, but construct a new tree with background value zero. More...
 
 ~Grid () override
 
Gridoperator= (const Grid &)=delete
 Disallow assignment, since it wouldn't be obvious whether the copy is deep or shallow. More...
 
Voxel access
const ValueTypebackground () const
 Return this grid's background value. More...
 
bool empty () const override
 Return true if this grid contains only inactive background voxels. More...
 
void clear () override
 Empty this grid, so that all voxels become inactive background voxels. More...
 
Accessor getAccessor ()
 Return an accessor that provides random read and write access to this grid's voxels. More...
 
UnsafeAccessor getUnsafeAccessor ()
 Return an unsafe accessor that provides random read and write access to this grid's voxels. More...
 
ConstAccessor getAccessor () const
 Return an accessor that provides random read-only access to this grid's voxels. More...
 
ConstAccessor getConstAccessor () const
 Return an accessor that provides random read-only access to this grid's voxels. More...
 
ConstUnsafeAccessor getConstUnsafeAccessor () const
 Return an unsafe accessor that provides random read-only access to this grid's voxels. More...
 
ValueOnIter beginValueOn ()
 Return an iterator over all of this grid's active values (tile and voxel). More...
 
ValueOnCIter beginValueOn () const
 Return an iterator over all of this grid's active values (tile and voxel). More...
 
ValueOnCIter cbeginValueOn () const
 Return an iterator over all of this grid's active values (tile and voxel). More...
 
ValueOffIter beginValueOff ()
 Return an iterator over all of this grid's inactive values (tile and voxel). More...
 
ValueOffCIter beginValueOff () const
 Return an iterator over all of this grid's inactive values (tile and voxel). More...
 
ValueOffCIter cbeginValueOff () const
 Return an iterator over all of this grid's inactive values (tile and voxel). More...
 
ValueAllIter beginValueAll ()
 Return an iterator over all of this grid's values (tile and voxel). More...
 
ValueAllCIter beginValueAll () const
 Return an iterator over all of this grid's values (tile and voxel). More...
 
ValueAllCIter cbeginValueAll () const
 Return an iterator over all of this grid's values (tile and voxel). More...
 
Tools
void sparseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value. More...
 
void fill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value. More...
 
void denseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within a given axis-aligned box to a constant value and ensure that those voxels are all represented at the leaf level. More...
 
void pruneGrid (float tolerance=0.0) override
 Reduce the memory footprint of this grid by increasing its sparseness. More...
 
void clip (const CoordBBox &) override
 Clip this grid to the given index-space bounding box. More...
 
void merge (Grid &other, MergePolicy policy=MERGE_ACTIVE_STATES)
 Efficiently merge another grid into this grid using one of several schemes. More...
 
template<typename OtherTreeType >
void topologyUnion (const Grid< OtherTreeType > &other)
 Union this grid's set of active values with the active values of the other grid, whose value type may be different. More...
 
template<typename OtherTreeType >
void topologyIntersection (const Grid< OtherTreeType > &other)
 Intersect this grid's set of active values with the active values of the other grid, whose value type may be different. More...
 
template<typename OtherTreeType >
void topologyDifference (const Grid< OtherTreeType > &other)
 Difference this grid's set of active values with the active values of the other grid, whose value type may be different. More...
 
Statistics
Index64 activeVoxelCount () const override
 Return the number of active voxels. More...
 
CoordBBox evalActiveVoxelBoundingBox () const override
 Return the axis-aligned bounding box of all active voxels. More...
 
Coord evalActiveVoxelDim () const override
 Return the dimensions of the axis-aligned bounding box of all active voxels. More...
 
void evalMinMax (ValueType &minVal, ValueType &maxVal) const
 Return the minimum and maximum active values in this grid. More...
 
Index64 memUsage () const override
 
Tree
TreePtrType treePtr ()
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
ConstTreePtrType treePtr () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
ConstTreePtrType constTreePtr () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
TreeBase::ConstPtr constBaseTreePtr () const override
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
TreeTypetree ()
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeTypetree () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
const TreeTypeconstTree () const
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
void setTree (TreeBase::Ptr) override
 Associate the given tree with this grid, in place of its existing tree. More...
 
void newTree () override
 Associate a new, empty tree with this grid, in place of its existing tree. More...
 
I/O
void readTopology (std::istream &) override
 Read the grid topology from a stream. This will read only the grid structure, not the actual data buffers. More...
 
void writeTopology (std::ostream &) const override
 Write the grid topology to a stream. This will write only the grid structure, not the actual data buffers. More...
 
void readBuffers (std::istream &) override
 Read all data buffers for this grid. More...
 
void readBuffers (std::istream &, const CoordBBox &) override
 Read all of this grid's data buffers that intersect the given index-space bounding box. More...
 
void readNonresidentBuffers () const override
 Read all of this grid's data buffers that are not yet resident in memory (because delayed loading is in effect). More...
 
void writeBuffers (std::ostream &) const override
 Write out all data buffers for this grid. More...
 
void print (std::ostream &=std::cout, int verboseLevel=1) const override
 Output a human-readable description of this grid. More...
 

Static Public Member Functions

static Ptr create (const ValueType &background)
 Return a new grid with the given background value. More...
 
static Ptr create ()
 Return a new grid with background value zero. More...
 
static Ptr create (TreePtrType)
 Return a new grid that contains the given tree. More...
 
static Ptr create (const GridBase &other)
 Return a new, empty grid with the same transform and metadata as the given grid and with background value zero. More...
 
static bool hasMultiPassIO ()
 Return true if grids of this type require multiple I/O passes to read and write data buffers. More...
 
Registry
static bool isRegistered ()
 Return true if this grid type is registered. More...
 
static void registerGrid ()
 Register this grid type along with a factory function. More...
 
static void unregisterGrid ()
 Remove this grid type from the registry. More...
 

Copying

static Name gridType ()
 Return the name of this type of grid. More...
 
Ptr copy ()
 Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is shared with this grid. More...
 
ConstPtr copy () const
 Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is shared with this grid. More...
 
Ptr copyWithNewTree () const
 Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is default-constructed. More...
 
GridBase::Ptr copyGrid () override
 Return a new grid of the same type as this grid whose metadata is a deep copy of this grid's and whose tree and transform are shared with this grid. More...
 
GridBase::ConstPtr copyGrid () const override
 Return a new grid of the same type as this grid whose metadata is a deep copy of this grid's and whose tree and transform are shared with this grid. More...
 
GridBase::Ptr copyGridWithNewTree () const override
 Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is default-constructed. More...
 
ConstPtr copyReplacingMetadata (const MetaMap &meta) const
 Return a new grid of the same type as this grid whose tree and transform is shared with this grid and whose metadata is provided as an argument. More...
 
ConstPtr copyReplacingTransform (math::Transform::Ptr xform) const
 Return a new grid of the same type as this grid whose tree is shared with this grid, whose metadata is a deep copy of this grid's and whose transform is provided as an argument. More...
 
ConstPtr copyReplacingMetadataAndTransform (const MetaMap &meta, math::Transform::Ptr xform) const
 Return a new grid of the same type as this grid whose tree is shared with this grid and whose transform and metadata are provided as arguments. More...
 
GridBase::ConstPtr copyGridReplacingMetadata (const MetaMap &meta) const override
 Return a new grid of the same type as this grid whose tree and transform is shared with this grid and whose metadata is provided as an argument. More...
 
GridBase::ConstPtr copyGridReplacingTransform (math::Transform::Ptr xform) const override
 Return a new grid of the same type as this grid whose tree is shared with this grid, whose metadata is a deep copy of this grid's and whose transform is provided as an argument. More...
 
GridBase::ConstPtr copyGridReplacingMetadataAndTransform (const MetaMap &meta, math::Transform::Ptr xform) const override
 Return a new grid of the same type as this grid whose tree is shared with this grid and whose transform and metadata are provided as arguments. More...
 
Ptr deepCopy () const
 Return a new grid whose metadata, transform and tree are deep copies of this grid's. More...
 
GridBase::Ptr deepCopyGrid () const override
 Return a new grid whose metadata, transform and tree are deep copies of this grid's. More...
 
Name type () const override
 Return the name of this grid's type. More...
 
Name valueType () const override
 Return the name of the type of a voxel's value (e.g., "float" or "vec3d"). More...
 

Detailed Description

template<typename _TreeType>
class openvdb::v7_0::Grid< _TreeType >

Container class that associates a tree with a transform and metadata.

Member Typedef Documentation

◆ Accessor

using Accessor = typename tree::ValueAccessor<_TreeType, true>

◆ BuildType

using BuildType = typename _TreeType::BuildType

◆ ConstAccessor

using ConstAccessor = typename tree::ValueAccessor<const _TreeType, true>

◆ ConstPtr

using ConstPtr = SharedPtr<const Grid>

◆ ConstTreePtrType

using ConstTreePtrType = typename _TreeType::ConstPtr

◆ ConstUnsafeAccessor

using ConstUnsafeAccessor = typename tree::ValueAccessor<const _TreeType, false>

◆ Ptr

using Ptr = SharedPtr<Grid>

◆ TreePtrType

using TreePtrType = typename _TreeType::Ptr

◆ TreeType

using TreeType = _TreeType

◆ UnsafeAccessor

using UnsafeAccessor = typename tree::ValueAccessor<_TreeType, false>

◆ ValueAllCIter

using ValueAllCIter = typename _TreeType::ValueAllCIter

◆ ValueAllIter

using ValueAllIter = typename _TreeType::ValueAllIter

◆ ValueOffCIter

using ValueOffCIter = typename _TreeType::ValueOffCIter

◆ ValueOffIter

using ValueOffIter = typename _TreeType::ValueOffIter

◆ ValueOnCIter

using ValueOnCIter = typename _TreeType::ValueOnCIter

◆ ValueOnIter

using ValueOnIter = typename _TreeType::ValueOnIter

◆ ValueType

using ValueType = typename _TreeType::ValueType

Constructor & Destructor Documentation

◆ Grid() [1/7]

Grid
inline

Construct a new grid with background value zero.

◆ Grid() [2/7]

Grid ( const ValueType background)
inlineexplicit

Construct a new grid with the given background value.

◆ Grid() [3/7]

Grid ( TreePtrType  tree)
inlineexplicit

Construct a new grid that shares the given tree and associates with it an identity linear transform.

Exceptions
ValueErrorif the tree pointer is null

◆ Grid() [4/7]

Grid ( const Grid< _TreeType > &  other)
inline

Deep copy another grid's metadata, transform and tree.

◆ Grid() [5/7]

Grid ( const Grid< OtherTreeType > &  other)
inlineexplicit

Deep copy the metadata, transform and tree of another grid whose tree configuration is the same as this grid's but whose value type is different. Cast the other grid's values to this grid's value type.

Exceptions
TypeErrorif the other grid's tree configuration doesn't match this grid's or if this grid's ValueType is not constructible from the other grid's ValueType.

◆ Grid() [6/7]

Grid ( Grid< _TreeType > &  other,
ShallowCopy   
)
inline

Deep copy another grid's metadata and transform, but share its tree.

◆ Grid() [7/7]

Grid ( const GridBase other)
inlineexplicit

Deep copy another grid's metadata and transform, but construct a new tree with background value zero.

◆ ~Grid()

~Grid ( )
inlineoverride

Member Function Documentation

◆ activeVoxelCount()

Index64 activeVoxelCount ( ) const
inlineoverride

Return the number of active voxels.

◆ background()

const ValueType& background ( ) const
inline

Return this grid's background value.

Note
Use tools::changeBackground to efficiently modify the background value.

◆ beginValueAll() [1/2]

ValueAllIter beginValueAll ( )
inline

Return an iterator over all of this grid's values (tile and voxel).

◆ beginValueAll() [2/2]

ValueAllCIter beginValueAll ( ) const
inline

Return an iterator over all of this grid's values (tile and voxel).

◆ beginValueOff() [1/2]

ValueOffIter beginValueOff ( )
inline

Return an iterator over all of this grid's inactive values (tile and voxel).

◆ beginValueOff() [2/2]

ValueOffCIter beginValueOff ( ) const
inline

Return an iterator over all of this grid's inactive values (tile and voxel).

◆ beginValueOn() [1/2]

ValueOnIter beginValueOn ( )
inline

Return an iterator over all of this grid's active values (tile and voxel).

◆ beginValueOn() [2/2]

ValueOnCIter beginValueOn ( ) const
inline

Return an iterator over all of this grid's active values (tile and voxel).

◆ cbeginValueAll()

ValueAllCIter cbeginValueAll ( ) const
inline

Return an iterator over all of this grid's values (tile and voxel).

◆ cbeginValueOff()

ValueOffCIter cbeginValueOff ( ) const
inline

Return an iterator over all of this grid's inactive values (tile and voxel).

◆ cbeginValueOn()

ValueOnCIter cbeginValueOn ( ) const
inline

Return an iterator over all of this grid's active values (tile and voxel).

◆ clear()

void clear ( )
inlineoverride

Empty this grid, so that all voxels become inactive background voxels.

◆ clip()

void clip ( const CoordBBox bbox)
inlineoverride

Clip this grid to the given index-space bounding box.

Voxels that lie outside the bounding box are set to the background.

Warning
Clipping a level set will likely produce a grid that is no longer a valid level set.

◆ constBaseTreePtr()

TreeBase::ConstPtr constBaseTreePtr ( ) const
inlineoverride

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

◆ constTree()

const TreeType& constTree ( ) const
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

◆ constTreePtr()

ConstTreePtrType constTreePtr ( ) const
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

◆ copy() [1/2]

Grid< TreeT >::Ptr copy
inline

Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is shared with this grid.

◆ copy() [2/2]

ConstPtr copy ( ) const

Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is shared with this grid.

◆ copyGrid() [1/2]

GridBase::ConstPtr copyGrid ( ) const
override

Return a new grid of the same type as this grid whose metadata is a deep copy of this grid's and whose tree and transform are shared with this grid.

◆ copyGrid() [2/2]

GridBase::ConstPtr copyGrid
inlineoverride

Return a new grid of the same type as this grid whose metadata is a deep copy of this grid's and whose tree and transform are shared with this grid.

◆ copyGridReplacingMetadata()

GridBase::ConstPtr copyGridReplacingMetadata ( const MetaMap meta) const
inlineoverride

Return a new grid of the same type as this grid whose tree and transform is shared with this grid and whose metadata is provided as an argument.

◆ copyGridReplacingMetadataAndTransform()

GridBase::ConstPtr copyGridReplacingMetadataAndTransform ( const MetaMap meta,
math::Transform::Ptr  xform 
) const
inlineoverride

Return a new grid of the same type as this grid whose tree is shared with this grid and whose transform and metadata are provided as arguments.

Exceptions
ValueErrorif the transform pointer is null

◆ copyGridReplacingTransform()

GridBase::ConstPtr copyGridReplacingTransform ( math::Transform::Ptr  xform) const
inlineoverride

Return a new grid of the same type as this grid whose tree is shared with this grid, whose metadata is a deep copy of this grid's and whose transform is provided as an argument.

Exceptions
ValueErrorif the transform pointer is null

◆ copyGridWithNewTree()

GridBase::Ptr copyGridWithNewTree
inlineoverride

Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is default-constructed.

◆ copyReplacingMetadata()

Grid< TreeT >::ConstPtr copyReplacingMetadata ( const MetaMap meta) const
inline

Return a new grid of the same type as this grid whose tree and transform is shared with this grid and whose metadata is provided as an argument.

◆ copyReplacingMetadataAndTransform()

Grid< TreeT >::ConstPtr copyReplacingMetadataAndTransform ( const MetaMap meta,
math::Transform::Ptr  xform 
) const
inline

Return a new grid of the same type as this grid whose tree is shared with this grid and whose transform and metadata are provided as arguments.

Exceptions
ValueErrorif the transform pointer is null

◆ copyReplacingTransform()

Grid< TreeT >::ConstPtr copyReplacingTransform ( math::Transform::Ptr  xform) const
inline

Return a new grid of the same type as this grid whose tree is shared with this grid, whose metadata is a deep copy of this grid's and whose transform is provided as an argument.

Exceptions
ValueErrorif the transform pointer is null

◆ copyWithNewTree()

Grid< TreeT >::Ptr copyWithNewTree
inline

Return a new grid of the same type as this grid whose metadata and transform are deep copies of this grid's and whose tree is default-constructed.

◆ create() [1/4]

Grid< TreeT >::Ptr create
inlinestatic

Return a new grid with background value zero.

◆ create() [2/4]

Grid< TreeT >::Ptr create ( const GridBase other)
inlinestatic

Return a new, empty grid with the same transform and metadata as the given grid and with background value zero.

◆ create() [3/4]

Grid< TreeT >::Ptr create ( const ValueType background)
inlinestatic

Return a new grid with the given background value.

◆ create() [4/4]

Grid< TreeT >::Ptr create ( TreePtrType  tree)
inlinestatic

Return a new grid that contains the given tree.

Exceptions
ValueErrorif the tree pointer is null

◆ deepCopy()

Ptr deepCopy ( ) const
inline

Return a new grid whose metadata, transform and tree are deep copies of this grid's.

◆ deepCopyGrid()

GridBase::Ptr deepCopyGrid ( ) const
inlineoverride

Return a new grid whose metadata, transform and tree are deep copies of this grid's.

◆ denseFill()

void denseFill ( const CoordBBox bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value and ensure that those voxels are all represented at the leaf level.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box.
valuethe value to which to set voxels within the box.
activeif true, mark voxels within the box as active, otherwise mark them as inactive.

◆ empty()

bool empty ( ) const
inlineoverride

Return true if this grid contains only inactive background voxels.

◆ evalActiveVoxelBoundingBox()

CoordBBox evalActiveVoxelBoundingBox
inlineoverride

Return the axis-aligned bounding box of all active voxels.

◆ evalActiveVoxelDim()

Coord evalActiveVoxelDim
inlineoverride

Return the dimensions of the axis-aligned bounding box of all active voxels.

◆ evalMinMax()

void evalMinMax ( ValueType minVal,
ValueType maxVal 
) const
inline

Return the minimum and maximum active values in this grid.

◆ fill()

void fill ( const CoordBBox bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box
valuethe value to which to set voxels within the box
activeif true, mark voxels within the box as active, otherwise mark them as inactive
Note
This operation generates a sparse, but not always optimally sparse, representation of the filled box. Follow fill operations with a prune() operation for optimal sparseness.

◆ getAccessor() [1/2]

Accessor getAccessor ( )
inline

Return an accessor that provides random read and write access to this grid's voxels.

The accessor is safe in the sense that it is registered with this grid's tree.

◆ getAccessor() [2/2]

ConstAccessor getAccessor ( ) const
inline

Return an accessor that provides random read-only access to this grid's voxels.

◆ getConstAccessor()

ConstAccessor getConstAccessor ( ) const
inline

Return an accessor that provides random read-only access to this grid's voxels.

◆ getConstUnsafeAccessor()

ConstUnsafeAccessor getConstUnsafeAccessor ( ) const
inline

Return an unsafe accessor that provides random read-only access to this grid's voxels.

The accessor is unsafe in the sense that it is not registered with this grid's tree. In some rare cases this can give a performance advantage over a registered accessor, but it is unsafe if the tree topology is modified.

Warning
Only use this method if you're an expert and know the risks of using an unregistered accessor (see tree/ValueAccessor.h)

◆ getUnsafeAccessor()

UnsafeAccessor getUnsafeAccessor ( )
inline

Return an unsafe accessor that provides random read and write access to this grid's voxels.

The accessor is unsafe in the sense that it is not registered with this grid's tree. In some rare cases this can give a performance advantage over a registered accessor, but it is unsafe if the tree topology is modified.

Warning
Only use this method if you're an expert and know the risks of using an unregistered accessor (see tree/ValueAccessor.h)

◆ gridType()

static Name gridType ( )
inlinestatic

Return the name of this type of grid.

◆ hasMultiPassIO()

bool hasMultiPassIO
inlinestatic

Return true if grids of this type require multiple I/O passes to read and write data buffers.

See also
HasMultiPassIO

◆ isRegistered()

static bool isRegistered ( )
inlinestatic

Return true if this grid type is registered.

◆ memUsage()

Index64 memUsage ( ) const
inlineoverride

Return the number of bytes of memory used by this grid.

◆ merge()

void merge ( Grid< _TreeType > &  other,
MergePolicy  policy = MERGE_ACTIVE_STATES 
)
inline

Efficiently merge another grid into this grid using one of several schemes.

This operation is primarily intended to combine grids that are mostly non-overlapping (for example, intermediate grids from computations that are parallelized across disjoint regions of space).

Warning
This operation always empties the other grid.

◆ newTree()

void newTree
inlineoverride

Associate a new, empty tree with this grid, in place of its existing tree.

Note
The new tree has the same background value as the existing tree.

◆ operator=()

Grid& operator= ( const Grid< _TreeType > &  )
delete

Disallow assignment, since it wouldn't be obvious whether the copy is deep or shallow.

◆ print()

void print ( std::ostream &  os = std::cout,
int  verboseLevel = 1 
) const
inlineoverride

Output a human-readable description of this grid.

◆ pruneGrid()

void pruneGrid ( float  tolerance = 0.0)
inlineoverride

Reduce the memory footprint of this grid by increasing its sparseness.

◆ readBuffers() [1/2]

void readBuffers ( std::istream &  is)
inlineoverride

Read all data buffers for this grid.

◆ readBuffers() [2/2]

void readBuffers ( std::istream &  is,
const CoordBBox bbox 
)
inlineoverride

Read all of this grid's data buffers that intersect the given index-space bounding box.

◆ readNonresidentBuffers()

void readNonresidentBuffers
inlineoverride

Read all of this grid's data buffers that are not yet resident in memory (because delayed loading is in effect).

If this grid was read from a memory-mapped file, this operation disconnects the grid from the file.

See also
io::File::open, io::MappedFile

◆ readTopology()

void readTopology ( std::istream &  is)
inlineoverride

Read the grid topology from a stream. This will read only the grid structure, not the actual data buffers.

◆ registerGrid()

static void registerGrid ( )
inlinestatic

Register this grid type along with a factory function.

◆ setTree()

void setTree ( TreeBase::Ptr  tree)
inlineoverride

Associate the given tree with this grid, in place of its existing tree.

Exceptions
ValueErrorif the tree pointer is null
TypeErrorif the tree is not of type TreeType
Note
Invalidates all references previously returned by baseTree(), constBaseTree(), tree() or constTree().

◆ sparseFill()

void sparseFill ( const CoordBBox bbox,
const ValueType value,
bool  active = true 
)
inline

Set all voxels within a given axis-aligned box to a constant value.

Parameters
bboxinclusive coordinates of opposite corners of an axis-aligned box
valuethe value to which to set voxels within the box
activeif true, mark voxels within the box as active, otherwise mark them as inactive
Note
This operation generates a sparse, but not always optimally sparse, representation of the filled box. Follow fill operations with a prune() operation for optimal sparseness.

◆ topologyDifference()

void topologyDifference ( const Grid< OtherTreeType > &  other)
inline

Difference this grid's set of active values with the active values of the other grid, whose value type may be different.

After this method is called, voxels in this grid will be active only if they were active to begin with and if the corresponding voxels in the other grid were inactive.

Note
This operation can delete branches of this grid that overlap with active tiles in the other grid. Also, because it can deactivate voxels, it can create leaf nodes with no active values. Thus, it is recommended to prune this grid after calling this method.

◆ topologyIntersection()

void topologyIntersection ( const Grid< OtherTreeType > &  other)
inline

Intersect this grid's set of active values with the active values of the other grid, whose value type may be different.

The resulting state of a value is active only if the corresponding value was already active AND if it is active in the other tree. Also, a resulting value maps to a voxel if the corresponding value already mapped to an active voxel in either of the two grids and it maps to an active tile or voxel in the other grid.

Note
This operation can delete branches of this grid that overlap with inactive tiles in the other grid. Also, because it can deactivate voxels, it can create leaf nodes with no active values. Thus, it is recommended to prune this grid after calling this method.

◆ topologyUnion()

void topologyUnion ( const Grid< OtherTreeType > &  other)
inline

Union this grid's set of active values with the active values of the other grid, whose value type may be different.

The resulting state of a value is active if the corresponding value was already active OR if it is active in the other grid. Also, a resulting value maps to a voxel if the corresponding value already mapped to a voxel OR if it is a voxel in the other grid. Thus, a resulting value can only map to a tile if the corresponding value already mapped to a tile AND if it is a tile value in the other grid.

Note
This operation modifies only active states, not values. Specifically, active tiles and voxels in this grid are not changed, and tiles or voxels that were inactive in this grid but active in the other grid are marked as active in this grid but left with their original values.

◆ tree() [1/2]

TreeType& tree ( )
inline

Return a reference to this grid's tree, which might be shared with other grids.

Note
Calling setTree() on this grid invalidates all references previously returned by this method.

◆ tree() [2/2]

const TreeType& tree ( ) const
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

◆ treePtr() [1/2]

TreePtrType treePtr ( )
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

◆ treePtr() [2/2]

ConstTreePtrType treePtr ( ) const
inline

Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.

◆ type()

Name type ( ) const
inlineoverride

Return the name of this grid's type.

◆ unregisterGrid()

static void unregisterGrid ( )
inlinestatic

Remove this grid type from the registry.

◆ valueType()

Name valueType ( ) const
inlineoverride

Return the name of the type of a voxel's value (e.g., "float" or "vec3d").

◆ writeBuffers()

void writeBuffers ( std::ostream &  os) const
inlineoverride

Write out all data buffers for this grid.

◆ writeTopology()

void writeTopology ( std::ostream &  os) const
inlineoverride

Write the grid topology to a stream. This will write only the grid structure, not the actual data buffers.


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