OpenVDB
9.0.1
|
#include <openvdb/tools/MultiResGrid.h>
Inherits MetaMap.
Classes | |
struct | MaskOp |
struct | ProlongateOp |
struct | RestrictOp |
Public Types | |
using | Ptr = SharedPtr< MultiResGrid > |
using | ConstPtr = SharedPtr< const MultiResGrid > |
using | ValueType = typename TreeType::ValueType |
using | ValueOnCIter = typename TreeType::ValueOnCIter |
using | ValueOnIter = typename TreeType::ValueOnIter |
using | TreePtr = typename TreeType::Ptr |
using | ConstTreePtr = typename TreeType::ConstPtr |
using | GridPtr = typename Grid< TreeType >::Ptr |
using | ConstGridPtr = typename Grid< TreeType >::ConstPtr |
using | MetadataMap = std::map< Name, Metadata::Ptr > |
using | MetaIterator = MetadataMap::iterator |
using | ConstMetaIterator = MetadataMap::const_iterator |
Public Member Functions | |
MultiResGrid (size_t levels, ValueType background, double voxelSize=1.0) | |
Constructor of empty grids. More... | |
MultiResGrid (size_t levels, const Grid< TreeType > &grid, bool useInjection=false) | |
Given an initial high-resolution grid this constructor generates all the coarser grids by means of restriction. More... | |
MultiResGrid (size_t levels, GridPtr grid, bool useInjection=false) | |
Given an initial high-resolution grid this constructor generates all the coarser grids by means of restriction. More... | |
size_t | numLevels () const |
Return the number of levels, i.e. trees, in this MultiResGrid. More... | |
size_t | coarsestLevel () const |
Return the level of the coarsest grid, i.e. numLevels()-1. More... | |
TreeType & | tree (size_t level) |
Return a reference to the tree at the specified level. More... | |
const TreeType & | constTree (size_t level) const |
Return a const reference to the tree at the specified level. More... | |
TreePtr | treePtr (size_t level) |
Return a shared pointer to the tree at the specified level. More... | |
ConstTreePtr | constTreePtr (size_t level) const |
Return a const shared pointer to the tree at the specified level. More... | |
TreeType & | finestTree () |
Return a reference to the tree at the finest level. More... | |
const TreeType & | finestConstTree () const |
Return a const reference to the tree at the finest level. More... | |
TreePtr | finestTreePtr () |
Return a shared pointer to the tree at the finest level. More... | |
ConstTreePtr | finestConstTreePtr () const |
Return a const shared pointer to the tree at the finest level. More... | |
TreeType & | coarsestTree () |
Return a reference to the tree at the coarsest level. More... | |
const TreeType & | coarsestConstTree () const |
Return a const reference to the tree at the coarsest level. More... | |
TreePtr | coarsestTreePtr () |
Return a shared pointer to the tree at the coarsest level. More... | |
ConstTreePtr | coarsestConstTreePtr () const |
Return a const shared pointer to the tree at the coarsest level. More... | |
GridPtr | grid (size_t level) |
Return a shared pointer to the grid at the specified integer level. More... | |
ConstGridPtr | grid (size_t level) const |
Return a const shared pointer to the grid at the specified level. More... | |
template<Index Order> | |
GridPtr | createGrid (float level, size_t grainSize=1) const |
Return a shared pointer to a new grid at the specified floating-point level. More... | |
GridPtrVecPtr | grids () |
Return a shared pointer to a vector of all the base grids in this instance of the MultiResGrid. More... | |
GridCPtrVecPtr | grids () const |
Return a const shared pointer to a vector of all the base grids in this instance of the MultiResGrid. More... | |
template<Index Order> | |
ValueType | sampleValue (const Coord &ijk, double level) const |
Return the value at the specified integer coordinate position and level using interpolation of the specified order. More... | |
template<Index Order> | |
ValueType | sampleValue (const Vec3R &xyz, double level) const |
Return the value at the specified floating-point coordinate position and level using interpolation of the specified order. More... | |
ValueType | prolongateVoxel (const Coord &coords, const size_t level) const |
Return the value at coordinate location in level tree from the coarser tree at level+1 using trilinear interpolation. More... | |
void | prolongateActiveVoxels (size_t destlevel, size_t grainSize=1) |
ValueType | restrictVoxel (Coord ijk, const size_t level, bool useInjection=false) const |
void | restrictActiveVoxels (size_t destlevel, size_t grainSize=1) |
void | print (std::ostream &=std::cout, int verboseLevel=1) const |
Output a human-readable description of this MultiResGrid. More... | |
std::string | getName () const |
Return a string with the name of this MultiResGrid. More... | |
void | setName (const std::string &name) |
Set the name of this MultiResGrid. More... | |
GridClass | getGridClass () const |
Return the class of volumetric data (level set, fog volume, etc.) stored in this grid. More... | |
void | setGridClass (GridClass cls) |
Specify the class of volumetric data (level set, fog volume, etc.) stored in this grid. More... | |
void | clearGridClass () |
Remove the setting specifying the class of this grid's volumetric data. More... | |
template<Index Order> | |
Grid< TreeType >::Ptr | createGrid (float level, size_t grainSize) const |
template<Index Order> | |
TreeType::ValueType | sampleValue (const Coord &in_ijk, size_t in_level, size_t out_level) const |
template<Index Order> | |
TreeType::ValueType | sampleValue (const Vec3R &in_xyz, size_t in_level, size_t out_level) const |
template<Index Order> | |
TreeType::ValueType | sampleValue (const Coord &ijk, double level) const |
template<Index Order> | |
TreeType::ValueType | sampleValue (const Vec3R &xyz, double level) const |
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... | |
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 () |
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. 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... | |
math::Transform & | transform () |
Return a reference to the finest grid's transform, which might be shared with other grids. More... | |
const math::Transform & | transform () const |
Return a reference to the finest grid's transform, which might be shared with other grids. More... | |
const math::Transform & | constTransform () const |
Return a reference to the finest grid's transform, which might be shared with other grids. More... | |
template<Index Order> | |
ValueType | sampleValue (const Coord &in_ijk, size_t in_level, size_t out_level) const |
Return the value at the specified coordinate position using interpolation of the specified order into the tree at the out_level. More... | |
template<Index Order> | |
ValueType | sampleValue (const Vec3R &in_ijk, size_t in_level, size_t out_level) const |
Return the value at the specified coordinate position using interpolation of the specified order into the tree at the out_level. 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 size_t | finestLevel () |
Return the level of the finest grid (always 0) More... | |
static Vec3R | xyz (const Coord &in_ijk, size_t in_level, size_t out_level) |
Return the floating-point index coordinate at out_level given the index coordinate in_xyz at in_level. More... | |
static Vec3R | xyz (const Vec3R &in_xyz, size_t in_level, size_t out_level) |
Return the floating-point index coordinate at out_level given the index coordinate in_xyz at in_level. More... | |
static Vec3R | xyz (const Vec3R &in_xyz, double in_level, double out_level) |
Return the floating-point index coordinate at out_level given the index coordinate in_xyz at in_level. More... | |
using ConstGridPtr = typename Grid<TreeType>::ConstPtr |
|
inherited |
using ConstPtr = SharedPtr<const MultiResGrid> |
using ConstTreePtr = typename TreeType::ConstPtr |
|
inherited |
|
inherited |
using Ptr = SharedPtr<MultiResGrid> |
using TreePtr = typename TreeType::Ptr |
using ValueOnCIter = typename TreeType::ValueOnCIter |
using ValueOnIter = typename TreeType::ValueOnIter |
using ValueType = typename TreeType::ValueType |
MultiResGrid | ( | size_t | levels, |
ValueType | background, | ||
double | voxelSize = 1.0 |
||
) |
Constructor of empty grids.
levels | The number of trees in this MultiResGrid |
background | Background value |
voxelSize | Size of a (uniform voxel). Defaults to one. |
MultiResGrid | ( | size_t | levels, |
const Grid< TreeType > & | grid, | ||
bool | useInjection = false |
||
) |
Given an initial high-resolution grid this constructor generates all the coarser grids by means of restriction.
levels | The number of trees in this MultiResGrid |
grid | High-resolution input grid |
useInjection | Use restriction by injection, vs full-weighting. It defaults to false and should rarely be used. |
MultiResGrid | ( | size_t | levels, |
GridPtr | grid, | ||
bool | useInjection = false |
||
) |
Given an initial high-resolution grid this constructor generates all the coarser grids by means of restriction.
levels | The number of trees in this MultiResGrid |
grid | High-resolution input grid |
useInjection | Use restriction by injection, vs full-weighting. It defaults to false and should rarely be used. |
|
inlineinherited |
|
inlineinherited |
|
inline |
Remove the setting specifying the class of this grid's volumetric data.
|
inlineinherited |
|
inline |
Return a const reference to the tree at the coarsest level.
|
inline |
Return a const shared pointer to the tree at the coarsest level.
|
inline |
Return the level of the coarsest grid, i.e. numLevels()-1.
|
inline |
Return a reference to the tree at the coarsest level.
|
inline |
Return a shared pointer to the tree at the coarsest level.
|
inline |
Return a reference to the finest grid's transform, which might be shared with other grids.
|
inline |
Return a const reference to the tree at the specified level.
level | The level of the tree to be returned |
|
inline |
Return a const shared pointer to the tree at the specified level.
level | The level of the tree to be returned |
|
inherited |
Return a copy of this map whose fields are shared with this map.
GridPtr createGrid | ( | float | level, |
size_t | grainSize = 1 |
||
) | const |
Return a shared pointer to a new grid at the specified floating-point level.
level | Floating-point level of the grid to be returned |
grainSize | Grain size for the multi-threading |
Interpolation of the specified order is performed between the bracketing integer levels.
|
inherited |
Return a deep copy of this map that shares no data with this map.
|
inlineinherited |
|
inlineinherited |
|
inline |
Return a const reference to the tree at the finest level.
|
inline |
Return a const shared pointer to the tree at the finest level.
|
inlinestatic |
Return the level of the finest grid (always 0)
|
inline |
Return a reference to the tree at the finest level.
|
inline |
Return a shared pointer to the tree at the finest level.
|
inline |
Return the class of volumetric data (level set, fog volume, etc.) stored in this grid.
|
inlineinherited |
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.
|
inlineinherited |
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.
|
inline |
Return a string with the name of this MultiResGrid.
Return a shared pointer to the grid at the specified integer level.
level | Integer level of the grid to be returned |
Return a const shared pointer to the grid at the specified level.
level | The level of the grid to be returned |
GridPtrVecPtr grids | ( | ) |
Return a shared pointer to a vector of all the base grids in this instance of the MultiResGrid.
This method is useful for I/O
GridCPtrVecPtr grids | ( | ) | const |
Return a const shared pointer to a vector of all the base grids in this instance of the MultiResGrid.
This method is useful for I/O
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.
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. |
|
inherited |
Deep copy all of the metadata fields from the given map into this map.
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. |
|
inlineinherited |
|
inlineinherited |
Return a reference to the value of type T
stored in the given metadata field.
LookupError | if no field with the given name exists. |
TypeError | if the given field is not of type T . |
|
inlineinherited |
|
inline |
Return the number of levels, i.e. trees, in this MultiResGrid.
|
inlineinherited |
Return true
if the given map is different from this map.
|
inherited |
Return true
if the given map is equivalent to this map.
|
inlineinherited |
Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.
|
inlineinherited |
Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.
void print | ( | std::ostream & | os = std::cout , |
int | verboseLevel = 1 |
||
) | const |
Output a human-readable description of this MultiResGrid.
void prolongateActiveVoxels | ( | size_t | destlevel, |
size_t | grainSize = 1 |
||
) |
(coarse->fine) Populates all the active voxel values in a fine (level) tree from the coarse (level+1) tree using linear interpolation This transforms multiple values of the tree in parallel
TreeType::ValueType prolongateVoxel | ( | const Coord & | coords, |
const size_t | level | ||
) | const |
Return the value at coordinate location in level tree from the coarser tree at level+1 using trilinear interpolation.
coords | input coords relative to the fine tree at level |
level | The fine level to receive values from the coarser level-1 |
|
inherited |
Unserialize metadata from the given stream.
|
inherited |
Remove the given metadata field if it exists.
void restrictActiveVoxels | ( | size_t | destlevel, |
size_t | grainSize = 1 |
||
) |
(fine->coarse) Populates all the active voxel values in the coarse (level) tree from the fine (level-1) tree using trilinear interpolation. For cell-centered data, this is equivalent to an average For vertex-centered data this is equivalent to transferring the data from the fine vertex directly above the coarse vertex. This transforms multiple values of the tree in parallel
TreeType::ValueType restrictVoxel | ( | Coord | ijk, |
const size_t | level, | ||
bool | useInjection = false |
||
) | const |
Populate a coordinate location in level (coarse) tree from the level-1 (fine) tree using trilinear interpolation input coords are relative to the mTree[level] (coarse)
ValueType sampleValue | ( | const Coord & | in_ijk, |
size_t | in_level, | ||
size_t | out_level | ||
) | const |
Return the value at the specified coordinate position using interpolation of the specified order into the tree at the out_level.
First in_ijk is mapped from index space at in_level to out_level, and then a value is interpolated from the tree at out_level.
in_ijk | Index coordinate position relative to tree at in_level |
in_level | Integer level of the input coordinate in_ijk |
out_level | Integer level of the interpolated value |
Return the value at the specified coordinate position using interpolation of the specified order into the tree at the out_level.
First in_ijk is mapped from index space at in_level to out_level, and then a value is interpolated from the tree at out_level.
in_ijk | Index coordinate position relative to tree at in_level |
in_level | Integer level of the input coordinate in_ijk |
out_level | Integer level of the interpolated value |
ValueType sampleValue | ( | const Coord & | ijk, |
double | level | ||
) | const |
Return the value at the specified integer coordinate position and level using interpolation of the specified order.
ijk | Integer coordinate position relative to the highest level (=0) grid |
level | Floating-point level from which to interpolate the value. Non-integer values of the level will use linear-interpolation between the neighboring integer levels. |
Return the value at the specified floating-point coordinate position and level using interpolation of the specified order.
xyz | Floating-point coordinate position relative to the highest level grid |
level | Floating-point level from which to interpolate the value. Non-integer values of the level will use linear-interpolation between the neighboring integer levels. |
TreeType::ValueType sampleValue | ( | const Coord & | in_ijk, |
size_t | in_level, | ||
size_t | out_level | ||
) | const |
TreeType::ValueType sampleValue | ( | const Vec3R & | in_xyz, |
size_t | in_level, | ||
size_t | out_level | ||
) | const |
TreeType::ValueType sampleValue | ( | const Coord & | ijk, |
double | level | ||
) | const |
TreeType::ValueType sampleValue | ( | const Vec3R & | xyz, |
double | level | ||
) | const |
|
inline |
Specify the class of volumetric data (level set, fog volume, etc.) stored in this grid.
|
inline |
Set the name of this MultiResGrid.
|
inherited |
Return a string describing this metadata map. Prefix each line with indent.
|
inline |
Return a reference to the finest grid's transform, which might be shared with other grids.
|
inline |
Return a reference to the finest grid's transform, which might be shared with other grids.
|
inline |
Return a reference to the tree at the specified level.
level | The level of the tree to be returned |
|
inline |
Return a shared pointer to the tree at the specified level.
level | The level of the tree to be returned |
|
inherited |
Serialize metadata to the given stream.
|
static |
Return the floating-point index coordinate at out_level given the index coordinate in_xyz at in_level.
Return the floating-point index coordinate at out_level given the index coordinate in_xyz at in_level.