VTK  9.7.20261001
WdgCnGradient.h
Go to the documentation of this file.
1// Gradients of the arbitrary-order Lagrange interpolants on the wedge.
2//
3// See WdgCnBasis.h for the interpolants. The r- and s-derivatives come from the
4// triangle factor (TriCnGradient.h) scaled by the edge factor, and the
5// t-derivative from the edge factor (EdgeCnGradient.h) scaled by the triangle.
6RealT nn = RealT(order[0]);
7RealT invspcT = RealT(order[2]) / 2.;
8
9WORKSPACE(RealT, bary, 3);
10bary[0] = 1. - rr - ss;
11bary[1] = rr;
12bary[2] = ss;
13
14WORKSPACE(RealT, pval, 3 * (order[0] + 1));
15WORKSPACE(RealT, pder, 3 * (order[0] + 1));
16for (int kk = 0; kk < 3; ++kk)
17{
18 int base = kk * (order[0] + 1);
19 pval[base] = 1.;
20 pder[base] = 0.;
21 for (int mm = 1; mm <= order[0]; ++mm)
22 {
23 RealT rmm = RealT(mm);
24 RealT factor = nn * bary[kk] - (rmm - 1.);
25 pder[base + mm] = (pder[base + mm - 1] * factor + pval[base + mm - 1] * nn) / rmm;
26 pval[base + mm] = pval[base + mm - 1] * factor / rmm;
27 }
28}
29
30WORKSPACE(RealT, ttmp, order[2] + 1);
31WORKSPACE(RealT, dttmp, order[2] + 1);
32for (int ll = 0; ll <= order[2]; ++ll)
33{
34 RealT termSum = 0.;
35 ttmp[ll] = 1.;
36 for (int kk = 0; kk <= order[2]; ++kk)
37 {
38 if (kk == ll)
39 {
40 continue;
41 }
42 ttmp[ll] *= (tt * invspcT - (RealT(kk) - invspcT)) / RealT(ll - kk);
43 RealT term = invspcT / RealT(ll - kk);
44 for (int ii = 0; ii <= order[2]; ++ii)
45 {
46 if (ii == kk || ii == ll)
47 {
48 continue;
49 }
50 term *= (tt * invspcT - (RealT(ii) - invspcT)) / RealT(ll - ii);
51 }
52 termSum += term;
53 }
54 dttmp[ll] = termSum;
55}
56
57int idx = 0;
58for (int it = 0; it <= order[2]; ++it)
59{
60 for (int i2 = 0; i2 <= order[0]; ++i2)
61 {
62 for (int i1 = 0; i1 <= order[0] - i2; ++i1)
63 {
64 int i0 = order[0] - i1 - i2;
65 RealT p0 = pval[i0];
66 RealT p1 = pval[(order[0] + 1) + i1];
67 RealT p2 = pval[2 * (order[0] + 1) + i2];
68 RealT d0 = pder[i0];
69 RealT d1 = pder[(order[0] + 1) + i1];
70 RealT d2 = pder[2 * (order[0] + 1) + i2];
71 basisGradient[idx++] = ttmp[it] * p2 * (d1 * p0 - d0 * p1); // ∂/∂r
72 basisGradient[idx++] = ttmp[it] * p1 * (d2 * p0 - d0 * p2); // ∂/∂s
73 basisGradient[idx++] = dttmp[it] * p0 * p1 * p2; // ∂/∂t
74 }
75 }
76}
int idx
Definition HexCnBasis.h:79
bary[0]
Definition TetCnBasis.h:15
WORKSPACE(RealT, bary, 3)
basisGradient[0]
RealT invspcT
Definition HexCnBasis.h:8
RealT nn
Definition TetCnBasis.h:7
int term
Definition HexGnBasis.h:23