GCC Code Coverage Report


Directory: Bembel/src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 96.6% 252 / 0 / 261
Functions: 100.0% 70 / 0 / 70
Branches: 50.0% 71 / 0 / 142

AnsatzSpace/AnsatzSpace.hpp
Line Branch Exec Source
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2024 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_ANSATZSPACE_ANSATZSPACE_HPP_
12 #define BEMBEL_SRC_ANSATZSPACE_ANSATZSPACE_HPP_
13
14 namespace Bembel {
15 /**
16 * \ingroup AnsatzSpace
17 * \brief The AnsatzSpace is the class that handles the assembly of the
18 *discrete basis.
19 *
20 * It invokes a SuperSpace and uses the Glue and Projector class to
21 *assemble a transformation matrix, which relates the SuperSpace to the desired
22 *basis.
23 */
24 template <typename Derived>
25 class AnsatzSpace {
26 public:
27 enum { Form = LinearOperatorTraits<Derived>::Form };
28 //////////////////////////////////////////////////////////////////////////////
29 // constructors
30 //////////////////////////////////////////////////////////////////////////////
31 /**
32 * \brief Default constructor
33 */
34 170 AnsatzSpace() {}
35 /**
36 * \brief Copy constructor
37 * \param other The object to copy from
38 */
39 170 AnsatzSpace(const AnsatzSpace &other) {
40 170 super_space_ = other.super_space_;
41 170 knot_repetition_ = other.knot_repetition_;
42
8/16
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::AnsatzSpace(Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator> const&):
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::AnsatzSpace(Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator> const&):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::AnsatzSpace(Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator> const&):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::AnsatzSpace(Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator> const&):
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::AnsatzSpace(Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont> const&):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::AnsatzSpace(Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator> const&):
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorC>::AnsatzSpace(Bembel::AnsatzSpace<TestOperatorC> const&):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::AnsatzSpace(Bembel::AnsatzSpace<TestOperatorDivC> const&):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
170 transformation_matrix_ = other.transformation_matrix_;
43 170 }
44 /**
45 * @brief Move constructor
46 * @param other The object to move from
47 */
48 AnsatzSpace(AnsatzSpace &&other) {
49 super_space_ = other.super_space_;
50 knot_repetition_ = other.knot_repetition_;
51 transformation_matrix_ = other.transformation_matrix_;
52 }
53 /**
54 * \brief Copy assignment operator.
55 *
56 * This operator assigns the contents of another AnsatzSpace object to this
57 * one.
58 *
59 * \param other The AnsatzSpace object to copy from.
60 * \return A reference to the updated AnsatzSpace object.
61 */
62 170 AnsatzSpace &operator=(AnsatzSpace other) {
63 170 super_space_ = other.super_space_;
64 170 knot_repetition_ = other.knot_repetition_;
65 170 transformation_matrix_ = other.transformation_matrix_;
66 170 return *this;
67 }
68 /**
69 * \brief Constructor for AnsatzSpace.
70 *
71 * This constructor initializes an AnsatzSpace object with the provided
72 * parameters.
73 *
74 * \param geometry The geometry object defining the space.
75 * \param refinement_level The refinement level of the space.
76 * \param polynomial_degree The degree of polynomials used in the space.
77 * \param knot_repetition (optional) The number of repetitions of knots in the
78 * space.
79 */
80 144 AnsatzSpace(const Geometry &geometry, int refinement_level,
81 144 int polynomial_degree, int knot_repetition = 1) {
82
9/18
Bembel::AnsatzSpace<Bembel::DummyOperator>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorC>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
144 init_AnsatzSpace(geometry, refinement_level, polynomial_degree,
83 knot_repetition);
84 144 return;
85 }
86 //////////////////////////////////////////////////////////////////////////////
87 // init_Ansatzspace
88 //////////////////////////////////////////////////////////////////////////////
89 /**
90 * \brief Initializes the AnsatzSpace object.
91 *
92 * This function initializes the AnsatzSpace object with the provided
93 * parameters. It sets the knot repetition, initializes the super space,
94 * utilizes the Projector and Glue class to create a transformation matrix
95 * which assembles conforming B-Splines from local Bernstein polynomials.
96 *
97 * \param geometry The geometry object.
98 * \param refinement_level The refinement level of the space.
99 * \param polynomial_degree The degree of polynomials used in the space.
100 * \param knot_repetition The number of repetitions of knots in the space.
101 */
102 144 void init_AnsatzSpace(const Geometry &geometry, int refinement_level,
103 int polynomial_degree, int knot_repetition) {
104 144 knot_repetition_ = knot_repetition;
105
9/18
Bembel::AnsatzSpace<Bembel::DummyOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
144 super_space_.init_SuperSpace(geometry, refinement_level, polynomial_degree);
106
9/18
Bembel::AnsatzSpace<Bembel::DummyOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
144 Projector<Derived> proj(super_space_, knot_repetition_);
107
9/18
Bembel::AnsatzSpace<Bembel::DummyOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
144 Glue<Derived> glue(super_space_, proj);
108
9/18
Bembel::AnsatzSpace<Bembel::DummyOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
144 transformation_matrix_ =
109
18/36
Bembel::AnsatzSpace<Bembel::DummyOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<Bembel::HelmholtzSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 3 times.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<Bembel::HomogenisedLaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceBeltramiOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<Bembel::LaplaceSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<Bembel::MassMatrixScalarCont>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 1 time.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 time.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<Bembel::MaxwellSingleLayerOperator>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<TestOperatorC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 64 times.
✗ Branch 6 not taken.
Bembel::AnsatzSpace<TestOperatorDivC>::init_AnsatzSpace(Bembel::Geometry const&, int, int, int):
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 65 times.
✗ Branch 6 not taken.
288 proj.get_projection_matrix() * glue.get_glue_matrix();
110 288 return;
111 144 }
112 //////////////////////////////////////////////////////////////////////////////
113 // getters
114 //////////////////////////////////////////////////////////////////////////////
115 /**
116 * \brief Retrieves the reference to the SuperSpace associated with this
117 * AnsatzSpace.
118 *
119 * \return A const reference to the SuperSpace.
120 */
121 1098637 const SuperSpace<Derived> &get_superspace() const { return super_space_; }
122
123 /**
124 * \brief Retrieves the knot repetition value of this AnsatzSpace.
125 *
126 * \return The knot repetition value.
127 */
128 int get_knot_repetition() const { return knot_repetition_; }
129
130 /**
131 * \brief Retrieves the refinement level of this AnsatzSpace.
132 *
133 * \return The refinement level.
134 */
135 3840 int get_refinement_level() const {
136 3840 return super_space_.get_refinement_level();
137 }
138
139 /**
140 * \brief Retrieves the polynomial degree of this AnsatzSpace.
141 *
142 * \return The polynomial degree.
143 */
144 159 int get_polynomial_degree() const {
145 159 return super_space_.get_polynomial_degree();
146 }
147
148 /**
149 * \brief Retrieves the number of elements of the underlying ElementTree in
150 * the SuperSpace of this AnsatzSpace.
151 *
152 * \return The number of elements.
153 */
154 int get_number_of_elements() const {
155 return super_space_.get_number_of_elements();
156 }
157
158 /**
159 * \brief Retrieves the number of patches of the underlying Geometry.
160 *
161 * \return The number of patches.
162 */
163 int get_number_of_patches() const {
164 return super_space_.get_number_of_patches();
165 }
166
167 /**
168 * \brief Retrieves the number of degrees of freedom of this AnsatzSpace.
169 *
170 * \return The number of degrees of freedom.
171 */
172 32 int get_number_of_dofs() const { return transformation_matrix_.cols(); }
173
174 /**
175 * \brief Retrieves the geometry associated with this AnsatzSpace.
176 *
177 * \return A const reference to the geometry.
178 */
179 const PatchVector &get_geometry() const {
180 return super_space_.get_geometry();
181 }
182
183 /**
184 * \brief Retrieves the transformation matrix associated with this
185 * AnsatzSpace.
186 *
187 * \return A const reference to the transformation matrix.
188 */
189 158 const Eigen::SparseMatrix<double> &get_transformation_matrix() const {
190 158 return transformation_matrix_;
191 }
192 //////////////////////////////////////////////////////////////////////////////
193 // private member variables
194 //////////////////////////////////////////////////////////////////////////////
195 private:
196 Eigen::SparseMatrix<double> transformation_matrix_;
197 SuperSpace<Derived> super_space_;
198 int knot_repetition_;
199 };
200 } // namespace Bembel
201 #endif // BEMBEL_SRC_ANSATZSPACE_ANSATZSPACE_HPP_
202