GCC Code Coverage Report


Directory: Bembel/src/
File: Bembel/src/HomogenisedLaplace/SingleLayerPotential.hpp
Date: 2024-09-30 07:01:38
Exec Total Coverage
Lines: 18 18 100.0%
Functions: 3 3 100.0%
Branches: 21 42 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
12 #ifndef BEMBEL_SRC_HOMOGENISEDLAPLACE_SINGLELAYERPOTENTIAL_HPP_
13 #define BEMBEL_SRC_HOMOGENISEDLAPLACE_SINGLELAYERPOTENTIAL_HPP_
14
15 namespace Bembel {
16 // forward declaration of class HomogenisedLaplaceSingleLayerPotential
17 // in order to define traits
18 template<typename LinOp>
19 class HomogenisedLaplaceSingleLayerPotential;
20
21 /**
22 * \brief Specification of the PotentialTraits for the Homogenised Laplace.
23 */
24 template<typename LinOp>
25 struct PotentialTraits<HomogenisedLaplaceSingleLayerPotential<LinOp>> {
26 typedef Eigen::VectorXd::Scalar Scalar;
27 static constexpr int OutputSpaceDimension = 1;
28 };
29
30 /**
31 * \ingroup HomogenisedLaplace
32 * \brief This class implements the specification of the integration for the
33 * single layer potential for the homogenised Laplace.
34 */
35 template<typename LinOp>
36 class HomogenisedLaplaceSingleLayerPotential : public PotentialBase<
37 HomogenisedLaplaceSingleLayerPotential<LinOp>, LinOp> {
38 // implementation of the kernel evaluation, which may be based on the
39 // information available from the superSpace
40
41 public:
42 /**
43 * \brief Constructs an object initialising the coefficients and the degree
44 * via the static variable HomogenisedLaplaceSingleLayerOperator::precision.
45 */
46 2 HomogenisedLaplaceSingleLayerPotential() {
47 2 this->deg = getDegree(
48 HomogenisedLaplaceSingleLayerOperator::getPrecision());
49
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 this->cs = getCoefficients(
50 HomogenisedLaplaceSingleLayerOperator::getPrecision());
51 2 }
52 Eigen::Matrix<
53 typename PotentialReturnScalar<
54 typename LinearOperatorTraits<LinOp>::Scalar,
55 480000 double>::Scalar, 1, 1> evaluateIntegrand_impl(
56 const FunctionEvaluator<LinOp> &fun_ev, const ElementTreeNode &element,
57 const Eigen::Vector3d &point, const SurfacePoint &p) const {
58 // get evaluation points on unit square
59
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
480000 auto s = p.segment < 2 > (0);
60
61 // get quadrature weights
62
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
480000 auto ws = p(2);
63
64 // get points on geometry and tangential derivatives
65
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
480000 auto x_f = p.segment < 3 > (3);
66
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
480000 auto x_f_dx = p.segment < 3 > (6);
67
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
480000 auto x_f_dy = p.segment < 3 > (9);
68
69 // compute surface measures from tangential derivatives
70
2/4
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 480000 times.
✗ Branch 5 not taken.
480000 auto x_kappa = x_f_dx.cross(x_f_dy).norm();
71
72 // evaluate kernel
73
2/4
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 480000 times.
✗ Branch 5 not taken.
480000 auto kernel = evaluateKernel(point, x_f);
74
75 // assemble Galerkin solution
76
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
480000 auto cauchy_value = fun_ev.evaluate(element, p);
77
78 // integrand without basis functions
79
3/6
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 480000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 480000 times.
✗ Branch 8 not taken.
480000 auto integrand = kernel * cauchy_value * x_kappa * ws;
80
81
1/2
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
960000 return integrand;
82 }
83
84 /**
85 * \brief Fundamental solution of the homogenised Laplace problem
86 */
87 480000 double evaluateKernel(const Eigen::Vector3d &x,
88 const Eigen::Vector3d &y) const {
89
2/4
✓ Branch 2 taken 480000 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 480000 times.
✗ Branch 6 not taken.
480000 return k_mod(x - y)
90
4/8
✓ Branch 1 taken 480000 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 480000 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 480000 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 480000 times.
✗ Branch 11 not taken.
480000 + evaluate_solid_sphericals(x - y, this->cs, this->deg, false);
91 }
92
93 private:
94 /** The degree of the spherical harmonics expansion */
95 unsigned int deg;
96 /** The coefficients of the spherical harmonics expansion */
97 Eigen::VectorXd cs;
98 };
99
100 } // namespace Bembel
101
102 #endif // BEMBEL_SRC_HOMOGENISEDLAPLACE_SINGLELAYERPOTENTIAL_HPP_
103