OpenVDB 13.0.0

Loading...
Searching...
No Matches
Grid< _TreeType > Class Template Reference

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

`#include <openvdb/Grid.h>`

Inheritance diagram for Grid< _TreeType >:

## 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 _TreeType::Accessor
using | ConstAccessor = typename _TreeType::ConstAccessor
using | UnsafeAccessor = typename _TreeType::UnsafeAccessor
using | ConstUnsafeAccessor = typename _TreeType::ConstUnsafeAccessor
using | GridFactory = Ptr (*)()
using | MetadataMap = std::map<Name, Metadata::Ptr>
using | MetaIterator = MetadataMap::iterator
using | ConstMetaIterator = MetadataMap::const_iterator

## Public Member Functions
| Grid ()
| Construct a new grid with background value zero.
| Grid (const ValueType &background)
| Construct a new grid with the given background value.
| Grid (TreePtrType)
| Construct a new grid that shares the given tree and associates with it an identity linear transform.
| Grid (const Grid &)
| Deep copy another grid's metadata, transform and tree.
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.
| Grid (Grid &, ShallowCopy)
| Deep copy another grid's metadata and transform, but share its tree.
| Grid (const GridBase &)
| Deep copy another grid's metadata and transform, but construct a new tree with background value zero.
| ~Grid () override
Grid & | operator= (const Grid &)=delete
| Disallow assignment, since it wouldn't be obvious whether the copy is deep or shallow.
MetaMap::Ptr | copyMeta () const
| Return a copy of this map whose fields are shared with this map.
MetaMap::Ptr | deepCopyMeta () const
| Return a deep copy of this map that shares no data with this map.
void | readMeta (std::istream &)
| Unserialize metadata from the given stream.
void | writeMeta (std::ostream &) const
| Serialize metadata to the given stream.
void | insertMeta (const Name &, const Metadata &value)
| Insert a new metadata field or overwrite the value of an existing field.
void | insertMeta (const MetaMap &)
| Deep copy all of the metadata fields from the given map into this map.
void | removeMeta (const Name &)
| Remove the given metadata field if it exists.
Metadata::Ptr | operator[] (const Name &)
| Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.
Metadata::ConstPtr | operator[] (const Name &) const
template<typename T>
T::Ptr | getMetadata (const Name &)
| Return a pointer to a TypedMetadata object of type `T` and with the given name. If no such field exists or if there is a type mismatch, return a null pointer.
template<typename T>
T::ConstPtr | getMetadata (const Name &) const
template<typename T>
T & | metaValue (const Name &)
| Return a reference to the value of type `T` stored in the given metadata field.
template<typename T>
const T & | metaValue (const Name &) const
MetaIterator | beginMeta ()
ConstMetaIterator | beginMeta () const
MetaIterator | endMeta ()
ConstMetaIterator | endMeta () const
void | clearMetadata ()
size_t | metaCount () const
std::string | str (const std::string &indent="") const
| Return a string describing this metadata map. Prefix each line with indent.
bool | operator== (const MetaMap &other) const
| Return `true` if the given map is equivalent to this map.
bool | operator!= (const MetaMap &other) const
| Return `true` if the given map is different from this map.
Voxel access
const ValueType & | background () const
| Return this grid's background value.
bool | empty () const override
| Return `true` if this grid contains only inactive background voxels.
void | clear () override
| Empty this grid, so that all voxels become inactive background voxels.
Accessor | getAccessor ()
| Return an accessor that provides random read and write access to this grid's voxels.
UnsafeAccessor | getUnsafeAccessor ()
| Return an unsafe accessor that provides random read and write access to this grid's voxels.
ConstAccessor | getAccessor () const
| Return an accessor that provides random read-only access to this grid's voxels.
ConstAccessor | getConstAccessor () const
| Return an accessor that provides random read-only access to this grid's voxels.
ConstUnsafeAccessor | getConstUnsafeAccessor () const
| Return an unsafe accessor that provides random read-only access to this grid's voxels.
ValueOnIter | beginValueOn ()
| Return an iterator over all of this grid's active values (tile and voxel).
ValueOnCIter | beginValueOn () const
| Return an iterator over all of this grid's active values (tile and voxel).
ValueOnCIter | cbeginValueOn () const
| Return an iterator over all of this grid's active values (tile and voxel).
ValueOffIter | beginValueOff ()
| Return an iterator over all of this grid's inactive values (tile and voxel).
ValueOffCIter | beginValueOff () const
| Return an iterator over all of this grid's inactive values (tile and voxel).
ValueOffCIter | cbeginValueOff () const
| Return an iterator over all of this grid's inactive values (tile and voxel).
ValueAllIter | beginValueAll ()
| Return an iterator over all of this grid's values (tile and voxel).
ValueAllCIter | beginValueAll () const
| Return an iterator over all of this grid's values (tile and voxel).
ValueAllCIter | cbeginValueAll () const
| Return an iterator over all of this grid's values (tile and voxel).
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.
void | fill (const CoordBBox &bbox, const ValueType &value, bool active=true)
| Set all voxels within a given axis-aligned box to a constant value.
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.
void | pruneGrid (float tolerance=0.0) override
| Reduce the memory footprint of this grid by increasing its sparseness.
void | clip (const CoordBBox &) override
| Clip this grid to the given index-space bounding box.
void | merge (Grid &other, MergePolicy policy=MERGE_ACTIVE_STATES)
| Efficiently merge another grid into this grid using one of several schemes.
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.
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.
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.
Statistics
Index64 | activeVoxelCount () const override
| Return the number of active voxels.
CoordBBox | evalActiveVoxelBoundingBox () const override
| Return the axis-aligned bounding box of all active voxels.
Coord | evalActiveVoxelDim () const override
| Return the dimensions of the axis-aligned bounding box of all active voxels.
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.
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.
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.
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.
bool | isTreeUnique () const final
| Return true if tree is not shared with another grid.
TreeType & | tree ()
| Return a reference to this grid's tree, which might be shared with other grids.
const TreeType & | tree () const
| Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.
const TreeType & | constTree () const
| Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.
void | setTree (TreeBase::Ptr) override
| Associate the given tree with this grid, in place of its existing tree.
void | newTree () override
| Associate a new, empty tree with this grid, in place of its existing tree.
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.
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.
void | readBuffers (std::istream &) override
| Read all data buffers for this grid.
void | readBuffers (std::istream &, const CoordBBox &) override
| Read all of this grid's data buffers that intersect the given index-space bounding box.
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).
void | writeBuffers (std::ostream &) const override
| Write out all data buffers for this grid.
void | print (std::ostream &=std::cout, int verboseLevel=1) const override
| Output a human-readable description of this grid.
Type access
template<typename GridType>
bool | isType () const
| Return `true` if this grid is of the same type as the template parameter.
Tree
TreeBase::Ptr | baseTreePtr ()
| Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.
TreeBase::ConstPtr | baseTreePtr () const
| Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null.
TreeBase & | baseTree ()
| Return a reference to this grid's tree, which might be shared with other grids.
const TreeBase & | baseTree () const
| Return a reference to this grid's tree, which might be shared with other grids.
const TreeBase & | constBaseTree () const
| Return a reference to this grid's tree, which might be shared with other grids.
Tools
void | clipGrid (const BBoxd &)
| Clip this grid to the given world-space bounding box.
template<typename GridTypeListT, typename OpT>
bool | apply (OpT &) const
| If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.
template<typename GridTypeListT, typename OpT>
bool | apply (OpT &)
| If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.
template<typename GridTypeListT, typename OpT>
bool | apply (const OpT &) const
| If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.
template<typename GridTypeListT, typename OpT>
bool | apply (const OpT &)
| If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.
Metadata
std::string | getName () const
| Return this grid's user-specified name.
void | setName (const std::string &)
| Specify a name for this grid.
std::string | getCreator () const
| Return the user-specified description of this grid's creator.
void | setCreator (const std::string &)
| Provide a description of this grid's creator.
bool | saveFloatAsHalf () const
| Return `true` if this grid should be written out with floating-point voxel values (including components of vectors) quantized to 16 bits.
void | setSaveFloatAsHalf (bool)
| Return this grid's user-specified name.
GridClass | getGridClass () const
| Return the class of volumetric data (level set, fog volume, etc.) that is stored in this grid.
void | setGridClass (GridClass)
| Specify the class of volumetric data (level set, fog volume, etc.) that is stored in this grid.
void | clearGridClass ()
| Remove the setting specifying the class of this grid's volumetric data.
VecType | getVectorType () const
| Return the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree.
void | setVectorType (VecType)
| Specify the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree.
void | clearVectorType ()
| Remove the setting specifying the type of vector data stored in this grid.
bool | isInWorldSpace () const
void | setIsInWorldSpace (bool)
| Specify whether this grid's voxel values are in world space or in local space.
Statistics
void | addStatsMetadata ()
| Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box.
MetaMap::Ptr | getStatsMetadata () const
| Return a new MetaMap containing just the metadata that was added to this grid with addStatsMetadata.
Transform
math::Transform::Ptr | transformPtr ()
| Return a pointer to this grid's transform, which might be shared with other grids.
math::Transform::ConstPtr | transformPtr () const
| Return a pointer to this grid's transform, which might be shared with other grids.
math::Transform::ConstPtr | constTransformPtr () const
| Return a pointer to this grid's transform, which might be shared with other grids.
math::Transform & | transform ()
| Return a reference to this grid's transform, which might be shared with other grids.
const math::Transform & | transform () const
| Return a pointer to this grid's transform, which might be shared with other grids.
const math::Transform & | constTransform () const
| Return a pointer to this grid's transform, which might be shared with other grids.
void | setTransform (math::Transform::Ptr)
| Associate the given transform with this grid, in place of its existing transform.
Vec3d | voxelSize () const
| Return the size of this grid's voxels.
Vec3d | voxelSize (const Vec3d &xyz) const
| Return the size of this grid's voxel at position (x, y, z).
bool | hasUniformVoxels () const
| Return true if the voxels in world space are uniformly sized cubes.
Vec3d | indexToWorld (const Vec3d &xyz) const
| Apply this grid's transform to the given coordinates.
Vec3d | indexToWorld (const Coord &ijk) const
| Apply this grid's transform to the given coordinates.
Vec3d | worldToIndex (const Vec3d &xyz) const
| Apply the inverse of this grid's transform to the given coordinates.
I/O
void | readTransform (std::istream &is)
| Read in the transform for this grid.
void | writeTransform (std::ostream &os) const
| Write out the transform for this grid.

## Static Public Member Functions
static Ptr | create (const ValueType &background)
| Return a new grid with the given background value.
static Ptr | create ()
| Return a new grid with background value zero.
static Ptr | create (TreePtrType)
| Return a new grid that contains the given tree.
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.
static bool | hasMultiPassIO ()
| Return `true` if grids of this type require multiple I/O passes to read and write data buffers.
template<typename GridType>
static GridType::Ptr | grid (const GridBase::Ptr &)
| Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible.
template<typename GridType>
static GridType::ConstPtr | grid (const GridBase::ConstPtr &)
template<typename GridType>
static GridType::ConstPtr | constGrid (const GridBase::Ptr &)
template<typename GridType>
static GridType::ConstPtr | constGrid (const GridBase::ConstPtr &)
static std::string | gridClassToString (GridClass)
| Return the metadata string value for the given class of volumetric data.
static std::string | gridClassToMenuName (GridClass)
| Return a formatted string version of the grid class.
static GridClass | stringToGridClass (const std::string &)
| Return the class of volumetric data specified by the given string.
static std::string | vecTypeToString (VecType)
| Return the metadata string value for the given type of vector data.
static std::string | vecTypeExamples (VecType)
static std::string | vecTypeDescription (VecType)
| Return a string describing how the given type of vector data is affected by transformations (e.g., "Does not transform", given VEC_INVARIANT).
static VecType | stringToVecType (const std::string &)
Registry
static bool | isRegistered ()
| Return `true` if this grid type is registered.
static void | registerGrid ()
| Register this grid type along with a factory function.
static void | unregisterGrid ()
| Remove this grid type from the registry.
Registry
static Ptr | createGrid (const Name &type)
| Create a new grid of the given (registered) type.
static bool | isRegistered (const Name &type)
| Return `true` if the given grid type name is registered.
static void | clearRegistry ()
| Clear the grid type registry.

## Static Public Attributes
static const char *const | META_GRID_CLASS
static const char *const | META_GRID_CREATOR
static const char *const | META_GRID_NAME
static const char *const | META_SAVE_HALF_FLOAT
static const char *const | META_IS_LOCAL_SPACE
static const char *const | META_VECTOR_TYPE
static const char *const | META_FILE_BBOX_MIN
static const char *const | META_FILE_BBOX_MAX
static const char *const | META_FILE_COMPRESSION
static const char *const | META_FILE_MEM_BYTES
static const char *const | META_FILE_VOXEL_COUNT
static const char *const | META_FILE_DELAYED_LOAD

## Static Protected Member Functions
static void | registerGrid (const Name &type, GridFactory)
| Register a grid type along with a factory function.
static void | unregisterGrid (const Name &type)
| Remove a grid type from the registry.

## Copying
static Name | gridType ()
| Return the name of this type of grid.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Ptr | deepCopy () const
| Return a new grid whose metadata, transform and tree are deep copies of this grid's.
GridBase::Ptr | deepCopyGrid () const override
| Return a new grid whose metadata, transform and tree are deep copies of this grid's.
Name | type () const override
| Return the name of this grid's type.
Name | valueType () const override
| Return the name of the type of a voxel's value (e.g., "float" or "vec3d").

## Detailed Description

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

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

## Member Typedef Documentation

## ◆ Accessor

template<typename _TreeType>

using Accessor = typename _TreeType::Accessor

## ◆ BuildType

template<typename _TreeType>

using BuildType = typename _TreeType::BuildType

## ◆ ConstAccessor

template<typename _TreeType>

using ConstAccessor = typename _TreeType::ConstAccessor

## ◆ ConstMetaIterator

using ConstMetaIterator = MetadataMap::const_iterator
| inherited

## ◆ ConstPtr

template<typename _TreeType>

using ConstPtr = SharedPtr<const Grid>

## ◆ ConstTreePtrType

template<typename _TreeType>

using ConstTreePtrType = typename _TreeType::ConstPtr

## ◆ ConstUnsafeAccessor

template<typename _TreeType>

using ConstUnsafeAccessor = typename _TreeType::ConstUnsafeAccessor

## ◆ GridFactory

using GridFactory = Ptr (*)()
| inherited

## ◆ MetadataMap

using MetadataMap = std::map<Name, Metadata::Ptr>
| inherited

## ◆ MetaIterator

using MetaIterator = MetadataMap::iterator
| inherited

## ◆ Ptr

template<typename _TreeType>

using Ptr = SharedPtr<Grid>

## ◆ TreePtrType

template<typename _TreeType>

using TreePtrType = typename _TreeType::Ptr

## ◆ TreeType

template<typename _TreeType>

using TreeType = _TreeType

## ◆ UnsafeAccessor

template<typename _TreeType>

using UnsafeAccessor = typename _TreeType::UnsafeAccessor

## ◆ ValueAllCIter

template<typename _TreeType>

using ValueAllCIter = typename _TreeType::ValueAllCIter

## ◆ ValueAllIter

template<typename _TreeType>

using ValueAllIter = typename _TreeType::ValueAllIter

## ◆ ValueOffCIter

template<typename _TreeType>

using ValueOffCIter = typename _TreeType::ValueOffCIter

## ◆ ValueOffIter

template<typename _TreeType>

using ValueOffIter = typename _TreeType::ValueOffIter

## ◆ ValueOnCIter

template<typename _TreeType>

using ValueOnCIter = typename _TreeType::ValueOnCIter

## ◆ ValueOnIter

template<typename _TreeType>

using ValueOnIter = typename _TreeType::ValueOnIter

## ◆ ValueType

template<typename _TreeType>

using ValueType = typename _TreeType::ValueType

## Constructor & Destructor Documentation

## ◆ Grid() [1/7]

template<typename TreeT>

Grid | ( |  | ) |
| inline

Construct a new grid with background value zero.

## ◆ Grid() [2/7]

template<typename TreeT>

Grid | ( | const ValueType & | background | ) |
| inline explicit

Construct a new grid with the given background value.

## ◆ Grid() [3/7]

template<typename TreeT>

Grid | ( | TreePtrType | tree | ) |
| inline explicit

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

Exceptions

  ValueError | if the tree pointer is null

## ◆ Grid() [4/7]

template<typename TreeT>

Grid | ( | const Grid< _TreeType > & | other | ) |
| inline

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

## ◆ Grid() [5/7]

template<typename TreeT>
template<typename OtherTreeType>

Grid | ( | const Grid< OtherTreeType > & | other | ) |
| inline explicit

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

  TypeError | if 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]

template<typename TreeT>

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

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

## ◆ Grid() [7/7]

template<typename TreeT>

Grid | ( | const GridBase & | other | ) |
| inline explicit

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

## ◆ ~Grid()

template<typename _TreeType>

~Grid | ( |  | ) |
| inline override

## Member Function Documentation

## ◆ activeVoxelCount()

template<typename _TreeType>

Index64 activeVoxelCount | ( |  | ) | const
| inline override virtual

Return the number of active voxels.

Implements GridBase.

## ◆ addStatsMetadata()

void addStatsMetadata | ( |  | ) |
| inherited

Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box.

Note
  This metadata is not automatically kept up-to-date with changes to this grid.

## ◆ apply() [1/4]

template<typename GridTypeListT, typename OpT>

bool apply | ( | const OpT & | op | ) |
| inline inherited

If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.

Returns
  `false` if this grid's type is not one of the listed types

Example:
  using AllowedGridTypes = openvdb::TypeList<
  openvdb::Int32Grid, openvdb::Int64Grid,
  openvdb::FloatGrid, openvdb::DoubleGrid>;
  const openvdb::CoordBBox bbox{
  openvdb::Coord{0,0,0}, openvdb::Coord{10,10,10}};
  // Fill the grid if it is one of the allowed types.
  myGridBasePtr->apply<AllowedGridTypes>(
  [&bbox](auto& grid) { // C++14
  using GridType = typename std::decay<decltype(grid)>::type;
  grid.fill(bbox, typename GridType::ValueType(1));
  }
  );
  openvdb::v13_0::GridBase::grid
  static GridType::Ptr grid(const GridBase::Ptr &)
  Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type,...
  Definition Grid.h:1220
  openvdb::v13_0::Grid::type
  Name type() const override
  Return the name of this grid's type.
  Definition Grid.h:709
  openvdb::v13_0::math::CoordBBox
  Axis-aligned bounding box of signed integer coordinates.
  Definition Coord.h:252
  openvdb::v13_0::math::Coord
  Signed (x, y, z) 32-bit integer coordinates.
  Definition Coord.h:26
  openvdb::v13_0::FloatGrid
  Grid< FloatTree > FloatGrid
  Definition openvdb.h:76
  openvdb::v13_0::Int64Grid
  Grid< Int64Tree > Int64Grid
  Definition openvdb.h:79
  openvdb::v13_0::Int32Grid
  Grid< Int32Tree > Int32Grid
  Definition openvdb.h:78
  openvdb::v13_0::DoubleGrid
  Grid< DoubleTree > DoubleGrid
  Definition openvdb.h:75
  openvdb::v13_0::TypeList
  A list of types (not necessarily unique).
  Definition TypeList.h:578

See also
  TypeList

## ◆ apply() [2/4]

template<typename GridTypeListT, typename OpT>

bool apply | ( | const OpT & | op | ) | const
| inline inherited

If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.

Returns
  `false` if this grid's type is not one of the listed types

Example:
  using AllowedGridTypes = openvdb::TypeList<
  openvdb::Int32Grid, openvdb::Int64Grid,
  openvdb::FloatGrid, openvdb::DoubleGrid>;
  const openvdb::CoordBBox bbox{
  openvdb::Coord{0,0,0}, openvdb::Coord{10,10,10}};
  // Fill the grid if it is one of the allowed types.
  myGridBasePtr->apply<AllowedGridTypes>(
  [&bbox](auto& grid) { // C++14
  using GridType = typename std::decay<decltype(grid)>::type;
  grid.fill(bbox, typename GridType::ValueType(1));
  }
  );

See also
  TypeList

## ◆ apply() [3/4]

template<typename GridTypeListT, typename OpT>

bool apply | ( | OpT & | op | ) |
| inline inherited

If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.

Returns
  `false` if this grid's type is not one of the listed types

Example:
  using AllowedGridTypes = openvdb::TypeList<
  openvdb::Int32Grid, openvdb::Int64Grid,
  openvdb::FloatGrid, openvdb::DoubleGrid>;
  const openvdb::CoordBBox bbox{
  openvdb::Coord{0,0,0}, openvdb::Coord{10,10,10}};
  // Fill the grid if it is one of the allowed types.
  myGridBasePtr->apply<AllowedGridTypes>(
  [&bbox](auto& grid) { // C++14
  using GridType = typename std::decay<decltype(grid)>::type;
  grid.fill(bbox, typename GridType::ValueType(1));
  }
  );

See also
  TypeList

## ◆ apply() [4/4]

template<typename GridTypeListT, typename OpT>

bool apply | ( | OpT & | op | ) | const
| inline inherited

If this grid resolves to one of the listed grid types, invoke the given functor on the resolved grid.

Returns
  `false` if this grid's type is not one of the listed types

Example:
  using AllowedGridTypes = openvdb::TypeList<
  openvdb::Int32Grid, openvdb::Int64Grid,
  openvdb::FloatGrid, openvdb::DoubleGrid>;
  const openvdb::CoordBBox bbox{
  openvdb::Coord{0,0,0}, openvdb::Coord{10,10,10}};
  // Fill the grid if it is one of the allowed types.
  myGridBasePtr->apply<AllowedGridTypes>(
  [&bbox](auto& grid) { // C++14
  using GridType = typename std::decay<decltype(grid)>::type;
  grid.fill(bbox, typename GridType::ValueType(1));
  }
  );

See also
  TypeList

## ◆ background()

template<typename _TreeType>

const ValueType & background | ( |  | ) | const
| inline

Return this grid's background value.

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

## ◆ baseTree() [1/2]

TreeBase & baseTree | ( |  | ) |
| inline inherited

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.

## ◆ baseTree() [2/2]

const TreeBase & baseTree | ( |  | ) | const
| inline inherited

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.

## ◆ baseTreePtr() [1/2]

TreeBase::Ptr baseTreePtr | ( |  | ) |
| inline inherited

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

## ◆ baseTreePtr() [2/2]

TreeBase::ConstPtr baseTreePtr | ( |  | ) | const
| inline inherited

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

## ◆ beginMeta() [1/2]

MetaIterator beginMeta | ( |  | ) |
| inline inherited

## ◆ beginMeta() [2/2]

ConstMetaIterator beginMeta | ( |  | ) | const
| inline inherited

## ◆ beginValueAll() [1/2]

template<typename _TreeType>

ValueAllIter beginValueAll | ( |  | ) |
| inline

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

## ◆ beginValueAll() [2/2]

template<typename _TreeType>

ValueAllCIter beginValueAll | ( |  | ) | const
| inline

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

## ◆ beginValueOff() [1/2]

template<typename _TreeType>

ValueOffIter beginValueOff | ( |  | ) |
| inline

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

## ◆ beginValueOff() [2/2]

template<typename _TreeType>

ValueOffCIter beginValueOff | ( |  | ) | const
| inline

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

## ◆ beginValueOn() [1/2]

template<typename _TreeType>

ValueOnIter beginValueOn | ( |  | ) |
| inline

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

## ◆ beginValueOn() [2/2]

template<typename _TreeType>

ValueOnCIter beginValueOn | ( |  | ) | const
| inline

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

## ◆ cbeginValueAll()

template<typename _TreeType>

ValueAllCIter cbeginValueAll | ( |  | ) | const
| inline

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

## ◆ cbeginValueOff()

template<typename _TreeType>

ValueOffCIter cbeginValueOff | ( |  | ) | const
| inline

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

## ◆ cbeginValueOn()

template<typename _TreeType>

ValueOnCIter cbeginValueOn | ( |  | ) | const
| inline

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

## ◆ clear()

template<typename _TreeType>

void clear | ( |  | ) |
| inline override virtual

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

Implements GridBase.

## ◆ clearGridClass()

void clearGridClass | ( |  | ) |
| inherited

Remove the setting specifying the class of this grid's volumetric data.

## ◆ clearMetadata()

void clearMetadata | ( |  | ) |
| inline inherited

## ◆ clearRegistry()

void clearRegistry | ( |  | ) |
| static inherited

Clear the grid type registry.

## ◆ clearVectorType()

void clearVectorType | ( |  | ) |
| inherited

Remove the setting specifying the type of vector data stored in this grid.

## ◆ clip()

template<typename TreeT>

void clip | ( | const CoordBBox & | bbox | ) |
| inline override virtual

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.

Implements GridBase.

## ◆ clipGrid()

void clipGrid | ( | const BBoxd & |  | ) |
| inherited

Clip this grid to the given world-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.

## ◆ constBaseTree()

const TreeBase & constBaseTree | ( |  | ) | const
| inline inherited

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.

## ◆ constBaseTreePtr()

template<typename _TreeType>

TreeBase::ConstPtr constBaseTreePtr | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ constGrid() [1/2]

template<typename GridType>

GridType::ConstPtr constGrid | ( | const GridBase::ConstPtr & | grid | ) |
| inline static inherited

## ◆ constGrid() [2/2]

template<typename GridType>

GridType::ConstPtr constGrid | ( | const GridBase::Ptr & | grid | ) |
| inline static inherited

## ◆ constTransform()

const math::Transform & constTransform | ( |  | ) | const
| inline inherited

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

## ◆ constTransformPtr()

math::Transform::ConstPtr constTransformPtr | ( |  | ) | const
| inline inherited

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

## ◆ constTree()

template<typename _TreeType>

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

template<typename _TreeType>

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]

template<typename TreeT>

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]

template<typename TreeT>

Grid< TreeT >::ConstPtr copy | ( |  | ) | const
| 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.

## ◆ copyGrid() [1/2]

template<typename TreeT>

GridBase::ConstPtr copyGrid | ( |  | ) | const
| inline override virtual

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.

Implements GridBase.

## ◆ copyGrid() [2/2]

template<typename TreeT>

GridBase::Ptr copyGrid | ( |  | ) |
| inline override virtual

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.

Implements GridBase.

## ◆ copyGridReplacingMetadata()

template<typename TreeT>

GridBase::ConstPtr copyGridReplacingMetadata | ( | const MetaMap & | meta | ) | const
| inline override virtual

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.

Implements GridBase.

## ◆ copyGridReplacingMetadataAndTransform()

template<typename TreeT>

GridBase::ConstPtr copyGridReplacingMetadataAndTransform | ( | const MetaMap & | meta,
|  | math::Transform::Ptr | xform ) const
| inline override virtual

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

  ValueError | if the transform pointer is null

Implements GridBase.

## ◆ copyGridReplacingTransform()

template<typename TreeT>

GridBase::ConstPtr copyGridReplacingTransform | ( | math::Transform::Ptr | xform | ) | const
| inline override virtual

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

  ValueError | if the transform pointer is null

Implements GridBase.

## ◆ copyGridWithNewTree()

template<typename TreeT>

GridBase::Ptr copyGridWithNewTree | ( |  | ) | const
| inline override virtual

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.

Implements GridBase.

## ◆ copyMeta()

MetaMap::Ptr copyMeta | ( |  | ) | const
| inherited

Return a copy of this map whose fields are shared with this map.

## ◆ copyReplacingMetadata()

template<typename TreeT>

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

template<typename TreeT>

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

  ValueError | if the transform pointer is null

## ◆ copyReplacingTransform()

template<typename TreeT>

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

  ValueError | if the transform pointer is null

## ◆ copyWithNewTree()

template<typename TreeT>

Grid< TreeT >::Ptr copyWithNewTree | ( |  | ) | const
| 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]

template<typename TreeT>

Grid< TreeT >::Ptr create | ( |  | ) |
| inline static

Return a new grid with background value zero.

## ◆ create() [2/4]

template<typename TreeT>

Grid< TreeT >::Ptr create | ( | const GridBase & | other | ) |
| inline static

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

## ◆ create() [3/4]

template<typename TreeT>

Grid< TreeT >::Ptr create | ( | const ValueType & | background | ) |
| inline static

Return a new grid with the given background value.

## ◆ create() [4/4]

template<typename TreeT>

Grid< TreeT >::Ptr create | ( | TreePtrType | tree | ) |
| inline static

Return a new grid that contains the given tree.

Exceptions

  ValueError | if the tree pointer is null

## ◆ createGrid()

Ptr createGrid | ( | const Name & | type | ) |
| static inherited

Create a new grid of the given (registered) type.

## ◆ deepCopy()

template<typename _TreeType>

Ptr deepCopy | ( |  | ) | const
| inline

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

## ◆ deepCopyGrid()

template<typename _TreeType>

GridBase::Ptr deepCopyGrid | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ deepCopyMeta()

MetaMap::Ptr deepCopyMeta | ( |  | ) | const
| inherited

Return a deep copy of this map that shares no data with this map.

## ◆ denseFill()

template<typename TreeT>

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

  bbox | inclusive coordinates of opposite corners of an axis-aligned box.
  value | the value to which to set voxels within the box.
  active | if true, mark voxels within the box as active, otherwise mark them as inactive.

## ◆ empty()

template<typename _TreeType>

bool empty | ( |  | ) | const
| inline override virtual

Return `true` if this grid contains only inactive background voxels.

Implements GridBase.

## ◆ endMeta() [1/2]

MetaIterator endMeta | ( |  | ) |
| inline inherited

## ◆ endMeta() [2/2]

ConstMetaIterator endMeta | ( |  | ) | const
| inline inherited

## ◆ evalActiveVoxelBoundingBox()

template<typename TreeT>

CoordBBox evalActiveVoxelBoundingBox | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ evalActiveVoxelDim()

template<typename TreeT>

Coord evalActiveVoxelDim | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ fill()

template<typename TreeT>

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

  bbox | inclusive coordinates of opposite corners of an axis-aligned box
  value | the value to which to set voxels within the box
  active | if 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]

template<typename _TreeType>

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]

template<typename _TreeType>

ConstAccessor getAccessor | ( |  | ) | const
| inline

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

## ◆ getConstAccessor()

template<typename _TreeType>

ConstAccessor getConstAccessor | ( |  | ) | const
| inline

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

## ◆ getConstUnsafeAccessor()

template<typename _TreeType>

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)

## ◆ getCreator()

std::string getCreator | ( |  | ) | const
| inherited

Return the user-specified description of this grid's creator.

## ◆ getGridClass()

GridClass getGridClass | ( |  | ) | const
| inherited

Return the class of volumetric data (level set, fog volume, etc.) that is stored in this grid.

See also
  gridClassToString, gridClassToMenuName, stringToGridClass

## ◆ getMetadata() [1/2]

template<typename T>

T::Ptr getMetadata | ( | const Name & | name | ) |
| inline inherited

Return a pointer to a TypedMetadata object of type `T` and with the given name. If no such field exists or if there is a type mismatch, return a null pointer.

## ◆ getMetadata() [2/2]

template<typename T>

T::ConstPtr getMetadata | ( | const Name & | name | ) | const
| inline inherited

## ◆ getName()

std::string getName | ( |  | ) | const
| inherited

Return this grid's user-specified name.

## ◆ getStatsMetadata()

MetaMap::Ptr getStatsMetadata | ( |  | ) | const
| inherited

Return a new MetaMap containing just the metadata that was added to this grid with addStatsMetadata.

If addStatsMetadata was never called on this grid, return an empty MetaMap.

## ◆ getUnsafeAccessor()

template<typename _TreeType>

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)

## ◆ getVectorType()

VecType getVectorType | ( |  | ) | const
| inherited

Return the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree.

See also
  vecTypeToString, vecTypeExamples, vecTypeDescription, stringToVecType

## ◆ grid() [1/2]

template<typename GridType>

GridType::ConstPtr grid | ( | const GridBase::ConstPtr & | grid | ) |
| inline static inherited

## ◆ grid() [2/2]

template<typename GridType>

GridType::Ptr grid | ( | const GridBase::Ptr & | grid | ) |
| inline static inherited

Return the result of downcasting a GridBase pointer to a Grid pointer of the specified type, or return a null pointer if the types are incompatible.

## ◆ gridClassToMenuName()

std::string gridClassToMenuName | ( | GridClass |  | ) |
| static inherited

Return a formatted string version of the grid class.

## ◆ gridClassToString()

std::string gridClassToString | ( | GridClass |  | ) |
| static inherited

Return the metadata string value for the given class of volumetric data.

## ◆ gridType()

template<typename _TreeType>

Name gridType | ( |  | ) |
| inline static

Return the name of this type of grid.

## ◆ hasMultiPassIO()

template<typename TreeT>

bool hasMultiPassIO | ( |  | ) |
| inline static

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

See also
  HasMultiPassIO

## ◆ hasUniformVoxels()

bool hasUniformVoxels | ( |  | ) | const
| inline inherited

Return true if the voxels in world space are uniformly sized cubes.

## ◆ indexToWorld() [1/2]

Vec3d indexToWorld | ( | const Coord & | ijk | ) | const
| inline inherited

Apply this grid's transform to the given coordinates.

## ◆ indexToWorld() [2/2]

Vec3d indexToWorld | ( | const Vec3d & | xyz | ) | const
| inline inherited

Apply this grid's transform to the given coordinates.

## ◆ insertMeta() [1/2]

void insertMeta | ( | const MetaMap & |  | ) |
| inherited

Deep copy all of the metadata fields from the given map into this map.

Exceptions

  TypeError | if any field in the given map has the same name as but a different value type than one of this map's fields.

## ◆ insertMeta() [2/2]

void insertMeta | ( | const Name & | ,
|  | const Metadata & | value )
| inherited

Insert a new metadata field or overwrite the value of an existing field.

If a field with the given name doesn't already exist, add a new field. Otherwise, if the new value's type is the same as the existing field's value type, overwrite the existing value with new value.

Exceptions

  TypeError | if a field with the given name already exists, but its value type is not the same as the new value's
  ValueError | if the given field name is empty.

## ◆ isInWorldSpace()

bool isInWorldSpace | ( |  | ) | const
| inherited

Return `true` if this grid's voxel values are in world space and should be affected by transformations, `false` if they are in local space and should not be affected by transformations.

## ◆ isRegistered() [1/2]

template<typename _TreeType>

bool isRegistered | ( |  | ) |
| inline static

Return `true` if this grid type is registered.

## ◆ isRegistered() [2/2]

bool isRegistered | ( | const Name & | type | ) |
| static inherited

Return `true` if the given grid type name is registered.

## ◆ isTreeUnique()

template<typename TreeT>

bool isTreeUnique | ( |  | ) | const
| inline final virtual

Return true if tree is not shared with another grid.

Note
  This is a virtual function with ABI=8

Implements GridBase.

## ◆ isType()

template<typename GridType>

bool isType | ( |  | ) | const
| inline inherited

Return `true` if this grid is of the same type as the template parameter.

## ◆ memUsage()

template<typename _TreeType>

Index64 memUsage | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ merge()

template<typename TreeT>

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.

## ◆ metaCount()

size_t metaCount | ( |  | ) | const
| inline inherited

## ◆ metaValue() [1/2]

template<typename T>

T & metaValue | ( | const Name & | name | ) |
| inline inherited

Return a reference to the value of type `T` stored in the given metadata field.

Exceptions

  LookupError | if no field with the given name exists.
  TypeError | if the given field is not of type `T`.

## ◆ metaValue() [2/2]

template<typename T>

const T & metaValue | ( | const Name & | name | ) | const
| inline inherited

## ◆ newTree()

template<typename TreeT>

void newTree | ( |  | ) |
| inline override virtual

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.

Implements GridBase.

## ◆ operator!=()

bool operator!= | ( | const MetaMap & | other | ) | const
| inline inherited

Return `true` if the given map is different from this map.

## ◆ operator=()

template<typename _TreeType>

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

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

## ◆ operator==()

bool operator== | ( | const MetaMap & | other | ) | const
| inherited

Return `true` if the given map is equivalent to this map.

## ◆ operator[]() [1/2]

Metadata::Ptr operator[] | ( | const Name & | name | ) |
| inline inherited

Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.

## ◆ operator[]() [2/2]

Metadata::ConstPtr operator[] | ( | const Name & | name | ) | const
| inline inherited

## ◆ print()

template<typename TreeT>

void print | ( | std::ostream & | os = std::cout,
|  | int | verboseLevel = 1 ) const
| inline override virtual

Output a human-readable description of this grid.

Implements GridBase.

## ◆ pruneGrid()

template<typename TreeT>

void pruneGrid | ( | float | tolerance = 0.0 | ) |
| inline override virtual

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

Implements GridBase.

## ◆ readBuffers() [1/2]

template<typename TreeT>

void readBuffers | ( | std::istream & | is | ) |
| inline override virtual

Read all data buffers for this grid.

Implements GridBase.

## ◆ readBuffers() [2/2]

template<typename TreeT>

void readBuffers | ( | std::istream & | is,
|  | const CoordBBox & | bbox )
| inline override virtual

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

Implements GridBase.

## ◆ readMeta()

void readMeta | ( | std::istream & |  | ) |
| inherited

Unserialize metadata from the given stream.

## ◆ readNonresidentBuffers()

template<typename TreeT>

void readNonresidentBuffers | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ readTopology()

template<typename TreeT>

void readTopology | ( | std::istream & | is | ) |
| inline override virtual

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

Implements GridBase.

## ◆ readTransform()

void readTransform | ( | std::istream & | is | ) |
| inline inherited

Read in the transform for this grid.

## ◆ registerGrid() [1/2]

template<typename _TreeType>

void registerGrid | ( |  | ) |
| inline static

Register this grid type along with a factory function.

## ◆ registerGrid() [2/2]

void registerGrid | ( | const Name & | type,
|  | GridFactory | )
| static protected inherited

Register a grid type along with a factory function.

## ◆ removeMeta()

void removeMeta | ( | const Name & |  | ) |
| inherited

Remove the given metadata field if it exists.

## ◆ saveFloatAsHalf()

bool saveFloatAsHalf | ( |  | ) | const
| inherited

Return `true` if this grid should be written out with floating-point voxel values (including components of vectors) quantized to 16 bits.

## ◆ setCreator()

void setCreator | ( | const std::string & |  | ) |
| inherited

Provide a description of this grid's creator.

## ◆ setGridClass()

void setGridClass | ( | GridClass |  | ) |
| inherited

Specify the class of volumetric data (level set, fog volume, etc.) that is stored in this grid.

See also
  gridClassToString, gridClassToMenuName, stringToGridClass

## ◆ setIsInWorldSpace()

void setIsInWorldSpace | ( | bool |  | ) |
| inherited

Specify whether this grid's voxel values are in world space or in local space.

## ◆ setName()

void setName | ( | const std::string & |  | ) |
| inherited

Specify a name for this grid.

## ◆ setSaveFloatAsHalf()

void setSaveFloatAsHalf | ( | bool |  | ) |
| inherited

Return this grid's user-specified name.

## ◆ setTransform()

void setTransform | ( | math::Transform::Ptr | xform | ) |
| inline inherited

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

Exceptions

  ValueError | if the transform pointer is null

Note
  Invalidates all references previously returned by transform or Transform.

## ◆ setTree()

template<typename TreeT>

void setTree | ( | TreeBase::Ptr | tree | ) |
| inline override virtual

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

Exceptions

  ValueError | if the tree pointer is null
  TypeError | if the tree is not of type TreeType

Note
  Invalidates all references previously returned by baseTree(), constBaseTree(), tree() or constTree().

Implements GridBase.

## ◆ setVectorType()

void setVectorType | ( | VecType |  | ) |
| inherited

Specify the type of vector data (invariant, covariant, etc.) stored in this grid, assuming that this grid contains a vector-valued tree.

See also
  vecTypeToString, vecTypeExamples, vecTypeDescription, stringToVecType

## ◆ sparseFill()

template<typename TreeT>

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

  bbox | inclusive coordinates of opposite corners of an axis-aligned box
  value | the value to which to set voxels within the box
  active | if 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.

## ◆ str()

std::string str | ( | const std::string & | indent = "" | ) | const
| inherited

Return a string describing this metadata map. Prefix each line with indent.

## ◆ stringToGridClass()

GridClass stringToGridClass | ( | const std::string & |  | ) |
| static inherited

Return the class of volumetric data specified by the given string.

If the string is not one of the ones returned by gridClassToString, return `GRID_UNKNOWN`.

## ◆ stringToVecType()

VecType stringToVecType | ( | const std::string & |  | ) |
| static inherited

## ◆ topologyDifference()

template<typename TreeT>
template<typename OtherTreeType>

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

template<typename TreeT>
template<typename OtherTreeType>

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

template<typename TreeT>
template<typename OtherTreeType>

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.

## ◆ transform() [1/2]

math::Transform & transform | ( |  | ) |
| inline inherited

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

Note
  Calling setTransform on this grid invalidates all references previously returned by this method.

## ◆ transform() [2/2]

const math::Transform & transform | ( |  | ) | const
| inline inherited

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

## ◆ transformPtr() [1/2]

math::Transform::Ptr transformPtr | ( |  | ) |
| inline inherited

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

## ◆ transformPtr() [2/2]

math::Transform::ConstPtr transformPtr | ( |  | ) | const
| inline inherited

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

## ◆ tree() [1/2]

template<typename _TreeType>

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]

template<typename _TreeType>

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]

template<typename _TreeType>

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]

template<typename _TreeType>

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

template<typename _TreeType>

Name type | ( |  | ) | const
| inline override virtual

Return the name of this grid's type.

Implements GridBase.

## ◆ unregisterGrid() [1/2]

template<typename _TreeType>

void unregisterGrid | ( |  | ) |
| inline static

Remove this grid type from the registry.

## ◆ unregisterGrid() [2/2]

void unregisterGrid | ( | const Name & | type | ) |
| static protected inherited

Remove a grid type from the registry.

## ◆ valueType()

template<typename _TreeType>

Name valueType | ( |  | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ vecTypeDescription()

std::string vecTypeDescription | ( | VecType |  | ) |
| static inherited

Return a string describing how the given type of vector data is affected by transformations (e.g., "Does not transform", given VEC_INVARIANT).

## ◆ vecTypeExamples()

std::string vecTypeExamples | ( | VecType |  | ) |
| static inherited

Return a string listing examples of the given type of vector data (e.g., "Gradient/Normal", given VEC_COVARIANT).

## ◆ vecTypeToString()

std::string vecTypeToString | ( | VecType |  | ) |
| static inherited

Return the metadata string value for the given type of vector data.

## ◆ voxelSize() [1/2]

Vec3d voxelSize | ( |  | ) | const
| inline inherited

Return the size of this grid's voxels.

## ◆ voxelSize() [2/2]

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

Return the size of this grid's voxel at position (x, y, z).

Note
  Frustum and perspective transforms have position-dependent voxel size.

## ◆ worldToIndex()

Vec3d worldToIndex | ( | const Vec3d & | xyz | ) | const
| inline inherited

Apply the inverse of this grid's transform to the given coordinates.

## ◆ writeBuffers()

template<typename TreeT>

void writeBuffers | ( | std::ostream & | os | ) | const
| inline override virtual

Write out all data buffers for this grid.

Implements GridBase.

## ◆ writeMeta()

void writeMeta | ( | std::ostream & |  | ) | const
| inherited

Serialize metadata to the given stream.

## ◆ writeTopology()

template<typename TreeT>

void writeTopology | ( | std::ostream & | os | ) | const
| inline override virtual

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

Implements GridBase.

## ◆ writeTransform()

void writeTransform | ( | std::ostream & | os | ) | const
| inline inherited

Write out the transform for this grid.

## Member Data Documentation

## ◆ META_FILE_BBOX_MAX

const char* const META_FILE_BBOX_MAX
| static inherited

## ◆ META_FILE_BBOX_MIN

const char* const META_FILE_BBOX_MIN
| static inherited

## ◆ META_FILE_COMPRESSION

const char* const META_FILE_COMPRESSION
| static inherited

## ◆ META_FILE_DELAYED_LOAD

const char* const META_FILE_DELAYED_LOAD
| static inherited

## ◆ META_FILE_MEM_BYTES

const char* const META_FILE_MEM_BYTES
| static inherited

## ◆ META_FILE_VOXEL_COUNT

const char* const META_FILE_VOXEL_COUNT
| static inherited

## ◆ META_GRID_CLASS

const char* const META_GRID_CLASS
| static inherited

## ◆ META_GRID_CREATOR

const char* const META_GRID_CREATOR
| static inherited

## ◆ META_GRID_NAME

const char* const META_GRID_NAME
| static inherited

## ◆ META_IS_LOCAL_SPACE

const char* const META_IS_LOCAL_SPACE
| static inherited

## ◆ META_SAVE_HALF_FLOAT

const char* const META_SAVE_HALF_FLOAT
| static inherited

## ◆ META_VECTOR_TYPE

const char* const META_VECTOR_TYPE
| static inherited