VTK  9.4.20250106
PyrC2Gradient.h
Go to the documentation of this file.
1const RealT ZERO = 0.;
2const RealT HALF = 0.5;
3const RealT FOURTH = 0.25;
4const RealT NINTH = 1. / 9.;
5const RealT FOURNINTHS = 4. / 9.;
6const RealT ONE = 1.;
7const RealT TWO = 2.;
8const RealT FOUR = 4.;
9const RealT EIGHT = 9.;
10const RealT TWENTYSEVEN = 27.;
11
12const RealT K1 = -FOURTH;
13const RealT K5 = ONE;
14const RealT K6 = -HALF;
15const RealT K10 = -ONE;
16const RealT K14 = ONE;
17const RealT K15A = TWENTYSEVEN / EIGHT;
18const RealT K15B = -TWENTYSEVEN / EIGHT;
19
20// Evaluate common rr,ss,tt multiplication terms
21RealT r2 = rr * rr;
22RealT s2 = ss * ss;
23RealT t2 = tt * tt;
24RealT rs = rr * ss;
25RealT rt = rr * tt;
26RealT st = ss * tt;
27RealT r2s = r2 * ss;
28RealT rs2 = rr * s2;
29RealT r2s2 = r2 * s2;
30
31// Evaluate numerical values of (tt-1), (tt-1)^2, (tt-1)^3, and (tt-1)^4
32RealT tm = tt - ONE;
33RealT tm2 = tm * tm;
34RealT tm3 = tm2 * tm;
35RealT tm4 = tm3 * tm;
36
37// Evaluate numerical value of 1/(tt-1)
38RealT mt = abs(tm) > eps ? ONE / tm : ZERO;
39RealT m2t = abs(tm2) > eps ? ONE / tm2 : ZERO;
40RealT m3t = abs(tm3) > eps ? ONE / tm3 : ZERO;
41RealT m4t = abs(tm4) > eps ? ONE / tm4 : ZERO;
42
43// BASELINE DHDR
44basisGradient[0] = K1 * (rs * mt - rr - ss + tt + (ss * mt - ONE) * (rr + ss - ONE) - ONE);
45basisGradient[3] = K1 * (rs * mt - rr + ss - tt + (-ss * mt + ONE) * (-rr + ss - ONE) + ONE);
46basisGradient[6] = K1 * (-rs * mt - rr - ss - tt + (ss * mt + ONE) * (-rr - ss - ONE) + ONE);
47basisGradient[9] = K1 * (-rs * mt - rr + ss + tt + (-ss * mt - ONE) * (rr - ss - ONE) - ONE);
49basisGradient[15] = K6 * (-TWO * rs * mt + TWO * rr);
50basisGradient[18] = K6 * (s2 * mt - tt + ONE);
51basisGradient[21] = K6 * (TWO * rs * mt + TWO * rr);
52basisGradient[24] = K6 * (-s2 * mt + tt - ONE);
53basisGradient[27] = K10 * (ss + ss * mt - tt);
54basisGradient[30] = K10 * (-ss - ss * mt + tt);
55basisGradient[33] = K10 * (ss + ss * mt + tt);
56basisGradient[36] = K10 * (-ss - ss * mt - tt);
57basisGradient[39] = K14 * (TWO * rs2 * m2t - TWO * rr);
58basisGradient[42] = K15A * (TWO * rs + TWO * rs * mt - TWO * rs2 * mt - TWO * rs2 * m2t);
59basisGradient[45] = K15B * (TWO * rs2 * mt + TWO * rs2 * m2t - TWO * rt + s2 + s2 * mt + tt - t2);
60basisGradient[48] = K15B * (TWO * rs + TWO * rs * mt + TWO * rs2 * mt + TWO * rs2 * m2t);
61basisGradient[51] = K15A * (-TWO * rs2 * mt - TWO * rs2 * m2t + TWO * rt + s2 + s2 * mt + tt - t2);
62
63// BASELINE DHDS
64
65basisGradient[1] = K1 * (rs * mt - rr - ss + tt + (rr * mt - ONE) * (rr + ss - ONE) - ONE);
66basisGradient[4] = K1 * (-rs * mt + rr - ss + tt + (-rr * mt - ONE) * (-rr + ss - ONE) - ONE);
67basisGradient[7] = K1 * (-rs * mt - rr - ss - tt + (rr * mt + ONE) * (-rr - ss - ONE) + ONE);
68basisGradient[10] = K1 * (rs * mt + rr - ss - tt + (-rr * mt + ONE) * (rr - ss - ONE) + ONE);
70basisGradient[16] = K6 * (-r2 * mt + tt - ONE);
71basisGradient[19] = K6 * (TWO * rs * mt + TWO * ss);
72basisGradient[22] = K6 * (r2 * mt - tt + ONE);
73basisGradient[25] = K6 * (-TWO * rs * mt + TWO * ss);
74basisGradient[28] = K10 * (rr + rr * mt - tt);
75basisGradient[31] = K10 * (-rr - rr * mt - tt);
76basisGradient[34] = K10 * (rr + rr * mt + tt);
77basisGradient[37] = K10 * (-rr - rr * mt + tt);
78basisGradient[40] = K14 * (TWO * r2s * m2t - TWO * ss);
79basisGradient[43] = K15A * (-TWO * r2s * mt - TWO * r2s * m2t + r2 + r2 * mt + TWO * st + tt - t2);
80basisGradient[46] = K15B * (TWO * rs + TWO * rs * mt + TWO * r2s * mt + TWO * r2s * m2t);
81basisGradient[49] = K15B * (TWO * r2s * mt + TWO * r2s * m2t + r2 + r2 * mt - TWO * st + tt - t2);
82basisGradient[52] = K15A * (TWO * rs + TWO * rs * mt - TWO * r2s * mt - TWO * r2s * m2t);
83
84// BASELINE DHDT
85
86basisGradient[2] = K1 * (-rs * m2t + ONE) * (rr + ss - ONE);
87basisGradient[5] = K1 * (rs * m2t + ONE) * (-rr + ss - ONE);
88basisGradient[8] = K1 * (-rs * m2t + ONE) * (-rr - ss - ONE);
89basisGradient[11] = K1 * (rs * m2t + ONE) * (rr - ss - ONE);
90basisGradient[14] = K5 * (FOUR * tt - ONE);
91basisGradient[17] = K6 * (r2s * m2t + ss - TWO * tt + TWO);
92basisGradient[20] = K6 * (-rs2 * m2t - rr - TWO * tt + TWO);
93basisGradient[23] = K6 * (-r2s * m2t - ss - TWO * tt + TWO);
94basisGradient[26] = K6 * (rs2 * m2t + rr - TWO * tt + TWO);
95basisGradient[29] = K10 * (-rs * m2t - rr - ss + TWO * tt - ONE);
96basisGradient[32] = K10 * (rs * m2t + rr - ss + TWO * tt - ONE);
97basisGradient[35] = K10 * (-rs * m2t + rr + ss + TWO * tt - ONE);
98basisGradient[38] = K10 * (rs * m2t - rr + ss + TWO * tt - ONE);
99basisGradient[41] = K14 * (-TWO * r2s2 * m3t + TWO * tt - TWO);
100basisGradient[44] =
101 K15A * (-r2s * m2t - r2s2 * (-TWO * tt + TWO) * m4t + r2s2 * m2t - TWO * st + ss + s2);
102basisGradient[47] =
103 K15B * (-rs2 * m2t - TWO * rt + rr + r2s2 * (-TWO * tt + TWO) * m4t - r2s2 * m2t - r2);
104basisGradient[50] =
105 K15B * (-r2s * m2t + r2s2 * (-TWO * tt + TWO) * m4t - r2s2 * m2t - TWO * st + ss - s2);
106basisGradient[53] =
107 K15A * (-rs2 * m2t - TWO * rt + rr - r2s2 * (-TWO * tt + TWO) * m4t + r2s2 * m2t + r2);
108
109// MODIFICATIONS TO DHDR
110
111basisGradient[0] =
113basisGradient[3] =
115basisGradient[6] =
117basisGradient[9] =
129
130// MODIFICATIONS TO DHDS
131
132basisGradient[1] =
134basisGradient[4] =
136basisGradient[7] =
138basisGradient[10] =
150
151// MODIFICATIONS TO DHDT
152
153basisGradient[2] =
155basisGradient[5] =
157basisGradient[8] =
159basisGradient[11] =
const RealT K1
RealT r2
const RealT K14
RealT m2t
RealT tm4
RealT st
const RealT K5
RealT r2s2
const RealT NINTH
const RealT EIGHT
const RealT K15A
const RealT FOUR
const RealT FOURTH
RealT t2
RealT m3t
RealT tm
RealT rs2
RealT tm2
const RealT TWENTYSEVEN
const RealT TWO
basisGradient[0]
RealT r2s
const RealT ONE
const RealT K15B
RealT s2
RealT m4t
const RealT ZERO
RealT mt
const RealT K6
const RealT HALF
const RealT FOURNINTHS
RealT rt
const RealT K10
RealT rs
RealT tm3