GCC Code Coverage Report


Directory: Bembel/src/
File: Bembel/src/Laplace/SingleLayerPotential.hpp
Date: 2024-03-19 14:38:05
Exec Total Coverage
Lines: 14 14 100.0%
Functions: 3 3 100.0%
Branches: 15 30 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_LAPLACE_SINGLELAYERPOTENTIAL_HPP_
12 #define BEMBEL_SRC_LAPLACE_SINGLELAYERPOTENTIAL_HPP_
13
14 namespace Bembel {
15 // forward declaration of class LaplaceSingleLayerPotential in order to define
16 // traits
17 template <typename LinOp>
18 class LaplaceSingleLayerPotential;
19 /**
20 * \brief Specification of the PotentialTraits for Laplace.
21 */
22 template <typename LinOp>
23 struct PotentialTraits<LaplaceSingleLayerPotential<LinOp>> {
24 typedef Eigen::VectorXd::Scalar Scalar;
25 static constexpr int OutputSpaceDimension = 1;
26 };
27
28 /**
29 * \ingroup Laplace
30 * \brief This class implements the specification of the integration for the
31 * single layer potential for Laplace.
32 */
33 template <typename LinOp>
34 class LaplaceSingleLayerPotential
35 : public PotentialBase<LaplaceSingleLayerPotential<LinOp>, LinOp> {
36 // implementation of the kernel evaluation, which may be based on the
37 // information available from the superSpace
38 public:
39 2 LaplaceSingleLayerPotential() {}
40 Eigen::Matrix<
41 typename PotentialReturnScalar<
42 typename LinearOperatorTraits<LinOp>::Scalar, double>::Scalar,
43 1, 1>
44 384001 evaluateIntegrand_impl(const FunctionEvaluator<LinOp> &fun_ev,
45 const ElementTreeNode &element,
46 const Eigen::Vector3d &point,
47 const SurfacePoint &p) const {
48 // get evaluation points on unit square
49
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
384001 auto s = p.segment<2>(0);
50
51 // get quadrature weights
52
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
384001 auto ws = p(2);
53
54 // get points on geometry and tangential derivatives
55
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
384001 auto x_f = p.segment<3>(3);
56
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
384001 auto x_f_dx = p.segment<3>(6);
57
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
384001 auto x_f_dy = p.segment<3>(9);
58
59 // compute surface measures from tangential derivatives
60
2/4
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384001 times.
✗ Branch 5 not taken.
384001 auto x_kappa = x_f_dx.cross(x_f_dy).norm();
61
62 // evaluate kernel
63
2/4
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384001 times.
✗ Branch 5 not taken.
384001 auto kernel = evaluateKernel(point, x_f);
64
65 // assemble Galerkin solution
66
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
384001 auto cauchy_value = fun_ev.evaluate(element, p);
67
68 // integrand without basis functions
69
3/6
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384001 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 384001 times.
✗ Branch 8 not taken.
384001 auto integrand = kernel * cauchy_value * x_kappa * ws;
70
71
1/2
✓ Branch 1 taken 384001 times.
✗ Branch 2 not taken.
768002 return integrand;
72 }
73
74 /**
75 * \brief Fundamental solution of Laplace problem
76 */
77 384001 double evaluateKernel(const Eigen::Vector3d &x,
78 const Eigen::Vector3d &y) const {
79
1/2
✓ Branch 2 taken 384001 times.
✗ Branch 3 not taken.
384001 return 1. / 4. / BEMBEL_PI / (x - y).norm();
80 }
81 };
82
83 } // namespace Bembel
84 #endif // BEMBEL_SRC_LAPLACE_SINGLELAYERPOTENTIAL_HPP_
85