29#ifndef OPENVDB_TOOLS_VALUETRANSFORMER_HAS_BEEN_INCLUDED 
   30#define OPENVDB_TOOLS_VALUETRANSFORMER_HAS_BEEN_INCLUDED 
   33#include <tbb/parallel_for.h> 
   34#include <tbb/parallel_reduce.h> 
   88template<
typename IterT, 
typename XformOp>
 
   89inline void foreach(
const IterT& iter, XformOp& op,
 
   90    bool threaded = 
true, 
bool shareOp = 
true);
 
   92template<
typename IterT, 
typename XformOp>
 
   93inline void foreach(
const IterT& iter, 
const XformOp& op,
 
   94    bool threaded = 
true, 
bool shareOp = 
true);
 
  137template<
typename InIterT, 
typename OutGr
idT, 
typename XformOp>
 
  139void transformValues(const InIterT& inIter, OutGridT& 
outGrid,
 
  143template<typename InIterT, typename OutGridT, typename XformOp>
 
  145void transformValues(const InIterT& inIter, OutGridT& 
outGrid,
 
  194template<typename IterT, typename XformOp>
 
  203template<typename TreeT>
 
  211template<typename TreeT>
 
  219template<typename TreeT>
 
  227template<typename TreeT>
 
  236template<
typename ValueType>
 
  240    inline void operator()(ValueType& v)
 const { v = std::min<ValueType>(v, 
val); }
 
 
  243template<
typename ValueType>
 
  247    inline void operator()(ValueType& v)
 const { v = std::max<ValueType>(v, 
val); }
 
 
  250template<
typename ValueType>
 
  265template<
typename ValueType>
 
 
  283template<
typename TreeT>
 
  291template<
typename TreeT>
 
  299template<
typename TreeT>
 
  307template<
typename TreeT>
 
  320template<
typename IterT, 
typename OpT>
 
  332            tbb::parallel_for(range, *
this);
 
 
 
  346template<
typename IterT, 
typename OpT>
 
  357        mIter(other.mIter), mOp(*other.mOrigOp), mOrigOp(other.mOrigOp) {}
 
 
  363            tbb::parallel_for(range, *
this);
 
 
  374    OpT 
const * 
const mOrigOp; 
 
 
  380template<
typename IterT, 
typename XformOp>
 
  394template<
typename IterT, 
typename XformOp>
 
  396foreach(
const IterT& iter, 
const XformOp& 
op, 
bool threaded, 
bool )
 
 
  409template<
typename InIterT, 
typename OutTreeT, 
typename OpT>
 
  420        mInputTree(inIter.getTree()),
 
  421        mOutputTree(&outTree),
 
  425        if (
static_cast<const void*
>(mInputTree) == 
static_cast<void*
>(mOutputTree)) {
 
  427                " to transform a grid in place");
 
 
  434        mInputIter(other.mInputIter),
 
  435        mInputTree(other.mInputTree),
 
  438        mMergePolicy(other.mMergePolicy)
 
 
  447            mOutputTree = 
nullptr;
 
 
  453        if (!mInputTree || !mOutputTree) 
return;
 
  460            tbb::parallel_reduce(range, *
this);
 
 
  469        if (!mOutputTree) 
return;
 
  473            mOp(r.iterator(), outAccessor);
 
 
  479        if (mOutputTree && other.mOutputTree) {
 
  480            mOutputTree->merge(*other.mOutputTree, mMergePolicy);
 
 
  487    const InTreeT* mInputTree;
 
 
  494template<
typename InIterT, 
typename OutTreeT, 
typename OpT>
 
  506        mInputTree(inIter.getTree()),
 
  507        mOutputTree(&outTree),
 
  512        if (
static_cast<const void*
>(mInputTree) == 
static_cast<void*
>(mOutputTree)) {
 
  514                " to transform a grid in place");
 
 
  522        mInputIter(other.mInputIter),
 
  523        mInputTree(other.mInputTree),
 
  526        mOrigOp(other.mOrigOp),
 
  527        mMergePolicy(other.mMergePolicy)
 
 
  536            mOutputTree = 
nullptr;
 
 
  542        if (!mInputTree || !mOutputTree) 
return;
 
  549            tbb::parallel_reduce(range, *
this);
 
 
  558        if (!mOutputTree) 
return;
 
  562            mOp(r.iterator(), outAccessor);
 
 
  568        if (mOutputTree && other.mOutputTree) {
 
  569            mOutputTree->merge(*other.mOutputTree, mMergePolicy);
 
 
  576    const InTreeT* mInputTree;
 
  579    OpT 
const * 
const mOrigOp; 
 
 
  589template<
typename InIterT, 
typename OutGr
idT, 
typename XformOp>
 
  591void transformValues(const InIterT& inIter, OutGridT& outGrid, XformOp& op,
 
  601        using Processor = 
typename valxform::CopyableOpTransformer<InIterT, OutTreeT, XformOp>;
 
  607template<
typename InIterT, 
typename OutGr
idT, 
typename XformOp>
 
  609void transformValues(const InIterT& inIter, OutGridT& outGrid, const XformOp& op,
 
  613    using OutTreeT = 
typename Adapter::TreeType;
 
  626template<
typename IterT, 
typename OpT>
 
  648        mOp(new OpT(*other.mOrigOp)),
 
  649        mOrigOp(other.mOrigOp)
 
 
  658            tbb::parallel_reduce(range, *
this);
 
 
  672    OpT 
const * 
const mOrigOp; 
 
 
  681template<
typename IterT, 
typename XformOp>
 
  695#ifdef OPENVDB_USE_EXPLICIT_INSTANTIATION 
  697#ifdef OPENVDB_INSTANTIATE_VALUETRANSFORMER 
  701#define _FUNCTION(TreeT) \ 
  702    void setValueOnMin(TreeT&, const Coord&, const TreeT::ValueType&) 
  706#define _FUNCTION(TreeT) \ 
  707    void setValueOnMax(TreeT&, const Coord&, const TreeT::ValueType&) 
  711#define _FUNCTION(TreeT) \ 
  712    void setValueOnSum(TreeT&, const Coord&, const TreeT::ValueType&) 
  716#define _FUNCTION(TreeT) \ 
  717    void setValueOnMult(TreeT&, const Coord&, const TreeT::ValueType&) 
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
Definition TreeIterator.h:1304
#define OPENVDB_LOG_INFO(message)
Log an info message of the form 'someVar << "some text" << ...'.
Definition logging.h:254
Definition PointDataGrid.h:170
ValueAccessorImpl< TreeType, IsSafe, MutexType, openvdb::make_index_sequence< CacheLevels > > ValueAccessor
Default alias for a ValueAccessor. This is simply a helper alias for the generic definition but takes...
Definition ValueAccessor.h:86
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:70
MergePolicy
Definition Types.h:506
@ MERGE_ACTIVE_STATES
Definition Types.h:507
Definition Exceptions.h:13
This adapter allows code that is templated on a Tree type to accept either a Tree type or a Grid type...
Definition Grid.h:1060
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218
#define OPENVDB_VOLUME_TREE_INSTANTIATE(Function)
Definition version.h.in:165