6 #ifndef OPENVDB_MATH_FINITEDIFFERENCE_HAS_BEEN_INCLUDED
7 #define OPENVDB_MATH_FINITEDIFFERENCE_HAS_BEEN_INCLUDED
17 #include <simd/Simd.h>
58 case CD_2NDT: ret =
"cd_2ndt";
break;
59 case CD_2ND: ret =
"cd_2nd";
break;
60 case CD_4TH: ret =
"cd_4th";
break;
61 case CD_6TH: ret =
"cd_6th";
break;
62 case FD_1ST: ret =
"fd_1st";
break;
63 case FD_2ND: ret =
"fd_2nd";
break;
64 case FD_3RD: ret =
"fd_3rd";
break;
65 case BD_1ST: ret =
"bd_1st";
break;
66 case BD_2ND: ret =
"bd_2nd";
break;
67 case BD_3RD: ret =
"bd_3rd";
break;
68 case FD_WENO5: ret =
"fd_weno5";
break;
69 case BD_WENO5: ret =
"bd_weno5";
break;
123 case UNKNOWN_DS: ret =
"Unknown DS scheme";
break;
124 case CD_2NDT: ret =
"Twice 2nd-order center difference";
break;
125 case CD_2ND: ret =
"2nd-order center difference";
break;
126 case CD_4TH: ret =
"4th-order center difference";
break;
127 case CD_6TH: ret =
"6th-order center difference";
break;
128 case FD_1ST: ret =
"1st-order forward difference";
break;
129 case FD_2ND: ret =
"2nd-order forward difference";
break;
130 case FD_3RD: ret =
"3rd-order forward difference";
break;
131 case BD_1ST: ret =
"1st-order backward difference";
break;
132 case BD_2ND: ret =
"2nd-order backward difference";
break;
133 case BD_3RD: ret =
"3rd-order backward difference";
break;
134 case FD_WENO5: ret =
"5th-order WENO forward difference";
break;
135 case BD_WENO5: ret =
"5th-order WENO backward difference";
break;
136 case FD_HJWENO5: ret =
"5th-order HJ-WENO forward difference";
break;
137 case BD_HJWENO5: ret =
"5th-order HJ-WENO backward difference";
break;
218 case UNKNOWN_BIAS: ret =
"Unknown biased gradient";
break;
219 case FIRST_BIAS: ret =
"1st-order biased gradient";
break;
220 case SECOND_BIAS: ret =
"2nd-order biased gradient";
break;
221 case THIRD_BIAS: ret =
"3rd-order biased gradient";
break;
222 case WENO5_BIAS: ret =
"5th-order WENO biased gradient";
break;
223 case HJWENO5_BIAS: ret =
"5th-order HJ-WENO biased gradient";
break;
248 case TVD_RK1: ret =
"tvd_rk1";
break;
249 case TVD_RK2: ret =
"tvd_rk2";
break;
250 case TVD_RK3: ret =
"tvd_rk3";
break;
280 case UNKNOWN_TIS: ret =
"Unknown temporal integration";
break;
281 case TVD_RK1: ret =
"Forward Euler";
break;
282 case TVD_RK2: ret =
"2nd-order Runge-Kutta";
break;
283 case TVD_RK3: ret =
"3rd-order Runge-Kutta";
break;
301 template<
typename ValueType>
306 const double C = 13.0 / 12.0;
311 const double eps = 1.0e-6 *
static_cast<double>(scale2);
318 A1*(2.0*v1 - 7.0*v2 + 11.0*
v3) +
319 A2*(5.0*v3 - v2 + 2.0*v4) +
320 A3*(2.0*v3 + 5.0*v4 - v5))/(6.0*(A1+A2+A3)));
324 template <
typename Real>
349 template<
typename Real>
353 return GodunovsNormSqrd<Real>(isOutside,
354 gradient_m[0], gradient_p[0],
355 gradient_m[1], gradient_p[1],
356 gradient_m[2], gradient_p[2]);
361 inline simd::Float4 simdMin(
const simd::Float4&
a,
const simd::Float4&
b) {
362 return simd::Float4(_mm_min_ps(a.base(), b.base()));
364 inline simd::Float4 simdMax(
const simd::Float4& a,
const simd::Float4& b) {
365 return simd::Float4(_mm_max_ps(a.base(), b.base()));
368 inline float simdSum(
const simd::Float4&
v);
370 inline simd::Float4
Pow2(
const simd::Float4&
v) {
return v *
v; }
374 WENO5<simd::Float4>(
const simd::Float4&
v1,
const simd::Float4&
v2,
const simd::Float4&
v3,
375 const simd::Float4& v4,
const simd::Float4& v5,
float scale2)
378 using F4 = simd::Float4;
381 eps(1.0e-6
f * scale2),
382 two(2.0), three(3.0), four(4.0), five(5.0), fourth(0.25),
385 A3 = F4(0.3
f) /
Pow2(C*
Pow2(
v3-two*v4+v5) + fourth*
Pow2(three*
v3-four*v4+v5) + eps);
386 return (A1 * (two *
v1 - F4(7.0) *
v2 + F4(11.0) *
v3) +
387 A2 * (five *
v3 -
v2 + two * v4) +
388 A3 * (two *
v3 + five * v4 - v5)) / (F4(6.0) * (A1 + A2 + A3));
393 simdSum(
const simd::Float4&
v)
396 __m128 temp = _mm_add_ps(v.base(), _mm_movehl_ps(v.base(), v.base()));
398 temp = _mm_add_ss(temp, _mm_shuffle_ps(temp, temp, 1));
399 return _mm_cvtss_f32(temp);
403 GodunovsNormSqrd(
bool isOutside,
const simd::Float4& dP_m,
const simd::Float4& dP_p)
405 const simd::Float4
zero(0.0);
406 simd::Float4 v = isOutside
408 : simdMax(math::
Pow2(simdMin(dP_m,
zero)), math::
Pow2(simdMax(dP_p,
zero)));
414 template<DScheme DiffScheme>
418 template<
typename Accessor>
421 template<
typename Accessor>
424 template<
typename Accessor>
428 template<
typename Stencil>
431 template<
typename Stencil>
434 template<
typename Stencil>
442 template <
typename ValueType>
448 template<
typename Accessor>
452 grid.getValue(ijk.offsetBy(1, 0, 0)),
453 grid.getValue(ijk.offsetBy(-1, 0, 0)));
456 template<
typename Accessor>
460 grid.getValue(ijk.offsetBy(0, 1, 0)),
461 grid.getValue(ijk.offsetBy( 0, -1, 0)));
464 template<
typename Accessor>
468 grid.getValue(ijk.offsetBy(0, 0, 1)),
469 grid.getValue(ijk.offsetBy( 0, 0, -1)));
473 template<
typename Stencil>
476 return difference( S.template getValue< 1, 0, 0>(), S.template getValue<-1, 0, 0>());
479 template<
typename Stencil>
482 return difference( S.template getValue< 0, 1, 0>(), S.template getValue< 0,-1, 0>());
485 template<
typename Stencil>
488 return difference( S.template getValue< 0, 0, 1>(), S.template getValue< 0, 0,-1>());
497 template <
typename ValueType>
507 template<
typename Accessor>
511 grid.getValue(ijk.offsetBy(1, 0, 0)),
512 grid.getValue(ijk.offsetBy(-1, 0, 0)));
515 template<
typename Accessor>
519 grid.getValue(ijk.offsetBy(0, 1, 0)),
520 grid.getValue(ijk.offsetBy( 0, -1, 0)));
523 template<
typename Accessor>
527 grid.getValue(ijk.offsetBy(0, 0, 1)),
528 grid.getValue(ijk.offsetBy( 0, 0, -1)));
533 template<
typename Stencil>
536 return difference(S.template getValue< 1, 0, 0>(), S.template getValue<-1, 0, 0>());
538 template<
typename Stencil>
541 return difference(S.template getValue< 0, 1, 0>(), S.template getValue< 0,-1, 0>());
544 template<
typename Stencil>
547 return difference(S.template getValue< 0, 0, 1>(), S.template getValue< 0, 0,-1>());
557 template <
typename ValueType>
565 template<
typename Accessor>
569 grid.getValue(ijk.offsetBy( 2,0,0)), grid.getValue(ijk.offsetBy( 1,0,0)),
570 grid.getValue(ijk.offsetBy(-1,0,0)), grid.getValue(ijk.offsetBy(-2,0,0)) );
573 template<
typename Accessor>
578 grid.getValue(ijk.offsetBy( 0, 2, 0)), grid.getValue(ijk.offsetBy( 0, 1, 0)),
579 grid.getValue(ijk.offsetBy( 0,-1, 0)), grid.getValue(ijk.offsetBy( 0,-2, 0)) );
582 template<
typename Accessor>
587 grid.getValue(ijk.offsetBy( 0, 0, 2)), grid.getValue(ijk.offsetBy( 0, 0, 1)),
588 grid.getValue(ijk.offsetBy( 0, 0,-1)), grid.getValue(ijk.offsetBy( 0, 0,-2)) );
593 template<
typename Stencil>
596 return difference( S.template getValue< 2, 0, 0>(),
597 S.template getValue< 1, 0, 0>(),
598 S.template getValue<-1, 0, 0>(),
599 S.template getValue<-2, 0, 0>() );
602 template<
typename Stencil>
605 return difference( S.template getValue< 0, 2, 0>(),
606 S.template getValue< 0, 1, 0>(),
607 S.template getValue< 0,-1, 0>(),
608 S.template getValue< 0,-2, 0>() );
611 template<
typename Stencil>
614 return difference( S.template getValue< 0, 0, 2>(),
615 S.template getValue< 0, 0, 1>(),
616 S.template getValue< 0, 0,-1>(),
617 S.template getValue< 0, 0,-2>() );
626 template <
typename ValueType>
636 template<
typename Accessor>
640 grid.getValue(ijk.offsetBy( 3,0,0)), grid.getValue(ijk.offsetBy( 2,0,0)),
641 grid.getValue(ijk.offsetBy( 1,0,0)), grid.getValue(ijk.offsetBy(-1,0,0)),
642 grid.getValue(ijk.offsetBy(-2,0,0)), grid.getValue(ijk.offsetBy(-3,0,0)));
645 template<
typename Accessor>
649 grid.getValue(ijk.offsetBy( 0, 3, 0)), grid.getValue(ijk.offsetBy( 0, 2, 0)),
650 grid.getValue(ijk.offsetBy( 0, 1, 0)), grid.getValue(ijk.offsetBy( 0,-1, 0)),
651 grid.getValue(ijk.offsetBy( 0,-2, 0)), grid.getValue(ijk.offsetBy( 0,-3, 0)));
654 template<
typename Accessor>
658 grid.getValue(ijk.offsetBy( 0, 0, 3)), grid.getValue(ijk.offsetBy( 0, 0, 2)),
659 grid.getValue(ijk.offsetBy( 0, 0, 1)), grid.getValue(ijk.offsetBy( 0, 0,-1)),
660 grid.getValue(ijk.offsetBy( 0, 0,-2)), grid.getValue(ijk.offsetBy( 0, 0,-3)));
664 template<
typename Stencil>
667 return difference(S.template getValue< 3, 0, 0>(),
668 S.template getValue< 2, 0, 0>(),
669 S.template getValue< 1, 0, 0>(),
670 S.template getValue<-1, 0, 0>(),
671 S.template getValue<-2, 0, 0>(),
672 S.template getValue<-3, 0, 0>());
675 template<
typename Stencil>
679 return difference( S.template getValue< 0, 3, 0>(),
680 S.template getValue< 0, 2, 0>(),
681 S.template getValue< 0, 1, 0>(),
682 S.template getValue< 0,-1, 0>(),
683 S.template getValue< 0,-2, 0>(),
684 S.template getValue< 0,-3, 0>());
687 template<
typename Stencil>
691 return difference( S.template getValue< 0, 0, 3>(),
692 S.template getValue< 0, 0, 2>(),
693 S.template getValue< 0, 0, 1>(),
694 S.template getValue< 0, 0,-1>(),
695 S.template getValue< 0, 0,-2>(),
696 S.template getValue< 0, 0,-3>());
706 template <
typename ValueType>
713 template<
typename Accessor>
716 return difference(grid.getValue(ijk.offsetBy(1, 0, 0)), grid.getValue(ijk));
719 template<
typename Accessor>
722 return difference(grid.getValue(ijk.offsetBy(0, 1, 0)), grid.getValue(ijk));
725 template<
typename Accessor>
728 return difference(grid.getValue(ijk.offsetBy(0, 0, 1)), grid.getValue(ijk));
732 template<
typename Stencil>
735 return difference(S.template getValue< 1, 0, 0>(), S.template getValue< 0, 0, 0>());
738 template<
typename Stencil>
741 return difference(S.template getValue< 0, 1, 0>(), S.template getValue< 0, 0, 0>());
744 template<
typename Stencil>
747 return difference(S.template getValue< 0, 0, 1>(), S.template getValue< 0, 0, 0>());
756 template <
typename ValueType>
764 template<
typename Accessor>
768 grid.getValue(ijk.offsetBy(2,0,0)),
769 grid.getValue(ijk.offsetBy(1,0,0)),
773 template<
typename Accessor>
777 grid.getValue(ijk.offsetBy(0,2,0)),
778 grid.getValue(ijk.offsetBy(0,1,0)),
782 template<
typename Accessor>
786 grid.getValue(ijk.offsetBy(0,0,2)),
787 grid.getValue(ijk.offsetBy(0,0,1)),
793 template<
typename Stencil>
796 return difference( S.template getValue< 2, 0, 0>(),
797 S.template getValue< 1, 0, 0>(),
798 S.template getValue< 0, 0, 0>() );
801 template<
typename Stencil>
804 return difference( S.template getValue< 0, 2, 0>(),
805 S.template getValue< 0, 1, 0>(),
806 S.template getValue< 0, 0, 0>() );
809 template<
typename Stencil>
812 return difference( S.template getValue< 0, 0, 2>(),
813 S.template getValue< 0, 0, 1>(),
814 S.template getValue< 0, 0, 0>() );
825 template<
typename ValueType>
829 return static_cast<ValueType>(xp3/3.0 - 1.5*xp2 + 3.0*xp1 - 11.0*xp0/6.0);
834 template<
typename Accessor>
837 return difference( grid.getValue(ijk.offsetBy(3,0,0)),
838 grid.getValue(ijk.offsetBy(2,0,0)),
839 grid.getValue(ijk.offsetBy(1,0,0)),
840 grid.getValue(ijk) );
843 template<
typename Accessor>
846 return difference( grid.getValue(ijk.offsetBy(0,3,0)),
847 grid.getValue(ijk.offsetBy(0,2,0)),
848 grid.getValue(ijk.offsetBy(0,1,0)),
849 grid.getValue(ijk) );
852 template<
typename Accessor>
855 return difference( grid.getValue(ijk.offsetBy(0,0,3)),
856 grid.getValue(ijk.offsetBy(0,0,2)),
857 grid.getValue(ijk.offsetBy(0,0,1)),
858 grid.getValue(ijk) );
863 template<
typename Stencil>
866 return difference(S.template getValue< 3, 0, 0>(),
867 S.template getValue< 2, 0, 0>(),
868 S.template getValue< 1, 0, 0>(),
869 S.template getValue< 0, 0, 0>() );
872 template<
typename Stencil>
875 return difference(S.template getValue< 0, 3, 0>(),
876 S.template getValue< 0, 2, 0>(),
877 S.template getValue< 0, 1, 0>(),
878 S.template getValue< 0, 0, 0>() );
881 template<
typename Stencil>
884 return difference( S.template getValue< 0, 0, 3>(),
885 S.template getValue< 0, 0, 2>(),
886 S.template getValue< 0, 0, 1>(),
887 S.template getValue< 0, 0, 0>() );
897 template <
typename ValueType>
904 template<
typename Accessor>
907 return difference(grid.getValue(ijk.offsetBy(-1,0,0)), grid.getValue(ijk));
910 template<
typename Accessor>
913 return difference(grid.getValue(ijk.offsetBy(0,-1,0)), grid.getValue(ijk));
916 template<
typename Accessor>
919 return difference(grid.getValue(ijk.offsetBy(0, 0,-1)), grid.getValue(ijk));
924 template<
typename Stencil>
927 return difference(S.template getValue<-1, 0, 0>(), S.template getValue< 0, 0, 0>());
930 template<
typename Stencil>
933 return difference(S.template getValue< 0,-1, 0>(), S.template getValue< 0, 0, 0>());
936 template<
typename Stencil>
939 return difference(S.template getValue< 0, 0,-1>(), S.template getValue< 0, 0, 0>());
949 template <
typename ValueType>
957 template<
typename Accessor>
960 return difference( grid.getValue(ijk.offsetBy(-2,0,0)),
961 grid.getValue(ijk.offsetBy(-1,0,0)),
962 grid.getValue(ijk) );
965 template<
typename Accessor>
968 return difference( grid.getValue(ijk.offsetBy(0,-2,0)),
969 grid.getValue(ijk.offsetBy(0,-1,0)),
970 grid.getValue(ijk) );
973 template<
typename Accessor>
976 return difference( grid.getValue(ijk.offsetBy(0,0,-2)),
977 grid.getValue(ijk.offsetBy(0,0,-1)),
978 grid.getValue(ijk) );
982 template<
typename Stencil>
985 return difference( S.template getValue<-2, 0, 0>(),
986 S.template getValue<-1, 0, 0>(),
987 S.template getValue< 0, 0, 0>() );
990 template<
typename Stencil>
993 return difference( S.template getValue< 0,-2, 0>(),
994 S.template getValue< 0,-1, 0>(),
995 S.template getValue< 0, 0, 0>() );
998 template<
typename Stencil>
1001 return difference( S.template getValue< 0, 0,-2>(),
1002 S.template getValue< 0, 0,-1>(),
1003 S.template getValue< 0, 0, 0>() );
1013 template <
typename ValueType>
1021 template<
typename Accessor>
1024 return difference( grid.getValue(ijk.offsetBy(-3,0,0)),
1025 grid.getValue(ijk.offsetBy(-2,0,0)),
1026 grid.getValue(ijk.offsetBy(-1,0,0)),
1027 grid.getValue(ijk) );
1030 template<
typename Accessor>
1033 return difference( grid.getValue(ijk.offsetBy( 0,-3,0)),
1034 grid.getValue(ijk.offsetBy( 0,-2,0)),
1035 grid.getValue(ijk.offsetBy( 0,-1,0)),
1036 grid.getValue(ijk) );
1039 template<
typename Accessor>
1042 return difference( grid.getValue(ijk.offsetBy( 0, 0,-3)),
1043 grid.getValue(ijk.offsetBy( 0, 0,-2)),
1044 grid.getValue(ijk.offsetBy( 0, 0,-1)),
1045 grid.getValue(ijk) );
1049 template<
typename Stencil>
1052 return difference( S.template getValue<-3, 0, 0>(),
1053 S.template getValue<-2, 0, 0>(),
1054 S.template getValue<-1, 0, 0>(),
1055 S.template getValue< 0, 0, 0>() );
1058 template<
typename Stencil>
1061 return difference( S.template getValue< 0,-3, 0>(),
1062 S.template getValue< 0,-2, 0>(),
1063 S.template getValue< 0,-1, 0>(),
1064 S.template getValue< 0, 0, 0>() );
1067 template<
typename Stencil>
1070 return difference( S.template getValue< 0, 0,-3>(),
1071 S.template getValue< 0, 0,-2>(),
1072 S.template getValue< 0, 0,-1>(),
1073 S.template getValue< 0, 0, 0>() );
1082 template <
typename ValueType>
1086 return WENO5<ValueType>(xp3, xp2, xp1, xp0, xm1)
1087 - WENO5<ValueType>(xp2, xp1, xp0, xm1, xm2);
1092 template<
typename Accessor>
1097 V[0] = grid.getValue(ijk.offsetBy(3,0,0));
1098 V[1] = grid.getValue(ijk.offsetBy(2,0,0));
1099 V[2] = grid.getValue(ijk.offsetBy(1,0,0));
1100 V[3] = grid.getValue(ijk);
1101 V[4] = grid.getValue(ijk.offsetBy(-1,0,0));
1102 V[5] = grid.getValue(ijk.offsetBy(-2,0,0));
1104 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1107 template<
typename Accessor>
1112 V[0] = grid.getValue(ijk.offsetBy(0,3,0));
1113 V[1] = grid.getValue(ijk.offsetBy(0,2,0));
1114 V[2] = grid.getValue(ijk.offsetBy(0,1,0));
1115 V[3] = grid.getValue(ijk);
1116 V[4] = grid.getValue(ijk.offsetBy(0,-1,0));
1117 V[5] = grid.getValue(ijk.offsetBy(0,-2,0));
1119 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1122 template<
typename Accessor>
1127 V[0] = grid.getValue(ijk.offsetBy(0,0,3));
1128 V[1] = grid.getValue(ijk.offsetBy(0,0,2));
1129 V[2] = grid.getValue(ijk.offsetBy(0,0,1));
1130 V[3] = grid.getValue(ijk);
1131 V[4] = grid.getValue(ijk.offsetBy(0,0,-1));
1132 V[5] = grid.getValue(ijk.offsetBy(0,0,-2));
1134 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1138 template<
typename Stencil>
1143 S.template getValue< 3, 0, 0>(),
1144 S.template getValue< 2, 0, 0>(),
1145 S.template getValue< 1, 0, 0>(),
1146 S.template getValue< 0, 0, 0>(),
1147 S.template getValue<-1, 0, 0>(),
1148 S.template getValue<-2, 0, 0>() ));
1152 template<
typename Stencil>
1156 S.template getValue< 0, 3, 0>(),
1157 S.template getValue< 0, 2, 0>(),
1158 S.template getValue< 0, 1, 0>(),
1159 S.template getValue< 0, 0, 0>(),
1160 S.template getValue< 0,-1, 0>(),
1161 S.template getValue< 0,-2, 0>() ));
1164 template<
typename Stencil>
1168 S.template getValue< 0, 0, 3>(),
1169 S.template getValue< 0, 0, 2>(),
1170 S.template getValue< 0, 0, 1>(),
1171 S.template getValue< 0, 0, 0>(),
1172 S.template getValue< 0, 0,-1>(),
1173 S.template getValue< 0, 0,-2>() ));
1182 template <
typename ValueType>
1186 return WENO5<ValueType>(xp3 - xp2, xp2 - xp1, xp1 - xp0, xp0-xm1, xm1-xm2);
1190 template<
typename Accessor>
1195 V[0] = grid.getValue(ijk.offsetBy(3,0,0));
1196 V[1] = grid.getValue(ijk.offsetBy(2,0,0));
1197 V[2] = grid.getValue(ijk.offsetBy(1,0,0));
1198 V[3] = grid.getValue(ijk);
1199 V[4] = grid.getValue(ijk.offsetBy(-1,0,0));
1200 V[5] = grid.getValue(ijk.offsetBy(-2,0,0));
1202 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1206 template<
typename Accessor>
1211 V[0] = grid.getValue(ijk.offsetBy(0,3,0));
1212 V[1] = grid.getValue(ijk.offsetBy(0,2,0));
1213 V[2] = grid.getValue(ijk.offsetBy(0,1,0));
1214 V[3] = grid.getValue(ijk);
1215 V[4] = grid.getValue(ijk.offsetBy(0,-1,0));
1216 V[5] = grid.getValue(ijk.offsetBy(0,-2,0));
1218 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1221 template<
typename Accessor>
1226 V[0] = grid.getValue(ijk.offsetBy(0,0,3));
1227 V[1] = grid.getValue(ijk.offsetBy(0,0,2));
1228 V[2] = grid.getValue(ijk.offsetBy(0,0,1));
1229 V[3] = grid.getValue(ijk);
1230 V[4] = grid.getValue(ijk.offsetBy(0,0,-1));
1231 V[5] = grid.getValue(ijk.offsetBy(0,0,-2));
1233 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1237 template<
typename Stencil>
1241 return difference( S.template getValue< 3, 0, 0>(),
1242 S.template getValue< 2, 0, 0>(),
1243 S.template getValue< 1, 0, 0>(),
1244 S.template getValue< 0, 0, 0>(),
1245 S.template getValue<-1, 0, 0>(),
1246 S.template getValue<-2, 0, 0>() );
1250 template<
typename Stencil>
1253 return difference( S.template getValue< 0, 3, 0>(),
1254 S.template getValue< 0, 2, 0>(),
1255 S.template getValue< 0, 1, 0>(),
1256 S.template getValue< 0, 0, 0>(),
1257 S.template getValue< 0,-1, 0>(),
1258 S.template getValue< 0,-2, 0>() );
1261 template<
typename Stencil>
1265 return difference( S.template getValue< 0, 0, 3>(),
1266 S.template getValue< 0, 0, 2>(),
1267 S.template getValue< 0, 0, 1>(),
1268 S.template getValue< 0, 0, 0>(),
1269 S.template getValue< 0, 0,-1>(),
1270 S.template getValue< 0, 0,-2>() );
1279 template<
typename ValueType>
1288 template<
typename Accessor>
1293 V[0] = grid.getValue(ijk.offsetBy(-3,0,0));
1294 V[1] = grid.getValue(ijk.offsetBy(-2,0,0));
1295 V[2] = grid.getValue(ijk.offsetBy(-1,0,0));
1296 V[3] = grid.getValue(ijk);
1297 V[4] = grid.getValue(ijk.offsetBy(1,0,0));
1298 V[5] = grid.getValue(ijk.offsetBy(2,0,0));
1300 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1303 template<
typename Accessor>
1308 V[0] = grid.getValue(ijk.offsetBy(0,-3,0));
1309 V[1] = grid.getValue(ijk.offsetBy(0,-2,0));
1310 V[2] = grid.getValue(ijk.offsetBy(0,-1,0));
1311 V[3] = grid.getValue(ijk);
1312 V[4] = grid.getValue(ijk.offsetBy(0,1,0));
1313 V[5] = grid.getValue(ijk.offsetBy(0,2,0));
1315 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1318 template<
typename Accessor>
1323 V[0] = grid.getValue(ijk.offsetBy(0,0,-3));
1324 V[1] = grid.getValue(ijk.offsetBy(0,0,-2));
1325 V[2] = grid.getValue(ijk.offsetBy(0,0,-1));
1326 V[3] = grid.getValue(ijk);
1327 V[4] = grid.getValue(ijk.offsetBy(0,0,1));
1328 V[5] = grid.getValue(ijk.offsetBy(0,0,2));
1330 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1334 template<
typename Stencil>
1339 V[0] = S.template
getValue<-3, 0, 0>();
1340 V[1] = S.template
getValue<-2, 0, 0>();
1341 V[2] = S.template
getValue<-1, 0, 0>();
1342 V[3] = S.template getValue< 0, 0, 0>();
1343 V[4] = S.template getValue< 1, 0, 0>();
1344 V[5] = S.template getValue< 2, 0, 0>();
1346 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1349 template<
typename Stencil>
1354 V[0] = S.template
getValue< 0,-3, 0>();
1355 V[1] = S.template
getValue< 0,-2, 0>();
1356 V[2] = S.template
getValue< 0,-1, 0>();
1357 V[3] = S.template getValue< 0, 0, 0>();
1358 V[4] = S.template getValue< 0, 1, 0>();
1359 V[5] = S.template getValue< 0, 2, 0>();
1361 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1364 template<
typename Stencil>
1369 V[0] = S.template
getValue< 0, 0,-3>();
1370 V[1] = S.template
getValue< 0, 0,-2>();
1371 V[2] = S.template
getValue< 0, 0,-1>();
1372 V[3] = S.template getValue< 0, 0, 0>();
1373 V[4] = S.template getValue< 0, 0, 1>();
1374 V[5] = S.template getValue< 0, 0, 2>();
1376 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1384 template<
typename ValueType>
1392 template<
typename Accessor>
1397 V[0] = grid.getValue(ijk.offsetBy(-3,0,0));
1398 V[1] = grid.getValue(ijk.offsetBy(-2,0,0));
1399 V[2] = grid.getValue(ijk.offsetBy(-1,0,0));
1400 V[3] = grid.getValue(ijk);
1401 V[4] = grid.getValue(ijk.offsetBy(1,0,0));
1402 V[5] = grid.getValue(ijk.offsetBy(2,0,0));
1404 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1407 template<
typename Accessor>
1412 V[0] = grid.getValue(ijk.offsetBy(0,-3,0));
1413 V[1] = grid.getValue(ijk.offsetBy(0,-2,0));
1414 V[2] = grid.getValue(ijk.offsetBy(0,-1,0));
1415 V[3] = grid.getValue(ijk);
1416 V[4] = grid.getValue(ijk.offsetBy(0,1,0));
1417 V[5] = grid.getValue(ijk.offsetBy(0,2,0));
1419 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1422 template<
typename Accessor>
1427 V[0] = grid.getValue(ijk.offsetBy(0,0,-3));
1428 V[1] = grid.getValue(ijk.offsetBy(0,0,-2));
1429 V[2] = grid.getValue(ijk.offsetBy(0,0,-1));
1430 V[3] = grid.getValue(ijk);
1431 V[4] = grid.getValue(ijk.offsetBy(0,0,1));
1432 V[5] = grid.getValue(ijk.offsetBy(0,0,2));
1434 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1438 template<
typename Stencil>
1443 V[0] = S.template
getValue<-3, 0, 0>();
1444 V[1] = S.template
getValue<-2, 0, 0>();
1445 V[2] = S.template
getValue<-1, 0, 0>();
1446 V[3] = S.template getValue< 0, 0, 0>();
1447 V[4] = S.template getValue< 1, 0, 0>();
1448 V[5] = S.template getValue< 2, 0, 0>();
1450 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1453 template<
typename Stencil>
1458 V[0] = S.template
getValue< 0,-3, 0>();
1459 V[1] = S.template
getValue< 0,-2, 0>();
1460 V[2] = S.template
getValue< 0,-1, 0>();
1461 V[3] = S.template getValue< 0, 0, 0>();
1462 V[4] = S.template getValue< 0, 1, 0>();
1463 V[5] = S.template getValue< 0, 2, 0>();
1465 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1468 template<
typename Stencil>
1473 V[0] = S.template
getValue< 0, 0,-3>();
1474 V[1] = S.template
getValue< 0, 0,-2>();
1475 V[2] = S.template
getValue< 0, 0,-1>();
1476 V[3] = S.template getValue< 0, 0, 0>();
1477 V[4] = S.template getValue< 0, 0, 1>();
1478 V[5] = S.template getValue< 0, 0, 2>();
1480 return difference(V[0], V[1], V[2], V[3], V[4], V[5]);
1485 template<DScheme DiffScheme>
1489 template<
typename Accessor>
1496 template<
typename Accessor>
1502 template<
typename Accessor>
1511 template<
typename Stencil>
1517 template<
typename Stencil>
1523 template<
typename Stencil>
1536 template<
typename Accessor>
1541 grid.getValue(ijk.offsetBy(-1, 0, 0))[n] );
1544 template<
typename Accessor>
1549 grid.getValue(ijk.offsetBy(0,-1, 0))[n] );
1552 template<
typename Accessor>
1557 grid.getValue(ijk.offsetBy(0, 0,-1))[n] );
1561 template<
typename Stencil>
1565 S.template getValue<-1, 0, 0>()[n] );
1568 template<
typename Stencil>
1572 S.template getValue< 0,-1, 0>()[n] );
1575 template<
typename Stencil>
1579 S.template getValue< 0, 0,-1>()[n] );
1588 template<
typename Accessor>
1593 grid.getValue(ijk.offsetBy(-1, 0, 0))[n] );
1596 template<
typename Accessor>
1601 grid.getValue(ijk.offsetBy(0,-1, 0))[n] );
1604 template<
typename Accessor>
1609 grid.getValue(ijk.offsetBy(0, 0,-1))[n] );
1614 template<
typename Stencil>
1618 S.template getValue<-1, 0, 0>()[n] );
1621 template<
typename Stencil>
1625 S.template getValue< 0,-1, 0>()[n] );
1628 template<
typename Stencil>
1632 S.template getValue< 0, 0,-1>()[n] );
1643 template<
typename Accessor>
1648 grid.getValue(ijk.offsetBy(2, 0, 0))[n], grid.getValue(ijk.offsetBy( 1, 0, 0))[n],
1649 grid.getValue(ijk.offsetBy(-1,0, 0))[n], grid.getValue(ijk.offsetBy(-2, 0, 0))[n]);
1652 template<
typename Accessor>
1657 grid.getValue(ijk.offsetBy( 0, 2, 0))[n], grid.getValue(ijk.offsetBy( 0, 1, 0))[n],
1658 grid.getValue(ijk.offsetBy( 0,-1, 0))[n], grid.getValue(ijk.offsetBy( 0,-2, 0))[n]);
1661 template<
typename Accessor>
1666 grid.getValue(ijk.offsetBy(0,0, 2))[n], grid.getValue(ijk.offsetBy( 0, 0, 1))[n],
1667 grid.getValue(ijk.offsetBy(0,0,-1))[n], grid.getValue(ijk.offsetBy( 0, 0,-2))[n]);
1671 template<
typename Stencil>
1675 S.template getValue< 2, 0, 0>()[n], S.template getValue< 1, 0, 0>()[n],
1676 S.template getValue<-1, 0, 0>()[n], S.template getValue<-2, 0, 0>()[n] );
1679 template<
typename Stencil>
1683 S.template getValue< 0, 2, 0>()[n], S.template getValue< 0, 1, 0>()[n],
1684 S.template getValue< 0,-1, 0>()[n], S.template getValue< 0,-2, 0>()[n]);
1687 template<
typename Stencil>
1691 S.template getValue< 0, 0, 2>()[n], S.template getValue< 0, 0, 1>()[n],
1692 S.template getValue< 0, 0,-1>()[n], S.template getValue< 0, 0,-2>()[n]);
1703 template<
typename Accessor>
1708 grid.getValue(ijk.offsetBy( 3, 0, 0))[n], grid.getValue(ijk.offsetBy( 2, 0, 0))[n],
1709 grid.getValue(ijk.offsetBy( 1, 0, 0))[n], grid.getValue(ijk.offsetBy(-1, 0, 0))[n],
1710 grid.getValue(ijk.offsetBy(-2, 0, 0))[n], grid.getValue(ijk.offsetBy(-3, 0, 0))[n] );
1713 template<
typename Accessor>
1718 grid.getValue(ijk.offsetBy( 0, 3, 0))[n], grid.getValue(ijk.offsetBy( 0, 2, 0))[n],
1719 grid.getValue(ijk.offsetBy( 0, 1, 0))[n], grid.getValue(ijk.offsetBy( 0,-1, 0))[n],
1720 grid.getValue(ijk.offsetBy( 0,-2, 0))[n], grid.getValue(ijk.offsetBy( 0,-3, 0))[n] );
1723 template<
typename Accessor>
1728 grid.getValue(ijk.offsetBy( 0, 0, 3))[n], grid.getValue(ijk.offsetBy( 0, 0, 2))[n],
1729 grid.getValue(ijk.offsetBy( 0, 0, 1))[n], grid.getValue(ijk.offsetBy( 0, 0,-1))[n],
1730 grid.getValue(ijk.offsetBy( 0, 0,-2))[n], grid.getValue(ijk.offsetBy( 0, 0,-3))[n] );
1735 template<
typename Stencil>
1739 S.template getValue< 3, 0, 0>()[n], S.template getValue< 2, 0, 0>()[n],
1740 S.template getValue< 1, 0, 0>()[n], S.template getValue<-1, 0, 0>()[n],
1741 S.template getValue<-2, 0, 0>()[n], S.template getValue<-3, 0, 0>()[n] );
1744 template<
typename Stencil>
1748 S.template getValue< 0, 3, 0>()[n], S.template getValue< 0, 2, 0>()[n],
1749 S.template getValue< 0, 1, 0>()[n], S.template getValue< 0,-1, 0>()[n],
1750 S.template getValue< 0,-2, 0>()[n], S.template getValue< 0,-3, 0>()[n] );
1753 template<
typename Stencil>
1757 S.template getValue< 0, 0, 3>()[n], S.template getValue< 0, 0, 2>()[n],
1758 S.template getValue< 0, 0, 1>()[n], S.template getValue< 0, 0,-1>()[n],
1759 S.template getValue< 0, 0,-2>()[n], S.template getValue< 0, 0,-3>()[n] );
1763 template<DDScheme DiffScheme>
1767 template<
typename Accessor>
1769 template<
typename Accessor>
1771 template<
typename Accessor>
1775 template<
typename Accessor>
1778 template<
typename Accessor>
1781 template<
typename Accessor>
1786 template<
typename Stencil>
1788 template<
typename Stencil>
1790 template<
typename Stencil>
1794 template<
typename Stencil>
1797 template<
typename Stencil>
1800 template<
typename Stencil>
1809 template <
typename ValueType>
1815 template <
typename ValueType>
1819 return ValueType(0.25)*(xpyp + xmym - xpym - xmyp);
1823 template<
typename Accessor>
1826 return difference( grid.getValue(ijk.offsetBy( 1,0,0)), grid.getValue(ijk),
1827 grid.getValue(ijk.offsetBy(-1,0,0)) );
1830 template<
typename Accessor>
1834 return difference( grid.getValue(ijk.offsetBy(0, 1,0)), grid.getValue(ijk),
1835 grid.getValue(ijk.offsetBy(0,-1,0)) );
1838 template<
typename Accessor>
1841 return difference( grid.getValue(ijk.offsetBy( 0,0, 1)), grid.getValue(ijk),
1842 grid.getValue(ijk.offsetBy( 0,0,-1)) );
1846 template<
typename Accessor>
1849 return crossdifference(
1850 grid.getValue(ijk.offsetBy(1, 1,0)), grid.getValue(ijk.offsetBy( 1,-1,0)),
1851 grid.getValue(ijk.offsetBy(-1,1,0)), grid.getValue(ijk.offsetBy(-1,-1,0)));
1855 template<
typename Accessor>
1858 return crossdifference(
1859 grid.getValue(ijk.offsetBy(1,0, 1)), grid.getValue(ijk.offsetBy(1, 0,-1)),
1860 grid.getValue(ijk.offsetBy(-1,0,1)), grid.getValue(ijk.offsetBy(-1,0,-1)) );
1863 template<
typename Accessor>
1866 return crossdifference(
1867 grid.getValue(ijk.offsetBy(0, 1,1)), grid.getValue(ijk.offsetBy(0, 1,-1)),
1868 grid.getValue(ijk.offsetBy(0,-1,1)), grid.getValue(ijk.offsetBy(0,-1,-1)) );
1873 template<
typename Stencil>
1876 return difference( S.template getValue< 1, 0, 0>(), S.template getValue< 0, 0, 0>(),
1877 S.template getValue<-1, 0, 0>() );
1880 template<
typename Stencil>
1883 return difference( S.template getValue< 0, 1, 0>(), S.template getValue< 0, 0, 0>(),
1884 S.template getValue< 0,-1, 0>() );
1887 template<
typename Stencil>
1890 return difference( S.template getValue< 0, 0, 1>(), S.template getValue< 0, 0, 0>(),
1891 S.template getValue< 0, 0,-1>() );
1895 template<
typename Stencil>
1898 return crossdifference(S.template getValue< 1, 1, 0>(), S.template getValue< 1,-1, 0>(),
1899 S.template getValue<-1, 1, 0>(), S.template getValue<-1,-1, 0>() );
1902 template<
typename Stencil>
1905 return crossdifference(S.template getValue< 1, 0, 1>(), S.template getValue< 1, 0,-1>(),
1906 S.template getValue<-1, 0, 1>(), S.template getValue<-1, 0,-1>() );
1909 template<
typename Stencil>
1912 return crossdifference(S.template getValue< 0, 1, 1>(), S.template getValue< 0, 1,-1>(),
1913 S.template getValue< 0,-1, 1>(), S.template getValue< 0,-1,-1>() );
1923 template <
typename ValueType>
1929 template <
typename ValueType>
1939 ValueType(2./3.0)*(xp1yp1 - xm1yp1 - xp1ym1 + xm1ym1)-
1940 ValueType(1./12.)*(xp2yp1 - xm2yp1 - xp2ym1 + xm2ym1);
1942 ValueType(2./3.0)*(xp1yp2 - xm1yp2 - xp1ym2 + xm1ym2)-
1943 ValueType(1./12.)*(xp2yp2 - xm2yp2 - xp2ym2 + xm2ym2);
1951 template<
typename Accessor>
1955 grid.getValue(ijk.offsetBy(2,0,0)), grid.getValue(ijk.offsetBy( 1,0,0)),
1957 grid.getValue(ijk.offsetBy(-1,0,0)), grid.getValue(ijk.offsetBy(-2, 0, 0)));
1960 template<
typename Accessor>
1964 grid.getValue(ijk.offsetBy(0, 2,0)), grid.getValue(ijk.offsetBy(0, 1,0)),
1966 grid.getValue(ijk.offsetBy(0,-1,0)), grid.getValue(ijk.offsetBy(0,-2, 0)));
1969 template<
typename Accessor>
1973 grid.getValue(ijk.offsetBy(0,0, 2)), grid.getValue(ijk.offsetBy(0, 0,1)),
1975 grid.getValue(ijk.offsetBy(0,0,-1)), grid.getValue(ijk.offsetBy(0,0,-2)));
1979 template<
typename Accessor>
1992 template<
typename Accessor>
2005 template<
typename Accessor>
2020 template<
typename Stencil>
2023 return difference(S.template getValue< 2, 0, 0>(), S.template getValue< 1, 0, 0>(),
2024 S.template getValue< 0, 0, 0>(),
2025 S.template getValue<-1, 0, 0>(), S.template getValue<-2, 0, 0>() );
2028 template<
typename Stencil>
2031 return difference(S.template getValue< 0, 2, 0>(), S.template getValue< 0, 1, 0>(),
2032 S.template getValue< 0, 0, 0>(),
2033 S.template getValue< 0,-1, 0>(), S.template getValue< 0,-2, 0>() );
2036 template<
typename Stencil>
2039 return difference(S.template getValue< 0, 0, 2>(), S.template getValue< 0, 0, 1>(),
2040 S.template getValue< 0, 0, 0>(),
2041 S.template getValue< 0, 0,-1>(), S.template getValue< 0, 0,-2>() );
2045 template<
typename Stencil>
2048 return crossdifference(
2049 S.template getValue< 2, 2, 0>(), S.template getValue< 2, 1, 0>(),
2050 S.template getValue< 2,-1, 0>(), S.template getValue< 2,-2, 0>(),
2051 S.template getValue< 1, 2, 0>(), S.template getValue< 1, 1, 0>(),
2052 S.template getValue< 1,-1, 0>(), S.template getValue< 1,-2, 0>(),
2053 S.template getValue<-2, 2, 0>(), S.template getValue<-2, 1, 0>(),
2054 S.template getValue<-2,-1, 0>(), S.template getValue<-2,-2, 0>(),
2055 S.template getValue<-1, 2, 0>(), S.template getValue<-1, 1, 0>(),
2056 S.template getValue<-1,-1, 0>(), S.template getValue<-1,-2, 0>() );
2059 template<
typename Stencil>
2062 return crossdifference(
2063 S.template getValue< 2, 0, 2>(), S.template getValue< 2, 0, 1>(),
2064 S.template getValue< 2, 0,-1>(), S.template getValue< 2, 0,-2>(),
2065 S.template getValue< 1, 0, 2>(), S.template getValue< 1, 0, 1>(),
2066 S.template getValue< 1, 0,-1>(), S.template getValue< 1, 0,-2>(),
2067 S.template getValue<-2, 0, 2>(), S.template getValue<-2, 0, 1>(),
2068 S.template getValue<-2, 0,-1>(), S.template getValue<-2, 0,-2>(),
2069 S.template getValue<-1, 0, 2>(), S.template getValue<-1, 0, 1>(),
2070 S.template getValue<-1, 0,-1>(), S.template getValue<-1, 0,-2>() );
2073 template<
typename Stencil>
2076 return crossdifference(
2077 S.template getValue< 0, 2, 2>(), S.template getValue< 0, 2, 1>(),
2078 S.template getValue< 0, 2,-1>(), S.template getValue< 0, 2,-2>(),
2079 S.template getValue< 0, 1, 2>(), S.template getValue< 0, 1, 1>(),
2080 S.template getValue< 0, 1,-1>(), S.template getValue< 0, 1,-2>(),
2081 S.template getValue< 0,-2, 2>(), S.template getValue< 0,-2, 1>(),
2082 S.template getValue< 0,-2,-1>(), S.template getValue< 0,-2,-2>(),
2083 S.template getValue< 0,-1, 2>(), S.template getValue< 0,-1, 1>(),
2084 S.template getValue< 0,-1,-1>(), S.template getValue< 0,-1,-2>() );
2093 template <
typename ValueType>
2102 template <
typename ValueType>
2123 ValueType(0.7500)*(xp1yp1 - xm1yp1 - xp1ym1 + xm1ym1) -
2124 ValueType(0.1500)*(xp2yp1 - xm2yp1 - xp2ym1 + xm2ym1) +
2125 ValueType(1./60.)*(xp3yp1 - xm3yp1 - xp3ym1 + xm3ym1);
2128 ValueType(0.7500)*(xp1yp2 - xm1yp2 - xp1ym2 + xm1ym2) -
2129 ValueType(0.1500)*(xp2yp2 - xm2yp2 - xp2ym2 + xm2ym2) +
2130 ValueType(1./60.)*(xp3yp2 - xm3yp2 - xp3ym2 + xm3ym2);
2133 ValueType(0.7500)*(xp1yp3 - xm1yp3 - xp1ym3 + xm1ym3) -
2134 ValueType(0.1500)*(xp2yp3 - xm2yp3 - xp2ym3 + xm2ym3) +
2135 ValueType(1./60.)*(xp3yp3 - xm3yp3 - xp3ym3 + xm3ym3);
2142 template<
typename Accessor>
2146 grid.getValue(ijk.offsetBy( 3, 0, 0)), grid.getValue(ijk.offsetBy( 2, 0, 0)),
2147 grid.getValue(ijk.offsetBy( 1, 0, 0)), grid.getValue(ijk),
2148 grid.getValue(ijk.offsetBy(-1, 0, 0)), grid.getValue(ijk.offsetBy(-2, 0, 0)),
2149 grid.getValue(ijk.offsetBy(-3, 0, 0)) );
2152 template<
typename Accessor>
2156 grid.getValue(ijk.offsetBy( 0, 3, 0)), grid.getValue(ijk.offsetBy( 0, 2, 0)),
2157 grid.getValue(ijk.offsetBy( 0, 1, 0)), grid.getValue(ijk),
2158 grid.getValue(ijk.offsetBy( 0,-1, 0)), grid.getValue(ijk.offsetBy( 0,-2, 0)),
2159 grid.getValue(ijk.offsetBy( 0,-3, 0)) );
2162 template<
typename Accessor>
2167 grid.getValue(ijk.offsetBy( 0, 0, 3)), grid.getValue(ijk.offsetBy( 0, 0, 2)),
2168 grid.getValue(ijk.offsetBy( 0, 0, 1)), grid.getValue(ijk),
2169 grid.getValue(ijk.offsetBy( 0, 0,-1)), grid.getValue(ijk.offsetBy( 0, 0,-2)),
2170 grid.getValue(ijk.offsetBy( 0, 0,-3)) );
2173 template<
typename Accessor>
2186 return ValueT(0.75*tmp1 - 0.15*tmp2 + 1./60*tmp3);
2189 template<
typename Accessor>
2202 return ValueT(0.75*tmp1 - 0.15*tmp2 + 1./60*tmp3);
2205 template<
typename Accessor>
2218 return ValueT(0.75*tmp1 - 0.15*tmp2 + 1./60*tmp3);
2223 template<
typename Stencil>
2226 return difference( S.template getValue< 3, 0, 0>(), S.template getValue< 2, 0, 0>(),
2227 S.template getValue< 1, 0, 0>(), S.template getValue< 0, 0, 0>(),
2228 S.template getValue<-1, 0, 0>(), S.template getValue<-2, 0, 0>(),
2229 S.template getValue<-3, 0, 0>() );
2232 template<
typename Stencil>
2235 return difference( S.template getValue< 0, 3, 0>(), S.template getValue< 0, 2, 0>(),
2236 S.template getValue< 0, 1, 0>(), S.template getValue< 0, 0, 0>(),
2237 S.template getValue< 0,-1, 0>(), S.template getValue< 0,-2, 0>(),
2238 S.template getValue< 0,-3, 0>() );
2242 template<
typename Stencil>
2245 return difference( S.template getValue< 0, 0, 3>(), S.template getValue< 0, 0, 2>(),
2246 S.template getValue< 0, 0, 1>(), S.template getValue< 0, 0, 0>(),
2247 S.template getValue< 0, 0,-1>(), S.template getValue< 0, 0,-2>(),
2248 S.template getValue< 0, 0,-3>() );
2251 template<
typename Stencil>
2254 return crossdifference( S.template getValue< 1, 1, 0>(), S.template getValue<-1, 1, 0>(),
2255 S.template getValue< 1,-1, 0>(), S.template getValue<-1,-1, 0>(),
2256 S.template getValue< 2, 1, 0>(), S.template getValue<-2, 1, 0>(),
2257 S.template getValue< 2,-1, 0>(), S.template getValue<-2,-1, 0>(),
2258 S.template getValue< 3, 1, 0>(), S.template getValue<-3, 1, 0>(),
2259 S.template getValue< 3,-1, 0>(), S.template getValue<-3,-1, 0>(),
2260 S.template getValue< 1, 2, 0>(), S.template getValue<-1, 2, 0>(),
2261 S.template getValue< 1,-2, 0>(), S.template getValue<-1,-2, 0>(),
2262 S.template getValue< 2, 2, 0>(), S.template getValue<-2, 2, 0>(),
2263 S.template getValue< 2,-2, 0>(), S.template getValue<-2,-2, 0>(),
2264 S.template getValue< 3, 2, 0>(), S.template getValue<-3, 2, 0>(),
2265 S.template getValue< 3,-2, 0>(), S.template getValue<-3,-2, 0>(),
2266 S.template getValue< 1, 3, 0>(), S.template getValue<-1, 3, 0>(),
2267 S.template getValue< 1,-3, 0>(), S.template getValue<-1,-3, 0>(),
2268 S.template getValue< 2, 3, 0>(), S.template getValue<-2, 3, 0>(),
2269 S.template getValue< 2,-3, 0>(), S.template getValue<-2,-3, 0>(),
2270 S.template getValue< 3, 3, 0>(), S.template getValue<-3, 3, 0>(),
2271 S.template getValue< 3,-3, 0>(), S.template getValue<-3,-3, 0>() );
2274 template<
typename Stencil>
2277 return crossdifference( S.template getValue< 1, 0, 1>(), S.template getValue<-1, 0, 1>(),
2278 S.template getValue< 1, 0,-1>(), S.template getValue<-1, 0,-1>(),
2279 S.template getValue< 2, 0, 1>(), S.template getValue<-2, 0, 1>(),
2280 S.template getValue< 2, 0,-1>(), S.template getValue<-2, 0,-1>(),
2281 S.template getValue< 3, 0, 1>(), S.template getValue<-3, 0, 1>(),
2282 S.template getValue< 3, 0,-1>(), S.template getValue<-3, 0,-1>(),
2283 S.template getValue< 1, 0, 2>(), S.template getValue<-1, 0, 2>(),
2284 S.template getValue< 1, 0,-2>(), S.template getValue<-1, 0,-2>(),
2285 S.template getValue< 2, 0, 2>(), S.template getValue<-2, 0, 2>(),
2286 S.template getValue< 2, 0,-2>(), S.template getValue<-2, 0,-2>(),
2287 S.template getValue< 3, 0, 2>(), S.template getValue<-3, 0, 2>(),
2288 S.template getValue< 3, 0,-2>(), S.template getValue<-3, 0,-2>(),
2289 S.template getValue< 1, 0, 3>(), S.template getValue<-1, 0, 3>(),
2290 S.template getValue< 1, 0,-3>(), S.template getValue<-1, 0,-3>(),
2291 S.template getValue< 2, 0, 3>(), S.template getValue<-2, 0, 3>(),
2292 S.template getValue< 2, 0,-3>(), S.template getValue<-2, 0,-3>(),
2293 S.template getValue< 3, 0, 3>(), S.template getValue<-3, 0, 3>(),
2294 S.template getValue< 3, 0,-3>(), S.template getValue<-3, 0,-3>() );
2297 template<
typename Stencil>
2300 return crossdifference( S.template getValue< 0, 1, 1>(), S.template getValue< 0,-1, 1>(),
2301 S.template getValue< 0, 1,-1>(), S.template getValue< 0,-1,-1>(),
2302 S.template getValue< 0, 2, 1>(), S.template getValue< 0,-2, 1>(),
2303 S.template getValue< 0, 2,-1>(), S.template getValue< 0,-2,-1>(),
2304 S.template getValue< 0, 3, 1>(), S.template getValue< 0,-3, 1>(),
2305 S.template getValue< 0, 3,-1>(), S.template getValue< 0,-3,-1>(),
2306 S.template getValue< 0, 1, 2>(), S.template getValue< 0,-1, 2>(),
2307 S.template getValue< 0, 1,-2>(), S.template getValue< 0,-1,-2>(),
2308 S.template getValue< 0, 2, 2>(), S.template getValue< 0,-2, 2>(),
2309 S.template getValue< 0, 2,-2>(), S.template getValue< 0,-2,-2>(),
2310 S.template getValue< 0, 3, 2>(), S.template getValue< 0,-3, 2>(),
2311 S.template getValue< 0, 3,-2>(), S.template getValue< 0,-3,-2>(),
2312 S.template getValue< 0, 1, 3>(), S.template getValue< 0,-1, 3>(),
2313 S.template getValue< 0, 1,-3>(), S.template getValue< 0,-1,-3>(),
2314 S.template getValue< 0, 2, 3>(), S.template getValue< 0,-2, 3>(),
2315 S.template getValue< 0, 2,-3>(), S.template getValue< 0,-2,-3>(),
2316 S.template getValue< 0, 3, 3>(), S.template getValue< 0,-3, 3>(),
2317 S.template getValue< 0, 3,-3>(), S.template getValue< 0,-3,-3>() );
2326 #endif // OPENVDB_MATH_FINITEDIFFERENCE_HAS_BEEN_INCLUDED
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType::value_type inX(const Stencil &S, int n)
static Accessor::ValueType inXandZ(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inZ(const Stencil &S)
static ValueType difference(const ValueType &xp1, const ValueType &xm1)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType inXandY(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType::value_type inX(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType::value_type inY(const Stencil &S, int n)
static Stencil::ValueType inY(const Stencil &S)
static Stencil::ValueType::value_type inX(const Stencil &S, int n)
static Stencil::ValueType inZ(const Stencil &S)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
TemporalIntegrationScheme
Temporal integration schemes.
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xp2, const ValueType &xp1, const ValueType &xp0, const ValueType &xm1, const ValueType &xm2)
static Stencil::ValueType inY(const Stencil &S)
TemporalIntegrationScheme stringToTemporalIntegrationScheme(const std::string &s)
static Accessor::ValueType::value_type inY(const Accessor &grid, const Coord &ijk, int n)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xp1, const ValueType &xp0, const ValueType &xm1)
static Accessor::ValueType inXandZ(const Accessor &grid, const Coord &ijk)
Type Pow2(Type x)
Return x2.
static Stencil::ValueType inXandZ(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
static ValueType difference(const ValueType &xp3, const ValueType &xp2, const ValueType &xp1, const ValueType &xp0, const ValueType &xm1, const ValueType &xm2, const ValueType &xm3)
static Accessor::ValueType::value_type inY(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inXandY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inYandZ(const Accessor &grid, const Coord &ijk)
GLsizei const GLchar *const * string
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType::value_type inZ(const Stencil &S, int n)
static ValueType difference(const ValueType &xm3, const ValueType &xm2, const ValueType &xm1, const ValueType &xm0)
static Stencil::ValueType inZ(const Stencil &S)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
GLboolean GLboolean GLboolean GLboolean a
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType inXandZ(const Stencil &S)
static Stencil::ValueType inXandY(const Stencil &S)
static Stencil::ValueType::value_type inZ(const Stencil &S, int n)
#define OPENVDB_USE_VERSION_NAMESPACE
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType::value_type inZ(const Stencil &S, int n)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType inZ(const Stencil &S)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static bool difference(const bool &xp1, const bool &)
GLfloat GLfloat GLfloat v2
static Stencil::ValueType inX(const Stencil &S)
Signed (x, y, z) 32-bit integer coordinates.
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
GLfloat GLfloat GLfloat GLfloat v3
static Stencil::ValueType inX(const Stencil &S)
static Accessor::ValueType::value_type inZ(const Accessor &grid, const Coord &ijk, int n)
static ValueType difference(const ValueType &xm2, const ValueType &xm1, const ValueType &xm0)
BiasedGradientScheme
Biased Gradients are limited to non-centered differences.
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
__hostdev__ float getValue(uint32_t i) const
static Stencil::ValueType inZ(const Stencil &S)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
DScheme
Different discrete schemes used in the first derivatives.
static Stencil::ValueType inZ(const Stencil &S)
static ValueType crossdifference(const ValueType &xpyp, const ValueType &xpym, const ValueType &xmyp, const ValueType &xmym)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xp2, const ValueType &xp1, const ValueType &xm1, const ValueType &xm2)
static ValueType difference(const ValueType &xm1, const ValueType &xm0)
static Stencil::ValueType::value_type inY(const Stencil &S, int n)
static ValueType difference(const ValueType &xm3, const ValueType &xm2, const ValueType &xm1, const ValueType &xm0, const ValueType &xp1, const ValueType &xp2)
static Stencil::ValueType inY(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType::value_type inY(const Stencil &S, int n)
static Stencil::ValueType::value_type inX(const Stencil &S, int n)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType::value_type inY(const Stencil &S, int n)
static Stencil::ValueType::value_type inZ(const Stencil &S, int n)
static ValueType crossdifference(const ValueType &xp1yp1, const ValueType &xm1yp1, const ValueType &xp1ym1, const ValueType &xm1ym1, const ValueType &xp2yp1, const ValueType &xm2yp1, const ValueType &xp2ym1, const ValueType &xm2ym1, const ValueType &xp3yp1, const ValueType &xm3yp1, const ValueType &xp3ym1, const ValueType &xm3ym1, const ValueType &xp1yp2, const ValueType &xm1yp2, const ValueType &xp1ym2, const ValueType &xm1ym2, const ValueType &xp2yp2, const ValueType &xm2yp2, const ValueType &xp2ym2, const ValueType &xm2ym2, const ValueType &xp3yp2, const ValueType &xm3yp2, const ValueType &xp3ym2, const ValueType &xm3ym2, const ValueType &xp1yp3, const ValueType &xm1yp3, const ValueType &xp1ym3, const ValueType &xm1ym3, const ValueType &xp2yp3, const ValueType &xm2yp3, const ValueType &xp2ym3, const ValueType &xm2ym3, const ValueType &xp3yp3, const ValueType &xm3yp3, const ValueType &xp3ym3, const ValueType &xm3ym3)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType::value_type inZ(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xm3, const ValueType &xm2, const ValueType &xm1, const ValueType &xm0, const ValueType &xp1, const ValueType &xp2)
static Accessor::ValueType::value_type inZ(const Accessor &grid, const Coord &ijk, int n)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType::value_type inY(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
void OIIO_UTIL_API to_lower(std::string &a)
DScheme stringToDScheme(const std::string &s)
static ValueType difference(const ValueType &xp3, const ValueType &xp2, const ValueType &xp1, const ValueType &xm1, const ValueType &xm2, const ValueType &xm3)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
std::string dsSchemeToString(DScheme dss)
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType::value_type inY(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType::value_type inX(const Accessor &grid, const Coord &ijk, int n)
static ValueType difference(const ValueType &xp3, const ValueType &xp2, const ValueType &xp1, const ValueType &xp0, const ValueType &xm1, const ValueType &xm2)
static Accessor::ValueType inXandY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType inX(const Stencil &S)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType::value_type inX(const Accessor &grid, const Coord &ijk, int n)
void trim(std::string &s)
static Accessor::ValueType::value_type inX(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static ValueType difference(const ValueType &xp3, const ValueType &xp2, const ValueType &xp1, const ValueType &xp0, const ValueType &xm1, const ValueType &xm2)
static Stencil::ValueType inZ(const Stencil &S)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inXandY(const Stencil &S)
GLboolean GLboolean GLboolean b
static Stencil::ValueType::value_type inZ(const Stencil &S, int n)
static Stencil::ValueType inZ(const Stencil &S)
static ValueType difference(const ValueType &xp1, const ValueType &xm1)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xp3, const ValueType &xp2, const ValueType &xp1, const ValueType &xp0)
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType inZ(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
std::string temporalIntegrationSchemeToMenuName(TemporalIntegrationScheme tis)
static Stencil::ValueType inY(const Stencil &S)
static Stencil::ValueType inYandZ(const Stencil &S)
std::string temporalIntegrationSchemeToString(TemporalIntegrationScheme tis)
static Accessor::ValueType inXandY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType inXandZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType::value_type inX(const Accessor &grid, const Coord &ijk, int n)
static Stencil::ValueType inZ(const Stencil &S)
std::string biasedGradientSchemeToMenuName(BiasedGradientScheme bgs)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inYandZ(const Stencil &S)
static Stencil::ValueType inX(const Stencil &S)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
const Type & Min(const Type &a, const Type &b)
Return the minimum of two values.
static Accessor::ValueType inXandY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inXandZ(const Stencil &S)
static Stencil::ValueType inYandZ(const Stencil &S)
static Accessor::ValueType::value_type inY(const Accessor &grid, const Coord &ijk, int n)
static Stencil::ValueType inY(const Stencil &S)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType::value_type inX(const Stencil &S, int n)
static Stencil::ValueType inY(const Stencil &S)
DDScheme
Different discrete schemes used in the second derivatives.
static Stencil::ValueType::value_type inX(const Stencil &S, int n)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType inX(const Stencil &S)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
std::string dsSchemeToMenuName(DScheme dss)
static Accessor::ValueType::value_type inZ(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inXandZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xp2, const ValueType &xp1, const ValueType &xp0)
static Accessor::ValueType::value_type inZ(const Accessor &grid, const Coord &ijk, int n)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
static Stencil::ValueType::value_type inY(const Stencil &S, int n)
static Accessor::ValueType inYandZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
ImageBuf OIIO_API zero(ROI roi, int nthreads=0)
static ValueType crossdifference(const ValueType &xp2yp2, const ValueType &xp2yp1, const ValueType &xp2ym1, const ValueType &xp2ym2, const ValueType &xp1yp2, const ValueType &xp1yp1, const ValueType &xp1ym1, const ValueType &xp1ym2, const ValueType &xm2yp2, const ValueType &xm2yp1, const ValueType &xm2ym1, const ValueType &xm2ym2, const ValueType &xm1yp2, const ValueType &xm1yp1, const ValueType &xm1ym1, const ValueType &xm1ym2)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
BiasedGradientScheme stringToBiasedGradientScheme(const std::string &s)
static Accessor::ValueType inY(const Accessor &grid, const Coord &ijk)
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
std::string biasedGradientSchemeToString(BiasedGradientScheme bgs)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
const Type & Max(const Type &a, const Type &b)
Return the maximum of two values.
static Accessor::ValueType inYandZ(const Accessor &grid, const Coord &ijk)
static Accessor::ValueType inZ(const Accessor &grid, const Coord &ijk)
static ValueType difference(const ValueType &xp1, const ValueType &xp0)
static Stencil::ValueType inZ(const Stencil &S)
static Accessor::ValueType inX(const Accessor &grid, const Coord &ijk)
Real GodunovsNormSqrd(bool isOutside, Real dP_xm, Real dP_xp, Real dP_ym, Real dP_yp, Real dP_zm, Real dP_zp)
static Stencil::ValueType inX(const Stencil &S)
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.
static Accessor::ValueType inYandZ(const Accessor &grid, const Coord &ijk)