LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
mesh_factory.h
1#ifndef INCGe98a803fac5b430a8ff634ceb2f809aX
2#define INCGe98a803fac5b430a8ff634ceb2f809aX
3
4#include <lf/mesh/mesh.h>
5
6#include <iostream>
7
8#include "mesh.h"
9
10namespace lf::mesh::hybrid2d {
11
24 public:
25 MeshFactory(const MeshFactory&) = delete;
29
41 explicit MeshFactory(dim_t dim_world, bool check_completeness = true)
42 : dim_world_(dim_world), check_completeness_(check_completeness) {}
43
44 [[nodiscard]] dim_t DimWorld() const override { return dim_world_; }
45
46 [[nodiscard]] dim_t DimMesh() const override { return 2; }
47
48 // NOLINTNEXTLINE(modernize-use-nodiscard)
49 size_type AddPoint(coord_t coord) override;
50
51 // NOLINTNEXTLINE(modernize-use-nodiscard)
52 size_type AddPoint(std::unique_ptr<geometry::Geometry>&& geometry) override;
53
54 // NOLINTNEXTLINE(modernize-use-nodiscard)
56 const std::span<const size_type>& nodes,
57 std::unique_ptr<geometry::Geometry>&& geometry) override;
58
59 [[nodiscard]] std::shared_ptr<mesh::Mesh> Build() override;
60
62 void PrintLists(std::ostream& o = std::cout) const;
63
64 ~MeshFactory() override = default;
65
66 private:
67 dim_t dim_world_; // dimension of ambient space
71
72 // If set to true, the Build() method will check whether all sub-entities
73 // belong to at least one entity */
75
76 public:
81 static std::shared_ptr<spdlog::logger>& Logger();
82};
83
84inline std::ostream& operator<<(std::ostream& stream,
85 const MeshFactory& /*mesh_factory*/) {
86 stream << "mesh factory object";
87 return stream;
88}
89
90} // namespace lf::mesh::hybrid2d
91
93
97template <>
98struct fmt::formatter<lf::mesh::hybrid2d::MeshFactory> : ostream_formatter {};
100
101#endif // INCGe98a803fac5b430a8ff634ceb2f809aX
Represents a reference element with all its properties.
Definition ref_el.h:109
Interface class for initialization of a mesh object.
Eigen::VectorXd coord_t
Coordinate type of a point.
Implements mesh::MeshFactory interface and can be used to construct a hybrid mesh with dimMesh=2.
hybrid2d::Mesh::CellList elements_
MeshFactory & operator=(MeshFactory &&)=delete
MeshFactory & operator=(const MeshFactory &)=delete
static std::shared_ptr< spdlog::logger > & Logger()
logger that is used by the build method to output additional information to the command line.
std::shared_ptr< mesh::Mesh > Build() override
Construct a mesh out of the specified nodes and elements.
size_type AddEntity(base::RefEl ref_el, const std::span< const size_type > &nodes, std::unique_ptr< geometry::Geometry > &&geometry) override
Add an an entity (codim>0) to the mesh.
void PrintLists(std::ostream &o=std::cout) const
output function printing assembled lists of entity information
dim_t DimWorld() const override
Return the Mesh::DimWorld() of the mesh that will be returned.
MeshFactory(const MeshFactory &)=delete
MeshFactory(dim_t dim_world, bool check_completeness=true)
Construct a new builder that can be used to construct a new hybrid2d mesh.
hybrid2d::Mesh::NodeCoordList nodes_
hybrid2d::Mesh::EdgeList edges_
MeshFactory(MeshFactory &&)=delete
size_type AddPoint(coord_t coord) override
Add a point to the mesh.
dim_t DimMesh() const override
Return the Mesh::DimMesh() of the mesh that will be returned.
~MeshFactory() override=default
Virtual destructor.
std::vector< std::pair< std::array< size_type, 4 >, GeometryPtr > > CellList
Definition mesh.h:74
std::vector< std::pair< std::array< size_type, 2 >, GeometryPtr > > EdgeList
Definition mesh.h:72
std::vector< GeometryPtr > NodeCoordList
Definition mesh.h:71
An alternative implementation of a hybrid2d mesh manager that uses Pointers to store sub-entity relat...
Definition hybrid2d.h:11
std::ostream & operator<<(std::ostream &stream, const MeshFactory &)
lf::base::size_type size_type
Definition mesh.h:24
Definition assemble.h:31