HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout > Class Template Reference

Dense is a simple dense grid API used by the CopyToDense and CopyFromDense classes defined below. More...

#include <Dense.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >:

Public Types

using ValueType = ValueT
 
using BaseT = DenseBase< ValueT, Layout >
 
using Ptr = SharedPtr< Dense >
 
using ConstPtr = SharedPtr< const Dense >
 

Public Member Functions

 Dense (const CoordBBox &bbox)
 Construct a dense grid with a given range of coordinates. More...
 
 Dense (const CoordBBox &bbox, const ValueT &value)
 Construct a dense grid with a given range of coordinates and initial value. More...
 
 Dense (const CoordBBox &bbox, ValueT *data)
 Construct a dense grid that wraps an external array. More...
 
 Dense (const Coord &dim, const Coord &min=Coord(0))
 Construct a dense grid with a given origin and dimensions. More...
 
ValueT * data ()
 Return a raw pointer to this grid's value array. More...
 
const ValueT * data () const
 Return a raw pointer to this grid's value array. More...
 
const CoordBBox & bbox () const
 Return the bounding box of the signed index domain of this grid. More...
 
const Coord & origin () const
 Return the grid's origin in index coordinates. More...
 
Index64 valueCount () const
 Return the number of voxels contained in this grid. More...
 
void setValue (size_t offset, const ValueT &value)
 Set the value of the voxel at the given array offset. More...
 
const ValueT & getValue (size_t offset) const
 Return a const reference to the value of the voxel at the given array offset. More...
 
ValueT & getValue (size_t offset)
 Return a non-const reference to the value of the voxel at the given array offset. More...
 
void setValue (size_t i, size_t j, size_t k, const ValueT &value)
 Set the value of the voxel at unsigned index coordinates (i, j, k). More...
 
const ValueT & getValue (size_t i, size_t j, size_t k) const
 Return a const reference to the value of the voxel at unsigned index coordinates (i, j, k). More...
 
ValueT & getValue (size_t i, size_t j, size_t k)
 Return a non-const reference to the value of the voxel at unsigned index coordinates (i, j, k). More...
 
void setValue (const Coord &xyz, const ValueT &value)
 Set the value of the voxel at the given signed coordinates. More...
 
const ValueT & getValue (const Coord &xyz) const
 Return a const reference to the value of the voxel at the given signed coordinates. More...
 
ValueT & getValue (const Coord &xyz)
 Return a non-const reference to the value of the voxel at the given signed coordinates. More...
 
void fill (const ValueT &value)
 Fill this grid with a constant value. More...
 
size_t coordToOffset (const Coord &xyz) const
 Return the linear offset into this grid's value array given by the specified signed coordinates, i.e., coordinates in the space of this grid's bounding box. More...
 
Coord offsetToCoord (size_t n) const
 Return the global coordinate corresponding to the specified linear offset. More...
 
Index64 memUsage () const
 Return the memory footprint of this Dense grid in bytes. More...
 
void print (const std::string &name="", std::ostream &os=std::cout) const
 Output a human-readable description of this grid to the specified stream. More...
 

Static Public Member Functions

static MemoryLayout memoryLayout ()
 Return the memory layout for this grid (see above for definitions). More...
 

Detailed Description

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
class openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >

Dense is a simple dense grid API used by the CopyToDense and CopyFromDense classes defined below.

Use the Dense class to efficiently produce a dense in-memory representation of an OpenVDB grid. However, be aware that a dense grid could have a memory footprint that is orders of magnitude larger than the sparse grid from which it originates.

Note
This class can be used as a simple wrapper for existing dense grid classes if they provide access to the raw data array.
This implementation allows for the 3D memory layout to be defined by the MemoryLayout template parameter (see above for definition). The default memory layout is ZYX since that's the layout used by OpenVDB grids.

Definition at line 209 of file Dense.h.

Member Typedef Documentation

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
using openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::BaseT = DenseBase<ValueT, Layout>

Definition at line 213 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
using openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::ConstPtr = SharedPtr<const Dense>

Definition at line 215 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
using openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::Ptr = SharedPtr<Dense>

Definition at line 214 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
using openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::ValueType = ValueT

Definition at line 212 of file Dense.h.

Constructor & Destructor Documentation

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::Dense ( const CoordBBox &  bbox)
inline

Construct a dense grid with a given range of coordinates.

Parameters
bboxthe bounding box of the (signed) coordinate range of this grid
Exceptions
ValueErrorif the bounding box is empty.
Note
The min and max coordinates of the bounding box are inclusive.

Definition at line 222 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::Dense ( const CoordBBox &  bbox,
const ValueT &  value 
)
inline

Construct a dense grid with a given range of coordinates and initial value.

Parameters
bboxthe bounding box of the (signed) coordinate range of this grid
valuethe initial value of the grid.
Exceptions
ValueErrorif the bounding box is empty.
Note
The min and max coordinates of the bounding box are inclusive.

Definition at line 230 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::Dense ( const CoordBBox &  bbox,
ValueT *  data 
)
inline

Construct a dense grid that wraps an external array.

Parameters
bboxthe bounding box of the (signed) coordinate range of this grid
dataa raw C-style array whose size is commensurate with the coordinate domain of bbox
Note
The data array is assumed to have a stride of one in the z direction.
Exceptions
ValueErrorif the bounding box is empty.
Note
The min and max coordinates of the bounding box are inclusive.

Definition at line 245 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::Dense ( const Coord &  dim,
const Coord &  min = Coord(0) 
)
inline

Construct a dense grid with a given origin and dimensions.

Parameters
dimthe desired dimensions of the grid
minthe signed coordinates of the first voxel in the dense grid
Exceptions
ValueErrorif any of the dimensions are zero.
Note
The min coordinate is inclusive, and the max coordinate will be min + dim - 1.

Definition at line 259 of file Dense.h.

Member Function Documentation

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
const CoordBBox& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::bbox ( ) const
inline

Return the bounding box of the signed index domain of this grid.

Note
This method is required by both CopyToDense and CopyFromDense.

Definition at line 278 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
size_t openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::coordToOffset ( const Coord &  xyz) const
inline

Return the linear offset into this grid's value array given by the specified signed coordinates, i.e., coordinates in the space of this grid's bounding box.

Note
This method reflects the fact that we assume the same layout of values as an OpenVDB grid, i.e., the fastest coordinate is z.

Definition at line 354 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
ValueT* openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::data ( )
inline

Return a raw pointer to this grid's value array.

Note
This method is required by CopyToDense.

Definition at line 270 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
const ValueT* openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::data ( ) const
inline

Return a raw pointer to this grid's value array.

Note
This method is required by CopyFromDense.

Definition at line 274 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
void openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::fill ( const ValueT &  value)
inline

Fill this grid with a constant value.

Definition at line 341 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
const ValueT& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::getValue ( size_t  offset) const
inline

Return a const reference to the value of the voxel at the given array offset.

Definition at line 290 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
ValueT& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::getValue ( size_t  offset)
inline

Return a non-const reference to the value of the voxel at the given array offset.

Definition at line 293 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
const ValueT& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::getValue ( size_t  i,
size_t  j,
size_t  k 
) const
inline

Return a const reference to the value of the voxel at unsigned index coordinates (i, j, k).

Note
This is somewhat slower than using an array offset.

Definition at line 305 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
ValueT& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::getValue ( size_t  i,
size_t  j,
size_t  k 
)
inline

Return a non-const reference to the value of the voxel at unsigned index coordinates (i, j, k).

Note
This is somewhat slower than using an array offset.

Definition at line 313 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
const ValueT& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::getValue ( const Coord &  xyz) const
inline

Return a const reference to the value of the voxel at the given signed coordinates.

Note
This is slower than using either an array offset or unsigned index coordinates.

Definition at line 327 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
ValueT& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::getValue ( const Coord &  xyz)
inline

Return a non-const reference to the value of the voxel at the given signed coordinates.

Note
This is slower than using either an array offset or unsigned index coordinates.

Definition at line 335 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
static MemoryLayout openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::memoryLayout ( )
inlinestatic

Return the memory layout for this grid (see above for definitions).

Definition at line 266 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
Index64 openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::memUsage ( ) const
inline

Return the memory footprint of this Dense grid in bytes.

Definition at line 369 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
Coord openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::offsetToCoord ( size_t  n) const
inline

Return the global coordinate corresponding to the specified linear offset.

Definition at line 363 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
const Coord& openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::origin ( ) const
inline

Return the grid's origin in index coordinates.

Definition at line 281 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
void openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::print ( const std::string name = "",
std::ostream &  os = std::cout 
) const
inline

Output a human-readable description of this grid to the specified stream.

Definition at line 376 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
void openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::setValue ( size_t  offset,
const ValueT &  value 
)
inline

Set the value of the voxel at the given array offset.

Definition at line 287 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
void openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::setValue ( size_t  i,
size_t  j,
size_t  k,
const ValueT &  value 
)
inline

Set the value of the voxel at unsigned index coordinates (i, j, k).

Note
This is somewhat slower than using an array offset.

Definition at line 297 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
void openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::setValue ( const Coord &  xyz,
const ValueT &  value 
)
inline

Set the value of the voxel at the given signed coordinates.

Note
This is slower than using either an array offset or unsigned index coordinates.

Definition at line 320 of file Dense.h.

template<typename ValueT, MemoryLayout Layout = LayoutZYX>
Index64 openvdb::OPENVDB_VERSION_NAME::tools::Dense< ValueT, Layout >::valueCount ( ) const
inline

Return the number of voxels contained in this grid.

Definition at line 284 of file Dense.h.


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