GCC Code Coverage Report


Directory: Bembel/src/
File: Bembel/src/LinearForm/DirichletTrace.hpp
Date: 2024-09-30 07:01:38
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 9 9 100.0%
Branches: 11 22 50.0%

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 #ifndef BEMBEL_SRC_LINEARFORM_DIRICHLETTRACE_HPP_
12 #define BEMBEL_SRC_LINEARFORM_DIRICHLETTRACE_HPP_
13
14 namespace Bembel {
15
16 template <typename Scalar>
17 class DirichletTrace;
18
19 template <typename ScalarT>
20 struct LinearFormTraits<DirichletTrace<ScalarT>> {
21 typedef ScalarT Scalar;
22 };
23
24 /**
25 * \ingroup LinearForm
26 * \brief This class provides an implementation of the Dirichlet trace operator
27 * and a corresponding method to evaluate the linear form corresponding to the
28 * right hand side of the system via quadrature.
29 */
30 template <typename Scalar>
31 class DirichletTrace : public LinearFormBase<DirichletTrace<Scalar>, Scalar> {
32 public:
33 7 DirichletTrace() {}
34 7 void set_function(const std::function<Scalar(Eigen::Vector3d)> &function) {
35 7 function_ = function;
36 7 }
37 template <class T>
38 1410 void evaluateIntegrand_impl(
39 const T &super_space, const SurfacePoint &p,
40 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *intval) const {
41 1410 auto polynomial_degree = super_space.get_polynomial_degree();
42 1410 auto polynomial_degree_plus_one_squared =
43 1410 (polynomial_degree + 1) * (polynomial_degree + 1);
44
45 // get evaluation points on unit square
46
1/2
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
1410 auto s = p.segment<2>(0);
47
48 // get quadrature weights
49
1/2
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
1410 auto ws = p(2);
50
51 // get points on geometry and tangential derivatives
52
1/2
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
1410 auto x_f = p.segment<3>(3);
53
1/2
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
1410 auto x_f_dx = p.segment<3>(6);
54
1/2
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
1410 auto x_f_dy = p.segment<3>(9);
55
56 // compute surface measures from tangential derivatives
57
2/4
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1410 times.
✗ Branch 5 not taken.
1410 auto x_kappa = x_f_dx.cross(x_f_dy).norm();
58
59 // integrand without basis functions
60
2/4
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1410 times.
✗ Branch 5 not taken.
1410 auto integrand = function_(x_f) * x_kappa * ws;
61
62 // multiply basis functions with integrand
63
2/4
✓ Branch 1 taken 1410 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1410 times.
✗ Branch 5 not taken.
1410 super_space.addScaledBasis(intval, integrand, s);
64
65 2820 return;
66 }
67
68 private:
69 std::function<Scalar(Eigen::Vector3d)> function_;
70 };
71 } // namespace Bembel
72
73 #endif // BEMBEL_SRC_LINEARFORM_DIRICHLETTRACE_HPP_
74