GCC Code Coverage Report


Directory: Bembel/src/
File: Bembel/src/Spline/Basis.hpp
Date: 2024-09-30 07:01:38
Exec Total Coverage
Lines: 129 133 97.0%
Functions: 786 796 98.7%
Branches: 172 240 71.7%

Line Branch Exec Source
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2022 see <http://www.bembel.eu>
4 //
5 // It was written as part of a cooperation of J. Doelz, H. Harbrecht, S. Kurz,
6 // M. Multerer, S. Schoeps, and F. Wolf at Technische Universitaet Darmstadt,
7 // Universitaet Basel, and Universita della Svizzera italiana, Lugano. This
8 // source code is subject to the GNU General Public License version 3 and
9 // provided WITHOUT ANY WARRANTY, see <http://www.bembel.eu> for further
10 // information.
11
12 #ifndef BEMBEL_SRC_SPLINE_BASIS_HPP_
13 #define BEMBEL_SRC_SPLINE_BASIS_HPP_
14
15 namespace Bembel {
16 /**
17 * \ingroup Spline
18 * \brief The Basis namespace contains classes and functions that are to be
19 * used as an interface between the BEM code and the functions in the Spl
20 * namespace.
21 */
22 namespace Basis {
23
24 // These typedefs are required for the superspace to store the correct functions
25 template <typename Scalar>
26 using funptr_voidOut_scalarptrScalarDoubleIn =
27 void (*)(Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *, Scalar, double);
28 template <typename Scalar>
29 using funptr_voidOut_scalarptrScalarVec2In = void (*)(
30 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *, Scalar, Eigen::Vector2d);
31 template <typename Scalar>
32 using funptr_voidOut_scalarptrScalarVec2Vec2In =
33 void (*)(Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *, Scalar,
34 Eigen::Vector2d, Eigen::Vector2d);
35
36 // These typedefs are a convenience to make the above human-readable
37 template <typename Scalar>
38 using funptr_phi = funptr_voidOut_scalarptrScalarDoubleIn<Scalar>;
39 template <typename Scalar>
40 using funptr_phidx = funptr_voidOut_scalarptrScalarDoubleIn<Scalar>;
41 template <typename Scalar>
42 using funptr_phiphi = funptr_voidOut_scalarptrScalarVec2In<Scalar>;
43 template <typename Scalar>
44 using funptr_phiphidx = funptr_voidOut_scalarptrScalarVec2In<Scalar>;
45 template <typename Scalar>
46 using funptr_phiphidy = funptr_voidOut_scalarptrScalarVec2In<Scalar>;
47 template <typename Scalar>
48 using funptr_phitimesphi = funptr_voidOut_scalarptrScalarVec2Vec2In<Scalar>;
49 template <typename Scalar>
50 using funptr_divphitimesdivphi =
51 funptr_voidOut_scalarptrScalarVec2Vec2In<Scalar>;
52
53 /**
54 * \ingroup Spline
55 * \brief evaluates the 1D basis at x weighted with a quadrature weight w
56 **/
57 template <int P, typename Scalar>
58 27564 inline void phi_(Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c, Scalar w,
59 double x) {
60 27564 constexpr int I = P + 1;
61 double base[I];
62
1/2
✓ Branch 1 taken 418 times.
✗ Branch 2 not taken.
27564 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, base, x);
63
6/6
✓ Branch 1 taken 15141 times.
✓ Branch 2 taken 3801 times.
✓ Branch 3 taken 15141 times.
✓ Branch 4 taken 12831 times.
✓ Branch 5 taken 3801 times.
✓ Branch 6 taken 951 times.
65448 for (int i = 0; i < I; i++) (*c)(i) += w * base[i];
64 55128 return;
65 }
66
67 /**
68 * \ingroup Spline
69 * \brief evaluates the derivative of phi
70 **/
71 template <int P, typename Scalar>
72 1240 inline void phi_dx_(Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c, Scalar w,
73 double x) {
74 1240 constexpr int I = P + 1;
75 double base[I];
76
1/2
✓ Branch 1 taken 418 times.
✗ Branch 2 not taken.
1240 PSpecificShapeFunctionHandler<I - 1>::evalDerBasis(I - 1, base, x);
77
6/6
✓ Branch 1 taken 2530 times.
✓ Branch 2 taken 2890 times.
✓ Branch 3 taken 2530 times.
✓ Branch 4 taken 220 times.
✓ Branch 5 taken 2890 times.
✓ Branch 6 taken 400 times.
12080 for (int i = 0; i < I; i++) (*c)(i) += w * base[i];
78 2480 return;
79 }
80
81 /**
82 * \ingroup Spline
83 * \brief evaluates the 2D tensor product basis at a point a in [0,1]^2
84 **/
85 template <int P, typename Scalar>
86 2011522 inline void phiphi_(Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c, Scalar w,
87 Eigen::Vector2d a) {
88 2011522 constexpr int I = P + 1;
89 double X[I], Y[I];
90
2/4
✓ Branch 1 taken 1005761 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7478 times.
✗ Branch 5 not taken.
2011522 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, X, a(0));
91
2/4
✓ Branch 1 taken 1005761 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7478 times.
✗ Branch 5 not taken.
2011522 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, Y, a(1));
92
93
2/2
✓ Branch 0 taken 1159370 times.
✓ Branch 1 taken 1005761 times.
4330262 for (int iy = 0; iy < I; iy++)
94
5/6
✓ Branch 1 taken 1319220 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2129508 times.
✓ Branch 4 taken 907198 times.
✓ Branch 6 taken 810288 times.
✓ Branch 7 taken 252172 times.
6577756 for (int ix = 0; ix < I; ix++) (*c)(iy * I + ix) += w * X[ix] * Y[iy];
95
96 4023044 return;
97 }
98
99 /**
100 * \ingroup Spline
101 * \brief evaluates the x-derivative of the 2D tensor product basis at a
102 * point a in [0,1]^2
103 **/
104 template <int P, typename Scalar>
105 10438312 inline void phiphi_dx_(Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c, Scalar w,
106 Eigen::Vector2d a) {
107 10438312 constexpr int I = P + 1;
108 double dX[I], Y[I];
109
2/4
✓ Branch 1 taken 5219156 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
10438312 PSpecificShapeFunctionHandler<I - 1>::evalDerBasis(I - 1, dX, a(0));
110
2/4
✓ Branch 1 taken 5219156 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
10438312 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, Y, a(1));
111
112
2/2
✓ Branch 0 taken 10439072 times.
✓ Branch 1 taken 5219156 times.
31316456 for (int iy = 0; iy < I; iy++)
113
5/6
✓ Branch 1 taken 10264698 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20889544 times.
✓ Branch 4 taken 5128074 times.
✓ Branch 6 taken 10624846 times.
✓ Branch 7 taken 5310998 times.
62657232 for (int ix = 0; ix < I; ix++) (*c)(iy * I + ix) += w * dX[ix] * Y[iy];
114
115 20876624 return;
116 }
117
118 /**
119 * \ingroup Spline
120 * \brief evaluates the y-derivative of the 2D tensor product basis at a
121 * point a in [0,1]^2
122 **/
123 template <int P, typename Scalar>
124 10438312 inline void phiphi_dy_(Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c, Scalar w,
125 Eigen::Vector2d a) {
126 10438312 constexpr int I = P + 1;
127 double X[I], dY[I];
128
2/4
✓ Branch 1 taken 5219156 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
10438312 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, X, a(0));
129
2/4
✓ Branch 1 taken 5219156 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
10438312 PSpecificShapeFunctionHandler<I - 1>::evalDerBasis(I - 1, dY, a(1));
130
131
2/2
✓ Branch 0 taken 10439072 times.
✓ Branch 1 taken 5219156 times.
31316456 for (int iy = 0; iy < I; iy++)
132
5/6
✓ Branch 1 taken 10264698 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20889544 times.
✓ Branch 4 taken 5128074 times.
✓ Branch 6 taken 10624846 times.
✓ Branch 7 taken 5310998 times.
62657232 for (int ix = 0; ix < I; ix++) (*c)(iy * I + ix) += w * X[ix] * dY[iy];
133 20876624 return;
134 }
135
136 /**
137 * \ingroup Spline
138 * \brief evaluates the interaction of two phiphis, one at xi and one at
139 * eta. Used for e.g. gram matrices.
140 **/
141 template <int P, typename Scalar>
142 21506836 void Phi_times_Phi_(Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *c,
143 Scalar w, Eigen::Vector2d xi, Eigen::Vector2d eta) {
144 21506836 constexpr int I = P + 1;
145 18341852 Scalar a[I * I];
146 double b[I * I], X[I], Y[I];
147
148
2/4
✓ Branch 1 taken 10753418 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 38 times.
✗ Branch 5 not taken.
21506836 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, X, xi(0));
149
2/4
✓ Branch 1 taken 10753418 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 38 times.
✗ Branch 5 not taken.
21506836 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, Y, xi(1));
150
151
2/2
✓ Branch 0 taken 19129700 times.
✓ Branch 1 taken 10753418 times.
59766236 for (int iy = 0; iy < I; iy++)
152
4/4
✓ Branch 0 taken 1585944 times.
✓ Branch 1 taken 1582756 times.
✓ Branch 2 taken 34301640 times.
✓ Branch 3 taken 17546944 times.
110034568 for (int ix = 0; ix < I; ix++) a[iy * I + ix] = w * X[ix] * Y[iy];
153
154
2/4
✓ Branch 1 taken 10753418 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 38 times.
✗ Branch 5 not taken.
21506836 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, X, eta(0));
155
2/4
✓ Branch 1 taken 10753418 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 38 times.
✗ Branch 5 not taken.
21506836 PSpecificShapeFunctionHandler<I - 1>::evalBasis(I - 1, Y, eta(1));
156
157
2/2
✓ Branch 0 taken 19129700 times.
✓ Branch 1 taken 10753418 times.
59766236 for (int iy = 0; iy < I; iy++)
158
2/2
✓ Branch 0 taken 35887584 times.
✓ Branch 1 taken 19129700 times.
110034568 for (int ix = 0; ix < I; ix++) b[iy * I + ix] = X[ix] * Y[iy];
159
160
2/2
✓ Branch 0 taken 35887584 times.
✓ Branch 1 taken 10753418 times.
93282004 for (int i = 0; i < (I * I); i++)
161
6/6
✓ Branch 1 taken 2500428 times.
✓ Branch 2 taken 135725172 times.
✓ Branch 3 taken 2500428 times.
✓ Branch 4 taken 1585944 times.
✓ Branch 5 taken 135725172 times.
✓ Branch 6 taken 34301640 times.
348226368 for (int j = 0; j < (I * I); j++) (*c)(i, j) += a[i] * b[j];
162
163 43013672 return;
164 }
165
166 /**
167 * \ingroup Spline
168 * \brief same as above, just using the divergence
169 **/
170 template <int P, typename Scalar>
171 5127248 void Div_Phi_times_Div_Phi_(
172 Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *c, Scalar weight,
173 Eigen::Vector2d xi, Eigen::Vector2d eta) {
174 5127248 constexpr int I = P + 1;
175 5127248 constexpr int I2 = I * I;
176
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> a_dx(I2);
177
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 a_dx.setZero();
178
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> a_dy(I2);
179
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 a_dy.setZero();
180
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 Eigen::VectorXd b_dx(I2);
181
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 b_dx.setZero();
182
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 Eigen::VectorXd b_dy(I2);
183
1/2
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
5127248 b_dy.setZero();
184
185
2/4
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2563624 times.
✗ Branch 5 not taken.
5127248 phiphi_dx_<P>(&a_dx, weight, xi);
186
2/4
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2563624 times.
✗ Branch 5 not taken.
5127248 phiphi_dy_<P>(&a_dy, weight, xi);
187
2/4
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2563624 times.
✗ Branch 5 not taken.
5127248 phiphi_dx_<P>(&b_dx, 1., eta);
188
2/4
✓ Branch 1 taken 2563624 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2563624 times.
✗ Branch 5 not taken.
5127248 phiphi_dy_<P>(&b_dy, 1., eta);
189
190
2/2
✓ Branch 0 taken 10260956 times.
✓ Branch 1 taken 2563624 times.
25649160 for (int i = 0; i < I2; ++i)
191
8/10
✓ Branch 1 taken 42851636 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 42851636 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 917146 times.
✓ Branch 8 taken 41934490 times.
✓ Branch 9 taken 917146 times.
✓ Branch 10 taken 3310 times.
✓ Branch 11 taken 41934490 times.
✓ Branch 12 taken 10257646 times.
106225184 for (int j = 0; j < I2; ++j) (*c)(i, j) += a_dx[i] * b_dx[j];
192
2/2
✓ Branch 0 taken 10260956 times.
✓ Branch 1 taken 2563624 times.
25649160 for (int i = 0; i < I2; ++i)
193
8/10
✓ Branch 1 taken 42851636 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 42851636 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 917146 times.
✓ Branch 8 taken 41934490 times.
✓ Branch 9 taken 917146 times.
✓ Branch 10 taken 3310 times.
✓ Branch 11 taken 41934490 times.
✓ Branch 12 taken 10257646 times.
106225184 for (int j = 0; j < I2; ++j) (*c)(i, j + I2) += a_dx[i] * b_dy[j];
194
2/2
✓ Branch 0 taken 10260956 times.
✓ Branch 1 taken 2563624 times.
25649160 for (int i = 0; i < I2; ++i)
195
8/10
✓ Branch 1 taken 42851636 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 42851636 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 917146 times.
✓ Branch 8 taken 41934490 times.
✓ Branch 9 taken 917146 times.
✓ Branch 10 taken 3310 times.
✓ Branch 11 taken 41934490 times.
✓ Branch 12 taken 10257646 times.
106225184 for (int j = 0; j < I2; ++j) (*c)(i + I2, j) += a_dy[i] * b_dx[j];
196
2/2
✓ Branch 0 taken 10260956 times.
✓ Branch 1 taken 2563624 times.
25649160 for (int i = 0; i < I2; ++i)
197
8/10
✓ Branch 1 taken 42851636 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 42851636 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 917146 times.
✓ Branch 8 taken 41934490 times.
✓ Branch 9 taken 917146 times.
✓ Branch 10 taken 3310 times.
✓ Branch 11 taken 41934490 times.
✓ Branch 12 taken 10257646 times.
106225184 for (int j = 0; j < I2; ++j) (*c)(i + I2, j + I2) += a_dy[i] * b_dy[j];
198
199 10254496 return;
200 5127248 }
201
202 /**
203 * \ingroup Spline
204 * \brief The functions above have a fixed compile time polynomial degree. The
205 * PSpecificBasis handler is used to convert this to a runtime p through
206 * template recursion.
207 **/
208 template <int P, typename Scalar>
209 class PSpecificBasisHandler : public PSpecificShapeFunctionHandler<P> {
210 public:
211 // These methods are for calling the functions
212 10120 static inline void phi(int p, Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
213 Scalar w, double x) {
214
2/2
✓ Branch 0 taken 440 times.
✓ Branch 1 taken 4620 times.
10120 return P == p ? phi_<P, Scalar>(c, w, x)
215 10120 : PSpecificBasisHandler<P - 1, Scalar>::phi(p, c, w, x);
216 }
217 9240 static inline void phiDx(int p, Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
218 Scalar w, double x) {
219
2/2
✓ Branch 0 taken 440 times.
✓ Branch 1 taken 4180 times.
9240 return P == p ? phi_dx_<P, Scalar>(c, w, x)
220 9240 : PSpecificBasisHandler<P - 1, Scalar>::phiDx(p, c, w, x);
221 }
222 111320 static inline void phiPhi(int p, Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
223 Scalar w, Eigen::Vector2d a) {
224
4/6
✓ Branch 0 taken 4840 times.
✓ Branch 1 taken 50820 times.
✓ Branch 3 taken 4840 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 4840 times.
✗ Branch 7 not taken.
111320 return P == p ? phiphi_<P, Scalar>(c, w, a)
225
2/4
✓ Branch 1 taken 50820 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 50820 times.
✗ Branch 5 not taken.
111320 : PSpecificBasisHandler<P - 1, Scalar>::phiPhi(p, c, w, a);
226 }
227 static inline void phiPhiDx(int p,
228 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
229 Scalar w, Eigen::Vector2d a) {
230 return P == p ? phiphi_dx_<P, Scalar>(c, w, a)
231 : PSpecificBasisHandler<P - 1, Scalar>::phiPhiDx(p, c, w, a);
232 }
233 static inline void phiPhiDy(int p,
234 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
235 Scalar w, Eigen::Vector2d a) {
236 return P == p ? phiphi_dy_<P, Scalar>(c, w, a)
237 : PSpecificBasisHandler<P - 1, Scalar>::phiPhiDy(p, c, w, a);
238 }
239 920 static inline void phiTimesPhi(
240 int p, Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *c, Scalar w,
241 Eigen::Vector2d xi, Eigen::Vector2d eta) {
242
5/8
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 420 times.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 40 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 40 times.
✗ Branch 10 not taken.
920 return P == p ? Phi_times_Phi_<P, Scalar>(c, w, xi, eta)
243
3/6
✓ Branch 1 taken 420 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 420 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 420 times.
✗ Branch 8 not taken.
840 : PSpecificBasisHandler<P - 1, Scalar>::phiTimesPhi(p, c, w,
244 920 xi, eta);
245 }
246 840 static inline void divPhiTimesDivPhi(
247 int p, Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *c,
248 Scalar weight, Eigen::Vector2d xi, Eigen::Vector2d eta) {
249
5/8
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 380 times.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 40 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 40 times.
✗ Branch 10 not taken.
840 return P == p ? Div_Phi_times_Div_Phi_<P>(c, weight, xi, eta)
250
3/6
✓ Branch 1 taken 380 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 380 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 380 times.
✗ Branch 8 not taken.
760 : PSpecificBasisHandler<P - 1, Scalar>::divPhiTimesDivPhi(
251 840 p, c, weight, xi, eta);
252 }
253 // These methods are for storing the functions for a given p, i.e., return
254 // the function pointers
255 6264 static constexpr funptr_phi<Scalar> funPtrPhi(int p) {
256
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 return P == p ? &phi_<P, Scalar>
257 6264 : PSpecificBasisHandler<P - 1, Scalar>::funPtrPhi(p);
258 }
259 6264 static constexpr funptr_phidx<Scalar> funPtrPhiDx(int p) {
260
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 return P == p ? &phi_dx_<P, Scalar>
261 6264 : PSpecificBasisHandler<P - 1, Scalar>::funPtrPhiDx(p);
262 }
263 6264 static constexpr funptr_phiphi<Scalar> funPtrPhiPhi(int p) {
264
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 return P == p ? &phiphi_<P, Scalar>
265 6264 : PSpecificBasisHandler<P - 1, Scalar>::funPtrPhiPhi(p);
266 }
267 6264 static constexpr funptr_phiphidx<Scalar> funPtrPhiPhiDx(int p) {
268
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 return P == p ? &phiphi_dx_<P, Scalar>
269 6264 : PSpecificBasisHandler<P - 1, Scalar>::funPtrPhiPhiDx(p);
270 }
271 6264 static constexpr funptr_phiphidy<Scalar> funPtrPhiPhiDy(int p) {
272
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 return P == p ? &phiphi_dy_<P, Scalar>
273 6264 : PSpecificBasisHandler<P - 1, Scalar>::funPtrPhiPhiDy(p);
274 }
275 6264 static constexpr funptr_phitimesphi<Scalar> funPtrPhiTimesPhi(int p) {
276
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 return P == p ? &Phi_times_Phi_<P, Scalar>
277 6264 : PSpecificBasisHandler<P - 1, Scalar>::funPtrPhiTimesPhi(p);
278 }
279 6264 static constexpr funptr_divphitimesdivphi<Scalar> funPtrDivPhiTimesDivPhi(
280 int p) {
281 return P == p
282
2/2
✓ Branch 0 taken 2974 times.
✓ Branch 1 taken 158 times.
6264 ? &Div_Phi_times_Div_Phi_<P, Scalar>
283 5948 : PSpecificBasisHandler<P - 1, Scalar>::funPtrDivPhiTimesDivPhi(
284 6264 p);
285 }
286 };
287
288 // Anchors of the recursions above
289 template <typename Scalar>
290 class PSpecificBasisHandler<0, Scalar>
291 : public PSpecificShapeFunctionHandler<0> {
292 public:
293 44 static inline void phi(int p, Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
294 Scalar w, double x) {
295 44 return phi_<0, Scalar>(c, w, x);
296 }
297 static inline void phiDx(int p, Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
298 Scalar w, double x) {
299 return phi_dx_<0, Scalar>(c, w, x);
300 }
301 484 static inline void phiPhi(int p, Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
302 Scalar w, Eigen::Vector2d a) {
303
1/2
✓ Branch 2 taken 242 times.
✗ Branch 3 not taken.
484 return phiphi_<0, Scalar>(c, w, a);
304 }
305 static inline void phiPhiDx(int p,
306 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
307 Scalar w, Eigen::Vector2d a) {
308 return phiphi_dx_<0, Scalar>(c, w, a);
309 }
310 static inline void phiPhiDy(int p,
311 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *c,
312 Scalar w, Eigen::Vector2d a) {
313 return phiphi_dy_<0, Scalar>(c, w, a);
314 }
315 4 static inline void phiTimesPhi(
316 int p, Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *c, Scalar w,
317 Eigen::Vector2d xi, Eigen::Vector2d eta) {
318
2/4
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
4 return Phi_times_Phi_<0, Scalar>(c, w, xi, eta);
319 }
320 static inline void divPhiTimesDivPhi(
321 int p, Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> *c,
322 Scalar weight, Eigen::Vector2d xi, Eigen::Vector2d eta) {
323 return Div_Phi_times_Div_Phi_<0, Scalar>(c, weight, xi, eta);
324 }
325
326 10 static constexpr funptr_phi<Scalar> funPtrPhi(int p) {
327 10 return &phi_<0, Scalar>;
328 }
329 10 static constexpr funptr_phidx<Scalar> funPtrPhiDx(int p) {
330 10 return &phi_dx_<0, Scalar>;
331 }
332 10 static constexpr funptr_phiphi<Scalar> funPtrPhiPhi(int p) {
333 10 return &phiphi_<0, Scalar>;
334 }
335 10 static constexpr funptr_phiphidx<Scalar> funPtrPhiPhiDx(int p) {
336 10 return &phiphi_dx_<0, Scalar>;
337 }
338 10 static constexpr funptr_phiphidy<Scalar> funPtrPhiPhiDy(int p) {
339 10 return &phiphi_dy_<0, Scalar>;
340 }
341 10 static constexpr funptr_phitimesphi<Scalar> funPtrPhiTimesPhi(int p) {
342 10 return &Phi_times_Phi_<0, Scalar>;
343 }
344 10 static constexpr funptr_divphitimesdivphi<Scalar> funPtrDivPhiTimesDivPhi(
345 int p) {
346 10 return &Div_Phi_times_Div_Phi_<0, Scalar>;
347 }
348 };
349
350 /// This instantiates the basishandler for a maximal p
351 template <typename Scalar>
352 using BasisHandler = PSpecificBasisHandler<Constants::MaxP, Scalar>;
353
354 } // namespace Basis
355 } // namespace Bembel
356
357 #endif // BEMBEL_SRC_SPLINE_BASIS_HPP_
358