OpenVDB 13.0.0

Loading...
Searching...
No Matches
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::v13_0
namespace | openvdb::v13_0::tools
namespace | openvdb::v13_0::tools::valxform

## Typedefs
using | OutTreeT = typename Adapter::TreeType
using | Processor = typename valxform::SharedOpTransformer<InIterT, OutTreeT, const XformOp>

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

## Variables
OutGridT & | outGrid
OutGridT XformOp & | op
OutGridT XformOp bool | threaded = true
OutGridT XformOp bool bool | shareOp = true
OutGridT XformOp bool bool MergePolicy | merge = MERGE_ACTIVE_STATES)
OutGridT XformOp bool bool | shared
| else
OutGridT const XformOp bool | 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().