LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
tp_triag_mesh_builder.h
1#ifndef TP_TRIAG_MESH_BUILDER_H
2#define TP_TRIAG_MESH_BUILDER_H
3
4#include "lf/mesh/mesh_factory.h"
5#include "structured_mesh_builder.h"
6
7namespace lf::mesh::utils {
8
26 public:
31 explicit TPTriagMeshBuilder(std::unique_ptr<mesh::MeshFactory> mesh_factory)
32 : StructuredMeshBuilder(std::move(mesh_factory)) {
33 LF_ASSERT_MSG(
34 mesh_factory_->DimWorld() == 2,
35 "TPTriagMeshBuilder can only construct meshes with DimWorld==2");
36 }
37
42 [[nodiscard]] std::shared_ptr<mesh::Mesh> Build() override;
43
44 private:
48 [[nodiscard]] size_type VertexIndex(size_type i, size_type j) const {
49 return (i + j * (num_of_x_cells_ + 1));
50 }
51
52 public:
56 static std::shared_ptr<spdlog::logger>& Logger();
57}; // end class definition TPTriagMeshBuilder
58
59} // namespace lf::mesh::utils
60
61#endif /* TP_TRIAG_MESH_BUILDER_H */
std::unique_ptr< mesh::MeshFactory > mesh_factory_
Implements a MeshBuilder that generates a triangular structured mesh.
size_type VertexIndex(size_type i, size_type j) const
vertex index from grid position
std::shared_ptr< mesh::Mesh > Build() override
actual construction of the mesh
static std::shared_ptr< spdlog::logger > & Logger()
Used by Build() method to output additional debug info.
TPTriagMeshBuilder(std::unique_ptr< mesh::MeshFactory > mesh_factory)
Constructor: set factory object to be used by the builder.
Contains helper functions and classes that all operate on the interface classes defined in lf::mesh.