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
 

Typedefs

using openvdb::OPENVDB_VERSION_NAME::tools::OutTreeT = typename Adapter::TreeType
 
using openvdb::OPENVDB_VERSION_NAME::tools::Processor = typename valxform::SharedOpTransformer< InIterT, OutTreeT, const XformOp >
 

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 >
 openvdb::OPENVDB_VERSION_NAME::tools::OPENVDB_UBSAN_SUPPRESS ("undefined") void transformValues(const InIterT &inIter
 
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...
 
 openvdb::OPENVDB_VERSION_NAME::tools::if (shared)
 
Processor openvdb::OPENVDB_VERSION_NAME::tools::proc (inIter, Adapter::tree(outGrid), op, merge)
 
proc openvdb::OPENVDB_VERSION_NAME::tools::process (threaded)
 

Variables

OutGridT & openvdb::OPENVDB_VERSION_NAME::tools::outGrid
 
OutGridT XformOp & openvdb::OPENVDB_VERSION_NAME::tools::op
 
OutGridT XformOp bool openvdb::OPENVDB_VERSION_NAME::tools::threaded = true
 
OutGridT XformOp bool bool openvdb::OPENVDB_VERSION_NAME::tools::shareOp = true
 
OutGridT XformOp bool bool
MergePolicy 
openvdb::OPENVDB_VERSION_NAME::tools::merge = MERGE_ACTIVE_STATES)
 
OutGridT XformOp bool bool openvdb::OPENVDB_VERSION_NAME::tools::shared
 
 openvdb::OPENVDB_VERSION_NAME::tools::else
 
OutGridT const XformOp bool openvdb::OPENVDB_VERSION_NAME::tools::bool
 

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.