OpenVDB  1.2.0
Classes | Namespaces | Constant Groups | Functions
ValueTransformer.h File Reference
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <openvdb/Types.h>
#include <openvdb/Grid.h>

Go to the source code of this file.

Classes

class  SharedOpApplier< IterT, OpT >
 
class  CopyableOpApplier< IterT, OpT >
 
class  SharedOpTransformer< InIterT, OutTreeT, OpT >
 
class  CopyableOpTransformer< InIterT, OutTreeT, OpT >
 
class  OpAccumulator< IterT, OpT >
 

Namespaces

 openvdb
 
 openvdb::v1_2_0
 
 openvdb::v1_2_0::tools
 
 openvdb::v1_2_0::tools::valxform
 

Constant Groups

 openvdb
 
 openvdb::v1_2_0
 
 openvdb::v1_2_0::tools
 
 openvdb::v1_2_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)
 
template<typename InIterT , typename OutGridT , typename XformOp >
void transformValues (const InIterT &inIter, OutGridT &outGrid, const XformOp &op, bool threaded=true, bool shareOp=true)
 
template<typename IterT , typename XformOp >
void accumulate (const IterT &iter, XformOp &op, bool threaded=true)
 

Detailed Description

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.