VTK  9.7.20260922
WdgCnBasis.h
Go to the documentation of this file.
1// Bernstein-Bezier basis functions of arbitrary order on the reference wedge.
2//
3// A wedge is the product of a triangle (the r- and s-axes) with an edge (the
4// t-axis), so its basis is the product of the triangle's barycentric Bernstein
5// polynomials - see TriCnBasis.h - with the edge's 1-d ones - see
6// EdgeCnBasis.h. The two factors may have different orders, but the triangle
7// has a single total degree shared by its two axes: order[0] is the order of
8// the triangular cross-section and order[2] the order along t.
9//
10// The degrees of freedom are enumerated with the r-axis varying fastest and t
11// slowest, so the triangle's degrees of freedom repeat once per control point
12// along t.
13RealT nfact = 1.;
14for (int mm = 2; mm <= order[0]; ++mm)
15{
16 nfact *= RealT(mm);
17}
18
19WORKSPACE(RealT, bary, 3);
20bary[0] = 1. - rr - ss;
21bary[1] = rr;
22bary[2] = ss;
23
24WORKSPACE(RealT, wval, 3 * (order[0] + 1));
25for (int kk = 0; kk < 3; ++kk)
26{
27 int base = kk * (order[0] + 1);
28 wval[base] = 1.;
29 for (int mm = 1; mm <= order[0]; ++mm)
30 {
31 wval[base + mm] = wval[base + mm - 1] * bary[kk] / RealT(mm);
32 }
33}
34
35WORKSPACE(RealT, ttmp, order[2] + 1);
36{
37 RealT xx = 0.5 * (tt + 1.);
38 RealT yy = 1. - xx;
39 WORKSPACE(RealT, xpow, order[2] + 1);
40 WORKSPACE(RealT, ypow, order[2] + 1);
41 xpow[0] = 1.;
42 for (int kk = 1; kk <= order[2]; ++kk)
43 {
44 xpow[kk] = xpow[kk - 1] * xx;
45 }
46 ypow[order[2]] = 1.;
47 for (int kk = order[2] - 1; kk >= 0; --kk)
48 {
49 ypow[kk] = ypow[kk + 1] * yy;
50 }
51 RealT coeff = 1.;
52 for (int kk = 0; kk <= order[2]; ++kk)
53 {
54 ttmp[kk] = coeff * xpow[kk] * ypow[kk];
55 coeff = coeff * RealT(order[2] - kk) / RealT(kk + 1);
56 }
57}
58
59int idx = 0;
60for (int it = 0; it <= order[2]; ++it)
61{
62 for (int i2 = 0; i2 <= order[0]; ++i2)
63 {
64 for (int i1 = 0; i1 <= order[0] - i2; ++i1)
65 {
66 int i0 = order[0] - i1 - i2;
67 basis[idx++] =
68 nfact * wval[i0] * wval[(order[0] + 1) + i1] * wval[2 * (order[0] + 1) + i2] * ttmp[it];
69 }
70 }
71}
ypow[order[0]]
Definition EdgeCnBasis.h:27
xpow[0]
Definition EdgeCnBasis.h:22
RealT xx
Definition EdgeCnBasis.h:16
RealT coeff
Definition EdgeCnBasis.h:34
RealT yy
Definition EdgeCnBasis.h:17
int idx
Definition HexCnBasis.h:79
RealT nfact
Definition TetCnBasis.h:8
bary[0]
Definition TetCnBasis.h:15
WORKSPACE(RealT, bary, 3)
basis[0]
Definition CellC0Basis.h:1