HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ValueTransformer.h File Reference
#include <algorithm>
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <openvdb/Types.h>
#include <openvdb/Grid.h>
#include <openvdb/openvdb.h>
+ Include dependency graph for ValueTransformer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openvdb::OPENVDB_VERSION_NAME::tools::valxform::MinOp< ValueType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::valxform::MaxOp< ValueType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::valxform::SumOp< ValueType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::valxform::SumOp< bool >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::valxform::MultOp< ValueType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::valxform::MultOp< bool >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::valxform::SharedOpApplier< IterT, OpT >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::valxform::CopyableOpApplier< IterT, OpT >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::valxform::SharedOpTransformer< InIterT, OutTreeT, OpT >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::valxform::CopyableOpTransformer< InIterT, OutTreeT, OpT >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::valxform::OpAccumulator< IterT, OpT >
 

Namespaces

 openvdb
 
 openvdb::OPENVDB_VERSION_NAME
 
 openvdb::OPENVDB_VERSION_NAME::tools
 
 openvdb::OPENVDB_VERSION_NAME::tools::valxform
 

Functions

template<typename IterT , typename XformOp >
void openvdb::OPENVDB_VERSION_NAME::tools::foreach (const IterT &iter, XformOp &op, bool threaded=true, bool shareOp=true)
 
template<typename IterT , typename XformOp >
void openvdb::OPENVDB_VERSION_NAME::tools::foreach (const IterT &iter, const XformOp &op, bool threaded=true, bool shareOp=true)
 
template<typename InIterT , typename OutGridT , typename XformOp >
void openvdb::OPENVDB_VERSION_NAME::tools::transformValues (const InIterT &inIter, OutGridT &outGrid, XformOp &op, bool threaded=true, bool shareOp=true, MergePolicy merge=MERGE_ACTIVE_STATES)
 
template<typename InIterT , typename OutGridT , typename XformOp >
void openvdb::OPENVDB_VERSION_NAME::tools::transformValues (const InIterT &inIter, OutGridT &outGrid, const XformOp &op, bool threaded=true, bool shareOp=true, MergePolicy merge=MERGE_ACTIVE_STATES)
 
template<typename IterT , typename XformOp >
void openvdb::OPENVDB_VERSION_NAME::tools::accumulate (const IterT &iter, XformOp &op, bool threaded=true)
 
template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::setValueOnMin (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the minimum of its current value and value, and mark the voxel as active. More...
 
template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::setValueOnMax (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the maximum of its current value and value, and mark the voxel as active. More...
 
template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::setValueOnSum (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the sum of its current value and value, and mark the voxel as active. More...
 
template<typename TreeT >
void openvdb::OPENVDB_VERSION_NAME::tools::setValueOnMult (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the product of its current value and value, and mark the voxel as active. More...
 

Detailed Description

Author
Peter Cucka

tools::foreach() and tools::transformValues() transform the values in a grid by iterating over the grid with a user-supplied iterator and applying a user-supplied functor at each step of the iteration. With tools::foreach(), the transformation is done in-place on the input grid, whereas with tools::transformValues(), transformed values are written to an output grid (which can, for example, have a different value type than the input grid). Both functions can optionally transform multiple values of the grid in parallel.

tools::accumulate() can be used to accumulate the results of applying a functor at each step of a grid iteration. (The functor is responsible for storing and updating intermediate results.) When the iteration is done serially the behavior is the same as with tools::foreach(), but when multiple values are processed in parallel, an additional step is performed: when any two threads finish processing, op.join(otherOp) is called on one thread's functor to allow it to coalesce its intermediate result with the other thread's.

Finally, tools::setValueOnMin(), tools::setValueOnMax(), tools::setValueOnSum() and tools::setValueOnMult() are wrappers around Tree::modifyValue() (or ValueAccessor::modifyValue()) for some commmon in-place operations. These are typically significantly faster than calling getValue() followed by setValue().

Definition in file ValueTransformer.h.