Bembel
LinearOperatorBase.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_LINEAROPERATOR_LINEAROPERATORBASE_HPP_
12 #define BEMBEL_SRC_LINEAROPERATOR_LINEAROPERATORBASE_HPP_
13 
14 namespace Bembel {
23 template <typename Derived>
25  // Constructors
27  // the user has to provide the implementation of this function, which
28  // is able to evaluate the integrand of the Galerkin formulation in a
29  // pair of quadrature points represented as a
30  // Surface point [xi; h * w; Chi(xi); dsChi(xi); dtChi(xi)]
31  template <class T>
32  void evaluateIntegrand(
33  const T &super_space, const SurfacePoint &p1, const SurfacePoint &p2,
34  Eigen::Matrix<typename LinearOperatorTraits<Derived>::Scalar,
35  Eigen::Dynamic, Eigen::Dynamic> *intval) const {
36  static_cast<const Derived *>(this)->evaluateIntegrand_impl(super_space, p1,
37  p2, intval);
38  return;
39  }
40  // the user has to provide the implementation of this function, which
41  // is able to evaluate the interpolation values of the Galerkin formulation on
42  // the reference domain in a pair of interpolation points represented as a
43  // Surface point [xi; 1.; Chi(xi); dsChi(xi); dtChi(xi)]
44  Eigen::Matrix<
46  getFunctionSpaceVectorDimension<LinearOperatorTraits<Derived>::Form>() *
50  evaluateFMMInterpolation(const SurfacePoint &p1,
51  const SurfacePoint &p2) const {
52  return static_cast<const Derived *>(this)->evaluateFMMInterpolation_impl(
53  p1, p2);
54  }
55  // return the required quadrature degree for the far-field
56  int get_FarfieldQuadratureDegree(int ansatz_degree) const {
57  return ansatz_degree - LinearOperatorTraits<Derived>::OperatorOrder + 1;
58  }
68  // return the required quadrature degree for the near-field
69  int getNearfieldQuadratureDegree(int ansatz_degree, double distance,
70  int level) const {
71  // if farfield quadrature is computed: take log of distance
72  // otherwise compute quadrature degree for Duffy trick
73  double distance_log =
74  (distance * (1 << level) < 1) ? -(level * log(2.)) : log(distance);
75 
76  // alpha/2 is the convergence rate of the corresponding Galerkin solution,
77  // this ensures the correct convergence rate of the potential
78  int alpha =
79  2 - LinearOperatorTraits<Derived>::OperatorOrder + 2 * ansatz_degree;
80 
81  // compute numerator and denominator of quadrature degree
82  double numerator =
83  (alpha + ansatz_degree) * level * log(2.) -
84  (2 - ansatz_degree + LinearOperatorTraits<Derived>::OperatorOrder) *
85  distance_log;
86  double denominator = (level + 2) * log(2.) + distance_log;
87 
88  return 0.5 * numerator / denominator;
89  }
90  // pointer to the derived object
91  Derived &derived() { return *static_cast<Derived *>(this); }
92  // const pointer to the derived object
93  const Derived &derived() const { return *static_cast<const Derived *>(this); }
94 };
95 } // namespace Bembel
96 #endif // BEMBEL_SRC_LINEAROPERATOR_LINEAROPERATORBASE_HPP_
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14
constexpr int getFunctionSpaceVectorDimension()
linear operator base class. this serves as a common interface for existing linear operators.
int getNearfieldQuadratureDegree(int ansatz_degree, double distance, int level) const
Compute quadrature degree for numerical integretation close to the singularity based on distance,...
struct containing specifications on the linear operator has to be specialized or derived for any part...