OpenVDB  2.1.0
LevelSetTracker.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2013 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30 //
38 
39 #ifndef OPENVDB_TOOLS_LEVEL_SET_TRACKER_HAS_BEEN_INCLUDED
40 #define OPENVDB_TOOLS_LEVEL_SET_TRACKER_HAS_BEEN_INCLUDED
41 
42 #include <tbb/parallel_reduce.h>
43 #include <tbb/parallel_for.h>
44 #include <boost/bind.hpp>
45 #include <boost/function.hpp>
46 #include <boost/type_traits/is_floating_point.hpp>
47 #include <openvdb/Types.h>
48 #include <openvdb/math/Math.h>
49 #include <openvdb/math/FiniteDifference.h>
50 #include <openvdb/math/Operators.h>
51 #include <openvdb/math/Stencils.h>
52 #include <openvdb/math/Transform.h>
53 #include <openvdb/Grid.h>
54 #include <openvdb/util/NullInterrupter.h>
55 #include <openvdb/tree/ValueAccessor.h>
56 #include <openvdb/tree/LeafManager.h>
57 #include "Morphology.h"//for tools::dilateVoxels
58 
59 namespace openvdb {
61 namespace OPENVDB_VERSION_NAME {
62 namespace tools {
63 
65 template<typename GridT, typename InterruptT = util::NullInterrupter>
67 {
68 public:
69  typedef GridT GridType;
70  typedef typename GridT::TreeType TreeType;
71  typedef typename TreeType::LeafNodeType LeafType;
72  typedef typename TreeType::ValueType ValueType;
73  typedef typename tree::LeafManager<TreeType> LeafManagerType; // leafs + buffers
77  BOOST_STATIC_ASSERT(boost::is_floating_point<ValueType>::value);
78 
81  LevelSetTracker(GridT& grid, InterruptT* interrupt = NULL);
82 
84  LevelSetTracker(const LevelSetTracker& other);
85 
86  virtual ~LevelSetTracker() { if (mIsMaster) delete mLeafs; }
87 
89  void normalize();
90 
93  void track();
94 
96  void prune();
97 
99  math::BiasedGradientScheme getSpatialScheme() const { return mSpatialScheme; }
101  void setSpatialScheme(math::BiasedGradientScheme scheme) { mSpatialScheme = scheme; }
102 
104  math::TemporalIntegrationScheme getTemporalScheme() const { return mTemporalScheme; }
106  void setTemporalScheme(math::TemporalIntegrationScheme scheme) { mTemporalScheme = scheme; }
107 
110  int getNormCount() const { return mNormCount; }
113  void setNormCount(int n) { mNormCount = n; }
114 
116  int getGrainSize() const { return mGrainSize; }
119  void setGrainSize(int grainsize) { mGrainSize = grainsize; }
120 
121  ValueType voxelSize() const { return mDx; }
122 
123  void startInterrupter(const char* msg);
124  void endInterrupter();
126  bool checkInterrupter();
127 
128  const GridType& grid() const { return *mGrid; }
129 
130  LeafManagerType& leafs() { return *mLeafs; }
131  const LeafManagerType& leafs() const { return *mLeafs; }
132 
135  void operator()(const RangeType& r) const
136  {
137  if (mTask) mTask(const_cast<LevelSetTracker*>(this), r);
138  else OPENVDB_THROW(ValueError, "task is undefined - call track(), etc");
139  }
140 
141 private:
142 
143  template<math::BiasedGradientScheme SpatialScheme,
144  math::TemporalIntegrationScheme TemporalScheme>
145  struct Normalizer
146  {
147  Normalizer(LevelSetTracker& tracker): mTracker(tracker), mTask(0) {}
148  void normalize();
149  void operator()(const RangeType& r) const {mTask(const_cast<Normalizer*>(this), r);}
150  typedef typename boost::function<void (Normalizer*, const RangeType&)> FuncType;
151  LevelSetTracker& mTracker;
152  FuncType mTask;
153  void cook(int swapBuffer=0);
154  void euler1(const RangeType& range, ValueType dt, Index resultBuffer);
155  void euler2(const RangeType& range, ValueType dt, ValueType alpha,
156  Index phiBuffer, Index resultBuffer);
157  }; // end of protected Normalizer class
158 
159  typedef typename boost::function<void (LevelSetTracker*, const RangeType&)> FuncType;
160 
161  void trim(const RangeType& r);
162 
163  template<math::BiasedGradientScheme SpatialScheme>
164  void normalize1();
165 
166  template<math::BiasedGradientScheme SpatialScheme,
167  math::TemporalIntegrationScheme TemporalScheme>
168  void normalize2();
169 
170  // Throughout the methods below mLeafs is always assumed to contain
171  // a list of the current LeafNodes! The auxiliary buffers on the
172  // other hand always have to be allocated locally, since some
173  // methods need them and others don't!
174  GridType* mGrid;
175  LeafManagerType* mLeafs;
176  InterruptT* mInterrupter;
177  const ValueType mDx;
178  math::BiasedGradientScheme mSpatialScheme;
179  math::TemporalIntegrationScheme mTemporalScheme;
180  int mNormCount;// Number of iteratations of normalization
181  int mGrainSize;
182  FuncType mTask;
183  const bool mIsMaster;
184 
185  // disallow copy by assignment
186  void operator=(const LevelSetTracker& other) {}
187 
188 }; // end of LevelSetTracker class
189 
190 template<typename GridT, typename InterruptT>
191 LevelSetTracker<GridT, InterruptT>::LevelSetTracker(GridT& grid, InterruptT* interrupt):
192  mGrid(&grid),
193  mLeafs(new LeafManagerType(grid.tree())),
194  mInterrupter(interrupt),
195  mDx(grid.voxelSize()[0]),
196  mSpatialScheme(math::HJWENO5_BIAS),
197  mTemporalScheme(math::TVD_RK1),
198  mNormCount(static_cast<int>(LEVEL_SET_HALF_WIDTH)),
199  mGrainSize(1),
200  mTask(0),
201  mIsMaster(true)// N.B.
202 {
203  if ( !grid.hasUniformVoxels() ) {
205  "The transform must have uniform scale for the LevelSetTracker to function");
206  }
207  if ( grid.getGridClass() != GRID_LEVEL_SET) {
209  "LevelSetTracker only supports level sets!\n"
210  "However, only level sets are guaranteed to work!\n"
211  "Hint: Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
212  }
213 }
214 
215 template<typename GridT, typename InterruptT>
217  mGrid(other.mGrid),
218  mLeafs(other.mLeafs),
219  mInterrupter(other.mInterrupter),
220  mDx(other.mDx),
221  mSpatialScheme(other.mSpatialScheme),
222  mTemporalScheme(other.mTemporalScheme),
223  mNormCount(other.mNormCount),
224  mGrainSize(other.mGrainSize),
225  mTask(other.mTask),
226  mIsMaster(false)// N.B.
227 {
228 }
229 
230 template<typename GridT, typename InterruptT>
231 inline void
233 {
234  this->startInterrupter("Pruning Level Set");
235  // Prune voxels that are too far away from the zero-crossing
236  mTask = boost::bind(&LevelSetTracker::trim, _1, _2);
237  if (mGrainSize>0) {
238  tbb::parallel_for(mLeafs->getRange(mGrainSize), *this);
239  } else {
240  (*this)(mLeafs->getRange());
241  }
242 
243  // Remove inactive nodes from tree
244  mGrid->tree().pruneLevelSet();
245 
246  // The tree topology has changes so rebuild the list of leafs
247  mLeafs->rebuildLeafArray();
248  this->endInterrupter();
249 }
250 
251 template<typename GridT, typename InterruptT>
252 inline void
254 {
255  // Dilate narrow-band (this also rebuilds the leaf array!)
256  tools::dilateVoxels(*mLeafs);
257 
258  // Compute signed distances in dilated narrow-band
259  this->normalize();
260 
261  // Remove voxels that are outside the narrow band
262  this->prune();
263 }
264 
265 template<typename GridT, typename InterruptT>
266 inline void
268 {
269  if (mInterrupter) mInterrupter->start(msg);
270 }
271 
272 template<typename GridT, typename InterruptT>
273 inline void
275 {
276  if (mInterrupter) mInterrupter->end();
277 }
278 
279 template<typename GridT, typename InterruptT>
280 inline bool
282 {
283  if (util::wasInterrupted(mInterrupter)) {
284  tbb::task::self().cancel_group_execution();
285  return false;
286  }
287  return true;
288 }
289 
291 template<typename GridT, typename InterruptT>
292 inline void
293 LevelSetTracker<GridT, InterruptT>::trim(const RangeType& range)
294 {
295  typedef typename LeafType::ValueOnIter VoxelIterT;
296  const_cast<LevelSetTracker*>(this)->checkInterrupter();
297  const ValueType gamma = mGrid->background();
298  for (size_t n=range.begin(), e=range.end(); n != e; ++n) {
299  LeafType &leaf = mLeafs->leaf(n);
300  for (VoxelIterT iter = leaf.beginValueOn(); iter; ++iter) {
301  const ValueType val = *iter;
302  if (val < -gamma)
303  leaf.setValueOff(iter.pos(), -gamma);
304  else if (val > gamma)
305  leaf.setValueOff(iter.pos(), gamma);
306  }
307  }
308 }
309 
310 template<typename GridT, typename InterruptT>
311 inline void
313 {
314  switch (mSpatialScheme) {
315  case math::FIRST_BIAS:
316  this->normalize1<math::FIRST_BIAS >(); break;
317  case math::SECOND_BIAS:
318  this->normalize1<math::SECOND_BIAS >(); break;
319  case math::THIRD_BIAS:
320  this->normalize1<math::THIRD_BIAS >(); break;
321  case math::WENO5_BIAS:
322  this->normalize1<math::WENO5_BIAS >(); break;
323  case math::HJWENO5_BIAS:
324  this->normalize1<math::HJWENO5_BIAS>(); break;
325  default:
326  OPENVDB_THROW(ValueError, "Spatial difference scheme not supported!");
327  }
328 }
329 
330 template<typename GridT, typename InterruptT>
331 template<math::BiasedGradientScheme SpatialScheme>
332 inline void
334 {
335  switch (mTemporalScheme) {
336  case math::TVD_RK1:
337  this->normalize2<SpatialScheme, math::TVD_RK1>(); break;
338  case math::TVD_RK2:
339  this->normalize2<SpatialScheme, math::TVD_RK2>(); break;
340  case math::TVD_RK3:
341  this->normalize2<SpatialScheme, math::TVD_RK3>(); break;
342  default:
343  OPENVDB_THROW(ValueError, "Temporal integration scheme not supported!");
344  }
345 }
346 
347 template<typename GridT, typename InterruptT>
348 template<math::BiasedGradientScheme SpatialScheme,
349  math::TemporalIntegrationScheme TemporalScheme>
350 inline void
351 LevelSetTracker<GridT, InterruptT>::normalize2()
352 {
353  Normalizer<SpatialScheme, TemporalScheme> tmp(*this);
354  tmp.normalize();
355 }
356 
357 template<typename GridT, typename InterruptT>
358 template<math::BiasedGradientScheme SpatialScheme,
359  math::TemporalIntegrationScheme TemporalScheme>
360 inline void
362 normalize()
363 {
365  mTracker.mLeafs->rebuildAuxBuffers(TemporalScheme == math::TVD_RK3 ? 2 : 1);
366 
367  const ValueType dt = (TemporalScheme == math::TVD_RK1 ? ValueType(0.3) :
368  TemporalScheme == math::TVD_RK2 ? ValueType(0.9) : ValueType(1.0))
369  * ValueType(mTracker.voxelSize());
370 
371  for (int n=0, e=mTracker.getNormCount(); n < e; ++n) {
372 
374  switch(TemporalScheme) {//switch is resolved at compile-time
375  case math::TVD_RK1:
376  //std::cerr << "1";
377  // Perform one explicit Euler step: t1 = t0 + dt
378  // Phi_t1(0) = Phi_t0(0) - dt * VdotG_t0(1)
379  mTask = boost::bind(&Normalizer::euler1, _1, _2, dt, /*result=*/1);
380  // Cook and swap buffer 0 and 1 such that Phi_t1(0) and Phi_t0(1)
381  this->cook(1);
382  break;
383  case math::TVD_RK2:
384  //std::cerr << "2";
385  // Perform one explicit Euler step: t1 = t0 + dt
386  // Phi_t1(1) = Phi_t0(0) - dt * VdotG_t0(1)
387  mTask = boost::bind(&Normalizer::euler1, _1, _2, dt, /*result=*/1);
388  // Cook and swap buffer 0 and 1 such that Phi_t1(0) and Phi_t0(1)
389  this->cook(1);
390 
391  // Convex combine explict Euler step: t2 = t0 + dt
392  // Phi_t2(1) = 1/2 * Phi_t0(1) + 1/2 * (Phi_t1(0) - dt * V.Grad_t1(0))
393  mTask = boost::bind(&Normalizer::euler2,
394  _1, _2, dt, ValueType(0.5), /*phi=*/1, /*result=*/1);
395  // Cook and swap buffer 0 and 1 such that Phi_t2(0) and Phi_t1(1)
396  this->cook(1);
397  break;
398  case math::TVD_RK3:
399  //std::cerr << "3";
400  // Perform one explicit Euler step: t1 = t0 + dt
401  // Phi_t1(1) = Phi_t0(0) - dt * VdotG_t0(1)
402  mTask = boost::bind(&Normalizer::euler1, _1, _2, dt, /*result=*/1);
403  // Cook and swap buffer 0 and 1 such that Phi_t1(0) and Phi_t0(1)
404  this->cook(1);
405 
406  // Convex combine explict Euler step: t2 = t0 + dt/2
407  // Phi_t2(2) = 3/4 * Phi_t0(1) + 1/4 * (Phi_t1(0) - dt * V.Grad_t1(0))
408  mTask = boost::bind(&Normalizer::euler2,
409  _1, _2, dt, ValueType(0.75), /*phi=*/1, /*result=*/2);
410  // Cook and swap buffer 0 and 2 such that Phi_t2(0) and Phi_t1(2)
411  this->cook(2);
412 
413  // Convex combine explict Euler step: t3 = t0 + dt
414  // Phi_t3(2) = 1/3 * Phi_t0(1) + 2/3 * (Phi_t2(0) - dt * V.Grad_t2(0)
415  mTask = boost::bind(&Normalizer::euler2,
416  _1, _2, dt, ValueType(1.0/3.0), /*phi=*/1, /*result=*/2);
417  // Cook and swap buffer 0 and 2 such that Phi_t3(0) and Phi_t2(2)
418  this->cook(2);
419  break;
420  default:
421  OPENVDB_THROW(ValueError, "Temporal integration scheme not supported!");
422  }
424  }
425  mTracker.mLeafs->removeAuxBuffers();
426 }
427 
430 template<typename GridT, typename InterruptT>
431 template<math::BiasedGradientScheme SpatialScheme,
432  math::TemporalIntegrationScheme TemporalScheme>
433 inline void
434 LevelSetTracker<GridT,InterruptT>::Normalizer<SpatialScheme, TemporalScheme>::
435 cook(int swapBuffer)
436 {
437  mTracker.startInterrupter("Normalizing Level Set");
438 
439  if (mTracker.getGrainSize()>0) {
440  tbb::parallel_for(mTracker.mLeafs->getRange(mTracker.getGrainSize()), *this);
441  } else {
442  (*this)(mTracker.mLeafs->getRange());
443  }
444 
445  mTracker.mLeafs->swapLeafBuffer(swapBuffer, mTracker.getGrainSize()==0);
446 
447  mTracker.endInterrupter();
448 }
449 
450 
454 template<typename GridT, typename InterruptT>
455 template<math::BiasedGradientScheme SpatialScheme,
456  math::TemporalIntegrationScheme TemporalScheme>
457 inline void
458 LevelSetTracker<GridT,InterruptT>::Normalizer<SpatialScheme, TemporalScheme>::
459 euler1(const RangeType &range, ValueType dt, Index resultBuffer)
460 {
461  typedef math::BIAS_SCHEME<SpatialScheme> Scheme;
462  typedef typename Scheme::template ISStencil<GridType>::StencilType Stencil;
463  typedef typename LeafType::ValueOnCIter VoxelIterT;
464  mTracker.checkInterrupter();
465  const ValueType one(1.0), invDx = one/mTracker.voxelSize();
466  Stencil stencil(mTracker.grid());
467  for (size_t n=range.begin(), e=range.end(); n != e; ++n) {
468  BufferType& result = mTracker.mLeafs->getBuffer(n, resultBuffer);
469  const LeafType& leaf = mTracker.mLeafs->leaf(n);
470  for (VoxelIterT iter = leaf.cbeginValueOn(); iter; ++iter) {
471  stencil.moveTo(iter);
472  const ValueType normSqGradPhi =
474  const ValueType phi0 = stencil.getValue();
475  const ValueType diff = math::Sqrt(normSqGradPhi)*invDx - one;
476  const ValueType S = phi0 / (math::Sqrt(math::Pow2(phi0) + normSqGradPhi));
477  result.setValue(iter.pos(), phi0 - dt * S * diff);
478  }
479  }
480 }
481 
482 template<typename GridT, typename InterruptT>
483 template<math::BiasedGradientScheme SpatialScheme,
484  math::TemporalIntegrationScheme TemporalScheme>
485 inline void
486 LevelSetTracker<GridT,InterruptT>::Normalizer<SpatialScheme, TemporalScheme>::
487 euler2(const RangeType& range, ValueType dt, ValueType alpha, Index phiBuffer, Index resultBuffer)
488 {
489  typedef math::BIAS_SCHEME<SpatialScheme> Scheme;
490  typedef typename Scheme::template ISStencil<GridType>::StencilType Stencil;
491  typedef typename LeafType::ValueOnCIter VoxelIterT;
492  mTracker.checkInterrupter();
493  const ValueType one(1.0), beta = one - alpha, invDx = one/mTracker.voxelSize();
494  Stencil stencil(mTracker.grid());
495  for (size_t n=range.begin(), e=range.end(); n != e; ++n) {
496  const BufferType& phi = mTracker.mLeafs->getBuffer(n, phiBuffer);
497  BufferType& result = mTracker.mLeafs->getBuffer(n, resultBuffer);
498  const LeafType& leaf = mTracker.mLeafs->leaf(n);
499  for (VoxelIterT iter = leaf.cbeginValueOn(); iter; ++iter) {
500  stencil.moveTo(iter);
501  const ValueType normSqGradPhi =
503  const ValueType phi0 = stencil.getValue();
504  const ValueType diff = math::Sqrt(normSqGradPhi)*invDx - one;
505  const ValueType S = phi0 / (math::Sqrt(math::Pow2(phi0) + normSqGradPhi));
506  result.setValue(iter.pos(), alpha*phi[iter.pos()] + beta*(phi0 - dt * S * diff));
507  }
508  }
509 }
510 
511 } // namespace tools
512 } // namespace OPENVDB_VERSION_NAME
513 } // namespace openvdb
514 
515 #endif // OPENVDB_TOOLS_LEVEL_SET_TRACKER_HAS_BEEN_INCLUDED
516 
517 // Copyright (c) 2012-2013 DreamWorks Animation LLC
518 // All rights reserved. This software is distributed under the
519 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
math::BiasedGradientScheme getSpatialScheme() const
Definition: LevelSetTracker.h:99
Definition: FiniteDifference.h:196
ValueType voxelSize() const
Definition: LevelSetTracker.h:121
TemporalIntegrationScheme
Temporal integrations schemes.
Definition: FiniteDifference.h:261
math::TemporalIntegrationScheme getTemporalScheme() const
Definition: LevelSetTracker.h:104
Definition: FiniteDifference.h:265
LeafManagerType::RangeType RangeType
Definition: LevelSetTracker.h:74
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:143
Definition: Types.h:137
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:97
int getNormCount() const
Definition: LevelSetTracker.h:110
void endInterrupter()
Definition: LevelSetTracker.h:274
Definition: Exceptions.h:88
Definition: FiniteDifference.h:264
Definition: FiniteDifference.h:263
CopyConstness< TreeType, NonConstBufferType >::Type BufferType
Definition: LeafManager.h:117
Type Pow2(Type x)
Return .
Definition: Math.h:467
Index32 Index
Definition: Types.h:56
GridT::TreeType TreeType
Definition: LevelSetTracker.h:70
void track()
Definition: LevelSetTracker.h:253
TreeType::ValueType ValueType
Definition: LevelSetTracker.h:72
GridT GridType
Definition: LevelSetTracker.h:69
float Sqrt(float x)
Return the square root of a floating-point value.
Definition: Math.h:655
virtual ~LevelSetTracker()
Definition: LevelSetTracker.h:86
Definition: FiniteDifference.h:198
LeafManagerType::BufferType BufferType
Definition: LevelSetTracker.h:76
void setTemporalScheme(math::TemporalIntegrationScheme scheme)
Set the spatial finite difference scheme.
Definition: LevelSetTracker.h:106
LevelSetTracker(GridT &grid, InterruptT *interrupt=NULL)
Definition: LevelSetTracker.h:191
Definition: Exceptions.h:86
GridType::Ptr normalize(const GridType &grid, bool threaded, InterruptT *interrupt)
Normalize the vectors of the given vector-valued grid.
Definition: GridOperators.h:964
LeafManagerType & leafs()
Definition: LevelSetTracker.h:130
LeafManagerType::LeafRange LeafRange
Definition: LevelSetTracker.h:75
#define OPENVDB_VERSION_NAME
Definition: version.h:45
void setGrainSize(int grainsize)
Set the grain-size used for multi-threading.
Definition: LevelSetTracker.h:119
tree::LeafManager< TreeType > LeafManagerType
Definition: LevelSetTracker.h:73
int getGrainSize() const
Definition: LevelSetTracker.h:116
bool checkInterrupter()
Definition: LevelSetTracker.h:281
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
Definition: Platform.h:96
void setSpatialScheme(math::BiasedGradientScheme scheme)
Set the spatial finite difference scheme.
Definition: LevelSetTracker.h:101
void setNormCount(int n)
Set the number of normalizations performed per track or normalize call.
Definition: LevelSetTracker.h:113
const GridType & grid() const
Definition: LevelSetTracker.h:128
const LeafManagerType & leafs() const
Definition: LevelSetTracker.h:131
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
Definition: Platform.h:97
OPENVDB_STATIC_SPECIALIZATION void dilateVoxels(TreeType &tree, int count=1)
Definition: Morphology.h:362
Performs multi-threaded interface tracking of narrow band level sets.
Definition: LevelSetTracker.h:66
void prune()
Remove voxels that are outside the narrow band. (substep of track)
Definition: LevelSetTracker.h:232
TreeType::LeafNodeType LeafType
Definition: LevelSetTracker.h:71
Definition: FiniteDifference.h:195
tbb::blocked_range< size_t > RangeType
Definition: LeafManager.h:118
static Accessor::ValueType result(const Accessor &grid, const Coord &ijk)
Definition: Operators.h:260
BiasedGradientScheme
Biased Gradients are limited to non-centered differences.
Definition: FiniteDifference.h:192
void operator()(const RangeType &r) const
Public functor called by tbb::parallel_for()
Definition: LevelSetTracker.h:135
void startInterrupter(const char *msg)
Definition: LevelSetTracker.h:267
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:67
This class manages a linear array of pointers to a given tree&#39;s leaf nodes, as well as optional auxil...
Definition: LeafManager.h:109
void normalize()
Iterative normalization, i.e. solving the Eikonal equation.
Definition: LevelSetTracker.h:312
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:76
Definition: FiniteDifference.h:197
Definition: FiniteDifference.h:194