VTK  9.7.20260922
HexCnBasis.h
Go to the documentation of this file.
1// Bernstein-Bezier basis functions of arbitrary order on the reference hexahedron.
2//
3// The basis is the tensor product of the 1-d Bernstein polynomials along each
4// parametric axis; see EdgeCnBasis.h for their definition and for why the
5// powers and binomial coefficients are accumulated rather than computed with
6// pow(). The order along each axis is independent.
7WORKSPACE(RealT, rtmp, order[0] + 1);
8WORKSPACE(RealT, stmp, order[1] + 1);
9WORKSPACE(RealT, ttmp, order[2] + 1);
10
11{
12 RealT xx = 0.5 * (rr + 1.);
13 RealT yy = 1. - xx;
14 WORKSPACE(RealT, xpow, order[0] + 1);
15 WORKSPACE(RealT, ypow, order[0] + 1);
16 xpow[0] = 1.;
17 for (int kk = 1; kk <= order[0]; ++kk)
18 {
19 xpow[kk] = xpow[kk - 1] * xx;
20 }
21 ypow[order[0]] = 1.;
22 for (int kk = order[0] - 1; kk >= 0; --kk)
23 {
24 ypow[kk] = ypow[kk + 1] * yy;
25 }
26 RealT coeff = 1.;
27 for (int kk = 0; kk <= order[0]; ++kk)
28 {
29 rtmp[kk] = coeff * xpow[kk] * ypow[kk];
30 coeff = coeff * RealT(order[0] - kk) / RealT(kk + 1);
31 }
32}
33{
34 RealT xx = 0.5 * (ss + 1.);
35 RealT yy = 1. - xx;
36 WORKSPACE(RealT, xpow, order[1] + 1);
37 WORKSPACE(RealT, ypow, order[1] + 1);
38 xpow[0] = 1.;
39 for (int kk = 1; kk <= order[1]; ++kk)
40 {
41 xpow[kk] = xpow[kk - 1] * xx;
42 }
43 ypow[order[1]] = 1.;
44 for (int kk = order[1] - 1; kk >= 0; --kk)
45 {
46 ypow[kk] = ypow[kk + 1] * yy;
47 }
48 RealT coeff = 1.;
49 for (int kk = 0; kk <= order[1]; ++kk)
50 {
51 stmp[kk] = coeff * xpow[kk] * ypow[kk];
52 coeff = coeff * RealT(order[1] - kk) / RealT(kk + 1);
53 }
54}
55{
56 RealT xx = 0.5 * (tt + 1.);
57 RealT yy = 1. - xx;
58 WORKSPACE(RealT, xpow, order[2] + 1);
59 WORKSPACE(RealT, ypow, order[2] + 1);
60 xpow[0] = 1.;
61 for (int kk = 1; kk <= order[2]; ++kk)
62 {
63 xpow[kk] = xpow[kk - 1] * xx;
64 }
65 ypow[order[2]] = 1.;
66 for (int kk = order[2] - 1; kk >= 0; --kk)
67 {
68 ypow[kk] = ypow[kk + 1] * yy;
69 }
70 RealT coeff = 1.;
71 for (int kk = 0; kk <= order[2]; ++kk)
72 {
73 ttmp[kk] = coeff * xpow[kk] * ypow[kk];
74 coeff = coeff * RealT(order[2] - kk) / RealT(kk + 1);
75 }
76}
77
78// Compute the tensor product of the 1-dimensional basis functions:
79int idx = 0;
80for (int qq = 0; qq <= order[2]; ++qq)
81{
82 for (int pp = 0; pp <= order[1]; ++pp)
83 {
84 for (int oo = 0; oo <= order[0]; ++oo)
85 {
86 basis[idx++] = rtmp[oo] * stmp[pp] * ttmp[qq];
87 }
88 }
89}
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
WORKSPACE(RealT, rtmp, order[0]+1)
basis[0]
Definition CellC0Basis.h:1
@ order
Definition vtkX3D.h:441