15 #ifndef NANOVDB_STENCILS_HAS_BEEN_INCLUDED 16 #define NANOVDB_STENCILS_HAS_BEEN_INCLUDED 33 template<
typename ValueType,
typename RealT = ValueType>
42 static const RealT C = 13.0 / 12.0;
47 const RealT eps = RealT(1.0e-6) * scale2;
49 const RealT A1 = RealT(0.1)/
Pow2(C*
Pow2(v1-2*v2+v3)+RealT(0.25)*
Pow2(v1-4*v2+3*v3)+eps),
50 A2 = RealT(0.6)/
Pow2(C*
Pow2(v2-2*v3+v4)+RealT(0.25)*
Pow2(v2-v4)+eps),
51 A3 = RealT(0.3)/
Pow2(C*
Pow2(v3-2*v4+v5)+RealT(0.25)*
Pow2(3*v3-4*v4+v5)+eps);
53 return static_cast<ValueType
>((A1*(2*v1 - 7*v2 + 11*v3) +
54 A2*(5*v3 - v2 + 2*v4) +
55 A3*(2*v3 + 5*v4 - v5))/(6*(A1+A2+A3)));
60 template <
typename RealT>
63 RealT dP_xm, RealT dP_xp,
64 RealT dP_ym, RealT dP_yp,
65 RealT dP_zm, RealT dP_zp)
80 template<
typename RealT>
86 return GodunovsNormSqrd<RealT>(isOutside,
87 gradient_m[0], gradient_p[0],
88 gradient_m[1], gradient_p[1],
89 gradient_m[2], gradient_p[2]);
95 template<
typename DerivedType,
int SIZE,
typename Gr
idT>
111 static_cast<DerivedType&
>(*this).init(
mCenter);
123 static_cast<DerivedType&
>(*this).init(
mCenter);
131 template<
typename IterType>
136 static_cast<DerivedType&
>(*this).init(
mCenter);
145 template<
typename RealType>
164 template<
int i,
int j,
int k>
167 return mValues[
static_cast<const DerivedType&
>(*this).template pos<i,j,k>()];
171 template<
int i,
int j,
int k>
174 mValues[
static_cast<const DerivedType&
>(*this).template pos<i,j,k>()] = value;
184 for (
int i = 0; i < SIZE; ++i) sum +=
mValues[i];
192 for (
int i=1; i<SIZE; ++i) {
202 for (
int i=1; i<SIZE; ++i) {
218 const bool less = this->getValue< 0, 0, 0>() < isoValue;
219 return (less ^ (this->getValue<-1, 0, 0>() < isoValue)) ||
220 (less ^ (this->getValue< 1, 0, 0>() < isoValue)) ||
221 (less ^ (this->getValue< 0,-1, 0>() < isoValue)) ||
222 (less ^ (this->getValue< 0, 1, 0>() < isoValue)) ||
223 (less ^ (this->getValue< 0, 0,-1>() < isoValue)) ||
224 (less ^ (this->getValue< 0, 0, 1>() < isoValue)) ;
250 const bool less = this->getValue< 0, 0, 0>() < isoValue;
251 if (less ^ (this->getValue<-1, 0, 0>() < isoValue)) mask.
set(0);
252 if (less ^ (this->getValue< 1, 0, 0>() < isoValue)) mask.
set(1);
253 if (less ^ (this->getValue< 0,-1, 0>() < isoValue)) mask.
set(2);
254 if (less ^ (this->getValue< 0, 1, 0>() < isoValue)) mask.
set(3);
255 if (less ^ (this->getValue< 0, 0,-1>() < isoValue)) mask.
set(4);
256 if (less ^ (this->getValue< 0, 0, 1>() < isoValue)) mask.
set(5);
291 template<
int i,
int j,
int k>
struct BoxPt {};
292 template<>
struct BoxPt< 0, 0, 0> {
enum { idx = 0 }; };
293 template<>
struct BoxPt< 0, 0, 1> {
enum { idx = 1 }; };
294 template<>
struct BoxPt< 0, 1, 1> {
enum { idx = 2 }; };
295 template<>
struct BoxPt< 0, 1, 0> {
enum { idx = 3 }; };
296 template<>
struct BoxPt< 1, 0, 0> {
enum { idx = 4 }; };
297 template<>
struct BoxPt< 1, 0, 1> {
enum { idx = 5 }; };
298 template<>
struct BoxPt< 1, 1, 1> {
enum { idx = 6 }; };
299 template<>
struct BoxPt< 1, 1, 0> {
enum { idx = 7 }; };
303 template<
typename Gr
idT>
313 static constexpr
int SIZE = 8;
318 template<
int i,
int j,
int k>
325 const bool less =
mValues[0] < isoValue;
326 return (less ^ (
mValues[1] < isoValue)) ||
327 (less ^ (
mValues[2] < isoValue)) ||
328 (less ^ (
mValues[3] < isoValue)) ||
329 (less ^ (
mValues[4] < isoValue)) ||
330 (less ^ (
mValues[5] < isoValue)) ||
331 (less ^ (
mValues[6] < isoValue)) ||
332 (less ^ (
mValues[7] < isoValue)) ;
352 ValueType V = BaseType::template getValue<0,0,0>();
353 ValueType A = V + (BaseType::template getValue<0,0,1>() - V) * w;
354 V = BaseType::template getValue< 0, 1, 0>();
355 ValueType B = V + (BaseType::template getValue<0,1,1>() - V) * w;
358 V = BaseType::template getValue<1,0,0>();
359 A = V + (BaseType::template getValue<1,0,1>() - V) * w;
360 V = BaseType::template getValue<1,1,0>();
361 B = V + (BaseType::template getValue<1,1,1>() - V) * w;
364 return C + (D - C) * u;
384 ValueType D[4]={BaseType::template getValue<0,0,1>()-BaseType::template getValue<0,0,0>(),
385 BaseType::template getValue<0,1,1>()-BaseType::template getValue<0,1,0>(),
386 BaseType::template getValue<1,0,1>()-BaseType::template getValue<1,0,0>(),
387 BaseType::template getValue<1,1,1>()-BaseType::template getValue<1,1,0>()};
394 D[0] = BaseType::template getValue<0,0,0>() + D[0] * w;
395 D[1] = BaseType::template getValue<0,1,0>() + D[1] * w;
396 D[2] = BaseType::template getValue<1,0,0>() + D[2] * w;
397 D[3] = BaseType::template getValue<1,1,0>() + D[3] * w;
400 A = D[0] + (D[1] - D[0]) * v;
401 B = D[2] + (D[3] - D[2]) * v;
409 grad[1] = A + (B - A) * u;
411 return BaseType::mGrid->map().applyIJT(grad);
427 using BaseType::mAcc;
428 using BaseType::mValues;
429 using BaseType::mCenter;
437 template<
int i,
int j,
int k>
struct GradPt {};
438 template<>
struct GradPt< 0, 0, 0> {
enum { idx = 0 }; };
439 template<>
struct GradPt< 1, 0, 0> {
enum { idx = 2 }; };
440 template<>
struct GradPt< 0, 1, 0> {
enum { idx = 4 }; };
441 template<>
struct GradPt< 0, 0, 1> {
enum { idx = 6 }; };
442 template<>
struct GradPt<-1, 0, 0> {
enum { idx = 1 }; };
443 template<>
struct GradPt< 0,-1, 0> {
enum { idx = 3 }; };
444 template<>
struct GradPt< 0, 0,-1> {
enum { idx = 5 }; };
453 template<
typename Gr
idT>
463 static constexpr
int SIZE = 7;
467 , mInv2Dx(
ValueType(0.5 / grid.voxelSize()[0]))
468 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
475 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
503 mValues[4] - mValues[3],
504 mValues[6] - mValues[5])*mInv2Dx;
514 V[1]>0 ? mValues[0] - mValues[3] : mValues[4] - mValues[0],
515 V[2]>0 ? mValues[0] - mValues[5] : mValues[6] - mValues[0])*2*mInv2Dx;
544 const Coord& ijk = BaseType::getCenterCoord();
553 template<
int i,
int j,
int k>
571 using BaseType::mAcc;
572 using BaseType::mValues;
581 template<
int i,
int j,
int k>
struct WenoPt {};
582 template<>
struct WenoPt< 0, 0, 0> {
enum { idx = 0 }; };
584 template<>
struct WenoPt<-3, 0, 0> {
enum { idx = 1 }; };
585 template<>
struct WenoPt<-2, 0, 0> {
enum { idx = 2 }; };
586 template<>
struct WenoPt<-1, 0, 0> {
enum { idx = 3 }; };
587 template<>
struct WenoPt< 1, 0, 0> {
enum { idx = 4 }; };
588 template<>
struct WenoPt< 2, 0, 0> {
enum { idx = 5 }; };
589 template<>
struct WenoPt< 3, 0, 0> {
enum { idx = 6 }; };
591 template<>
struct WenoPt< 0,-3, 0> {
enum { idx = 7 }; };
592 template<>
struct WenoPt< 0,-2, 0> {
enum { idx = 8 }; };
593 template<>
struct WenoPt< 0,-1, 0> {
enum { idx = 9 }; };
594 template<>
struct WenoPt< 0, 1, 0> {
enum { idx =10 }; };
595 template<>
struct WenoPt< 0, 2, 0> {
enum { idx =11 }; };
596 template<>
struct WenoPt< 0, 3, 0> {
enum { idx =12 }; };
598 template<>
struct WenoPt< 0, 0,-3> {
enum { idx =13 }; };
599 template<>
struct WenoPt< 0, 0,-2> {
enum { idx =14 }; };
600 template<>
struct WenoPt< 0, 0,-1> {
enum { idx =15 }; };
601 template<>
struct WenoPt< 0, 0, 1> {
enum { idx =16 }; };
602 template<>
struct WenoPt< 0, 0, 2> {
enum { idx =17 }; };
603 template<>
struct WenoPt< 0, 0, 3> {
enum { idx =18 }; };
612 template<
typename Gr
idT,
typename RealT =
typename Gr
idT::ValueType>
622 static constexpr
int SIZE = 19;
627 , mInv2Dx(
ValueType(0.5 / grid.voxelSize()[0]))
649 dP_xm = WENO5<RealT>(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3],v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2),
650 dP_xp = WENO5<RealT>(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0],v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
651 dP_ym = WENO5<RealT>(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9],v[10]-v[ 0],v[11]-v[10],mDx2),
652 dP_yp = WENO5<RealT>(v[12]-v[11],v[11]-v[10],v[10]-v[ 0],v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
653 dP_zm = WENO5<RealT>(v[14]-v[13],v[15]-v[14],v[ 0]-v[15],v[16]-v[ 0],v[17]-v[16],mDx2),
654 dP_zp = WENO5<RealT>(v[18]-v[17],v[17]-v[16],v[16]-v[ 0],v[ 0]-v[15],v[15]-v[14],mDx2);
668 V[0]>0 ? WENO5<RealT>(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3], v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2)
669 : WENO5<RealT>(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0], v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
670 V[1]>0 ? WENO5<RealT>(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9], v[10]-v[ 0],v[11]-v[10],mDx2)
671 : WENO5<RealT>(v[12]-v[11],v[11]-v[10],v[10]-v[ 0], v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
672 V[2]>0 ? WENO5<RealT>(v[14]-v[13],v[15]-v[14],v[ 0]-v[15], v[16]-v[ 0],v[17]-v[16],mDx2)
673 : WENO5<RealT>(v[18]-v[17],v[17]-v[16],v[16]-v[ 0], v[ 0]-v[15],v[15]-v[14],mDx2));
683 mValues[10] - mValues[ 9],
684 mValues[16] - mValues[15]);
705 return (v[ 0]>0 ? (v[ 3]<0 || v[ 4]<0 || v[ 9]<0 || v[10]<0 || v[15]<0 || v[16]<0)
706 : (v[ 3]>0 || v[ 4]>0 || v[ 9]>0 || v[10]>0 || v[15]>0 || v[16]>0));
710 template<
int i,
int j,
int k>
739 using BaseType::mAcc;
740 using BaseType::mValues;
749 template<
int i,
int j,
int k>
struct CurvPt {};
750 template<>
struct CurvPt< 0, 0, 0> {
enum { idx = 0 }; };
752 template<>
struct CurvPt<-1, 0, 0> {
enum { idx = 1 }; };
753 template<>
struct CurvPt< 1, 0, 0> {
enum { idx = 2 }; };
755 template<>
struct CurvPt< 0,-1, 0> {
enum { idx = 3 }; };
756 template<>
struct CurvPt< 0, 1, 0> {
enum { idx = 4 }; };
758 template<>
struct CurvPt< 0, 0,-1> {
enum { idx = 5 }; };
759 template<>
struct CurvPt< 0, 0, 1> {
enum { idx = 6 }; };
761 template<>
struct CurvPt<-1,-1, 0> {
enum { idx = 7 }; };
762 template<>
struct CurvPt< 1,-1, 0> {
enum { idx = 8 }; };
763 template<>
struct CurvPt<-1, 1, 0> {
enum { idx = 9 }; };
764 template<>
struct CurvPt< 1, 1, 0> {
enum { idx =10 }; };
766 template<>
struct CurvPt<-1, 0,-1> {
enum { idx =11 }; };
767 template<>
struct CurvPt< 1, 0,-1> {
enum { idx =12 }; };
768 template<>
struct CurvPt<-1, 0, 1> {
enum { idx =13 }; };
769 template<>
struct CurvPt< 1, 0, 1> {
enum { idx =14 }; };
771 template<>
struct CurvPt< 0,-1,-1> {
enum { idx =15 }; };
772 template<>
struct CurvPt< 0, 1,-1> {
enum { idx =16 }; };
773 template<>
struct CurvPt< 0,-1, 1> {
enum { idx =17 }; };
774 template<>
struct CurvPt< 0, 1, 1> {
enum { idx =18 }; };
778 template<
typename Gr
idT,
typename RealT =
typename Gr
idT::ValueType>
788 static constexpr
int SIZE = 19;
792 , mInv2Dx(
ValueType(0.5 / grid.voxelSize()[0]))
793 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
800 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
810 RealT alpha, normGrad;
821 RealT alpha, normGrad;
822 return this->gaussianCurvature(alpha, normGrad) ?
833 RealT alphaM, alphaG, normGrad;
834 if (this->curvatures(alphaM, alphaG, normGrad)) {
850 RealT alpha, normGrad;
862 RealT alpha, normGrad;
863 return this->gaussianCurvature(alpha, normGrad) ?
874 RealT alphaM, alphaG, normGrad;
875 if (this->curvatures(alphaM, alphaG, normGrad)) {
891 RealT alphaM, alphaG, normGrad;
892 if (this->curvatures(alphaM, alphaG, normGrad)) {
893 const RealT
mean = alphaM*mInv2Dx/
Pow3(normGrad);
894 const RealT tmp =
Sqrt(mean*mean - alphaG*mInvDx2/
Pow4(normGrad));
922 mValues[4] - mValues[3],
923 mValues[6] - mValues[5])*mInv2Dx;
927 template<
int i,
int j,
int k>
971 const RealT Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
972 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
974 alpha = normGrad = 0;
977 const RealT Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz();
978 alpha = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
979 2*(Dx*(Dy*this->Dxy() + Dz*this->Dxz()) + Dy*Dz*this->Dyz());
980 normGrad =
Sqrt(normGrad2);
984 __hostdev__ inline bool gaussianCurvature(RealT& alpha, RealT& normGrad)
const 987 const RealT Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
988 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
990 alpha = normGrad = 0;
993 const RealT Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
994 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
995 alpha = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
996 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
997 normGrad =
Sqrt(normGrad2);
1001 __hostdev__ inline bool curvatures(RealT& alphaM, RealT& alphaG, RealT& normGrad)
const 1004 const RealT Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1005 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1007 alphaM = alphaG =normGrad = 0;
1010 const RealT Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
1011 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
1012 alphaM = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
1013 2*(Dx*(Dy*Dxy + Dz*Dxz) + Dy*Dz*Dyz);
1014 alphaG = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
1015 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
1016 normGrad =
Sqrt(normGrad2);
1021 using BaseType::mAcc;
1022 using BaseType::mValues;
1028 #endif // NANOVDB_STENCILS_HAS_BEEN_INCLUDED __hostdev__ void curvaturesNormGrad(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
Definition: Stencils.h:872
__hostdev__ ValueType meanCurvature() const
Return the mean curvature at the previously buffered location.
Definition: Stencils.h:808
typename GridT::TreeType TreeType
Definition: Stencils.h:619
typename GridT::TreeType TreeType
Definition: Stencils.h:310
__hostdev__ void moveTo(const Vec3< RealType > &xyz)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition: Stencils.h:146
__hostdev__ CurvatureStencil(const GridType &grid)
Definition: Stencils.h:790
__hostdev__ void setValue(const ValueType &value)
Set the value at the specified location relative to the center of the stencil.
Definition: Stencils.h:172
Definition: Stencils.h:779
__hostdev__ bool any() const
Definition: Stencils.h:231
__hostdev__ ValueType max() const
Return the largest value in the stencil buffer.
Definition: Stencils.h:199
__hostdev__ ValueType min() const
Return the smallest value in the stencil buffer.
Definition: Stencils.h:189
__hostdev__ Mask()
Definition: Stencils.h:228
__hostdev__ ValueType laplacian() const
Definition: Stencils.h:520
__hostdev__ Vec3< ValueType > gradient(const Vec3< ValueType > &xyz) const
Return the gradient in world space of the trilinear interpolation kernel.
Definition: Stencils.h:374
GridT GridType
Definition: Stencils.h:309
typename GridT::ValueType ValueType
Definition: Stencils.h:311
__hostdev__ void moveTo(const IterType &iter)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition: Stencils.h:132
__hostdev__ const ValueType & getValue() const
Return the value at the specified location relative to the center of the stencil. ...
Definition: Stencils.h:165
__hostdev__ ValueType laplacian() const
Definition: Stencils.h:905
Coord mCenter
Definition: Stencils.h:280
CoordT RoundDown(const Vec3T< RealT > &xyz)
Definition: NanoVDB.h:1226
GridT GridType
Definition: Stencils.h:784
__hostdev__ bool none() const
Definition: Stencils.h:233
typename GridT::TreeType TreeType
Definition: Stencils.h:101
__hostdev__ Mask intersectionMask(ValueType isoValue=ValueType(0)) const
Return true a bit-mask where the 6 lower bits indicates if the center of the stencil intersects the i...
Definition: Stencils.h:247
__hostdev__ WenoStencil(const GridType &grid, double dx)
Definition: Stencils.h:632
void set(uint32_t n, bool on)
Set the specified bit on or off.
Definition: NanoVDB.h:3026
Type Max(Type a, Type b)
Definition: NanoVDB.h:1110
__hostdev__ ValueType meanCurvatureNormGrad() const
Definition: Stencils.h:848
Type Min(Type a, Type b)
Definition: NanoVDB.h:1089
__hostdev__ ValueType WENO5(const ValueType &v1, const ValueType &v2, const ValueType &v3, const ValueType &v4, const ValueType &v5, RealT scale2=1.0)
Implementation of nominally fifth-order finite-difference WENO.
Definition: Stencils.h:35
typename GridT::ValueType ValueType
Definition: Stencils.h:786
This is a special 19-point stencil that supports optimal fifth-order WENO upwinding, second-order central differencing, Laplacian, and zero-crossing test.
Definition: Stencils.h:613
__hostdev__ void moveTo(const Coord &ijk, const ValueType ¢erValue)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors. The method also takes a value of the center element of the stencil, assuming it is already known.
Definition: Stencils.h:119
__hostdev__ ValueType gaussianCurvatureNormGrad() const
Definition: Stencils.h:860
__hostdev__ bool intersects(ValueType isoValue=ValueType(0)) const
Return true if the center of the stencil intersects the.
Definition: Stencils.h:323
Definition: Stencils.h:454
Implements a light-weight self-contained VDB data-structure in a single file! In other words...
typename GridT::ValueType ValueType
Definition: Stencils.h:461
Definition: NanoVDB.h:247
Bit-mask to encode active states and facilitate sequential iterators and a fast codec for I/O compres...
Definition: NanoVDB.h:2824
__hostdev__ const GridType & grid() const
Return a const reference to the grid from which this stencil was constructed.
Definition: Stencils.h:262
typename GridT::AccessorType AccessorType
Definition: Stencils.h:102
T Pow4(T x)
Definition: NanoVDB.h:1180
Definition: Stencils.h:304
A simple vector class with three components, similar to openvdb::math::Vec3.
Definition: NanoVDB.h:1298
GridT GridType
Definition: Stencils.h:459
AccessorType mAcc
Definition: Stencils.h:278
__hostdev__ bool test(int i) const
Definition: Stencils.h:230
__hostdev__ ValueType interpolation(const Vec3< ValueType > &xyz) const
Return the trilinear interpolation at the normalized position.
Definition: Stencils.h:342
__hostdev__ ValueType mean() const
Return the mean value of the current stencil.
Definition: Stencils.h:181
__hostdev__ GradStencil(const GridType &grid, double dx)
Definition: Stencils.h:472
__hostdev__ BoxStencil(const GridType &grid)
Definition: Stencils.h:315
__hostdev__ Vec3< ValueType > gradient(const Vec3< ValueType > &V) const
Return the first-order upwind gradient corresponding to the direction V.
Definition: Stencils.h:510
__hostdev__ const ValueType & getCenterValue() const
Return the value at the center of the stencil.
Definition: Stencils.h:212
__hostdev__ ValueType normSqGrad() const
Return the norm square of the single-sided upwind gradient (computed via Godunov's scheme) at the pre...
Definition: Stencils.h:484
typename GridT::TreeType TreeType
Definition: Stencils.h:785
__hostdev__ bool zeroCrossing() const
Definition: Stencils.h:529
__hostdev__ Vec3< ValueType > cpt()
Compute the closest-point transform to a level set.
Definition: Stencils.h:542
uint32_t CountOn(uint64_t v)
Definition: NanoVDB.h:2662
Definition: Stencils.h:226
__hostdev__ WenoStencil(const GridType &grid)
Definition: Stencils.h:624
__hostdev__ ValueType gaussianCurvature() const
Return the Gaussian curvature at the previously buffered location.
Definition: Stencils.h:819
typename GridT::ValueType ValueType
Definition: Stencils.h:620
__hostdev__ const ValueType & getValue(unsigned int pos=0) const
Return the value from the stencil buffer with linear offset pos.
Definition: Stencils.h:157
__hostdev__ unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition: Stencils.h:711
Coord offsetBy(ValueType dx, ValueType dy, ValueType dz) const
Definition: NanoVDB.h:1482
__hostdev__ BaseStencil(const GridType &grid)
Definition: Stencils.h:270
__hostdev__ ValueType laplacian() const
Definition: Stencils.h:692
typename GridT::TreeType TreeType
Definition: Stencils.h:460
__hostdev__ Vec3< ValueType > gradient() const
Definition: Stencils.h:680
static __hostdev__ int size()
Return the size of the stencil buffer.
Definition: Stencils.h:178
#define NANOVDB_ASSERT(x)
Definition: NanoVDB.h:190
__hostdev__ CurvatureStencil(const GridType &grid, double dx)
Definition: Stencils.h:797
__hostdev__ GradStencil(const GridType &grid)
Definition: Stencils.h:465
GridType
List of types that are currently supported by NanoVDB.
Definition: NanoVDB.h:317
__hostdev__ Vec3< ValueType > gradient() const
Definition: Stencils.h:918
__hostdev__ bool all() const
Definition: Stencils.h:232
__hostdev__ void principalCurvatures(ValueType &min, ValueType &max) const
Computes the minimum and maximum principal curvature at the previously buffered location.
Definition: Stencils.h:888
__hostdev__ const AccessorType & accessor() const
Return a const reference to the ValueAccessor associated with this Stencil.
Definition: Stencils.h:266
float Sqrt(float x)
Return the square root of a floating-point value.
Definition: NanoVDB.h:1233
__hostdev__ Vec3< ValueType > gradient(const Vec3< ValueType > &V) const
Definition: Stencils.h:664
const GridType * mGrid
Definition: Stencils.h:277
__hostdev__ const Coord & getCenterCoord() const
Return the coordinates of the center point of the stencil.
Definition: Stencils.h:209
Definition: Stencils.h:96
__hostdev__ unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition: Stencils.h:554
ValueType mValues[SIZE]
Definition: Stencils.h:279
__hostdev__ RealT GodunovsNormSqrd(bool isOutside, RealT dP_xm, RealT dP_xp, RealT dP_ym, RealT dP_yp, RealT dP_zm, RealT dP_zp)
Definition: Stencils.h:62
__hostdev__ void curvatures(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
Definition: Stencils.h:831
Tolerance for floating-point comparison.
Definition: NanoVDB.h:1019
T Pow2(T x)
Definition: NanoVDB.h:1168
typename GridT::ValueType ValueType
Definition: Stencils.h:99
#define __hostdev__
Definition: NanoVDB.h:213
__hostdev__ ValueType normSqGrad(ValueType isoValue=ValueType(0)) const
Return the norm-square of the WENO upwind gradient (computed via WENO upwinding and Godunov's scheme)...
Definition: Stencils.h:645
__hostdev__ unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition: Stencils.h:928
T Pow3(T x)
Definition: NanoVDB.h:1174
Signed (i, j, k) 32-bit integer coordinate class, similar to openvdb::math::Coord.
Definition: NanoVDB.h:1301
__hostdev__ bool intersects(const ValueType &isoValue=ValueType(0)) const
Return true if the center of the stencil intersects the iso-contour specified by the isoValue...
Definition: Stencils.h:216
GridT GridType
Definition: Stencils.h:618
__hostdev__ int count() const
Definition: Stencils.h:234
__hostdev__ unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition: Stencils.h:319
__hostdev__ void moveTo(const Coord &ijk)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors.
Definition: Stencils.h:107
__hostdev__ Vec3< ValueType > gradient() const
Return the gradient computed at the previously buffered location by second order central differencing...
Definition: Stencils.h:500
__hostdev__ bool zeroCrossing() const
Definition: Stencils.h:702
uint8_t bits
Definition: Stencils.h:227