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

Base class for typed trees. More...

#include <Tree.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::tree::TreeBase:

Public Types

using Ptr = SharedPtr< TreeBase >
 
using ConstPtr = SharedPtr< const TreeBase >
 

Public Member Functions

 TreeBase ()=default
 
 TreeBase (const TreeBase &)=default
 
TreeBaseoperator= (const TreeBase &)=delete
 
virtual ~TreeBase ()=default
 
virtual const Nametype () const =0
 Return the name of this tree'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 TreeType >
bool isType () const
 Return true if this tree is of the same type as the template parameter. More...
 
virtual TreeBase::Ptr copy () const =0
 Return a pointer to a deep copy of this tree. More...
 
virtual Metadata::Ptr getBackgroundValue () const
 Return this tree's background value wrapped as metadata. More...
 
virtual bool evalLeafBoundingBox (CoordBBox &bbox) const =0
 Return in bbox the axis-aligned bounding box of all active tiles and leaf nodes with active values. More...
 
virtual bool evalLeafDim (Coord &dim) const =0
 Return in dim the dimensions of the axis-aligned bounding box of all leaf nodes. More...
 
virtual bool evalActiveVoxelBoundingBox (CoordBBox &bbox) const =0
 Return in bbox the axis-aligned bounding box of all active voxels and tiles. More...
 
virtual bool evalActiveVoxelDim (Coord &dim) const =0
 Return in dim the dimensions of the axis-aligned bounding box of all active voxels. This is a tighter bounding box than the leaf node bounding box. More...
 
virtual void getIndexRange (CoordBBox &bbox) const =0
 
virtual void clipUnallocatedNodes ()=0
 Replace with background tiles any nodes whose voxel buffers have not yet been allocated. More...
 
virtual Index32 unallocatedLeafCount () const =0
 Return the total number of unallocated leaf nodes residing in this tree. More...
 
virtual Index treeDepth () const =0
 Return the depth of this tree. More...
 
virtual Index32 leafCount () const =0
 Return the number of leaf nodes. More...
 
virtual std::vector< Index32nodeCount () const =0
 
virtual Index32 nonLeafCount () const =0
 Return the number of non-leaf nodes. More...
 
virtual Index64 activeLeafVoxelCount () const =0
 Return the number of active voxels stored in leaf nodes. More...
 
virtual Index64 inactiveLeafVoxelCount () const =0
 Return the number of inactive voxels stored in leaf nodes. More...
 
virtual Index64 activeVoxelCount () const =0
 Return the total number of active voxels. More...
 
virtual Index64 inactiveVoxelCount () const =0
 Return the number of inactive voxels within the bounding box of all active voxels. More...
 
virtual Index64 activeTileCount () const =0
 Return the total number of active tiles. More...
 
virtual Index64 memUsage () const
 Return the total amount of memory in bytes occupied by this tree. More...
 
virtual void readTopology (std::istream &, bool saveFloatAsHalf=false)
 Read the tree topology from a stream. More...
 
virtual void writeTopology (std::ostream &, bool saveFloatAsHalf=false) const
 Write the tree topology to a stream. More...
 
virtual void readBuffers (std::istream &, bool saveFloatAsHalf=false)=0
 Read all data buffers for this tree. More...
 
virtual void readBuffers (std::istream &, const CoordBBox &, bool saveFloatAsHalf=false)=0
 Read all of this tree's data buffers that intersect the given bounding box. More...
 
virtual void readNonresidentBuffers () const =0
 Read all of this tree's data buffers that are not yet resident in memory (because delayed loading is in effect). More...
 
virtual void writeBuffers (std::ostream &, bool saveFloatAsHalf=false) const =0
 Write out all the data buffers for this tree. More...
 
virtual void print (std::ostream &os=std::cout, int verboseLevel=1) const
 Print statistics, memory usage and other information about this tree. More...
 

Detailed Description

Base class for typed trees.

Definition at line 36 of file Tree.h.

Member Typedef Documentation

Constructor & Destructor Documentation

openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::TreeBase ( )
default
openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::TreeBase ( const TreeBase )
default
virtual openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::~TreeBase ( )
virtualdefault

Member Function Documentation

virtual Index64 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::activeLeafVoxelCount ( ) const
pure virtual

Return the number of active voxels stored in leaf nodes.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Index64 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::activeTileCount ( ) const
pure virtual

Return the total number of active tiles.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Index64 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::activeVoxelCount ( ) const
pure virtual

Return the total number of active voxels.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::clipUnallocatedNodes ( )
pure virtual

Replace with background tiles any nodes whose voxel buffers have not yet been allocated.

Typically, unallocated nodes are leaf nodes whose voxel buffers are not yet resident in memory because delayed loading is in effect.

See Also
readNonresidentBuffers, io::File::open

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual TreeBase::Ptr openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::copy ( ) const
pure virtual

Return a pointer to a deep copy of this tree.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual bool openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::evalActiveVoxelBoundingBox ( CoordBBox &  bbox) const
pure virtual

Return in bbox the axis-aligned bounding box of all active voxels and tiles.

This method produces a more accurate, i.e. tighter, bounding box than evalLeafBoundingBox which is approximate but faster.

Returns
false if the bounding box is empty (in which case the bbox is set to its default value).

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual bool openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::evalActiveVoxelDim ( Coord &  dim) const
pure virtual

Return in dim the dimensions of the axis-aligned bounding box of all active voxels. This is a tighter bounding box than the leaf node bounding box.

Returns
false if the bounding box is empty.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual bool openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::evalLeafBoundingBox ( CoordBBox &  bbox) const
pure virtual

Return in bbox the axis-aligned bounding box of all active tiles and leaf nodes with active values.

This is faster than calling evalActiveVoxelBoundingBox, which visits the individual active voxels, and hence evalLeafBoundingBox produces a less tight, i.e. approximate, bbox.

Returns
false if the bounding box is empty (in which case the bbox is set to its default value).

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual bool openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::evalLeafDim ( Coord &  dim) const
pure virtual

Return in dim the dimensions of the axis-aligned bounding box of all leaf nodes.

Returns
false if the bounding box is empty.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Metadata::Ptr openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::getBackgroundValue ( ) const
inlinevirtual

Return this tree's background value wrapped as metadata.

Note
Query the metadata object for the value's type.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

Definition at line 65 of file Tree.h.

virtual void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::getIndexRange ( CoordBBox &  bbox) const
pure virtual
virtual Index64 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::inactiveLeafVoxelCount ( ) const
pure virtual

Return the number of inactive voxels stored in leaf nodes.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Index64 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::inactiveVoxelCount ( ) const
pure virtual

Return the number of inactive voxels within the bounding box of all active voxels.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

template<typename TreeType >
bool openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::isType ( ) const
inline

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

Definition at line 55 of file Tree.h.

virtual Index32 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::leafCount ( ) const
pure virtual

Return the number of leaf nodes.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Index64 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::memUsage ( ) const
inlinevirtual

Return the total amount of memory in bytes occupied by this tree.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

Definition at line 134 of file Tree.h.

virtual std::vector<Index32> openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::nodeCount ( ) const
pure virtual

Return a vector with node counts. The number of nodes of type NodeType is given as element NodeType::LEVEL in the return vector. Thus, the size of this vector corresponds to the height (or depth) of this tree.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Index32 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::nonLeafCount ( ) const
pure virtual

Return the number of non-leaf nodes.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

TreeBase& openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::operator= ( const TreeBase )
delete
void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::print ( std::ostream &  os = std::cout,
int  verboseLevel = 1 
) const
inlinevirtual

Print statistics, memory usage and other information about this tree.

Parameters
osa stream to which to write textual information
verboseLevel1: print tree configuration only; 2: include node and voxel statistics; 3: include memory usage; 4: include minimum and maximum voxel values
Warning
verboseLevel 4 forces loading of any unallocated nodes.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

Definition at line 1095 of file Tree.h.

virtual void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::readBuffers ( std::istream &  ,
bool  saveFloatAsHalf = false 
)
pure virtual

Read all data buffers for this tree.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::readBuffers ( std::istream &  ,
const CoordBBox &  ,
bool  saveFloatAsHalf = false 
)
pure virtual

Read all of this tree's data buffers that intersect the given bounding box.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::readNonresidentBuffers ( ) const
pure virtual

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

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

See Also
clipUnallocatedNodes, io::File::open, io::MappedFile

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::readTopology ( std::istream &  is,
bool  saveFloatAsHalf = false 
)
inlinevirtual

Read the tree topology from a stream.

This will read the tree structure and tile values, but not voxel data.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

Definition at line 1078 of file Tree.h.

virtual Index openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::treeDepth ( ) const
pure virtual

Return the depth of this tree.

A tree with only a root node and leaf nodes has depth 2, for example.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual const Name& openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::type ( ) const
pure virtual

Return the name of this tree's type.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Index32 openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::unallocatedLeafCount ( ) const
pure virtual

Return the total number of unallocated leaf nodes residing in this tree.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

virtual Name openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::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::tree::Tree< _RootNodeType >.

virtual void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::writeBuffers ( std::ostream &  ,
bool  saveFloatAsHalf = false 
) const
pure virtual

Write out all the data buffers for this tree.

Implemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

void openvdb::OPENVDB_VERSION_NAME::tree::TreeBase::writeTopology ( std::ostream &  os,
bool  saveFloatAsHalf = false 
) const
inlinevirtual

Write the tree topology to a stream.

This will write the tree structure and tile values, but not voxel data.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::tree::Tree< _RootNodeType >.

Definition at line 1087 of file Tree.h.


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