OpenVDB  6.2.0
LevelSetAdvect.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 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 
36 
37 #ifndef OPENVDB_TOOLS_LEVEL_SET_ADVECT_HAS_BEEN_INCLUDED
38 #define OPENVDB_TOOLS_LEVEL_SET_ADVECT_HAS_BEEN_INCLUDED
39 
40 #include <tbb/parallel_for.h>
41 #include <tbb/parallel_reduce.h>
42 #include <openvdb/Platform.h>
43 #include "LevelSetTracker.h"
44 #include "VelocityFields.h" // for EnrightField
46 //#include <openvdb/util/CpuTimer.h>
47 #include <functional>
48 
49 
50 namespace openvdb {
52 namespace OPENVDB_VERSION_NAME {
53 namespace tools {
54 
96 
97 template<typename GridT,
98  typename FieldT = EnrightField<typename GridT::ValueType>,
99  typename InterruptT = util::NullInterrupter>
101 {
102 public:
103  using GridType = GridT;
105  using LeafRange = typename TrackerT::LeafRange;
106  using LeafType = typename TrackerT::LeafType;
108  using ValueType = typename TrackerT::ValueType;
109  using VectorType = typename FieldT::VectorType;
110 
112  LevelSetAdvection(GridT& grid, const FieldT& field, InterruptT* interrupt = nullptr):
113  mTracker(grid, interrupt), mField(field),
114  mSpatialScheme(math::HJWENO5_BIAS),
115  mTemporalScheme(math::TVD_RK2) {}
116 
117  virtual ~LevelSetAdvection() {}
118 
120  math::BiasedGradientScheme getSpatialScheme() const { return mSpatialScheme; }
122  void setSpatialScheme(math::BiasedGradientScheme scheme) { mSpatialScheme = scheme; }
123 
125  math::TemporalIntegrationScheme getTemporalScheme() const { return mTemporalScheme; }
127  void setTemporalScheme(math::TemporalIntegrationScheme scheme) { mTemporalScheme = scheme; }
128 
131  return mTracker.getSpatialScheme();
132  }
135  mTracker.setSpatialScheme(scheme);
136  }
139  return mTracker.getTemporalScheme();
140  }
143  mTracker.setTemporalScheme(scheme);
144  }
145 
148  int getNormCount() const { return mTracker.getNormCount(); }
151  void setNormCount(int n) { mTracker.setNormCount(n); }
152 
154  int getGrainSize() const { return mTracker.getGrainSize(); }
157  void setGrainSize(int grainsize) { mTracker.setGrainSize(grainsize); }
158 
163  size_t advect(ValueType time0, ValueType time1);
164 
165 private:
166  // disallow copy construction and copy by assinment!
167  LevelSetAdvection(const LevelSetAdvection&);// not implemented
168  LevelSetAdvection& operator=(const LevelSetAdvection&);// not implemented
169 
170  // This templated private struct implements all the level set magic.
171  template<typename MapT, math::BiasedGradientScheme SpatialScheme,
172  math::TemporalIntegrationScheme TemporalScheme>
173  struct Advect
174  {
176  Advect(LevelSetAdvection& parent);
178  Advect(const Advect& other);
180  virtual ~Advect() { if (mIsMaster) this->clearField(); }
183  size_t advect(ValueType time0, ValueType time1);
185  void operator()(const LeafRange& r) const
186  {
187  if (mTask) mTask(const_cast<Advect*>(this), r);
188  else OPENVDB_THROW(ValueError, "task is undefined - don\'t call this method directly");
189  }
191  void cook(const char* msg, size_t swapBuffer = 0);
193  typename GridT::ValueType sampleField(ValueType time0, ValueType time1);
194  template <bool Aligned> void sample(const LeafRange& r, ValueType t0, ValueType t1);
195  inline void sampleXformed(const LeafRange& r, ValueType t0, ValueType t1)
196  {
197  this->sample<false>(r, t0, t1);
198  }
199  inline void sampleAligned(const LeafRange& r, ValueType t0, ValueType t1)
200  {
201  this->sample<true>(r, t0, t1);
202  }
203  void clearField();
204  // Convex combination of Phi and a forward Euler advection steps:
205  // Phi(result) = alpha * Phi(phi) + (1-alpha) * (Phi(0) - dt * Speed(speed)*|Grad[Phi(0)]|);
206  template <int Nominator, int Denominator>
207  void euler(const LeafRange&, ValueType, Index, Index);
208  inline void euler01(const LeafRange& r, ValueType t) {this->euler<0,1>(r, t, 0, 1);}
209  inline void euler12(const LeafRange& r, ValueType t) {this->euler<1,2>(r, t, 1, 1);}
210  inline void euler34(const LeafRange& r, ValueType t) {this->euler<3,4>(r, t, 1, 2);}
211  inline void euler13(const LeafRange& r, ValueType t) {this->euler<1,3>(r, t, 1, 2);}
212 
213  LevelSetAdvection& mParent;
214  VectorType* mVelocity;
215  size_t* mOffsets;
216  const MapT* mMap;
217  typename std::function<void (Advect*, const LeafRange&)> mTask;
218  const bool mIsMaster;
219  }; // end of private Advect struct
220 
221  template<math::BiasedGradientScheme SpatialScheme>
222  size_t advect1(ValueType time0, ValueType time1);
223 
224  template<math::BiasedGradientScheme SpatialScheme,
225  math::TemporalIntegrationScheme TemporalScheme>
226  size_t advect2(ValueType time0, ValueType time1);
227 
228  template<math::BiasedGradientScheme SpatialScheme,
229  math::TemporalIntegrationScheme TemporalScheme,
230  typename MapType>
231  size_t advect3(ValueType time0, ValueType time1);
232 
233  TrackerT mTracker;
234  //each thread needs a deep copy of the field since it might contain a ValueAccessor
235  const FieldT mField;
236  math::BiasedGradientScheme mSpatialScheme;
237  math::TemporalIntegrationScheme mTemporalScheme;
238 
239 };//end of LevelSetAdvection
240 
241 
242 template<typename GridT, typename FieldT, typename InterruptT>
243 inline size_t
245 {
246  switch (mSpatialScheme) {
247  case math::FIRST_BIAS:
248  return this->advect1<math::FIRST_BIAS >(time0, time1);
249  case math::SECOND_BIAS:
250  return this->advect1<math::SECOND_BIAS >(time0, time1);
251  case math::THIRD_BIAS:
252  return this->advect1<math::THIRD_BIAS >(time0, time1);
253  case math::WENO5_BIAS:
254  return this->advect1<math::WENO5_BIAS >(time0, time1);
255  case math::HJWENO5_BIAS:
256  return this->advect1<math::HJWENO5_BIAS>(time0, time1);
257  default:
258  OPENVDB_THROW(ValueError, "Spatial difference scheme not supported!");
259  }
260  return 0;
261 }
262 
263 
264 template<typename GridT, typename FieldT, typename InterruptT>
265 template<math::BiasedGradientScheme SpatialScheme>
266 inline size_t
268 {
269  switch (mTemporalScheme) {
270  case math::TVD_RK1:
271  return this->advect2<SpatialScheme, math::TVD_RK1>(time0, time1);
272  case math::TVD_RK2:
273  return this->advect2<SpatialScheme, math::TVD_RK2>(time0, time1);
274  case math::TVD_RK3:
275  return this->advect2<SpatialScheme, math::TVD_RK3>(time0, time1);
276  default:
277  OPENVDB_THROW(ValueError, "Temporal integration scheme not supported!");
278  }
279  return 0;
280 }
281 
282 
283 template<typename GridT, typename FieldT, typename InterruptT>
284 template<math::BiasedGradientScheme SpatialScheme, math::TemporalIntegrationScheme TemporalScheme>
285 inline size_t
287 {
288  const math::Transform& trans = mTracker.grid().transform();
289  if (trans.mapType() == math::UniformScaleMap::mapType()) {
290  return this->advect3<SpatialScheme, TemporalScheme, math::UniformScaleMap>(time0, time1);
291  } else if (trans.mapType() == math::UniformScaleTranslateMap::mapType()) {
292  return this->advect3<SpatialScheme, TemporalScheme, math::UniformScaleTranslateMap>(
293  time0, time1);
294  } else if (trans.mapType() == math::UnitaryMap::mapType()) {
295  return this->advect3<SpatialScheme, TemporalScheme, math::UnitaryMap >(time0, time1);
296  } else if (trans.mapType() == math::TranslationMap::mapType()) {
297  return this->advect3<SpatialScheme, TemporalScheme, math::TranslationMap>(time0, time1);
298  } else {
299  OPENVDB_THROW(ValueError, "MapType not supported!");
300  }
301  return 0;
302 }
303 
304 
305 template<typename GridT, typename FieldT, typename InterruptT>
306 template<
307  math::BiasedGradientScheme SpatialScheme,
308  math::TemporalIntegrationScheme TemporalScheme,
309  typename MapT>
310 inline size_t
312 {
313  Advect<MapT, SpatialScheme, TemporalScheme> tmp(*this);
314  return tmp.advect(time0, time1);
315 }
316 
317 
319 
320 
321 template<typename GridT, typename FieldT, typename InterruptT>
322 template<
323  typename MapT,
324  math::BiasedGradientScheme SpatialScheme,
325  math::TemporalIntegrationScheme TemporalScheme>
326 inline
329 Advect(LevelSetAdvection& parent)
330  : mParent(parent)
331  , mVelocity(nullptr)
332  , mOffsets(nullptr)
333  , mMap(parent.mTracker.grid().transform().template constMap<MapT>().get())
334  , mTask(0)
335  , mIsMaster(true)
336 {
337 }
338 
339 
340 template<typename GridT, typename FieldT, typename InterruptT>
341 template<
342  typename MapT,
343  math::BiasedGradientScheme SpatialScheme,
344  math::TemporalIntegrationScheme TemporalScheme>
345 inline
348 Advect(const Advect& other)
349  : mParent(other.mParent)
350  , mVelocity(other.mVelocity)
351  , mOffsets(other.mOffsets)
352  , mMap(other.mMap)
353  , mTask(other.mTask)
354  , mIsMaster(false)
355 {
356 }
357 
358 
359 template<typename GridT, typename FieldT, typename InterruptT>
360 template<
361  typename MapT,
362  math::BiasedGradientScheme SpatialScheme,
363  math::TemporalIntegrationScheme TemporalScheme>
364 inline size_t
367 advect(ValueType time0, ValueType time1)
368 {
369  namespace ph = std::placeholders;
370 
371  //util::CpuTimer timer;
372  size_t countCFL = 0;
373  if ( math::isZero(time0 - time1) ) return countCFL;
374  const bool isForward = time0 < time1;
375  while ((isForward ? time0<time1 : time0>time1) && mParent.mTracker.checkInterrupter()) {
377  //timer.start( "\nallocate buffers" );
378  mParent.mTracker.leafs().rebuildAuxBuffers(TemporalScheme == math::TVD_RK3 ? 2 : 1);
379  //timer.stop();
380 
381  const ValueType dt = this->sampleField(time0, time1);
382  if ( math::isZero(dt) ) break;//V is essentially zero so terminate
383 
384  OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN //switch is resolved at compile-time
385  switch(TemporalScheme) {
386  case math::TVD_RK1:
387  // Perform one explicit Euler step: t1 = t0 + dt
388  // Phi_t1(1) = Phi_t0(0) - dt * VdotG_t0(0)
389  mTask = std::bind(&Advect::euler01, ph::_1, ph::_2, dt);
390 
391  // Cook and swap buffer 0 and 1 such that Phi_t1(0) and Phi_t0(1)
392  this->cook("Advecting level set using TVD_RK1", 1);
393  break;
394  case math::TVD_RK2:
395  // Perform one explicit Euler step: t1 = t0 + dt
396  // Phi_t1(1) = Phi_t0(0) - dt * VdotG_t0(0)
397  mTask = std::bind(&Advect::euler01, ph::_1, ph::_2, dt);
398 
399  // Cook and swap buffer 0 and 1 such that Phi_t1(0) and Phi_t0(1)
400  this->cook("Advecting level set using TVD_RK1 (step 1 of 2)", 1);
401 
402  // Convex combine explict Euler step: t2 = t0 + dt
403  // Phi_t2(1) = 1/2 * Phi_t0(1) + 1/2 * (Phi_t1(0) - dt * V.Grad_t1(0))
404  mTask = std::bind(&Advect::euler12, ph::_1, ph::_2, dt);
405 
406  // Cook and swap buffer 0 and 1 such that Phi_t2(0) and Phi_t1(1)
407  this->cook("Advecting level set using TVD_RK1 (step 2 of 2)", 1);
408  break;
409  case math::TVD_RK3:
410  // Perform one explicit Euler step: t1 = t0 + dt
411  // Phi_t1(1) = Phi_t0(0) - dt * VdotG_t0(0)
412  mTask = std::bind(&Advect::euler01, ph::_1, ph::_2, dt);
413 
414  // Cook and swap buffer 0 and 1 such that Phi_t1(0) and Phi_t0(1)
415  this->cook("Advecting level set using TVD_RK3 (step 1 of 3)", 1);
416 
417  // Convex combine explict Euler step: t2 = t0 + dt/2
418  // Phi_t2(2) = 3/4 * Phi_t0(1) + 1/4 * (Phi_t1(0) - dt * V.Grad_t1(0))
419  mTask = std::bind(&Advect::euler34, ph::_1, ph::_2, dt);
420 
421  // Cook and swap buffer 0 and 2 such that Phi_t2(0) and Phi_t1(2)
422  this->cook("Advecting level set using TVD_RK3 (step 2 of 3)", 2);
423 
424  // Convex combine explict Euler step: t3 = t0 + dt
425  // Phi_t3(2) = 1/3 * Phi_t0(1) + 2/3 * (Phi_t2(0) - dt * V.Grad_t2(0)
426  mTask = std::bind(&Advect::euler13, ph::_1, ph::_2, dt);
427 
428  // Cook and swap buffer 0 and 2 such that Phi_t3(0) and Phi_t2(2)
429  this->cook("Advecting level set using TVD_RK3 (step 3 of 3)", 2);
430  break;
431  default:
432  OPENVDB_THROW(ValueError, "Temporal integration scheme not supported!");
433  }//end of compile-time resolved switch
435 
436  time0 += isForward ? dt : -dt;
437  ++countCFL;
438  mParent.mTracker.leafs().removeAuxBuffers();
439  this->clearField();
441  mParent.mTracker.track();
442  }//end wile-loop over time
443  return countCFL;//number of CLF propagation steps
444 }
445 
446 
447 template<typename GridT, typename FieldT, typename InterruptT>
448 template<
449  typename MapT,
450  math::BiasedGradientScheme SpatialScheme,
451  math::TemporalIntegrationScheme TemporalScheme>
452 inline typename GridT::ValueType
455 sampleField(ValueType time0, ValueType time1)
456 {
457  namespace ph = std::placeholders;
458 
459  const int grainSize = mParent.mTracker.getGrainSize();
460  const size_t leafCount = mParent.mTracker.leafs().leafCount();
461  if (leafCount==0) return ValueType(0.0);
462 
463  // Compute the prefix sum of offsets to active voxels
464  size_t size=0, voxelCount=mParent.mTracker.leafs().getPrefixSum(mOffsets, size, grainSize);
465 
466  // Sample the velocity field
467  if (mParent.mField.transform() == mParent.mTracker.grid().transform()) {
468  mTask = std::bind(&Advect::sampleAligned, ph::_1, ph::_2, time0, time1);
469  } else {
470  mTask = std::bind(&Advect::sampleXformed, ph::_1, ph::_2, time0, time1);
471  }
472  assert(voxelCount == mParent.mTracker.grid().activeVoxelCount());
473  mVelocity = new VectorType[ voxelCount ];
474  this->cook("Sampling advection field");
475 
476  // Find the extrema of the magnitude of the velocities
477  ValueType maxAbsV = 0;
478  VectorType* v = mVelocity;
479  for (size_t i = 0; i < voxelCount; ++i, ++v) {
480  maxAbsV = math::Max(maxAbsV, ValueType(v->lengthSqr()));
481  }
482 
483  // Compute the CFL number
485 #ifndef _MSC_VER // Visual C++ doesn't guarantee thread-safe initialization of local statics
486  static
487 #endif
488  const ValueType CFL = (TemporalScheme == math::TVD_RK1 ? ValueType(0.3) :
489  TemporalScheme == math::TVD_RK2 ? ValueType(0.9) :
490  ValueType(1.0))/math::Sqrt(ValueType(3.0));
491  const ValueType dt = math::Abs(time1 - time0), dx = mParent.mTracker.voxelSize();
492  return math::Min(dt, ValueType(CFL*dx/math::Sqrt(maxAbsV)));
493 }
494 
495 
496 template<typename GridT, typename FieldT, typename InterruptT>
497 template<
498  typename MapT,
499  math::BiasedGradientScheme SpatialScheme,
500  math::TemporalIntegrationScheme TemporalScheme>
501 template<bool Aligned>
502 inline void
505 sample(const LeafRange& range, ValueType time0, ValueType time1)
506 {
507  const bool isForward = time0 < time1;
508  using VoxelIterT = typename LeafType::ValueOnCIter;
509  const MapT& map = *mMap;
510  const FieldT field( mParent.mField );
511  mParent.mTracker.checkInterrupter();
512  for (typename LeafRange::Iterator leafIter = range.begin(); leafIter; ++leafIter) {
513  VectorType* vel = mVelocity + mOffsets[ leafIter.pos() ];
514  for (VoxelIterT iter = leafIter->cbeginValueOn(); iter; ++iter, ++vel) {
515  const VectorType v = Aligned ? field(iter.getCoord(), time0) ://resolved at compile time
516  field(map.applyMap(iter.getCoord().asVec3d()), time0);
517  *vel = isForward ? v : -v;
518  }
519  }
520 }
521 
522 
523 template<typename GridT, typename FieldT, typename InterruptT>
524 template<
525  typename MapT,
526  math::BiasedGradientScheme SpatialScheme,
527  math::TemporalIntegrationScheme TemporalScheme>
528 inline void
531 clearField()
532 {
533  delete [] mOffsets;
534  delete [] mVelocity;
535  mOffsets = nullptr;
536  mVelocity = nullptr;
537 }
538 
539 
540 template<typename GridT, typename FieldT, typename InterruptT>
541 template<
542  typename MapT,
543  math::BiasedGradientScheme SpatialScheme,
544  math::TemporalIntegrationScheme TemporalScheme>
545 inline void
548 cook(const char* msg, size_t swapBuffer)
549 {
550  mParent.mTracker.startInterrupter( msg );
551 
552  const int grainSize = mParent.mTracker.getGrainSize();
553  const LeafRange range = mParent.mTracker.leafs().leafRange(grainSize);
554 
555  grainSize == 0 ? (*this)(range) : tbb::parallel_for(range, *this);
556 
557  mParent.mTracker.leafs().swapLeafBuffer(swapBuffer, grainSize == 0);
558 
559  mParent.mTracker.endInterrupter();
560 }
561 
562 
563 // Convex combination of Phi and a forward Euler advection steps:
564 // Phi(result) = alpha * Phi(phi) + (1-alpha) * (Phi(0) - dt * V.Grad(0));
565 template<typename GridT, typename FieldT, typename InterruptT>
566 template<
567  typename MapT,
568  math::BiasedGradientScheme SpatialScheme,
569  math::TemporalIntegrationScheme TemporalScheme>
570 template <int Nominator, int Denominator>
571 inline void
574 euler(const LeafRange& range, ValueType dt, Index phiBuffer, Index resultBuffer)
575 {
576  using SchemeT = math::BIAS_SCHEME<SpatialScheme>;
577  using StencilT = typename SchemeT::template ISStencil<GridType>::StencilType;
578  using VoxelIterT = typename LeafType::ValueOnCIter;
580 
581  static const ValueType Alpha = ValueType(Nominator)/ValueType(Denominator);
582  static const ValueType Beta = ValueType(1) - Alpha;
583 
584  mParent.mTracker.checkInterrupter();
585  const MapT& map = *mMap;
586  StencilT stencil(mParent.mTracker.grid());
587  for (typename LeafRange::Iterator leafIter = range.begin(); leafIter; ++leafIter) {
588  const VectorType* vel = mVelocity + mOffsets[ leafIter.pos() ];
589  const ValueType* phi = leafIter.buffer(phiBuffer).data();
590  ValueType* result = leafIter.buffer(resultBuffer).data();
591  for (VoxelIterT voxelIter = leafIter->cbeginValueOn(); voxelIter; ++voxelIter, ++vel) {
592  const Index i = voxelIter.pos();
593  stencil.moveTo(voxelIter);
594  const ValueType a =
595  stencil.getValue() - dt * vel->dot(GradT::result(map, stencil, *vel));
596  result[i] = Nominator ? Alpha * phi[i] + Beta * a : a;
597  }//loop over active voxels in the leaf of the mask
598  }//loop over leafs of the level set
599 }
600 
601 } // namespace tools
602 } // namespace OPENVDB_VERSION_NAME
603 } // namespace openvdb
604 
605 #endif // OPENVDB_TOOLS_LEVEL_SET_ADVECT_HAS_BEEN_INCLUDED
606 
607 // Copyright (c) DreamWorks Animation LLC
608 // All rights reserved. This software is distributed under the
609 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
math::TemporalIntegrationScheme getTrackerTemporalScheme() const
Return the temporal integration scheme.
Definition: LevelSetAdvect.h:138
void setTrackerTemporalScheme(math::TemporalIntegrationScheme scheme)
Set the spatial finite difference scheme.
Definition: LevelSetAdvect.h:142
Performs multi-threaded interface tracking of narrow band level sets. This is the building-block for ...
const Type & Max(const Type &a, const Type &b)
Return the maximum of two values.
Definition: Math.h:569
Definition: FiniteDifference.h:196
Defines two simple wrapper classes for advection velocity fields as well as VelocitySampler and Veloc...
int getNormCount() const
Return The number of normalizations performed per track or normalize call.
Definition: LevelSetAdvect.h:148
Coord Abs(const Coord &xyz)
Definition: Coord.h:542
Delta for small floating-point offsets.
Definition: Math.h:124
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109
TemporalIntegrationScheme
Temporal integration schemes.
Definition: FiniteDifference.h:261
LevelSetAdvection(GridT &grid, const FieldT &field, InterruptT *interrupt=nullptr)
Main constructor.
Definition: LevelSetAdvect.h:112
int getGrainSize() const
Return the grain-size used for multi-threading.
Definition: LevelSetAdvect.h:154
Definition: FiniteDifference.h:264
Index32 Index
Definition: Types.h:61
typename TreeType::LeafNodeType LeafType
Definition: LevelSetTracker.h:89
void setTemporalScheme(math::TemporalIntegrationScheme scheme)
Set the spatial finite difference scheme.
Definition: LevelSetAdvect.h:127
virtual ~LevelSetAdvection()
Definition: LevelSetAdvect.h:117
math::BiasedGradientScheme getSpatialScheme() const
Return the spatial finite difference scheme.
Definition: LevelSetAdvect.h:120
float Sqrt(float x)
Return the square root of a floating-point value.
Definition: Math.h:735
Definition: FiniteDifference.h:194
typename TrackerT::ValueType ValueType
Definition: LevelSetAdvect.h:108
typename FieldT::VectorType VectorType
Definition: LevelSetAdvect.h:109
typename LeafManagerType::BufferType BufferType
Definition: LevelSetTracker.h:93
GridT GridType
Definition: LevelSetAdvect.h:103
Definition: Operators.h:153
Biased gradient operators, defined with respect to the range-space of the map.
Definition: Operators.h:848
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:128
Definition: FiniteDifference.h:198
bool isApproxZero(const Type &x)
Return true if x is equal to zero to within the default floating-point comparison tolerance...
Definition: Math.h:320
typename TreeType::ValueType ValueType
Definition: LevelSetTracker.h:90
const GridType & grid() const
Definition: LevelSetTracker.h:212
LeafManagerType & leafs()
Definition: LevelSetTracker.h:214
Definition: FiniteDifference.h:197
Definition: Exceptions.h:40
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
Definition: Platform.h:149
Name mapType() const
Return the transformation map&#39;s type-name.
Definition: Transform.h:93
math::BiasedGradientScheme getTrackerSpatialScheme() const
Return the spatial finite difference scheme.
Definition: LevelSetAdvect.h:130
void setTrackerSpatialScheme(math::BiasedGradientScheme scheme)
Set the spatial finite difference scheme.
Definition: LevelSetAdvect.h:134
typename TrackerT::BufferType BufferType
Definition: LevelSetAdvect.h:107
void setNormCount(int n)
Set the number of normalizations performed per track or normalize call.
Definition: LevelSetAdvect.h:151
math::TemporalIntegrationScheme getTemporalScheme() const
Return the temporal integration scheme.
Definition: LevelSetAdvect.h:125
typename LeafManagerType::LeafRange LeafRange
Definition: LevelSetTracker.h:92
BiasedGradientScheme
Biased Gradients are limited to non-centered differences.
Definition: FiniteDifference.h:192
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
Definition: Platform.h:150
Performs multi-threaded interface tracking of narrow band level sets.
Definition: LevelSetTracker.h:82
Definition: Transform.h:66
typename TrackerT::LeafRange LeafRange
Definition: LevelSetAdvect.h:105
typename TrackerT::LeafType LeafType
Definition: LevelSetAdvect.h:106
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:308
const Type & Min(const Type &a, const Type &b)
Return the minimum of two values.
Definition: Math.h:630
Definition: Exceptions.h:92
void setGrainSize(int grainsize)
Set the grain-size used for multi-threading.
Definition: LevelSetAdvect.h:157
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:180
void setSpatialScheme(math::BiasedGradientScheme scheme)
Set the spatial finite difference scheme.
Definition: LevelSetAdvect.h:122
Hyperbolic advection of narrow-band level sets in an external velocity field.
Definition: LevelSetAdvect.h:100
int getGrainSize() const
Definition: LevelSetTracker.h:189
Definition: FiniteDifference.h:263
void startInterrupter(const char *msg)
Definition: LevelSetTracker.h:393
Definition: FiniteDifference.h:265
Definition: FiniteDifference.h:195