Bembel
ClusterTree.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_CLUSTERTREE_CLUSTERTREE_HPP_
12 #define BEMBEL_SRC_CLUSTERTREE_CLUSTERTREE_HPP_
13 
14 namespace Bembel {
15 
22 class ClusterTree {
23  public:
29  ClusterTree(const ClusterTree& other) = delete;
30 
36  ClusterTree(ClusterTree&& other) = delete;
37 
44  ClusterTree& operator=(const ClusterTree& other) = delete;
45 
52  ClusterTree& operator=(ClusterTree&& other) = delete;
56 
69  ClusterTree(const Geometry& geom, int M) { init_ClusterTree(geom, M); }
73 
82  void init_ClusterTree(const Geometry& geom, int M) {
83  element_tree_.init_ElementTree(geom, M);
84  points_ = element_tree_.computeElementEnclosings();
85  return;
86  }
90 
95  ElementTree& get_element_tree() { return element_tree_; }
101  const ElementTree& get_element_tree() const { return element_tree_; }
107  const Eigen::MatrixXd& get_points() const { return points_; }
113  const PatchVector& get_geometry() const {
114  return element_tree_.get_geometry();
115  }
121  int get_max_level() const { return element_tree_.get_max_level(); }
128  return element_tree_.get_number_of_elements();
129  }
133 
138  std::vector<std::array<int, 4>> edges = element_tree_.patchTopologyInfo();
139  std::vector<Eigen::Vector2d> edge_midpoints = {
140  Eigen::Vector2d(Constants::edgemps[0][0], Constants::edgemps[1][0]), //
141  Eigen::Vector2d(Constants::edgemps[0][1], Constants::edgemps[1][1]), //
142  Eigen::Vector2d(Constants::edgemps[0][2], Constants::edgemps[1][2]), //
143  Eigen::Vector2d(Constants::edgemps[0][3], Constants::edgemps[1][3]) //
144  };
145  const PatchVector& geo = element_tree_.get_geometry();
146  for (auto edge : edges) {
147  if (edge[2] > 0 && edge[3] > 0) {
148  Eigen::Vector3d a = geo[edge[0]].eval(edge_midpoints[edge[2]]);
149  Eigen::Vector3d b = geo[edge[1]].eval(edge_midpoints[edge[3]]);
150  Eigen::Vector3d na = geo[edge[0]].evalNormal(edge_midpoints[edge[2]]);
151  Eigen::Vector3d nb = geo[edge[1]].evalNormal(edge_midpoints[edge[3]]);
152  assert((a - b).norm() < Constants::pt_comp_tolerance &&
153  "These points should coincide according to the element tree");
154  assert(a.dot(b) > 0 &&
155  "Normals across patches are oriented the same way");
156  }
157  }
158  return;
159  }
163  private:
164  ElementTree element_tree_;
165  Eigen::MatrixXd points_;
167 };
168 } // namespace Bembel
169 #endif // BEMBEL_SRC_CLUSTERTREE_CLUSTERTREE_HPP_
The ClusterTree class introduces an element structure on a Geometry object. Note that we do not intro...
Definition: ClusterTree.hpp:22
const Eigen::MatrixXd & get_points() const
Return point list with coordinates.
ClusterTree(ClusterTree &&other)=delete
Move constructor (deleted).
ClusterTree(const Geometry &geom, int M)
Constructs a ClusterTree object for a given refinement level.
Definition: ClusterTree.hpp:69
ClusterTree(const ClusterTree &other)=delete
Copy constructor (deleted).
void init_ClusterTree(const Geometry &geom, int M)
init
Definition: ClusterTree.hpp:82
ClusterTree & operator=(ClusterTree &&other)=delete
Move assignment operator (deleted).
const ElementTree & get_element_tree() const
Return const reference to the ElementTree.
const PatchVector & get_geometry() const
Return const reference to the Geometry.
ElementTree & get_element_tree()
getter
Definition: ClusterTree.hpp:95
int get_max_level() const
Return maximum level of refinement.
void checkOrientation()
member functions
int get_number_of_elements() const
Return number of elements in the ElementTree.
ClusterTree()
constructors
Definition: ClusterTree.hpp:59
ClusterTree & operator=(const ClusterTree &other)=delete
Copy assignment operator (deleted).
This class organizes an element structure on a Geometry object and handles refinement.
Definition: ElementTree.hpp:32
Eigen::MatrixXd computeElementEnclosings()
Computes enclosing balls surrounding all elements.
std::vector< std::array< int, 4 > > patchTopologyInfo() const
Resolves neighborhood relations of the patches.
void init_ElementTree(const Geometry &g, unsigned int max_level)
init
int get_number_of_elements() const
Return number of elements in the ElementTree.
const PatchVector & get_geometry() const
Return const reference to the Geometry.
int get_max_level() const
Return maximum level of refinement.
this class wraps a GeometryVector and provides some basic functionality, like reading Geometry files
Definition: Geometry.hpp:20
std::vector< Bembel::Patch > PatchVector
typedef for PatchVector
Definition: PatchVector.hpp:24
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14