10 #ifndef OPENVDB_TOOLS_PRUNE_HAS_BEEN_INCLUDED 
   11 #define OPENVDB_TOOLS_PRUNE_HAS_BEEN_INCLUDED 
   18 #include <type_traits> 
   37 template<
typename TreeT>
 
   42       size_t grainSize = 1);
 
   53 template<
typename TreeT>
 
   58            size_t grainSize = 1);
 
   67 template<
typename TreeT>
 
   79 template<
typename TreeT>
 
   85     size_t grainSize = 1);
 
  100 template<
typename TreeT>
 
  104               size_t grainSize = 1);
 
  123 template<
typename TreeT>
 
  129               size_t grainSize = 1);
 
  135 template<
typename TreeT, Index TerminationLevel = 0>
 
  140     using RootT = 
typename TreeT::RootNodeType;
 
  141     using LeafT = 
typename TreeT::LeafNodeType;
 
  142     static_assert(RootT::LEVEL > TerminationLevel, 
"TerminationLevel out of range");
 
  146         tree.clearAllAccessors();
 
  151         tree.clearAllAccessors();
 
  158     template<
typename NodeT>
 
  161         if (NodeT::LEVEL > TerminationLevel) {
 
  162             for (
typename NodeT::ChildOnIter it=node.beginChildOn(); it; ++it) {
 
  163                 if (it->isInactive()) node.addTile(it.pos(), mValue, 
false);
 
  171         for (
typename RootT::ChildOnIter it = root.beginChildOn(); it; ++it) {
 
  172             if (it->isInactive()) root.addTile(it.getCoord(), mValue, 
false);
 
  174         root.eraseBackgroundTiles();
 
  182 template<
typename TreeT, Index TerminationLevel = 0>
 
  187     using RootT = 
typename TreeT::RootNodeType;
 
  188     using LeafT = 
typename TreeT::LeafNodeType;
 
  189     static_assert(RootT::LEVEL > TerminationLevel, 
"TerminationLevel out of range");
 
  193         tree.clearAllAccessors();
 
  201         for (
typename RootT::ChildOnIter it = root.beginChildOn(); it; ++it) {
 
  202             if (this->isConstant(*it, value, state)) root.addTile(it.getCoord(), 
value, 
state);
 
  204         root.eraseBackgroundTiles();
 
  208     template<
typename NodeT>
 
  211         if (NodeT::LEVEL > TerminationLevel) {
 
  214             for (
typename NodeT::ChildOnIter it=node.beginChildOn(); it; ++it) {
 
  215                 if (this->isConstant(*it, value, state)) node.addTile(it.pos(), 
value, 
state);
 
  225     inline ValueT median(
LeafT& leaf)
 const {
return leaf.medianAll(leaf.buffer().data());}
 
  228     template<
typename NodeT>
 
  231         using UnionT = 
typename NodeT::UnionType;
 
  232         UnionT* 
data = 
const_cast<UnionT*
>(node.getTable());
 
  233         static const size_t midpoint = (NodeT::NUM_VALUES - 1) >> 1;
 
  234         auto op = [](
const UnionT& 
a, 
const UnionT& 
b){
return a.getValue() < 
b.getValue();};
 
  235         std::nth_element(data, data + midpoint, data + NodeT::NUM_VALUES, 
op);
 
  236         return data[midpoint].getValue();
 
  240     template<
typename NodeT>
 
  243     isConstant(NodeT& node, 
bool& 
value, 
bool& 
state)
 const 
  245         return node.isConstant(value, state, mTolerance);
 
  249     template<
typename NodeT>
 
  252     isConstant(NodeT& node, 
ValueT& value, 
bool& state)
 const 
  255         const bool test = node.isConstant(value, tmp, state, mTolerance);
 
  256         if (test) value = this->median(node);
 
  264 template<
typename TreeT, Index TerminationLevel = 0>
 
  269     using RootT = 
typename TreeT::RootNodeType;
 
  270     using LeafT = 
typename TreeT::LeafNodeType;
 
  271     static_assert(RootT::LEVEL > TerminationLevel, 
"TerminationLevel out of range");
 
  274         : mOutside(tree.background())
 
  279                           "LevelSetPruneOp: the background value cannot be negative!");
 
  281         tree.clearAllAccessors();
 
  290                           "LevelSetPruneOp: the outside value cannot be negative!");
 
  294                           "LevelSetPruneOp: the inside value must be negative!");
 
  296         tree.clearAllAccessors();
 
  303     template<
typename NodeT>
 
  306         if (NodeT::LEVEL > TerminationLevel) {
 
  307             for (
typename NodeT::ChildOnIter it=node.beginChildOn(); it; ++it) {
 
  308                 if (it->isInactive()) node.addTile(it.pos(), this->getTileValue(it), 
false);
 
  316         for (
typename RootT::ChildOnIter it = root.beginChildOn(); it; ++it) {
 
  317             if (it->isInactive()) root.addTile(it.getCoord(), this->getTileValue(it), 
false);
 
  319         root.eraseBackgroundTiles();
 
  323     template <
typename IterT>
 
  324     inline ValueT getTileValue(
const IterT& iter)
 const 
  329     const ValueT mOutside, mInside;
 
  333 template<
typename TreeT>
 
  339     nodes.foreachBottomUp(op, threaded, grainSize);
 
  343 template<
typename TreeT>
 
  349     nodes.foreachBottomUp(op, threaded, grainSize);
 
  353 template<
typename TreeT>
 
  359     nodes.foreachBottomUp(op, threaded, grainSize);
 
  363 template<
typename TreeT>
 
  370     nodes.foreachBottomUp(op, threaded, grainSize);
 
  374 template<
typename TreeT>
 
  384     nodes.foreachBottomUp(op, threaded, grainSize);
 
  388 template<
typename TreeT>
 
  394     nodes.foreachBottomUp(op, threaded, grainSize);
 
  403 #ifdef OPENVDB_USE_EXPLICIT_INSTANTIATION 
  405 #ifdef OPENVDB_INSTANTIATE_PRUNE 
  409 #define _FUNCTION(TreeT) \ 
  410     void prune(TreeT&, TreeT::ValueType, bool, size_t) 
  414 #define _FUNCTION(TreeT) \ 
  415     void pruneTiles(TreeT&, TreeT::ValueType, bool, size_t) 
  419 #define _FUNCTION(TreeT) \ 
  420     void pruneInactive(TreeT&, bool, size_t) 
  424 #define _FUNCTION(TreeT) \ 
  425     void pruneInactiveWithValue(TreeT&, const TreeT::ValueType&, bool, size_t) 
  429 #define _FUNCTION(TreeT) \ 
  430     void pruneLevelSet(TreeT&, bool, size_t) 
  434 #define _FUNCTION(TreeT) \ 
  435     void pruneLevelSet(TreeT&, const TreeT::ValueType&, const TreeT::ValueType&, bool, size_t) 
  439 #endif // OPENVDB_USE_EXPLICIT_INSTANTIATION 
  446 #endif // OPENVDB_TOOLS_PRUNE_HAS_BEEN_INCLUDED 
cvex test(vector P=0;int unbound=3;export float s=0;export vector Cf=0;)
 
T negative(const T &val)
Return the unary negation of the given value. 
 
GLsizei const GLfloat * value
 
#define OPENVDB_REAL_TREE_INSTANTIATE(Function)
 
GLboolean GLboolean GLboolean GLboolean a
 
#define OPENVDB_USE_VERSION_NAMESPACE
 
NodeManager produces linear arrays of all tree nodes allowing for efficient threading and bottom-up p...
 
bool isNegative(const Type &x)
Return true if x is less than zero. 
 
To facilitate threading over the nodes of a tree, cache node pointers in linear arrays, one for each level of the tree. 
 
GLint GLint GLsizei GLint GLenum GLenum type
 
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
 
#define OPENVDB_VOLUME_TREE_INSTANTIATE(Function)
 
GLboolean GLboolean GLboolean b
 
#define OPENVDB_VERSION_NAME
The version namespace name for this library version. 
 
#define OPENVDB_THROW(exception, message)