HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::GridBase Class Referenceabstract

Abstract base class for typed grids. More...

#include <Grid.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::GridBase:

Public Types

using Ptr = SharedPtr< GridBase >
 
using ConstPtr = SharedPtr< const GridBase >
 
using GridFactory ) = Ptr(*)(
 
- Public Types inherited from openvdb::OPENVDB_VERSION_NAME::MetaMap
using Ptr = SharedPtr< MetaMap >
 
using ConstPtr = SharedPtr< const MetaMap >
 
using MetadataMap = std::map< Name, Metadata::Ptr >
 
using MetaIterator = MetadataMap::iterator
 
using ConstMetaIterator = MetadataMap::const_iterator
 

Public Member Functions

 ~GridBase () override
 
virtual bool empty () const =0
 Return true if this grid contains only background voxels. More...
 
virtual void clear ()=0
 Empty this grid, setting all voxels to the background. More...
 
Copying
virtual GridBase::Ptr copyGrid ()=0
 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...
 
virtual GridBase::ConstPtr copyGrid () const =0
 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...
 
virtual GridBase::Ptr copyGridWithNewTree () const =0
 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...
 
virtual GridBase::ConstPtr copyGridReplacingMetadata (const MetaMap &meta) const =0
 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...
 
virtual GridBase::ConstPtr copyGridReplacingTransform (math::Transform::Ptr xform) const =0
 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...
 
virtual GridBase::ConstPtr copyGridReplacingMetadataAndTransform (const MetaMap &meta, math::Transform::Ptr xform) const =0
 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...
 
virtual GridBase::Ptr deepCopyGrid () const =0
 Return a new grid whose metadata, transform and tree are deep copies of this grid's. More...
 
Type access
virtual Name type () const =0
 Return the name of this grid's type. More...
 
virtual Name valueType () const =0
 Return the name of the type of a voxel's value (e.g., "float" or "vec3d"). More...
 
template<typename GridType >
bool isType () const
 Return true if this grid is of the same type as the template parameter. More...
 
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. More...
 
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. More...
 
virtual TreeBase::ConstPtr constBaseTreePtr () const =0
 Return a pointer to this grid's tree, which might be shared with other grids. The pointer is guaranteed to be non-null. More...
 
virtual bool isTreeUnique () const =0
 Return true if tree is not shared with another grid. More...
 
TreeBasebaseTree ()
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeBasebaseTree () const
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
const TreeBaseconstBaseTree () const
 Return a reference to this grid's tree, which might be shared with other grids. More...
 
virtual void setTree (TreeBase::Ptr)=0
 Associate the given tree with this grid, in place of its existing tree. More...
 
virtual void newTree ()=0
 Set a new tree with the same background value as the previous tree. More...
 
Tools
virtual void pruneGrid (float tolerance=0.0)=0
 Reduce the memory footprint of this grid by increasing its sparseness either losslessly (tolerance = 0) or lossily (tolerance > 0). More...
 
void clipGrid (const BBoxd &)
 Clip this grid to the given world-space bounding box. More...
 
virtual void clip (const CoordBBox &)=0
 Clip this grid to the given index-space bounding box. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Metadata
std::string getName () const
 Return this grid's user-specified name. More...
 
void setName (const std::string &)
 Specify a name for this grid. More...
 
std::string getCreator () const
 Return the user-specified description of this grid's creator. More...
 
void setCreator (const std::string &)
 Provide a description of this grid's creator. More...
 
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. More...
 
void setSaveFloatAsHalf (bool)
 Return this grid's user-specified name. More...
 
GridClass getGridClass () const
 Return the class of volumetric data (level set, fog volume, etc.) that is stored in this grid. More...
 
void setGridClass (GridClass)
 Specify the class of volumetric data (level set, fog volume, etc.) that is stored in this grid. More...
 
void clearGridClass ()
 Remove the setting specifying the class of this grid's volumetric data. More...
 
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. More...
 
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. More...
 
void clearVectorType ()
 Remove the setting specifying the type of vector data stored in this grid. More...
 
bool isInWorldSpace () const
 
void setIsInWorldSpace (bool)
 Specify whether this grid's voxel values are in world space or in local space. More...
 
Statistics
virtual Index64 activeVoxelCount () const =0
 Return the number of active voxels. More...
 
virtual CoordBBox evalActiveVoxelBoundingBox () const =0
 
virtual Coord evalActiveVoxelDim () const =0
 Return the dimensions of the axis-aligned bounding box of all active voxels. More...
 
virtual Index64 memUsage () const =0
 Return the number of bytes of memory used by this grid. More...
 
void addStatsMetadata ()
 Add metadata to this grid comprising the current values of statistics like the active voxel count and bounding box. More...
 
MetaMap::Ptr getStatsMetadata () const
 Return a new MetaMap containing just the metadata that was added to this grid with ::GridBase::addStatsMetadata() addStatsMetadata. More...
 
Transform
math::Transform::Ptr transformPtr ()
 Return a pointer to this grid's transform, which might be shared with other grids. More...
 
math::Transform::ConstPtr transformPtr () const
 Return a pointer to this grid's transform, which might be shared with other grids. More...
 
math::Transform::ConstPtr constTransformPtr () const
 Return a pointer to this grid's transform, which might be shared with other grids. More...
 
void setTransform (math::Transform::Ptr)
 Associate the given transform with this grid, in place of its existing transform. More...
 
Vec3d voxelSize () const
 Return the size of this grid's voxels. More...
 
Vec3d voxelSize (const Vec3d &xyz) const
 Return the size of this grid's voxel at position (x, y, z). More...
 
bool hasUniformVoxels () const
 Return true if the voxels in world space are uniformly sized cubes. More...
 
Vec3d indexToWorld (const Vec3d &xyz) const
 Apply this grid's transform to the given coordinates. More...
 
Vec3d indexToWorld (const Coord &ijk) const
 Apply this grid's transform to the given coordinates. More...
 
Vec3d worldToIndex (const Vec3d &xyz) const
 Apply the inverse of this grid's transform to the given coordinates. More...
 
math::Transformtransform ()
 Return a reference to this grid's transform, which might be shared with other grids. More...
 
const math::Transformtransform () const
 Return a reference to this grid's transform, which might be shared with other grids. More...
 
const math::TransformconstTransform () const
 Return a reference to this grid's transform, which might be shared with other grids. More...
 
I/O
virtual void readTopology (std::istream &)=0
 Read the grid topology from a stream. This will read only the grid structure, not the actual data buffers. More...
 
virtual void writeTopology (std::ostream &) const =0
 Write the grid topology to a stream. This will write only the grid structure, not the actual data buffers. More...
 
virtual void readBuffers (std::istream &)=0
 Read all data buffers for this grid. More...
 
virtual void readBuffers (std::istream &, const CoordBBox &)=0
 Read all of this grid's data buffers that intersect the given index-space bounding box. More...
 
virtual void readNonresidentBuffers () const =0
 Read all of this grid's data buffers that are not yet resident in memory (because delayed loading is in effect). More...
 
virtual void writeBuffers (std::ostream &) const =0
 Write out all data buffers for this grid. More...
 
void readTransform (std::istream &is)
 Read in the transform for this grid. More...
 
void writeTransform (std::ostream &os) const
 Write out the transform for this grid. More...
 
virtual void print (std::ostream &=std::cout, int verboseLevel=1) const =0
 Output a human-readable description of this grid. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::MetaMap
 MetaMap ()
 
 MetaMap (const MetaMap &other)
 
virtual ~MetaMap ()
 
MetaMap::Ptr copyMeta () const
 Return a copy of this map whose fields are shared with this map. More...
 
MetaMap::Ptr deepCopyMeta () const
 Return a deep copy of this map that shares no data with this map. More...
 
MetaMapoperator= (const MetaMap &)
 Assign a deep copy of another map to this map. More...
 
void readMeta (std::istream &)
 Unserialize metadata from the given stream. More...
 
void writeMeta (std::ostream &) const
 Serialize metadata to the given stream. More...
 
void insertMeta (const Name &, const Metadata &value)
 Insert a new metadata field or overwrite the value of an existing field. More...
 
void insertMeta (const MetaMap &)
 Deep copy all of the metadata fields from the given map into this map. More...
 
void removeMeta (const Name &)
 Remove the given metadata field if it exists. More...
 
template<typename T >
T & metaValue (const Name &)
 Return a reference to the value of type T stored in the given metadata field. More...
 
template<typename T >
const T & metaValue (const Name &) const
 
MetaIterator beginMeta ()
 
MetaIterator endMeta ()
 
ConstMetaIterator beginMeta () const
 
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. More...
 
bool operator== (const MetaMap &other) const
 Return true if the given map is equivalent to this map. More...
 
bool operator!= (const MetaMap &other) const
 Return true if the given map is different from this map. More...
 
Metadata::Ptr operator[] (const Name &)
 Return a pointer to the metadata with the given name. If no such field exists, return a null pointer. More...
 
Metadata::ConstPtr operator[] (const Name &) const
 Return a pointer to the metadata with the given name. If no such field exists, return a null pointer. More...
 
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. More...
 
template<typename T >
T::ConstPtr getMetadata (const Name &) const
 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. More...
 

Static Public Member Functions

static std::string gridClassToString (GridClass)
 Return the metadata string value for the given class of volumetric data. More...
 
static std::string gridClassToMenuName (GridClass)
 Return a formatted string version of the grid class. More...
 
static GridClass stringToGridClass (const std::string &)
 Return the class of volumetric data specified by the given string. More...
 
static std::string vecTypeToString (VecType)
 Return the metadata string value for the given type of vector data. More...
 
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). More...
 
static VecType stringToVecType (const std::string &)
 
Registry
static Ptr createGrid (const Name &type)
 Create a new grid of the given (registered) type. More...
 
static bool isRegistered (const Name &type)
 Return true if the given grid type name is registered. More...
 
static void clearRegistry ()
 Clear the grid type registry. More...
 
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. More...
 
template<typename GridType >
static GridType::ConstPtr grid (const GridBase::ConstPtr &)
 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. More...
 
template<typename GridType >
static GridType::ConstPtr constGrid (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. More...
 
template<typename GridType >
static GridType::ConstPtr constGrid (const GridBase::ConstPtr &)
 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. More...
 

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
 

Protected Member Functions

 GridBase ()
 Initialize with an identity linear transform. More...
 
 GridBase (const MetaMap &meta, math::Transform::Ptr xform)
 Initialize with metadata and a transform. More...
 
 GridBase (const GridBase &other)
 Deep copy another grid's metadata and transform. More...
 
 GridBase (GridBase &other, ShallowCopy)
 Copy another grid's metadata but share its transform. More...
 

Static Protected Member Functions

static void registerGrid (const Name &type, GridFactory)
 Register a grid type along with a factory function. More...
 
static void unregisterGrid (const Name &type)
 Remove a grid type from the registry. More...
 

Detailed Description

Abstract base class for typed grids.

Definition at line 77 of file Grid.h.

Member Typedef Documentation

using openvdb::OPENVDB_VERSION_NAME::GridBase::GridFactory = Ptr (*)(

Definition at line 83 of file Grid.h.

Constructor & Destructor Documentation

openvdb::OPENVDB_VERSION_NAME::GridBase::~GridBase ( )
inlineoverride

Definition at line 86 of file Grid.h.

openvdb::OPENVDB_VERSION_NAME::GridBase::GridBase ( )
inlineprotected

Initialize with an identity linear transform.

Definition at line 482 of file Grid.h.

openvdb::OPENVDB_VERSION_NAME::GridBase::GridBase ( const MetaMap meta,
math::Transform::Ptr  xform 
)
inlineprotected

Initialize with metadata and a transform.

Exceptions
ValueErrorif the transform pointer is null

Definition at line 1180 of file Grid.h.

openvdb::OPENVDB_VERSION_NAME::GridBase::GridBase ( const GridBase other)
inlineprotected

Deep copy another grid's metadata and transform.

Definition at line 489 of file Grid.h.

openvdb::OPENVDB_VERSION_NAME::GridBase::GridBase ( GridBase other,
ShallowCopy   
)
inlineprotected

Copy another grid's metadata but share its transform.

Definition at line 492 of file Grid.h.

Member Function Documentation

virtual Index64 openvdb::OPENVDB_VERSION_NAME::GridBase::activeVoxelCount ( ) const
pure virtual

Return the number of active voxels.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

void openvdb::OPENVDB_VERSION_NAME::GridBase::addStatsMetadata ( )

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.
template<typename GridTypeListT , typename OpT >
bool openvdb::OPENVDB_VERSION_NAME::GridBase::apply ( OpT &  op) const
inline

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<
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
grid.fill(bbox, typename GridType::ValueType(1));
}
);
See Also
::TypeList TypeList

Definition at line 1768 of file Grid.h.

template<typename GridTypeListT , typename OpT >
bool openvdb::OPENVDB_VERSION_NAME::GridBase::apply ( OpT &  op)
inline

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<
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
grid.fill(bbox, typename GridType::ValueType(1));
}
);
See Also
::TypeList TypeList

Definition at line 1775 of file Grid.h.

template<typename GridTypeListT , typename OpT >
bool openvdb::OPENVDB_VERSION_NAME::GridBase::apply ( const OpT &  op) const
inline

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::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
grid.fill(bbox, typename GridType::ValueType(1));
}
);
See Also
::TypeList TypeList

Definition at line 1782 of file Grid.h.

template<typename GridTypeListT , typename OpT >
bool openvdb::OPENVDB_VERSION_NAME::GridBase::apply ( const OpT &  op)
inline

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::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
grid.fill(bbox, typename GridType::ValueType(1));
}
);
See Also
::TypeList TypeList

Definition at line 1789 of file Grid.h.

TreeBase& openvdb::OPENVDB_VERSION_NAME::GridBase::baseTree ( )
inline

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

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

Definition at line 183 of file Grid.h.

const TreeBase& openvdb::OPENVDB_VERSION_NAME::GridBase::baseTree ( ) const
inline

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

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

Definition at line 188 of file Grid.h.

TreeBase::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::baseTreePtr ( )
inline

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

Definition at line 1227 of file Grid.h.

TreeBase::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::baseTreePtr ( ) 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.

Definition at line 171 of file Grid.h.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::clear ( )
pure virtual

Empty this grid, setting all voxels to the background.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

void openvdb::OPENVDB_VERSION_NAME::GridBase::clearGridClass ( )

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

static void openvdb::OPENVDB_VERSION_NAME::GridBase::clearRegistry ( )
static

Clear the grid type registry.

void openvdb::OPENVDB_VERSION_NAME::GridBase::clearVectorType ( )

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

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::clip ( const CoordBBox &  )
pure 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.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

void openvdb::OPENVDB_VERSION_NAME::GridBase::clipGrid ( const BBoxd )

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.
const TreeBase& openvdb::OPENVDB_VERSION_NAME::GridBase::constBaseTree ( ) const
inline

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

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

Definition at line 193 of file Grid.h.

virtual TreeBase::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::constBaseTreePtr ( ) const
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

template<typename GridType >
GridType::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::constGrid ( const GridBase::Ptr grid)
inlinestatic

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.

Definition at line 1211 of file Grid.h.

template<typename GridType >
GridType::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::constGrid ( const GridBase::ConstPtr grid)
inlinestatic

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.

Definition at line 1219 of file Grid.h.

const math::Transform& openvdb::OPENVDB_VERSION_NAME::GridBase::constTransform ( ) const
inline

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

Note
Calling ::GridBase::setTransform() setTransform on this grid invalidates all references previously returned by this method.

Definition at line 413 of file Grid.h.

math::Transform::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::constTransformPtr ( ) const
inline

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

Definition at line 404 of file Grid.h.

virtual GridBase::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::copyGrid ( )
pure 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.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual GridBase::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::copyGrid ( ) const
pure 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.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual GridBase::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::copyGridReplacingMetadata ( const MetaMap meta) const
pure 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.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual GridBase::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::copyGridReplacingMetadataAndTransform ( const MetaMap meta,
math::Transform::Ptr  xform 
) const
pure 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
ValueErrorif the transform pointer is null

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual GridBase::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::copyGridReplacingTransform ( math::Transform::Ptr  xform) const
pure 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
ValueErrorif the transform pointer is null

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual GridBase::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::copyGridWithNewTree ( ) const
pure 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.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

static Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::createGrid ( const Name type)
static

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

virtual GridBase::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::deepCopyGrid ( ) const
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual bool openvdb::OPENVDB_VERSION_NAME::GridBase::empty ( ) const
pure virtual

Return true if this grid contains only background voxels.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual CoordBBox openvdb::OPENVDB_VERSION_NAME::GridBase::evalActiveVoxelBoundingBox ( ) const
pure virtual

Return the axis-aligned bounding box of all active voxels. If the grid is empty a default bbox is returned.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual Coord openvdb::OPENVDB_VERSION_NAME::GridBase::evalActiveVoxelDim ( ) const
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

std::string openvdb::OPENVDB_VERSION_NAME::GridBase::getCreator ( ) const

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

GridClass openvdb::OPENVDB_VERSION_NAME::GridBase::getGridClass ( ) const

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

See Also
gridClassToString, gridClassToMenuName, stringToGridClass
std::string openvdb::OPENVDB_VERSION_NAME::GridBase::getName ( ) const

Return this grid's user-specified name.

MetaMap::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::getStatsMetadata ( ) const

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

If ::GridBase::addStatsMetadata() addStatsMetadata was never called on this grid, return an empty MetaMap.

VecType openvdb::OPENVDB_VERSION_NAME::GridBase::getVectorType ( ) const

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
template<typename GridType >
GridType::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::grid ( const GridBase::Ptr grid)
inlinestatic

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.

Definition at line 1189 of file Grid.h.

template<typename GridType >
GridType::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::grid ( const GridBase::ConstPtr grid)
inlinestatic

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.

Definition at line 1202 of file Grid.h.

static std::string openvdb::OPENVDB_VERSION_NAME::GridBase::gridClassToMenuName ( GridClass  )
static

Return a formatted string version of the grid class.

static std::string openvdb::OPENVDB_VERSION_NAME::GridBase::gridClassToString ( GridClass  )
static

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

bool openvdb::OPENVDB_VERSION_NAME::GridBase::hasUniformVoxels ( ) const
inline

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

Definition at line 435 of file Grid.h.

Vec3d openvdb::OPENVDB_VERSION_NAME::GridBase::indexToWorld ( const Vec3d &  xyz) const
inline

Apply this grid's transform to the given coordinates.

Definition at line 437 of file Grid.h.

Vec3d openvdb::OPENVDB_VERSION_NAME::GridBase::indexToWorld ( const Coord &  ijk) const
inline

Apply this grid's transform to the given coordinates.

Definition at line 439 of file Grid.h.

bool openvdb::OPENVDB_VERSION_NAME::GridBase::isInWorldSpace ( ) const

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.

static bool openvdb::OPENVDB_VERSION_NAME::GridBase::isRegistered ( const Name type)
static

Return true if the given grid type name is registered.

virtual bool openvdb::OPENVDB_VERSION_NAME::GridBase::isTreeUnique ( ) const
pure virtual

Return true if tree is not shared with another grid.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

template<typename GridType >
bool openvdb::OPENVDB_VERSION_NAME::GridBase::isType ( ) const
inline

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

Definition at line 146 of file Grid.h.

virtual Index64 openvdb::OPENVDB_VERSION_NAME::GridBase::memUsage ( ) const
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::newTree ( )
pure virtual

Set a new tree with the same background value as the previous tree.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::print ( std::ostream &  = std::cout,
int  verboseLevel = 1 
) const
pure virtual

Output a human-readable description of this grid.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::pruneGrid ( float  tolerance = 0.0)
pure virtual

Reduce the memory footprint of this grid by increasing its sparseness either losslessly (tolerance = 0) or lossily (tolerance > 0).

With tolerance > 0, sparsify regions where voxels have the same active state and have values that differ by no more than the tolerance (converted to this grid's value type).

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::readBuffers ( std::istream &  )
pure virtual

Read all data buffers for this grid.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::readBuffers ( std::istream &  ,
const CoordBBox &   
)
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::readNonresidentBuffers ( ) const
pure 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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::readTopology ( std::istream &  )
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

void openvdb::OPENVDB_VERSION_NAME::GridBase::readTransform ( std::istream &  is)
inline

Read in the transform for this grid.

Definition at line 470 of file Grid.h.

static void openvdb::OPENVDB_VERSION_NAME::GridBase::registerGrid ( const Name type,
GridFactory   
)
staticprotected

Register a grid type along with a factory function.

bool openvdb::OPENVDB_VERSION_NAME::GridBase::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 openvdb::OPENVDB_VERSION_NAME::GridBase::setCreator ( const std::string )

Provide a description of this grid's creator.

void openvdb::OPENVDB_VERSION_NAME::GridBase::setGridClass ( GridClass  )

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

See Also
gridClassToString, gridClassToMenuName, stringToGridClass
void openvdb::OPENVDB_VERSION_NAME::GridBase::setIsInWorldSpace ( bool  )

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

void openvdb::OPENVDB_VERSION_NAME::GridBase::setName ( const std::string )

Specify a name for this grid.

void openvdb::OPENVDB_VERSION_NAME::GridBase::setSaveFloatAsHalf ( bool  )

Return this grid's user-specified name.

void openvdb::OPENVDB_VERSION_NAME::GridBase::setTransform ( math::Transform::Ptr  xform)
inline

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

Exceptions
ValueErrorif the transform pointer is null
Note
Invalidates all references previously returned by GridBase::transform() transform or ::GridBase::constTransform() constTransform.

Definition at line 1234 of file Grid.h.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::setTree ( TreeBase::Ptr  )
pure virtual

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 the appropriate type
Note
Invalidates all references previously returned by ::GridBase::baseTree() baseTree or ::GridBase::constBaseTree() constBaseTree.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

void openvdb::OPENVDB_VERSION_NAME::GridBase::setVectorType ( VecType  )

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
static GridClass openvdb::OPENVDB_VERSION_NAME::GridBase::stringToGridClass ( const std::string )
static

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

If the string is not one of the ones returned by ::GridBase::gridClassToString() gridClassToString, return GRID_UNKNOWN.

static VecType openvdb::OPENVDB_VERSION_NAME::GridBase::stringToVecType ( const std::string )
static
math::Transform& openvdb::OPENVDB_VERSION_NAME::GridBase::transform ( )
inline

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

Note
Calling ::GridBase::setTransform() setTransform on this grid invalidates all references previously returned by this method.

Definition at line 411 of file Grid.h.

const math::Transform& openvdb::OPENVDB_VERSION_NAME::GridBase::transform ( ) const
inline

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

Note
Calling ::GridBase::setTransform() setTransform on this grid invalidates all references previously returned by this method.

Definition at line 412 of file Grid.h.

math::Transform::Ptr openvdb::OPENVDB_VERSION_NAME::GridBase::transformPtr ( )
inline

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

Definition at line 402 of file Grid.h.

math::Transform::ConstPtr openvdb::OPENVDB_VERSION_NAME::GridBase::transformPtr ( ) const
inline

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

Definition at line 403 of file Grid.h.

virtual Name openvdb::OPENVDB_VERSION_NAME::GridBase::type ( ) const
pure virtual

Return the name of this grid's type.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

static void openvdb::OPENVDB_VERSION_NAME::GridBase::unregisterGrid ( const Name type)
staticprotected

Remove a grid type from the registry.

virtual Name openvdb::OPENVDB_VERSION_NAME::GridBase::valueType ( ) const
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

static std::string openvdb::OPENVDB_VERSION_NAME::GridBase::vecTypeDescription ( VecType  )
static

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

static std::string openvdb::OPENVDB_VERSION_NAME::GridBase::vecTypeExamples ( VecType  )
static

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

static std::string openvdb::OPENVDB_VERSION_NAME::GridBase::vecTypeToString ( VecType  )
static

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

Vec3d openvdb::OPENVDB_VERSION_NAME::GridBase::voxelSize ( ) const
inline

Return the size of this grid's voxels.

Definition at line 430 of file Grid.h.

Vec3d openvdb::OPENVDB_VERSION_NAME::GridBase::voxelSize ( const Vec3d &  xyz) const
inline

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

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

Definition at line 433 of file Grid.h.

Vec3d openvdb::OPENVDB_VERSION_NAME::GridBase::worldToIndex ( const Vec3d &  xyz) const
inline

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

Definition at line 441 of file Grid.h.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::writeBuffers ( std::ostream &  ) const
pure virtual

Write out all data buffers for this grid.

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

virtual void openvdb::OPENVDB_VERSION_NAME::GridBase::writeTopology ( std::ostream &  ) const
pure virtual

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

Implemented in openvdb::OPENVDB_VERSION_NAME::Grid< typename >.

void openvdb::OPENVDB_VERSION_NAME::GridBase::writeTransform ( std::ostream &  os) const
inline

Write out the transform for this grid.

Definition at line 472 of file Grid.h.

Member Data Documentation

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_FILE_BBOX_MAX
static

Definition at line 358 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_FILE_BBOX_MIN
static

Definition at line 357 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_FILE_COMPRESSION
static

Definition at line 359 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_FILE_DELAYED_LOAD
static

Definition at line 362 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_FILE_MEM_BYTES
static

Definition at line 360 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_FILE_VOXEL_COUNT
static

Definition at line 361 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_GRID_CLASS
static

Definition at line 351 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_GRID_CREATOR
static

Definition at line 352 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_GRID_NAME
static

Definition at line 353 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_IS_LOCAL_SPACE
static

Definition at line 355 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_SAVE_HALF_FLOAT
static

Definition at line 354 of file Grid.h.

const char* const openvdb::OPENVDB_VERSION_NAME::GridBase::META_VECTOR_TYPE
static

Definition at line 356 of file Grid.h.


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