Bembel
 
Loading...
Searching...
No Matches
DirichletTrace.hpp
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
14namespace Bembel {
15
16template <typename Scalar>
17class DirichletTrace;
18
19template <typename ScalarT>
21 typedef ScalarT Scalar;
22};
23
30template <typename Scalar>
31class DirichletTrace : public LinearFormBase<DirichletTrace<Scalar>, Scalar> {
32 public:
34 void set_function(const std::function<Scalar(Eigen::Vector3d)> &function) {
35 function_ = function;
36 }
37 template <class T>
38 void evaluateIntegrand_impl(
39 const T &super_space, const SurfacePoint &p,
40 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> *intval) const {
41 auto polynomial_degree = super_space.get_polynomial_degree();
42 auto polynomial_degree_plus_one_squared =
43 (polynomial_degree + 1) * (polynomial_degree + 1);
44
45 // get evaluation points on unit square
46 auto s = p.segment<2>(0);
47
48 // get quadrature weights
49 auto ws = p(2);
50
51 // get points on geometry and tangential derivatives
52 auto x_f = p.segment<3>(3);
53 auto x_f_dx = p.segment<3>(6);
54 auto x_f_dy = p.segment<3>(9);
55
56 // compute surface measures from tangential derivatives
57 auto x_kappa = x_f_dx.cross(x_f_dy).norm();
58
59 // integrand without basis functions
60 auto integrand = function_(x_f) * x_kappa * ws;
61
62 // multiply basis functions with integrand
63 super_space.addScaledBasis(intval, integrand, s);
64
65 return;
66 }
67
68 private:
69 std::function<Scalar(Eigen::Vector3d)> function_;
70};
71} // namespace Bembel
72
73#endif // BEMBEL_SRC_LINEARFORM_DIRICHLETTRACE_HPP_
This class provides an implementation of the Dirichlet trace operator and a corresponding method to e...
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
Routines for the evalutation of pointwise errors.
constexpr int getFunctionSpaceOutputDimension()
This class provides a blueprint for the class that needs to be specialized for assembly of the right ...
This class needs to be specialized, such that key traits for user defined LinearForms are available.