OpenVDB: openvdb/tools/ValueTransformer.h File Reference

OpenVDB 10.0.1

Classes | Namespaces | Functions
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>`

Go to the source code of this file.

## Classes
struct | MinOp< ValueType >
struct | MaxOp< ValueType >
struct | SumOp< ValueType >
struct | SumOp< bool >
struct | MultOp< ValueType >
struct | MultOp< bool >
class | SharedOpApplier< IterT, OpT >
class | CopyableOpApplier< IterT, OpT >
class | SharedOpTransformer< InIterT, OutTreeT, OpT >
class | CopyableOpTransformer< InIterT, OutTreeT, OpT >
class | OpAccumulator< IterT, OpT >

## Namespaces
namespace | openvdb
namespace | openvdb::v10_0
namespace | openvdb::v10_0::tools
namespace | openvdb::v10_0::tools::valxform

## Functions
template<typename IterT , typename XformOp >
void | foreach (const IterT &iter, XformOp &op, bool threaded=true, bool shareOp=true)
template<typename IterT , typename XformOp >
void | foreach (const IterT &iter, const XformOp &op, bool threaded=true, bool shareOp=true)
template<typename InIterT , typename OutGridT , typename XformOp >
void | 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 | 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 | accumulate (const IterT &iter, XformOp &op, bool threaded=true)
template<typename TreeT >
void | 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 | 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 | 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 | 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().