Bembel
 
Loading...
Searching...
No Matches
TreeLeaf.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//
12#ifndef BEMBEL_SRC_H2MATRIX_TREELEAF_HPP_
13#define BEMBEL_SRC_H2MATRIX_TREELEAF_HPP_
14
15namespace Bembel {
19template <typename Derived>
20class TreeLeaf {
21 public:
23 // Constructors
25
29 : F_(Derived(0, 0)),
30 L_(Derived(0, 0)),
31 R_(Derived(0, 0)),
32 is_low_rank_(false) {}
37 : F_(other.F_),
38 L_(other.L_),
39 R_(other.R_),
40 is_low_rank_(other.is_low_rank_) {}
45 : F_(std::move(other.F_)),
46 L_(std::move(other.L_)),
47 R_(std::move(other.R_)),
48 is_low_rank_(other.is_low_rank_) {}
53 template <typename otherDerived>
54 TreeLeaf(const Eigen::MatrixBase<otherDerived> &L,
55 const Eigen::MatrixBase<otherDerived> &R)
56 : F_(Derived(0, 0)), L_(L), R_(R), is_low_rank_(true) {}
61 template <typename otherDerived>
62 explicit TreeLeaf(const Eigen::MatrixBase<otherDerived> &F)
63 : F_(F), L_(Derived(0, 0)), R_(Derived(0, 0)), is_low_rank_(false) {}
67 TreeLeaf(Derived &&L, Derived &&R)
68 : F_(Derived(0, 0)), L_(L), R_(R), is_low_rank_(true) {}
72 explicit TreeLeaf(Derived &&F)
73 : F_(F), L_(Derived(0, 0)), R_(Derived(0, 0)), is_low_rank_(false) {}
75 // getter
77 bool is_low_rank() { return is_low_rank_; }
78 Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic>
79 &get_F() {
80 return F_;
81 }
82 Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic>
83 &get_L() {
84 return L_;
85 }
86 Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic>
87 &get_R() {
88 return R_;
89 }
90 const Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic>
91 &get_F() const {
92 return F_;
93 }
94 const Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic>
95 &get_L() const {
96 return L_;
97 }
98 Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic>
99 &get_R() const {
100 return R_;
101 }
103 // setter
105 void set_low_rank_flag(bool flag) {
106 is_low_rank_ = flag;
107 return;
108 }
109 void set_F(const Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic,
110 Eigen::Dynamic> &F) {
111 F_ = F;
112 }
113 void set_L(const Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic,
114 Eigen::Dynamic> &L) {
115 L_ = L;
116 }
117 void set_R(const Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic,
118 Eigen::Dynamic> &R) {
119 R_ = R;
120 }
122 // Operators
124
128 F_.swap(other.F_);
129 L_.swap(other.L_);
130 R_.swap(other.R_);
131 std::swap(is_low_rank_, other.is_low_rank_);
132 return *this;
133 }
134
138 private:
139 // independently how the leave is instatiated, it will always be casted to
140 // an actual matrix
141 Eigen::Matrix<typename Derived::Scalar, Eigen::Dynamic, Eigen::Dynamic> F_,
142 L_, R_;
143 bool is_low_rank_;
144};
145} // namespace Bembel
146#endif // BEMBEL_SRC_H2MATRIX_TREELEAF_HPP_
This class is managing the leafs of the H2Matrix BlockClusterTree.
Definition TreeLeaf.hpp:20
TreeLeaf(Derived &&F)
full move constructor
Definition TreeLeaf.hpp:72
TreeLeaf(Derived &&L, Derived &&R)
lowRank move constructor
Definition TreeLeaf.hpp:67
TreeLeaf(const TreeLeaf &other)
copy constructor
Definition TreeLeaf.hpp:36
TreeLeaf(TreeLeaf &&other)
move constructor
Definition TreeLeaf.hpp:44
TreeLeaf(const Eigen::MatrixBase< otherDerived > &L, const Eigen::MatrixBase< otherDerived > &R)
lowRank constructor whatever Eigen object is put in here will be evaluated
Definition TreeLeaf.hpp:54
TreeLeaf & operator=(TreeLeaf other)
assignment operator, works for copy and move assignment
Definition TreeLeaf.hpp:127
TreeLeaf(void)
void constructor
Definition TreeLeaf.hpp:28
TreeLeaf(const Eigen::MatrixBase< otherDerived > &F)
full constructor whatever Eigen object is put in here will be evaluated
Definition TreeLeaf.hpp:62
Routines for the evalutation of pointwise errors.
constexpr int getFunctionSpaceOutputDimension()