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_LINEAROPERATOR_DUMMY_DUMMYOPERATOR_HPP_ | ||
12 | #define BEMBEL_SRC_LINEAROPERATOR_DUMMY_DUMMYOPERATOR_HPP_ | ||
13 | |||
14 | namespace Bembel { | ||
15 | |||
16 | class DummyOperator; | ||
17 | /** | ||
18 | * \brief Specification of the LinearOperatorTraits for the DummyOperator. | ||
19 | */ | ||
20 | template <> | ||
21 | struct LinearOperatorTraits<DummyOperator> { | ||
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 | |||
37 | /** | ||
38 | * \ingroup DummyOperator | ||
39 | * \brief This class provides a dummy specialization of the LinearOperator and | ||
40 | * corresponding Traits for testing and debugging | ||
41 | */ | ||
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: | ||
46 | /** | ||
47 | * \brief Default constructor | ||
48 | * | ||
49 | * The default test function is a constant 1. | ||
50 | */ | ||
51 | DummyOperator() { test_func_ = DummyOperator_test_function; } | ||
52 | /** | ||
53 | * \brief Constructor with a given test function. | ||
54 | */ | ||
55 | 5 | DummyOperator( | |
56 | std::function<double(const Eigen::Vector2d &, const Eigen::Vector2d &)> | ||
57 | 5 | test_func) { | |
58 |
1/2✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
|
5 | test_func_ = test_func; |
59 | 5 | } | |
60 | /** | ||
61 | * \brief Implements the integration routine. | ||
62 | * | ||
63 | * \param super_space SuperSpace specified with template parameter. | ||
64 | * \param p1 SurfacePoint for evaluating the first integral. | ||
65 | * \param p2 SurfacePoint for evaluating the second integral. | ||
66 | * \param intval Matrix for the computed integral. | ||
67 | */ | ||
68 | template <class T> | ||
69 | 89534512 | void evaluateIntegrand_impl( | |
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 | 179069024 | (*intval)(0, 0) += | |
74 |
7/14✓ Branch 2 taken 89534512 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 89534512 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 89534512 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 89534512 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 89534512 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 89534512 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 89534512 times.
✗ Branch 21 not taken.
|
89534512 | test_func_(p1.segment(3, 2), p2.segment(3, 2)) * p1(2) * p2(2); |
75 | 89534512 | 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_ | ||
85 |