LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
structured_mesh_builder.h
1#ifndef STRUCTURED_MESH_BUILDER_H
2#define STRUCTURED_MESH_BUILDER_H
3
4#include "lf/mesh/mesh_factory.h"
5
6namespace lf::mesh::utils {
7
17 public:
20 /*
21 * @brief Constructor: set factory object to be used by the builder
22 *
23 */
25 std::unique_ptr<mesh::MeshFactory> mesh_factory)
26 : mesh_factory_(std::move(mesh_factory)) {
27 LF_ASSERT_MSG(
28 mesh_factory_->DimMesh() == 2,
29 "TPTriagMeshBuilder can only construct meshes with DimMesh==2");
30 }
31
36 template <typename VECTOR>
38 bottom_left_corner_ << blc[0], blc[1];
39 return *this;
40 }
42 bottom_left_corner_ << x0, x1;
43 return *this;
44 }
45 template <typename VECTOR>
47 top_right_corner_ << trc[0], trc[1];
48 return *this;
49 }
51 top_right_corner_ << x0, x1;
52 return *this;
53 }
55 num_of_x_cells_ = nxc;
56 return *this;
57 }
59 num_of_y_cells_ = nyc;
60 return *this;
61 }
73 virtual std::shared_ptr<mesh::Mesh> Build() = 0;
74
75 protected:
76 // TODO(craffael): find a better way than implementation inheritance.
78 std::unique_ptr<mesh::MeshFactory> mesh_factory_; // NOLINT
80 Eigen::Vector2d bottom_left_corner_, top_right_corner_; // NOLINT
83}; // end class definition StructuredMeshBuilder
84
85} // namespace lf::mesh::utils
86
87#endif /* STRUCTURED_MESH_BUILDER_H */
unsigned int dim_t
Definition ref_el.h:132
lf::base::size_type size_type
StructuredMeshBuilder & setTopRightCorner(const VECTOR &&trc)
StructuredMeshBuilder & setTopRightCorner(double x0, double x1)
virtual std::shared_ptr< mesh::Mesh > Build()=0
Interface for the actual construction of the mesh.
StructuredMeshBuilder & setBottomLeftCorner(const VECTOR &blc)
StructuredMeshBuilder & setNumXCells(size_type nxc)
StructuredMeshBuilder & setBottomLeftCorner(double x0, double x1)
StructuredMeshBuilder(std::unique_ptr< mesh::MeshFactory > mesh_factory)
StructuredMeshBuilder & setNumYCells(size_type nyc)
std::unique_ptr< mesh::MeshFactory > mesh_factory_
Contains helper functions and classes that all operate on the interface classes defined in lf::mesh.