13#ifndef OPENVDB_MATH_STENCILS_HAS_BEEN_INCLUDED
14#define OPENVDB_MATH_STENCILS_HAS_BEEN_INCLUDED
34template<
typename DerivedType,
typename Gr
idT,
bool IsSafe>
51 static_cast<DerivedType&
>(*this).init(
mCenter);
63 static_cast<DerivedType&
>(*this).init(
mCenter);
71 template<
typename IterType>
72 inline void moveTo(
const IterType& iter)
76 static_cast<DerivedType&
>(*this).init(
mCenter);
85 template<
typename RealType>
104 template<
int i,
int j,
int k>
107 return mValues[
static_cast<const DerivedType&
>(*this).template pos<i,j,k>()];
111 template<
int i,
int j,
int k>
114 mValues[
static_cast<const DerivedType&
>(*this).template pos<i,j,k>()] = value;
125 size_t midpoint = (tmp.size() - 1) >> 1;
127 std::nth_element(tmp.begin(), tmp.begin() + midpoint, tmp.end(),
128 [](
const auto& a,
const auto& b) {
129 return math::cwiseLessThan(a, b);
131 return tmp[midpoint];
138 for (
int n = 0, s =
int(
mValues.size()); n < s; ++n) sum +=
mValues[n];
145 const auto iter = std::min_element(
mValues.begin(),
mValues.end());
152 const auto iter = std::max_element(
mValues.begin(),
mValues.end());
189 mask[0] = less ^ (this->
getValue<-1, 0, 0>() < isoValue);
191 mask[2] = less ^ (this->getValue< 0,-1, 0>() < isoValue);
193 mask[4] = less ^ (this->getValue< 0, 0,-1>() < isoValue);
230 template<
int i,
int j,
int k>
struct SevenPt {};
231 template<>
struct SevenPt< 0, 0, 0> {
enum { idx = 0 }; };
232 template<>
struct SevenPt< 1, 0, 0> {
enum { idx = 1 }; };
233 template<>
struct SevenPt< 0, 1, 0> {
enum { idx = 2 }; };
234 template<>
struct SevenPt< 0, 0, 1> {
enum { idx = 3 }; };
235 template<>
struct SevenPt<-1, 0, 0> {
enum { idx = 4 }; };
236 template<>
struct SevenPt< 0,-1, 0> {
enum { idx = 5 }; };
237 template<>
struct SevenPt< 0, 0,-1> {
enum { idx = 6 }; };
242template<
typename Gr
idT,
bool IsSafe = true>
257 template<
int i,
int j,
int k>
258 unsigned int pos()
const {
return SevenPt<i,j,k>::idx; }
261 inline void init(
const Coord& ijk)
263 BaseType::template setValue<-1, 0, 0>(mAcc.getValue(ijk.
offsetBy(-1, 0, 0)));
264 BaseType::template setValue< 1, 0, 0>(mAcc.getValue(ijk.
offsetBy( 1, 0, 0)));
266 BaseType::template setValue< 0,-1, 0>(mAcc.getValue(ijk.
offsetBy( 0,-1, 0)));
267 BaseType::template setValue< 0, 1, 0>(mAcc.getValue(ijk.
offsetBy( 0, 1, 0)));
269 BaseType::template setValue< 0, 0,-1>(mAcc.getValue(ijk.
offsetBy( 0, 0,-1)));
270 BaseType::template setValue< 0, 0, 1>(mAcc.getValue(ijk.
offsetBy( 0, 0, 1)));
285 template<
int i,
int j,
int k>
struct BoxPt {};
286 template<>
struct BoxPt< 0, 0, 0> {
enum { idx = 0 }; };
287 template<>
struct BoxPt< 0, 0, 1> {
enum { idx = 1 }; };
288 template<>
struct BoxPt< 0, 1, 1> {
enum { idx = 2 }; };
289 template<>
struct BoxPt< 0, 1, 0> {
enum { idx = 3 }; };
290 template<>
struct BoxPt< 1, 0, 0> {
enum { idx = 4 }; };
291 template<>
struct BoxPt< 1, 0, 1> {
enum { idx = 5 }; };
292 template<>
struct BoxPt< 1, 1, 1> {
enum { idx = 6 }; };
293 template<>
struct BoxPt< 1, 1, 0> {
enum { idx = 7 }; };
296template<
typename Gr
idT,
bool IsSafe = true>
311 template<
int i,
int j,
int k>
312 unsigned int pos()
const {
return BoxPt<i,j,k>::idx; }
318 const bool less = mValues[0] < isoValue;
319 return (less ^ (mValues[1] < isoValue)) ||
320 (less ^ (mValues[2] < isoValue)) ||
321 (less ^ (mValues[3] < isoValue)) ||
322 (less ^ (mValues[4] < isoValue)) ||
323 (less ^ (mValues[5] < isoValue)) ||
324 (less ^ (mValues[6] < isoValue)) ||
325 (less ^ (mValues[7] < isoValue)) ;
359 return static_cast<ValueType>(C + (D - C) * u);
391 static_cast<ValueType>(A + (B - A) * u));
399 A =
static_cast<ValueType>(D[0] + (D[1] - D[0]) * v);
400 B =
static_cast<ValueType>(D[2] + (D[3] - D[2]) * v);
408 grad[1] =
static_cast<ValueType>(A + (B - A) * u);
414 inline void init(
const Coord& ijk)
416 BaseType::template setValue< 0, 0, 1>(mAcc.getValue(ijk.
offsetBy( 0, 0, 1)));
417 BaseType::template setValue< 0, 1, 1>(mAcc.getValue(ijk.
offsetBy( 0, 1, 1)));
418 BaseType::template setValue< 0, 1, 0>(mAcc.getValue(ijk.
offsetBy( 0, 1, 0)));
419 BaseType::template setValue< 1, 0, 0>(mAcc.getValue(ijk.
offsetBy( 1, 0, 0)));
420 BaseType::template setValue< 1, 0, 1>(mAcc.getValue(ijk.
offsetBy( 1, 0, 1)));
421 BaseType::template setValue< 1, 1, 1>(mAcc.getValue(ijk.
offsetBy( 1, 1, 1)));
422 BaseType::template setValue< 1, 1, 0>(mAcc.getValue(ijk.
offsetBy( 1, 1, 0)));
437 template<
int i,
int j,
int k>
struct DensePt {};
438 template<>
struct DensePt< 0, 0, 0> {
enum { idx = 0 }; };
440 template<>
struct DensePt< 1, 0, 0> {
enum { idx = 1 }; };
441 template<>
struct DensePt< 0, 1, 0> {
enum { idx = 2 }; };
442 template<>
struct DensePt< 0, 0, 1> {
enum { idx = 3 }; };
444 template<>
struct DensePt<-1, 0, 0> {
enum { idx = 4 }; };
445 template<>
struct DensePt< 0,-1, 0> {
enum { idx = 5 }; };
446 template<>
struct DensePt< 0, 0,-1> {
enum { idx = 6 }; };
448 template<>
struct DensePt<-1,-1, 0> {
enum { idx = 7 }; };
449 template<>
struct DensePt< 0,-1,-1> {
enum { idx = 8 }; };
450 template<>
struct DensePt<-1, 0,-1> {
enum { idx = 9 }; };
452 template<>
struct DensePt< 1,-1, 0> {
enum { idx = 10 }; };
453 template<>
struct DensePt< 0, 1,-1> {
enum { idx = 11 }; };
454 template<>
struct DensePt<-1, 0, 1> {
enum { idx = 12 }; };
456 template<>
struct DensePt<-1, 1, 0> {
enum { idx = 13 }; };
457 template<>
struct DensePt< 0,-1, 1> {
enum { idx = 14 }; };
458 template<>
struct DensePt< 1, 0,-1> {
enum { idx = 15 }; };
460 template<>
struct DensePt< 1, 1, 0> {
enum { idx = 16 }; };
461 template<>
struct DensePt< 0, 1, 1> {
enum { idx = 17 }; };
462 template<>
struct DensePt< 1, 0, 1> {
enum { idx = 18 }; };
466template<
typename Gr
idT,
bool IsSafe = true>
468 :
public BaseStencil<SecondOrderDenseStencil<GridT, IsSafe>, GridT, IsSafe >
482 template<
int i,
int j,
int k>
483 unsigned int pos()
const {
return DensePt<i,j,k>::idx; }
486 inline void init(
const Coord& ijk)
488 mValues[DensePt< 1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
489 mValues[DensePt< 0, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
490 mValues[DensePt< 0, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
492 mValues[DensePt<-1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
493 mValues[DensePt< 0,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
494 mValues[DensePt< 0, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
496 mValues[DensePt<-1,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, -1, 0));
497 mValues[DensePt< 1,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, -1, 0));
498 mValues[DensePt<-1, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 1, 0));
499 mValues[DensePt< 1, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 1, 0));
501 mValues[DensePt<-1, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, -1));
502 mValues[DensePt< 1, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, -1));
503 mValues[DensePt<-1, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 1));
504 mValues[DensePt< 1, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 1));
506 mValues[DensePt< 0,-1,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -1, -1));
507 mValues[DensePt< 0, 1,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, -1));
508 mValues[DensePt< 0,-1, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -1, 1));
509 mValues[DensePt< 0, 1, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 1));
524 template<
int i,
int j,
int k>
struct ThirteenPt {};
525 template<>
struct ThirteenPt< 0, 0, 0> {
enum { idx = 0 }; };
527 template<>
struct ThirteenPt< 1, 0, 0> {
enum { idx = 1 }; };
528 template<>
struct ThirteenPt< 0, 1, 0> {
enum { idx = 2 }; };
529 template<>
struct ThirteenPt< 0, 0, 1> {
enum { idx = 3 }; };
531 template<>
struct ThirteenPt<-1, 0, 0> {
enum { idx = 4 }; };
532 template<>
struct ThirteenPt< 0,-1, 0> {
enum { idx = 5 }; };
533 template<>
struct ThirteenPt< 0, 0,-1> {
enum { idx = 6 }; };
535 template<>
struct ThirteenPt< 2, 0, 0> {
enum { idx = 7 }; };
536 template<>
struct ThirteenPt< 0, 2, 0> {
enum { idx = 8 }; };
537 template<>
struct ThirteenPt< 0, 0, 2> {
enum { idx = 9 }; };
539 template<>
struct ThirteenPt<-2, 0, 0> {
enum { idx = 10 }; };
540 template<>
struct ThirteenPt< 0,-2, 0> {
enum { idx = 11 }; };
541 template<>
struct ThirteenPt< 0, 0,-2> {
enum { idx = 12 }; };
546template<
typename Gr
idT,
bool IsSafe = true>
548 :
public BaseStencil<ThirteenPointStencil<GridT, IsSafe>, GridT, IsSafe>
562 template<
int i,
int j,
int k>
563 unsigned int pos()
const {
return ThirteenPt<i,j,k>::idx; }
566 inline void init(
const Coord& ijk)
568 mValues[ThirteenPt< 2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 0));
569 mValues[ThirteenPt< 1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
570 mValues[ThirteenPt<-1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
571 mValues[ThirteenPt<-2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 0));
573 mValues[ThirteenPt< 0, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 0));
574 mValues[ThirteenPt< 0, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
575 mValues[ThirteenPt< 0,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
576 mValues[ThirteenPt< 0,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -2, 0));
578 mValues[ThirteenPt< 0, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 2));
579 mValues[ThirteenPt< 0, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
580 mValues[ThirteenPt< 0, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
581 mValues[ThirteenPt< 0, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, -2));
596 template<
int i,
int j,
int k>
struct FourthDensePt {};
597 template<>
struct FourthDensePt< 0, 0, 0> {
enum { idx = 0 }; };
599 template<>
struct FourthDensePt<-2, 2, 0> {
enum { idx = 1 }; };
600 template<>
struct FourthDensePt<-1, 2, 0> {
enum { idx = 2 }; };
601 template<>
struct FourthDensePt< 0, 2, 0> {
enum { idx = 3 }; };
602 template<>
struct FourthDensePt< 1, 2, 0> {
enum { idx = 4 }; };
603 template<>
struct FourthDensePt< 2, 2, 0> {
enum { idx = 5 }; };
605 template<>
struct FourthDensePt<-2, 1, 0> {
enum { idx = 6 }; };
606 template<>
struct FourthDensePt<-1, 1, 0> {
enum { idx = 7 }; };
607 template<>
struct FourthDensePt< 0, 1, 0> {
enum { idx = 8 }; };
608 template<>
struct FourthDensePt< 1, 1, 0> {
enum { idx = 9 }; };
609 template<>
struct FourthDensePt< 2, 1, 0> {
enum { idx = 10 }; };
611 template<>
struct FourthDensePt<-2, 0, 0> {
enum { idx = 11 }; };
612 template<>
struct FourthDensePt<-1, 0, 0> {
enum { idx = 12 }; };
613 template<>
struct FourthDensePt< 1, 0, 0> {
enum { idx = 13 }; };
614 template<>
struct FourthDensePt< 2, 0, 0> {
enum { idx = 14 }; };
616 template<>
struct FourthDensePt<-2,-1, 0> {
enum { idx = 15 }; };
617 template<>
struct FourthDensePt<-1,-1, 0> {
enum { idx = 16 }; };
618 template<>
struct FourthDensePt< 0,-1, 0> {
enum { idx = 17 }; };
619 template<>
struct FourthDensePt< 1,-1, 0> {
enum { idx = 18 }; };
620 template<>
struct FourthDensePt< 2,-1, 0> {
enum { idx = 19 }; };
622 template<>
struct FourthDensePt<-2,-2, 0> {
enum { idx = 20 }; };
623 template<>
struct FourthDensePt<-1,-2, 0> {
enum { idx = 21 }; };
624 template<>
struct FourthDensePt< 0,-2, 0> {
enum { idx = 22 }; };
625 template<>
struct FourthDensePt< 1,-2, 0> {
enum { idx = 23 }; };
626 template<>
struct FourthDensePt< 2,-2, 0> {
enum { idx = 24 }; };
629 template<>
struct FourthDensePt<-2, 0, 2> {
enum { idx = 25 }; };
630 template<>
struct FourthDensePt<-1, 0, 2> {
enum { idx = 26 }; };
631 template<>
struct FourthDensePt< 0, 0, 2> {
enum { idx = 27 }; };
632 template<>
struct FourthDensePt< 1, 0, 2> {
enum { idx = 28 }; };
633 template<>
struct FourthDensePt< 2, 0, 2> {
enum { idx = 29 }; };
635 template<>
struct FourthDensePt<-2, 0, 1> {
enum { idx = 30 }; };
636 template<>
struct FourthDensePt<-1, 0, 1> {
enum { idx = 31 }; };
637 template<>
struct FourthDensePt< 0, 0, 1> {
enum { idx = 32 }; };
638 template<>
struct FourthDensePt< 1, 0, 1> {
enum { idx = 33 }; };
639 template<>
struct FourthDensePt< 2, 0, 1> {
enum { idx = 34 }; };
641 template<>
struct FourthDensePt<-2, 0,-1> {
enum { idx = 35 }; };
642 template<>
struct FourthDensePt<-1, 0,-1> {
enum { idx = 36 }; };
643 template<>
struct FourthDensePt< 0, 0,-1> {
enum { idx = 37 }; };
644 template<>
struct FourthDensePt< 1, 0,-1> {
enum { idx = 38 }; };
645 template<>
struct FourthDensePt< 2, 0,-1> {
enum { idx = 39 }; };
647 template<>
struct FourthDensePt<-2, 0,-2> {
enum { idx = 40 }; };
648 template<>
struct FourthDensePt<-1, 0,-2> {
enum { idx = 41 }; };
649 template<>
struct FourthDensePt< 0, 0,-2> {
enum { idx = 42 }; };
650 template<>
struct FourthDensePt< 1, 0,-2> {
enum { idx = 43 }; };
651 template<>
struct FourthDensePt< 2, 0,-2> {
enum { idx = 44 }; };
654 template<>
struct FourthDensePt< 0,-2, 2> {
enum { idx = 45 }; };
655 template<>
struct FourthDensePt< 0,-1, 2> {
enum { idx = 46 }; };
656 template<>
struct FourthDensePt< 0, 1, 2> {
enum { idx = 47 }; };
657 template<>
struct FourthDensePt< 0, 2, 2> {
enum { idx = 48 }; };
659 template<>
struct FourthDensePt< 0,-2, 1> {
enum { idx = 49 }; };
660 template<>
struct FourthDensePt< 0,-1, 1> {
enum { idx = 50 }; };
661 template<>
struct FourthDensePt< 0, 1, 1> {
enum { idx = 51 }; };
662 template<>
struct FourthDensePt< 0, 2, 1> {
enum { idx = 52 }; };
664 template<>
struct FourthDensePt< 0,-2,-1> {
enum { idx = 53 }; };
665 template<>
struct FourthDensePt< 0,-1,-1> {
enum { idx = 54 }; };
666 template<>
struct FourthDensePt< 0, 1,-1> {
enum { idx = 55 }; };
667 template<>
struct FourthDensePt< 0, 2,-1> {
enum { idx = 56 }; };
669 template<>
struct FourthDensePt< 0,-2,-2> {
enum { idx = 57 }; };
670 template<>
struct FourthDensePt< 0,-1,-2> {
enum { idx = 58 }; };
671 template<>
struct FourthDensePt< 0, 1,-2> {
enum { idx = 59 }; };
672 template<>
struct FourthDensePt< 0, 2,-2> {
enum { idx = 60 }; };
677template<
typename Gr
idT,
bool IsSafe = true>
679 :
public BaseStencil<FourthOrderDenseStencil<GridT, IsSafe>, GridT, IsSafe>
693 template<
int i,
int j,
int k>
694 unsigned int pos()
const {
return FourthDensePt<i,j,k>::idx; }
697 inline void init(
const Coord& ijk)
699 mValues[FourthDensePt<-2, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 2, 0));
700 mValues[FourthDensePt<-1, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 2, 0));
701 mValues[FourthDensePt< 0, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 0));
702 mValues[FourthDensePt< 1, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 2, 0));
703 mValues[FourthDensePt< 2, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 2, 0));
705 mValues[FourthDensePt<-2, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 1, 0));
706 mValues[FourthDensePt<-1, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 1, 0));
707 mValues[FourthDensePt< 0, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
708 mValues[FourthDensePt< 1, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 1, 0));
709 mValues[FourthDensePt< 2, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 1, 0));
711 mValues[FourthDensePt<-2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 0));
712 mValues[FourthDensePt<-1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
713 mValues[FourthDensePt< 1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
714 mValues[FourthDensePt< 2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 0));
716 mValues[FourthDensePt<-2,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2,-1, 0));
717 mValues[FourthDensePt<-1,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1,-1, 0));
718 mValues[FourthDensePt< 0,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 0));
719 mValues[FourthDensePt< 1,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1,-1, 0));
720 mValues[FourthDensePt< 2,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2,-1, 0));
722 mValues[FourthDensePt<-2,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2,-2, 0));
723 mValues[FourthDensePt<-1,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1,-2, 0));
724 mValues[FourthDensePt< 0,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 0));
725 mValues[FourthDensePt< 1,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1,-2, 0));
726 mValues[FourthDensePt< 2,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2,-2, 0));
728 mValues[FourthDensePt<-2, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 2));
729 mValues[FourthDensePt<-1, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 2));
730 mValues[FourthDensePt< 0, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 2));
731 mValues[FourthDensePt< 1, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 2));
732 mValues[FourthDensePt< 2, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 2));
734 mValues[FourthDensePt<-2, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 1));
735 mValues[FourthDensePt<-1, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 1));
736 mValues[FourthDensePt< 0, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
737 mValues[FourthDensePt< 1, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 1));
738 mValues[FourthDensePt< 2, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 1));
740 mValues[FourthDensePt<-2, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0,-1));
741 mValues[FourthDensePt<-1, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0,-1));
742 mValues[FourthDensePt< 0, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0,-1));
743 mValues[FourthDensePt< 1, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0,-1));
744 mValues[FourthDensePt< 2, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0,-1));
746 mValues[FourthDensePt<-2, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0,-2));
747 mValues[FourthDensePt<-1, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0,-2));
748 mValues[FourthDensePt< 0, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0,-2));
749 mValues[FourthDensePt< 1, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0,-2));
750 mValues[FourthDensePt< 2, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0,-2));
753 mValues[FourthDensePt< 0,-2, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 2));
754 mValues[FourthDensePt< 0,-1, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 2));
755 mValues[FourthDensePt< 0, 1, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 2));
756 mValues[FourthDensePt< 0, 2, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 2));
758 mValues[FourthDensePt< 0,-2, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 1));
759 mValues[FourthDensePt< 0,-1, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 1));
760 mValues[FourthDensePt< 0, 1, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 1));
761 mValues[FourthDensePt< 0, 2, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 1));
763 mValues[FourthDensePt< 0,-2,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2,-1));
764 mValues[FourthDensePt< 0,-1,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1,-1));
765 mValues[FourthDensePt< 0, 1,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1,-1));
766 mValues[FourthDensePt< 0, 2,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2,-1));
768 mValues[FourthDensePt< 0,-2,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2,-2));
769 mValues[FourthDensePt< 0,-1,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1,-2));
770 mValues[FourthDensePt< 0, 1,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1,-2));
771 mValues[FourthDensePt< 0, 2,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2,-2));
786 template<
int i,
int j,
int k>
struct NineteenPt {};
787 template<>
struct NineteenPt< 0, 0, 0> {
enum { idx = 0 }; };
789 template<>
struct NineteenPt< 1, 0, 0> {
enum { idx = 1 }; };
790 template<>
struct NineteenPt< 0, 1, 0> {
enum { idx = 2 }; };
791 template<>
struct NineteenPt< 0, 0, 1> {
enum { idx = 3 }; };
793 template<>
struct NineteenPt<-1, 0, 0> {
enum { idx = 4 }; };
794 template<>
struct NineteenPt< 0,-1, 0> {
enum { idx = 5 }; };
795 template<>
struct NineteenPt< 0, 0,-1> {
enum { idx = 6 }; };
797 template<>
struct NineteenPt< 2, 0, 0> {
enum { idx = 7 }; };
798 template<>
struct NineteenPt< 0, 2, 0> {
enum { idx = 8 }; };
799 template<>
struct NineteenPt< 0, 0, 2> {
enum { idx = 9 }; };
801 template<>
struct NineteenPt<-2, 0, 0> {
enum { idx = 10 }; };
802 template<>
struct NineteenPt< 0,-2, 0> {
enum { idx = 11 }; };
803 template<>
struct NineteenPt< 0, 0,-2> {
enum { idx = 12 }; };
805 template<>
struct NineteenPt< 3, 0, 0> {
enum { idx = 13 }; };
806 template<>
struct NineteenPt< 0, 3, 0> {
enum { idx = 14 }; };
807 template<>
struct NineteenPt< 0, 0, 3> {
enum { idx = 15 }; };
809 template<>
struct NineteenPt<-3, 0, 0> {
enum { idx = 16 }; };
810 template<>
struct NineteenPt< 0,-3, 0> {
enum { idx = 17 }; };
811 template<>
struct NineteenPt< 0, 0,-3> {
enum { idx = 18 }; };
816template<
typename Gr
idT,
bool IsSafe = true>
818 :
public BaseStencil<NineteenPointStencil<GridT, IsSafe>, GridT, IsSafe>
832 template<
int i,
int j,
int k>
833 unsigned int pos()
const {
return NineteenPt<i,j,k>::idx; }
836 inline void init(
const Coord& ijk)
838 mValues[NineteenPt< 3, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0, 0));
839 mValues[NineteenPt< 2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 0));
840 mValues[NineteenPt< 1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
841 mValues[NineteenPt<-1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
842 mValues[NineteenPt<-2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 0));
843 mValues[NineteenPt<-3, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0, 0));
845 mValues[NineteenPt< 0, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3, 0));
846 mValues[NineteenPt< 0, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 0));
847 mValues[NineteenPt< 0, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
848 mValues[NineteenPt< 0,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
849 mValues[NineteenPt< 0,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -2, 0));
850 mValues[NineteenPt< 0,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, -3, 0));
852 mValues[NineteenPt< 0, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 3));
853 mValues[NineteenPt< 0, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 2));
854 mValues[NineteenPt< 0, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
855 mValues[NineteenPt< 0, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
856 mValues[NineteenPt< 0, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, -2));
857 mValues[NineteenPt< 0, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, -3));
872 template<
int i,
int j,
int k>
struct SixthDensePt { };
873 template<>
struct SixthDensePt< 0, 0, 0> {
enum { idx = 0 }; };
875 template<>
struct SixthDensePt<-3, 3, 0> {
enum { idx = 1 }; };
876 template<>
struct SixthDensePt<-2, 3, 0> {
enum { idx = 2 }; };
877 template<>
struct SixthDensePt<-1, 3, 0> {
enum { idx = 3 }; };
878 template<>
struct SixthDensePt< 0, 3, 0> {
enum { idx = 4 }; };
879 template<>
struct SixthDensePt< 1, 3, 0> {
enum { idx = 5 }; };
880 template<>
struct SixthDensePt< 2, 3, 0> {
enum { idx = 6 }; };
881 template<>
struct SixthDensePt< 3, 3, 0> {
enum { idx = 7 }; };
883 template<>
struct SixthDensePt<-3, 2, 0> {
enum { idx = 8 }; };
884 template<>
struct SixthDensePt<-2, 2, 0> {
enum { idx = 9 }; };
885 template<>
struct SixthDensePt<-1, 2, 0> {
enum { idx = 10 }; };
886 template<>
struct SixthDensePt< 0, 2, 0> {
enum { idx = 11 }; };
887 template<>
struct SixthDensePt< 1, 2, 0> {
enum { idx = 12 }; };
888 template<>
struct SixthDensePt< 2, 2, 0> {
enum { idx = 13 }; };
889 template<>
struct SixthDensePt< 3, 2, 0> {
enum { idx = 14 }; };
891 template<>
struct SixthDensePt<-3, 1, 0> {
enum { idx = 15 }; };
892 template<>
struct SixthDensePt<-2, 1, 0> {
enum { idx = 16 }; };
893 template<>
struct SixthDensePt<-1, 1, 0> {
enum { idx = 17 }; };
894 template<>
struct SixthDensePt< 0, 1, 0> {
enum { idx = 18 }; };
895 template<>
struct SixthDensePt< 1, 1, 0> {
enum { idx = 19 }; };
896 template<>
struct SixthDensePt< 2, 1, 0> {
enum { idx = 20 }; };
897 template<>
struct SixthDensePt< 3, 1, 0> {
enum { idx = 21 }; };
899 template<>
struct SixthDensePt<-3, 0, 0> {
enum { idx = 22 }; };
900 template<>
struct SixthDensePt<-2, 0, 0> {
enum { idx = 23 }; };
901 template<>
struct SixthDensePt<-1, 0, 0> {
enum { idx = 24 }; };
902 template<>
struct SixthDensePt< 1, 0, 0> {
enum { idx = 25 }; };
903 template<>
struct SixthDensePt< 2, 0, 0> {
enum { idx = 26 }; };
904 template<>
struct SixthDensePt< 3, 0, 0> {
enum { idx = 27 }; };
907 template<>
struct SixthDensePt<-3,-1, 0> {
enum { idx = 28 }; };
908 template<>
struct SixthDensePt<-2,-1, 0> {
enum { idx = 29 }; };
909 template<>
struct SixthDensePt<-1,-1, 0> {
enum { idx = 30 }; };
910 template<>
struct SixthDensePt< 0,-1, 0> {
enum { idx = 31 }; };
911 template<>
struct SixthDensePt< 1,-1, 0> {
enum { idx = 32 }; };
912 template<>
struct SixthDensePt< 2,-1, 0> {
enum { idx = 33 }; };
913 template<>
struct SixthDensePt< 3,-1, 0> {
enum { idx = 34 }; };
916 template<>
struct SixthDensePt<-3,-2, 0> {
enum { idx = 35 }; };
917 template<>
struct SixthDensePt<-2,-2, 0> {
enum { idx = 36 }; };
918 template<>
struct SixthDensePt<-1,-2, 0> {
enum { idx = 37 }; };
919 template<>
struct SixthDensePt< 0,-2, 0> {
enum { idx = 38 }; };
920 template<>
struct SixthDensePt< 1,-2, 0> {
enum { idx = 39 }; };
921 template<>
struct SixthDensePt< 2,-2, 0> {
enum { idx = 40 }; };
922 template<>
struct SixthDensePt< 3,-2, 0> {
enum { idx = 41 }; };
925 template<>
struct SixthDensePt<-3,-3, 0> {
enum { idx = 42 }; };
926 template<>
struct SixthDensePt<-2,-3, 0> {
enum { idx = 43 }; };
927 template<>
struct SixthDensePt<-1,-3, 0> {
enum { idx = 44 }; };
928 template<>
struct SixthDensePt< 0,-3, 0> {
enum { idx = 45 }; };
929 template<>
struct SixthDensePt< 1,-3, 0> {
enum { idx = 46 }; };
930 template<>
struct SixthDensePt< 2,-3, 0> {
enum { idx = 47 }; };
931 template<>
struct SixthDensePt< 3,-3, 0> {
enum { idx = 48 }; };
934 template<>
struct SixthDensePt<-3, 0, 3> {
enum { idx = 49 }; };
935 template<>
struct SixthDensePt<-2, 0, 3> {
enum { idx = 50 }; };
936 template<>
struct SixthDensePt<-1, 0, 3> {
enum { idx = 51 }; };
937 template<>
struct SixthDensePt< 0, 0, 3> {
enum { idx = 52 }; };
938 template<>
struct SixthDensePt< 1, 0, 3> {
enum { idx = 53 }; };
939 template<>
struct SixthDensePt< 2, 0, 3> {
enum { idx = 54 }; };
940 template<>
struct SixthDensePt< 3, 0, 3> {
enum { idx = 55 }; };
943 template<>
struct SixthDensePt<-3, 0, 2> {
enum { idx = 56 }; };
944 template<>
struct SixthDensePt<-2, 0, 2> {
enum { idx = 57 }; };
945 template<>
struct SixthDensePt<-1, 0, 2> {
enum { idx = 58 }; };
946 template<>
struct SixthDensePt< 0, 0, 2> {
enum { idx = 59 }; };
947 template<>
struct SixthDensePt< 1, 0, 2> {
enum { idx = 60 }; };
948 template<>
struct SixthDensePt< 2, 0, 2> {
enum { idx = 61 }; };
949 template<>
struct SixthDensePt< 3, 0, 2> {
enum { idx = 62 }; };
951 template<>
struct SixthDensePt<-3, 0, 1> {
enum { idx = 63 }; };
952 template<>
struct SixthDensePt<-2, 0, 1> {
enum { idx = 64 }; };
953 template<>
struct SixthDensePt<-1, 0, 1> {
enum { idx = 65 }; };
954 template<>
struct SixthDensePt< 0, 0, 1> {
enum { idx = 66 }; };
955 template<>
struct SixthDensePt< 1, 0, 1> {
enum { idx = 67 }; };
956 template<>
struct SixthDensePt< 2, 0, 1> {
enum { idx = 68 }; };
957 template<>
struct SixthDensePt< 3, 0, 1> {
enum { idx = 69 }; };
960 template<>
struct SixthDensePt<-3, 0,-1> {
enum { idx = 70 }; };
961 template<>
struct SixthDensePt<-2, 0,-1> {
enum { idx = 71 }; };
962 template<>
struct SixthDensePt<-1, 0,-1> {
enum { idx = 72 }; };
963 template<>
struct SixthDensePt< 0, 0,-1> {
enum { idx = 73 }; };
964 template<>
struct SixthDensePt< 1, 0,-1> {
enum { idx = 74 }; };
965 template<>
struct SixthDensePt< 2, 0,-1> {
enum { idx = 75 }; };
966 template<>
struct SixthDensePt< 3, 0,-1> {
enum { idx = 76 }; };
969 template<>
struct SixthDensePt<-3, 0,-2> {
enum { idx = 77 }; };
970 template<>
struct SixthDensePt<-2, 0,-2> {
enum { idx = 78 }; };
971 template<>
struct SixthDensePt<-1, 0,-2> {
enum { idx = 79 }; };
972 template<>
struct SixthDensePt< 0, 0,-2> {
enum { idx = 80 }; };
973 template<>
struct SixthDensePt< 1, 0,-2> {
enum { idx = 81 }; };
974 template<>
struct SixthDensePt< 2, 0,-2> {
enum { idx = 82 }; };
975 template<>
struct SixthDensePt< 3, 0,-2> {
enum { idx = 83 }; };
978 template<>
struct SixthDensePt<-3, 0,-3> {
enum { idx = 84 }; };
979 template<>
struct SixthDensePt<-2, 0,-3> {
enum { idx = 85 }; };
980 template<>
struct SixthDensePt<-1, 0,-3> {
enum { idx = 86 }; };
981 template<>
struct SixthDensePt< 0, 0,-3> {
enum { idx = 87 }; };
982 template<>
struct SixthDensePt< 1, 0,-3> {
enum { idx = 88 }; };
983 template<>
struct SixthDensePt< 2, 0,-3> {
enum { idx = 89 }; };
984 template<>
struct SixthDensePt< 3, 0,-3> {
enum { idx = 90 }; };
987 template<>
struct SixthDensePt< 0,-3, 3> {
enum { idx = 91 }; };
988 template<>
struct SixthDensePt< 0,-2, 3> {
enum { idx = 92 }; };
989 template<>
struct SixthDensePt< 0,-1, 3> {
enum { idx = 93 }; };
990 template<>
struct SixthDensePt< 0, 1, 3> {
enum { idx = 94 }; };
991 template<>
struct SixthDensePt< 0, 2, 3> {
enum { idx = 95 }; };
992 template<>
struct SixthDensePt< 0, 3, 3> {
enum { idx = 96 }; };
994 template<>
struct SixthDensePt< 0,-3, 2> {
enum { idx = 97 }; };
995 template<>
struct SixthDensePt< 0,-2, 2> {
enum { idx = 98 }; };
996 template<>
struct SixthDensePt< 0,-1, 2> {
enum { idx = 99 }; };
997 template<>
struct SixthDensePt< 0, 1, 2> {
enum { idx = 100 }; };
998 template<>
struct SixthDensePt< 0, 2, 2> {
enum { idx = 101 }; };
999 template<>
struct SixthDensePt< 0, 3, 2> {
enum { idx = 102 }; };
1001 template<>
struct SixthDensePt< 0,-3, 1> {
enum { idx = 103 }; };
1002 template<>
struct SixthDensePt< 0,-2, 1> {
enum { idx = 104 }; };
1003 template<>
struct SixthDensePt< 0,-1, 1> {
enum { idx = 105 }; };
1004 template<>
struct SixthDensePt< 0, 1, 1> {
enum { idx = 106 }; };
1005 template<>
struct SixthDensePt< 0, 2, 1> {
enum { idx = 107 }; };
1006 template<>
struct SixthDensePt< 0, 3, 1> {
enum { idx = 108 }; };
1008 template<>
struct SixthDensePt< 0,-3,-1> {
enum { idx = 109 }; };
1009 template<>
struct SixthDensePt< 0,-2,-1> {
enum { idx = 110 }; };
1010 template<>
struct SixthDensePt< 0,-1,-1> {
enum { idx = 111 }; };
1011 template<>
struct SixthDensePt< 0, 1,-1> {
enum { idx = 112 }; };
1012 template<>
struct SixthDensePt< 0, 2,-1> {
enum { idx = 113 }; };
1013 template<>
struct SixthDensePt< 0, 3,-1> {
enum { idx = 114 }; };
1015 template<>
struct SixthDensePt< 0,-3,-2> {
enum { idx = 115 }; };
1016 template<>
struct SixthDensePt< 0,-2,-2> {
enum { idx = 116 }; };
1017 template<>
struct SixthDensePt< 0,-1,-2> {
enum { idx = 117 }; };
1018 template<>
struct SixthDensePt< 0, 1,-2> {
enum { idx = 118 }; };
1019 template<>
struct SixthDensePt< 0, 2,-2> {
enum { idx = 119 }; };
1020 template<>
struct SixthDensePt< 0, 3,-2> {
enum { idx = 120 }; };
1022 template<>
struct SixthDensePt< 0,-3,-3> {
enum { idx = 121 }; };
1023 template<>
struct SixthDensePt< 0,-2,-3> {
enum { idx = 122 }; };
1024 template<>
struct SixthDensePt< 0,-1,-3> {
enum { idx = 123 }; };
1025 template<>
struct SixthDensePt< 0, 1,-3> {
enum { idx = 124 }; };
1026 template<>
struct SixthDensePt< 0, 2,-3> {
enum { idx = 125 }; };
1027 template<>
struct SixthDensePt< 0, 3,-3> {
enum { idx = 126 }; };
1032template<
typename Gr
idT,
bool IsSafe = true>
1034 :
public BaseStencil<SixthOrderDenseStencil<GridT, IsSafe>, GridT, IsSafe>
1048 template<
int i,
int j,
int k>
1049 unsigned int pos()
const {
return SixthDensePt<i,j,k>::idx; }
1052 inline void init(
const Coord& ijk)
1054 mValues[SixthDensePt<-3, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 3, 0));
1055 mValues[SixthDensePt<-2, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 3, 0));
1056 mValues[SixthDensePt<-1, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 3, 0));
1057 mValues[SixthDensePt< 0, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3, 0));
1058 mValues[SixthDensePt< 1, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 3, 0));
1059 mValues[SixthDensePt< 2, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 3, 0));
1060 mValues[SixthDensePt< 3, 3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 3, 0));
1062 mValues[SixthDensePt<-3, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 2, 0));
1063 mValues[SixthDensePt<-2, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 2, 0));
1064 mValues[SixthDensePt<-1, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 2, 0));
1065 mValues[SixthDensePt< 0, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 0));
1066 mValues[SixthDensePt< 1, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 2, 0));
1067 mValues[SixthDensePt< 2, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 2, 0));
1068 mValues[SixthDensePt< 3, 2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 2, 0));
1070 mValues[SixthDensePt<-3, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 1, 0));
1071 mValues[SixthDensePt<-2, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 1, 0));
1072 mValues[SixthDensePt<-1, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 1, 0));
1073 mValues[SixthDensePt< 0, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
1074 mValues[SixthDensePt< 1, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 1, 0));
1075 mValues[SixthDensePt< 2, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 1, 0));
1076 mValues[SixthDensePt< 3, 1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 1, 0));
1078 mValues[SixthDensePt<-3, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0, 0));
1079 mValues[SixthDensePt<-2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 0));
1080 mValues[SixthDensePt<-1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
1081 mValues[SixthDensePt< 1, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
1082 mValues[SixthDensePt< 2, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 0));
1083 mValues[SixthDensePt< 3, 0, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0, 0));
1085 mValues[SixthDensePt<-3,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3,-1, 0));
1086 mValues[SixthDensePt<-2,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2,-1, 0));
1087 mValues[SixthDensePt<-1,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1,-1, 0));
1088 mValues[SixthDensePt< 0,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 0));
1089 mValues[SixthDensePt< 1,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1,-1, 0));
1090 mValues[SixthDensePt< 2,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2,-1, 0));
1091 mValues[SixthDensePt< 3,-1, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3,-1, 0));
1093 mValues[SixthDensePt<-3,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3,-2, 0));
1094 mValues[SixthDensePt<-2,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2,-2, 0));
1095 mValues[SixthDensePt<-1,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1,-2, 0));
1096 mValues[SixthDensePt< 0,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 0));
1097 mValues[SixthDensePt< 1,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1,-2, 0));
1098 mValues[SixthDensePt< 2,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2,-2, 0));
1099 mValues[SixthDensePt< 3,-2, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3,-2, 0));
1101 mValues[SixthDensePt<-3,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-3,-3, 0));
1102 mValues[SixthDensePt<-2,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-2,-3, 0));
1103 mValues[SixthDensePt<-1,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy(-1,-3, 0));
1104 mValues[SixthDensePt< 0,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3, 0));
1105 mValues[SixthDensePt< 1,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 1,-3, 0));
1106 mValues[SixthDensePt< 2,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 2,-3, 0));
1107 mValues[SixthDensePt< 3,-3, 0>::idx] = mAcc.getValue(ijk.
offsetBy( 3,-3, 0));
1109 mValues[SixthDensePt<-3, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0, 3));
1110 mValues[SixthDensePt<-2, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 3));
1111 mValues[SixthDensePt<-1, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 3));
1112 mValues[SixthDensePt< 0, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 3));
1113 mValues[SixthDensePt< 1, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 3));
1114 mValues[SixthDensePt< 2, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 3));
1115 mValues[SixthDensePt< 3, 0, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0, 3));
1117 mValues[SixthDensePt<-3, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0, 2));
1118 mValues[SixthDensePt<-2, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 2));
1119 mValues[SixthDensePt<-1, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 2));
1120 mValues[SixthDensePt< 0, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 2));
1121 mValues[SixthDensePt< 1, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 2));
1122 mValues[SixthDensePt< 2, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 2));
1123 mValues[SixthDensePt< 3, 0, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0, 2));
1125 mValues[SixthDensePt<-3, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0, 1));
1126 mValues[SixthDensePt<-2, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0, 1));
1127 mValues[SixthDensePt<-1, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0, 1));
1128 mValues[SixthDensePt< 0, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
1129 mValues[SixthDensePt< 1, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0, 1));
1130 mValues[SixthDensePt< 2, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0, 1));
1131 mValues[SixthDensePt< 3, 0, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0, 1));
1133 mValues[SixthDensePt<-3, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0,-1));
1134 mValues[SixthDensePt<-2, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0,-1));
1135 mValues[SixthDensePt<-1, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0,-1));
1136 mValues[SixthDensePt< 0, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0,-1));
1137 mValues[SixthDensePt< 1, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0,-1));
1138 mValues[SixthDensePt< 2, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0,-1));
1139 mValues[SixthDensePt< 3, 0,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0,-1));
1141 mValues[SixthDensePt<-3, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0,-2));
1142 mValues[SixthDensePt<-2, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0,-2));
1143 mValues[SixthDensePt<-1, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0,-2));
1144 mValues[SixthDensePt< 0, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0,-2));
1145 mValues[SixthDensePt< 1, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0,-2));
1146 mValues[SixthDensePt< 2, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0,-2));
1147 mValues[SixthDensePt< 3, 0,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0,-2));
1149 mValues[SixthDensePt<-3, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy(-3, 0,-3));
1150 mValues[SixthDensePt<-2, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy(-2, 0,-3));
1151 mValues[SixthDensePt<-1, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy(-1, 0,-3));
1152 mValues[SixthDensePt< 0, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 0,-3));
1153 mValues[SixthDensePt< 1, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 1, 0,-3));
1154 mValues[SixthDensePt< 2, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 2, 0,-3));
1155 mValues[SixthDensePt< 3, 0,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 3, 0,-3));
1157 mValues[SixthDensePt< 0,-3, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3, 3));
1158 mValues[SixthDensePt< 0,-2, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 3));
1159 mValues[SixthDensePt< 0,-1, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 3));
1160 mValues[SixthDensePt< 0, 1, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 3));
1161 mValues[SixthDensePt< 0, 2, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 3));
1162 mValues[SixthDensePt< 0, 3, 3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3, 3));
1164 mValues[SixthDensePt< 0,-3, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3, 2));
1165 mValues[SixthDensePt< 0,-2, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 2));
1166 mValues[SixthDensePt< 0,-1, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 2));
1167 mValues[SixthDensePt< 0, 1, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 2));
1168 mValues[SixthDensePt< 0, 2, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 2));
1169 mValues[SixthDensePt< 0, 3, 2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3, 2));
1171 mValues[SixthDensePt< 0,-3, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3, 1));
1172 mValues[SixthDensePt< 0,-2, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2, 1));
1173 mValues[SixthDensePt< 0,-1, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1, 1));
1174 mValues[SixthDensePt< 0, 1, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1, 1));
1175 mValues[SixthDensePt< 0, 2, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2, 1));
1176 mValues[SixthDensePt< 0, 3, 1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3, 1));
1178 mValues[SixthDensePt< 0,-3,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3,-1));
1179 mValues[SixthDensePt< 0,-2,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2,-1));
1180 mValues[SixthDensePt< 0,-1,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1,-1));
1181 mValues[SixthDensePt< 0, 1,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1,-1));
1182 mValues[SixthDensePt< 0, 2,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2,-1));
1183 mValues[SixthDensePt< 0, 3,-1>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3,-1));
1185 mValues[SixthDensePt< 0,-3,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3,-2));
1186 mValues[SixthDensePt< 0,-2,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2,-2));
1187 mValues[SixthDensePt< 0,-1,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1,-2));
1188 mValues[SixthDensePt< 0, 1,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1,-2));
1189 mValues[SixthDensePt< 0, 2,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2,-2));
1190 mValues[SixthDensePt< 0, 3,-2>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3,-2));
1192 mValues[SixthDensePt< 0,-3,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-3,-3));
1193 mValues[SixthDensePt< 0,-2,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-2,-3));
1194 mValues[SixthDensePt< 0,-1,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0,-1,-3));
1195 mValues[SixthDensePt< 0, 1,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 1,-3));
1196 mValues[SixthDensePt< 0, 2,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 2,-3));
1197 mValues[SixthDensePt< 0, 3,-3>::idx] = mAcc.getValue(ijk.
offsetBy( 0, 3,-3));
1211 template<
int i,
int j,
int k>
struct GradPt {};
1212 template<>
struct GradPt< 0, 0, 0> {
enum { idx = 0 }; };
1213 template<>
struct GradPt< 1, 0, 0> {
enum { idx = 2 }; };
1214 template<>
struct GradPt< 0, 1, 0> {
enum { idx = 4 }; };
1215 template<>
struct GradPt< 0, 0, 1> {
enum { idx = 6 }; };
1216 template<>
struct GradPt<-1, 0, 0> {
enum { idx = 1 }; };
1217 template<>
struct GradPt< 0,-1, 0> {
enum { idx = 3 }; };
1218 template<>
struct GradPt< 0, 0,-1> {
enum { idx = 5 }; };
1227template<
typename Gr
idT,
bool IsSafe = true>
1242 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1249 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1261 mValues[0] - mValues[1],
1262 mValues[2] - mValues[0],
1263 mValues[0] - mValues[3],
1264 mValues[4] - mValues[0],
1265 mValues[0] - mValues[5],
1266 mValues[6] - mValues[0]);
1277 mValues[4] - mValues[3],
1278 mValues[6] - mValues[5])*mInv2Dx;
1287 V[0]>0 ? mValues[0] - mValues[1] : mValues[2] - mValues[0],
1288 V[1]>0 ? mValues[0] - mValues[3] : mValues[4] - mValues[0],
1289 V[2]>0 ? mValues[0] - mValues[5] : mValues[6] - mValues[0])*2*mInv2Dx;
1296 return mInvDx2 * (mValues[1] + mValues[2] +
1297 mValues[3] + mValues[4] +
1298 mValues[5] + mValues[6] - 6*mValues[0]);
1306 return (v[0]>0 ? (v[1]<0 || v[2]<0 || v[3]<0 || v[4]<0 || v[5]<0 || v[6]<0)
1307 : (v[1]>0 || v[2]>0 || v[3]>0 || v[4]>0 || v[5]>0 || v[6]>0));
1323 ijk[1] - d*(mValues[4] - mValues[3]),
1324 ijk[2] - d*(mValues[6] - mValues[5]));
1330 template<
int i,
int j,
int k>
1331 unsigned int pos()
const {
return GradPt<i,j,k>::idx; }
1335 inline void init(
const Coord& ijk)
1337 BaseType::template setValue<-1, 0, 0>(mAcc.getValue(ijk.
offsetBy(-1, 0, 0)));
1338 BaseType::template setValue< 1, 0, 0>(mAcc.getValue(ijk.
offsetBy( 1, 0, 0)));
1340 BaseType::template setValue< 0,-1, 0>(mAcc.getValue(ijk.
offsetBy( 0,-1, 0)));
1341 BaseType::template setValue< 0, 1, 0>(mAcc.getValue(ijk.
offsetBy( 0, 1, 0)));
1343 BaseType::template setValue< 0, 0,-1>(mAcc.getValue(ijk.
offsetBy( 0, 0,-1)));
1344 BaseType::template setValue< 0, 0, 1>(mAcc.getValue(ijk.
offsetBy( 0, 0, 1)));
1361template<
typename Gr
idT,
bool IsSafe = true>
1378 , mDx2(static_cast<float>(_mDx2))
1387 , mDx2(static_cast<float>(_mDx2))
1402 v1(v[2]-v[1], v[ 8]-v[ 7], v[14]-v[13], 0),
1403 v2(v[3]-v[2], v[ 9]-v[ 8], v[15]-v[14], 0),
1404 v3(v[0]-v[3], v[ 0]-v[ 9], v[ 0]-v[15], 0),
1405 v4(v[4]-v[0], v[10]-v[ 0], v[16]-v[ 0], 0),
1406 v5(v[5]-v[4], v[11]-v[10], v[17]-v[16], 0),
1407 v6(v[6]-v[5], v[12]-v[11], v[18]-v[17], 0),
1414 dP_xm =
math::WENO5(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3],v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2),
1415 dP_xp =
math::WENO5(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0],v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
1416 dP_ym =
math::WENO5(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9],v[10]-v[ 0],v[11]-v[10],mDx2),
1417 dP_yp =
math::WENO5(v[12]-v[11],v[11]-v[10],v[10]-v[ 0],v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
1418 dP_zm =
math::WENO5(v[14]-v[13],v[15]-v[14],v[ 0]-v[15],v[16]-v[ 0],v[17]-v[16],mDx2),
1419 dP_zp =
math::WENO5(v[18]-v[17],v[17]-v[16],v[16]-v[ 0],v[ 0]-v[15],v[15]-v[14],mDx2);
1434 V[0]>0 ?
math::WENO5(v[ 2]-v[ 1],v[ 3]-v[ 2],v[ 0]-v[ 3], v[ 4]-v[ 0],v[ 5]-v[ 4],mDx2)
1435 :
math::WENO5(v[ 6]-v[ 5],v[ 5]-v[ 4],v[ 4]-v[ 0], v[ 0]-v[ 3],v[ 3]-v[ 2],mDx2),
1436 V[1]>0 ?
math::WENO5(v[ 8]-v[ 7],v[ 9]-v[ 8],v[ 0]-v[ 9], v[10]-v[ 0],v[11]-v[10],mDx2)
1437 :
math::WENO5(v[12]-v[11],v[11]-v[10],v[10]-v[ 0], v[ 0]-v[ 9],v[ 9]-v[ 8],mDx2),
1438 V[2]>0 ?
math::WENO5(v[14]-v[13],v[15]-v[14],v[ 0]-v[15], v[16]-v[ 0],v[17]-v[16],mDx2)
1439 :
math::WENO5(v[18]-v[17],v[17]-v[16],v[16]-v[ 0], v[ 0]-v[15],v[15]-v[14],mDx2));
1449 mValues[10] - mValues[ 9],
1450 mValues[16] - mValues[15]);
1461 mValues[ 3] + mValues[ 4] +
1462 mValues[ 9] + mValues[10] +
1463 mValues[15] + mValues[16] - 6*mValues[0]);
1471 return (v[ 0]>0 ? (v[ 3]<0 || v[ 4]<0 || v[ 9]<0 || v[10]<0 || v[15]<0 || v[16]<0)
1472 : (v[ 3]>0 || v[ 4]>0 || v[ 9]>0 || v[10]>0 || v[15]>0 || v[16]>0));
1476 inline void init(
const Coord& ijk)
1478 mValues[ 1] = mAcc.getValue(ijk.
offsetBy(-3, 0, 0));
1479 mValues[ 2] = mAcc.getValue(ijk.
offsetBy(-2, 0, 0));
1480 mValues[ 3] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
1481 mValues[ 4] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
1482 mValues[ 5] = mAcc.getValue(ijk.
offsetBy( 2, 0, 0));
1483 mValues[ 6] = mAcc.getValue(ijk.
offsetBy( 3, 0, 0));
1485 mValues[ 7] = mAcc.getValue(ijk.
offsetBy( 0, -3, 0));
1486 mValues[ 8] = mAcc.getValue(ijk.
offsetBy( 0, -2, 0));
1487 mValues[ 9] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
1488 mValues[10] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
1489 mValues[11] = mAcc.getValue(ijk.
offsetBy( 0, 2, 0));
1490 mValues[12] = mAcc.getValue(ijk.
offsetBy( 0, 3, 0));
1492 mValues[13] = mAcc.getValue(ijk.
offsetBy( 0, 0, -3));
1493 mValues[14] = mAcc.getValue(ijk.
offsetBy( 0, 0, -2));
1494 mValues[15] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
1495 mValues[16] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
1496 mValues[17] = mAcc.getValue(ijk.
offsetBy( 0, 0, 2));
1497 mValues[18] = mAcc.getValue(ijk.
offsetBy( 0, 0, 3));
1503 const ValueType _mDx2, mInv2Dx, mInvDx2;
1511template<
typename Gr
idT,
bool IsSafe = true>
1526 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1533 , mInvDx2(
ValueType(4.0 * mInv2Dx * mInv2Dx))
1543 Real alpha, normGrad;
1554 Real alpha, normGrad;
1566 Real alphaM, alphaG, normGrad;
1567 if (this->
curvatures(alphaM, alphaG, normGrad)) {
1583 Real alpha, normGrad;
1595 Real alpha, normGrad;
1607 Real alphaM, alphaG, normGrad;
1608 if (this->
curvatures(alphaM, alphaG, normGrad)) {
1623 std::pair<ValueType, ValueType> pair(0, 0);
1624 Real alphaM, alphaG, normGrad;
1625 if (this->
curvatures(alphaM, alphaG, normGrad)) {
1642 mValues[1] + mValues[2] +
1643 mValues[3] + mValues[4] +
1644 mValues[5] + mValues[6] - 6*mValues[0]);
1655 mValues[2] - mValues[1],
1656 mValues[4] - mValues[3],
1657 mValues[6] - mValues[5])*mInv2Dx;
1661 inline void init(
const Coord &ijk)
1663 mValues[ 1] = mAcc.getValue(ijk.
offsetBy(-1, 0, 0));
1664 mValues[ 2] = mAcc.getValue(ijk.
offsetBy( 1, 0, 0));
1666 mValues[ 3] = mAcc.getValue(ijk.
offsetBy( 0, -1, 0));
1667 mValues[ 4] = mAcc.getValue(ijk.
offsetBy( 0, 1, 0));
1669 mValues[ 5] = mAcc.getValue(ijk.
offsetBy( 0, 0, -1));
1670 mValues[ 6] = mAcc.getValue(ijk.
offsetBy( 0, 0, 1));
1672 mValues[ 7] = mAcc.getValue(ijk.
offsetBy(-1, -1, 0));
1673 mValues[ 8] = mAcc.getValue(ijk.
offsetBy( 1, -1, 0));
1674 mValues[ 9] = mAcc.getValue(ijk.
offsetBy(-1, 1, 0));
1675 mValues[10] = mAcc.getValue(ijk.
offsetBy( 1, 1, 0));
1677 mValues[11] = mAcc.getValue(ijk.
offsetBy(-1, 0, -1));
1678 mValues[12] = mAcc.getValue(ijk.
offsetBy( 1, 0, -1));
1679 mValues[13] = mAcc.getValue(ijk.
offsetBy(-1, 0, 1));
1680 mValues[14] = mAcc.getValue(ijk.
offsetBy( 1, 0, 1));
1682 mValues[15] = mAcc.getValue(ijk.
offsetBy( 0, -1, -1));
1683 mValues[16] = mAcc.getValue(ijk.
offsetBy( 0, 1, -1));
1684 mValues[17] = mAcc.getValue(ijk.
offsetBy( 0, -1, 1));
1685 mValues[18] = mAcc.getValue(ijk.
offsetBy( 0, 1, 1));
1688 inline Real Dx()
const {
return 0.5*(mValues[2] - mValues[1]); }
1689 inline Real Dy()
const {
return 0.5*(mValues[4] - mValues[3]); }
1690 inline Real Dz()
const {
return 0.5*(mValues[6] - mValues[5]); }
1691 inline Real Dxx()
const {
return mValues[2] - 2 * mValues[0] + mValues[1]; }
1692 inline Real Dyy()
const {
return mValues[4] - 2 * mValues[0] + mValues[3]; }
1693 inline Real Dzz()
const {
return mValues[6] - 2 * mValues[0] + mValues[5]; }
1694 inline Real Dxy()
const {
return 0.25 * (mValues[10] - mValues[ 8] + mValues[ 7] - mValues[ 9]); }
1695 inline Real Dxz()
const {
return 0.25 * (mValues[14] - mValues[12] + mValues[11] - mValues[13]); }
1696 inline Real Dyz()
const {
return 0.25 * (mValues[18] - mValues[16] + mValues[15] - mValues[17]); }
1698 inline bool meanCurvature(Real& alpha, Real& normGrad)
const
1701 const Real Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1702 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1703 if (normGrad2 <= math::Tolerance<Real>::value()) {
1704 alpha = normGrad = 0;
1707 const Real Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz();
1708 alpha = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
1709 2*(Dx*(Dy*this->Dxy() + Dz*this->Dxz()) + Dy*Dz*this->Dyz());
1710 normGrad = std::sqrt(normGrad2);
1714 inline bool gaussianCurvature(Real& alpha, Real& normGrad)
const
1717 const Real Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1718 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1719 if (normGrad2 <= math::Tolerance<Real>::value()) {
1720 alpha = normGrad = 0;
1723 const Real Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
1724 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
1725 alpha = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
1726 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
1727 normGrad = std::sqrt(normGrad2);
1730 inline bool curvatures(Real& alphaM, Real& alphaG, Real& normGrad)
const
1733 const Real Dx = this->Dx(), Dy = this->Dy(), Dz = this->Dz(),
1734 Dx2 = Dx*Dx, Dy2 = Dy*Dy, Dz2 = Dz*Dz, normGrad2 = Dx2 + Dy2 + Dz2;
1735 if (normGrad2 <= math::Tolerance<Real>::value()) {
1736 alphaM = alphaG =normGrad = 0;
1739 const Real Dxx = this->Dxx(), Dyy = this->Dyy(), Dzz = this->Dzz(),
1740 Dxy = this->Dxy(), Dxz = this->Dxz(), Dyz = this->Dyz();
1741 alphaM = Dx2*(Dyy + Dzz) + Dy2*(Dxx + Dzz) + Dz2*(Dxx + Dyy) -
1742 2*(Dx*(Dy*Dxy + Dz*Dxz) + Dy*Dz*Dyz);
1743 alphaG = Dx2*(Dyy*Dzz - Dyz*Dyz) + Dy2*(Dxx*Dzz - Dxz*Dxz) + Dz2*(Dxx*Dyy - Dxy*Dxy) +
1744 2*( Dy*Dz*(Dxy*Dxz - Dyz*Dxx) + Dx*Dz*(Dxy*Dyz - Dxz*Dyy) + Dx*Dy*(Dxz*Dyz - Dxy*Dzz) );
1745 normGrad = std::sqrt(normGrad2);
1760template<
typename Gr
idT,
bool IsSafe = true>
1772 , mHalfWidth(halfWidth)
1788 template<
typename IterType>
1798 inline void init(
const Coord& ijk)
1802 for (p[1] = ijk[1]-mHalfWidth; p[1] <= q[1]; ++p[1]) {
1803 for (p[2] = ijk[2]-mHalfWidth; p[2] <= q[2]; ++p[2]) {
1804 mValues[n++] = mAcc.getValue(p);
1813 const int mHalfWidth;
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
ValueAccessors are designed to help accelerate accesses into the OpenVDB Tree structures by storing c...
ValueType min() const
Return the smallest value in the stencil buffer.
Definition Stencils.h:143
void moveTo(const Vec3< RealType > &xyz)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition Stencils.h:86
BufferType mValues
Definition Stencils.h:218
const AccessorType & accessor() const
Return a const reference to the ValueAccessor associated with this Stencil.
Definition Stencils.h:204
void moveTo(const IterType &iter)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition Stencils.h:72
const ValueType & getValue(unsigned int pos=0) const
Return the value from the stencil buffer with linear offset pos.
Definition Stencils.h:97
ValueType mean() const
Return the mean value of the current stencil.
Definition Stencils.h:135
void setValue(const ValueType &value)
Set the value at the specified location relative to the center of the stencil.
Definition Stencils.h:112
void moveTo(const Coord &ijk, const ValueType ¢erValue)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors....
Definition Stencils.h:59
BaseStencil(const GridType &grid, int size)
Definition Stencils.h:208
GridT::ValueType ValueType
Definition Stencils.h:40
std::bitset< 6 > intersectionMask(const ValueType &isoValue=zeroVal< ValueType >()) const
Return true a bit-mask where the 6 bits indicates if the center of the stencil intersects the iso-con...
Definition Stencils.h:185
void moveTo(const Coord &ijk)
Initialize the stencil buffer with the values of voxel (i, j, k) and its neighbors.
Definition Stencils.h:47
Coord mCenter
Definition Stencils.h:219
const GridType * mGrid
Definition Stencils.h:216
const ValueType & getCenterValue() const
Return the value at the center of the stencil.
Definition Stencils.h:160
const ValueType & getValue() const
Return the value at the specified location relative to the center of the stencil.
Definition Stencils.h:105
const Coord & getCenterCoord() const
Return the coordinates of the center point of the stencil.
Definition Stencils.h:157
bool intersects(const ValueType &isoValue=zeroVal< ValueType >()) const
Return true if the center of the stencil intersects the iso-contour specified by the isoValue.
Definition Stencils.h:164
tree::ValueAccessor< const TreeType, IsSafe > AccessorType
Definition Stencils.h:41
ValueType median() const
Return the median value of the current stencil.
Definition Stencils.h:121
const GridType & grid() const
Return a const reference to the grid from which this stencil was constructed.
Definition Stencils.h:200
ValueType max() const
Return the largest value in the stencil buffer.
Definition Stencils.h:150
AccessorType mAcc
Definition Stencils.h:217
GridT::TreeType TreeType
Definition Stencils.h:39
std::vector< ValueType > BufferType
Definition Stencils.h:42
GridT GridType
Definition Stencils.h:38
int size()
Return the size of the stencil buffer.
Definition Stencils.h:118
math::Vec3< ValueType > gradient(const math::Vec3< ValueType > &xyz) const
Return the gradient in world space of the trilinear interpolation kernel.
Definition Stencils.h:369
BoxStencil(const GridType &grid)
Definition Stencils.h:308
GridT::ValueType ValueType
Definition Stencils.h:304
bool intersects(const ValueType &isoValue=zeroVal< ValueType >()) const
Return true if the center of the stencil intersects the.
Definition Stencils.h:316
friend class BaseStencil
Definition Stencils.h:425
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:312
GridT::TreeType TreeType
Definition Stencils.h:303
static const int SIZE
Definition Stencils.h:306
GridT GridType
Definition Stencils.h:302
ValueType interpolation(const math::Vec3< ValueType > &xyz) const
Return the trilinear interpolation at the normalized position.
Definition Stencils.h:335
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
Coord offsetBy(Int32 dx, Int32 dy, Int32 dz) const
Definition Coord.h:92
static Coord floor(const Vec3< T > &xyz)
Return the largest integer coordinates that are not greater than xyz (node centered conversion).
Definition Coord.h:57
void curvaturesNormGrad(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
Definition Stencils.h:1605
CurvatureStencil(const GridType &grid, Real dx)
Definition Stencils.h:1530
CurvatureStencil(const GridType &grid)
Definition Stencils.h:1523
ValueType meanCurvature() const
Return the mean curvature at the previously buffered location.
Definition Stencils.h:1541
ValueType gaussianCurvatureNormGrad() const
Definition Stencils.h:1593
void curvatures(ValueType &mean, ValueType &gauss) const
Return both the mean and the Gaussian curvature at the previously buffered location.
Definition Stencils.h:1564
math::Vec3< ValueType > gradient() const
Definition Stencils.h:1652
GridT::ValueType ValueType
Definition Stencils.h:1519
ValueType laplacian() const
Definition Stencils.h:1639
std::pair< ValueType, ValueType > principalCurvatures() const
Return the pair (minimum, maximum) principal curvature at the previously buffered location.
Definition Stencils.h:1621
friend class BaseStencil
Definition Stencils.h:1749
ValueType meanCurvatureNormGrad() const
Definition Stencils.h:1581
ValueType gaussianCurvature() const
Return the Gaussian curvature at the previously buffered location.
Definition Stencils.h:1552
GridT::TreeType TreeType
Definition Stencils.h:1518
static const int SIZE
Definition Stencils.h:1521
GridT GridType
Definition Stencils.h:1517
void moveTo(const IterType &iter)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition Stencils.h:1789
void moveTo(const Coord &ijk)
Initialize the stencil buffer with the values of voxel (x, y, z) and its neighbors.
Definition Stencils.h:1781
const ValueType & getCenterValue() const
Definition Stencils.h:1777
DenseStencil(const GridType &grid, int halfWidth)
Definition Stencils.h:1770
GridType::ValueType ValueType
Definition Stencils.h:1768
friend class BaseStencil
Definition Stencils.h:1810
GridT::TreeType TreeType
Definition Stencils.h:1767
GridT GridType
Definition Stencils.h:1766
FourthOrderDenseStencil(const GridType &grid)
Definition Stencils.h:690
GridType::ValueType ValueType
Definition Stencils.h:686
friend class BaseStencil
Definition Stencils.h:774
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:694
GridT::TreeType TreeType
Definition Stencils.h:685
static const int SIZE
Definition Stencils.h:688
GridT GridType
Definition Stencils.h:684
GradStencil(const GridType &grid)
Definition Stencils.h:1239
math::Vec3< ValueType > gradient(const math::Vec3< ValueType > &V) const
Return the first-order upwind gradient corresponding to the direction V.
Definition Stencils.h:1284
GradStencil(const GridType &grid, Real dx)
Definition Stencils.h:1246
math::Vec3< ValueType > gradient() const
Return the gradient computed at the previously buffered location by second order central differencing...
Definition Stencils.h:1274
ValueType laplacian() const
Definition Stencils.h:1294
bool zeroCrossing() const
Definition Stencils.h:1303
math::Vec3< ValueType > cpt()
Compute the closest-point transform to a level set.
Definition Stencils.h:1317
GridType::ValueType ValueType
Definition Stencils.h:1235
friend class BaseStencil
Definition Stencils.h:1347
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:1331
ValueType normSqGrad() const
Return the norm square of the single-sided upwind gradient (computed via Godunov's scheme) at the pre...
Definition Stencils.h:1258
GridT::TreeType TreeType
Definition Stencils.h:1234
static const int SIZE
Definition Stencils.h:1237
GridT GridType
Definition Stencils.h:1233
GridType::ValueType ValueType
Definition Stencils.h:825
friend class BaseStencil
Definition Stencils.h:860
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:833
GridType::TreeType TreeType
Definition Stencils.h:824
static const int SIZE
Definition Stencils.h:827
GridType GridType
Definition Stencils.h:823
NineteenPointStencil(const GridType &grid)
Definition Stencils.h:829
SecondOrderDenseStencil(const GridType &grid)
Definition Stencils.h:479
GridType::ValueType ValueType
Definition Stencils.h:475
friend class BaseStencil
Definition Stencils.h:512
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:483
GridT::TreeType TreeType
Definition Stencils.h:474
static const int SIZE
Definition Stencils.h:477
GridT GridType
Definition Stencils.h:473
SevenPointStencil(const GridT &grid)
Definition Stencils.h:254
GridType::ValueType ValueType
Definition Stencils.h:250
friend class BaseStencil
Definition Stencils.h:273
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:258
GridType::TreeType TreeType
Definition Stencils.h:249
static const int SIZE
Definition Stencils.h:252
GridType GridType
Definition Stencils.h:248
SixthOrderDenseStencil(const GridType &grid)
Definition Stencils.h:1045
GridType::ValueType ValueType
Definition Stencils.h:1041
friend class BaseStencil
Definition Stencils.h:1200
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:1049
GridT::TreeType TreeType
Definition Stencils.h:1040
static const int SIZE
Definition Stencils.h:1043
GridT GridType
Definition Stencils.h:1039
ThirteenPointStencil(const GridType &grid)
Definition Stencils.h:559
GridType::ValueType ValueType
Definition Stencils.h:555
friend class BaseStencil
Definition Stencils.h:584
unsigned int pos() const
Return linear offset for the specified stencil point relative to its center.
Definition Stencils.h:563
GridType::TreeType TreeType
Definition Stencils.h:554
static const int SIZE
Definition Stencils.h:557
GridType GridType
Definition Stencils.h:553
WenoStencil(const GridType &grid, Real dx)
Definition Stencils.h:1382
math::Vec3< ValueType > gradient(const math::Vec3< ValueType > &V) const
Definition Stencils.h:1430
WenoStencil(const GridType &grid)
Definition Stencils.h:1373
ValueType normSqGrad(const ValueType &isoValue=zeroVal< ValueType >()) const
Return the norm-square of the WENO upwind gradient (computed via WENO upwinding and Godunov's scheme)...
Definition Stencils.h:1396
math::Vec3< ValueType > gradient() const
Definition Stencils.h:1446
ValueType laplacian() const
Definition Stencils.h:1458
bool zeroCrossing() const
Definition Stencils.h:1468
GridType::ValueType ValueType
Definition Stencils.h:1369
friend class BaseStencil
Definition Stencils.h:1500
GridT::TreeType TreeType
Definition Stencils.h:1368
static const int SIZE
Definition Stencils.h:1371
GridT GridType
Definition Stencils.h:1367
ValueType WENO5(const ValueType &v1, const ValueType &v2, const ValueType &v3, const ValueType &v4, const ValueType &v5, float scale2=0.01f)
Implementation of nominally fifth-order finite-difference WENO.
Definition FiniteDifference.h:303
Real GodunovsNormSqrd(bool isOutside, Real dP_xm, Real dP_xp, Real dP_ym, Real dP_yp, Real dP_zm, Real dP_zp)
Definition FiniteDifference.h:325
Type Pow4(Type x)
Return x4.
Definition Math.h:578
Type Pow3(Type x)
Return x3.
Definition Math.h:574
Type Pow2(Type x)
Return x2.
Definition Math.h:570
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
double Real
Definition Types.h:40
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:71
Definition Exceptions.h:13
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
#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:291