Bembel
DummyOperator.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_DUMMY_DUMMYOPERATOR_HPP_
12 #define BEMBEL_SRC_LINEAROPERATOR_DUMMY_DUMMYOPERATOR_HPP_
13 
14 namespace Bembel {
15 
16 class DummyOperator;
20 template <>
22  typedef Eigen::VectorXd EigenType;
23  typedef Eigen::VectorXd::Scalar Scalar;
24  enum {
25  OperatorOrder = 0,
26  Form = DifferentialForm::Discontinuous,
27  NumberOfFMMComponents = 1
28  };
29 };
30 
31 // forward declaration of class DummyOperator in order to define traits
32 // define some default test functiom
33 std::function<double(const Eigen::Vector2d &, const Eigen::Vector2d &)>
34  DummyOperator_test_function =
35  [](const Eigen::Vector2d &x, const Eigen::Vector2d &y) { return 1.; };
36 
42 class DummyOperator : public LinearOperatorBase<DummyOperator> {
43  // implementation of the kernel evaluation, which may be based on the
44  // information available from the superSpace
45  public:
51  DummyOperator() { test_func_ = DummyOperator_test_function; }
56  std::function<double(const Eigen::Vector2d &, const Eigen::Vector2d &)>
57  test_func) {
58  test_func_ = test_func;
59  }
68  template <class T>
70  const T &super_space, const SurfacePoint &p1, const SurfacePoint &p2,
71  Eigen::Matrix<typename LinearOperatorTraits<DummyOperator>::Scalar,
72  Eigen::Dynamic, Eigen::Dynamic> *intval) const {
73  (*intval)(0, 0) +=
74  test_func_(p1.segment(3, 2), p2.segment(3, 2)) * p1(2) * p2(2);
75  return;
76  }
77 
78  private:
79  std::function<double(const Eigen::Vector2d &, const Eigen::Vector2d &)>
80  test_func_;
81 };
82 
83 } // namespace Bembel
84 #endif // BEMBEL_SRC_LINEAROPERATOR_DUMMY_DUMMYOPERATOR_HPP_
This class provides a dummy specialization of the LinearOperator and corresponding Traits for testing...
DummyOperator(std::function< double(const Eigen::Vector2d &, const Eigen::Vector2d &)> test_func)
Constructor with a given test function.
DummyOperator()
Default constructor.
void evaluateIntegrand_impl(const T &super_space, const SurfacePoint &p1, const SurfacePoint &p2, Eigen::Matrix< typename LinearOperatorTraits< DummyOperator >::Scalar, Eigen::Dynamic, Eigen::Dynamic > *intval) const
Implements the integration routine.
Eigen::Matrix< double, 12, 1 > SurfacePoint
typedef of SurfacePoint
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14
linear operator base class. this serves as a common interface for existing linear operators.
struct containing specifications on the linear operator has to be specialized or derived for any part...