LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
|
Implements mesh::MeshFactory interface and can be used to construct a hybrid mesh with dimMesh=2
.
More...
#include <lf/mesh/hybrid2d/mesh_factory.h>
Public Member Functions | |
MeshFactory (const MeshFactory &)=delete | |
MeshFactory (MeshFactory &&)=delete | |
MeshFactory & | operator= (const MeshFactory &)=delete |
MeshFactory & | operator= (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. | |
dim_t | DimWorld () const override |
Return the Mesh::DimWorld() of the mesh that will be returned. | |
dim_t | DimMesh () const override |
Return the Mesh::DimMesh() of the mesh that will be returned. | |
size_type | AddPoint (coord_t coord) override |
Add a point to the mesh. | |
size_type | AddPoint (std::unique_ptr< geometry::Geometry > &&geometry) override |
Add a point to the mesh. | |
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. | |
std::shared_ptr< mesh::Mesh > | Build () override |
Construct a mesh out of the specified nodes and elements. | |
void | PrintLists (std::ostream &o=std::cout) const |
output function printing assembled lists of entity information | |
~MeshFactory () override=default | |
Virtual destructor. | |
Static Public Member Functions | |
static std::shared_ptr< spdlog::logger > & | Logger () |
logger that is used by the build method to output additional information to the command line. | |
Private Attributes | |
dim_t | dim_world_ |
hybrid2d::Mesh::NodeCoordList | nodes_ |
hybrid2d::Mesh::EdgeList | edges_ |
hybrid2d::Mesh::CellList | elements_ |
bool | check_completeness_ |
Additional Inherited Members | |
![]() | |
using | size_type = unsigned int |
using | coord_t = Eigen::VectorXd |
Coordinate type of a point. | |
using | dim_t = base::dim_t |
![]() | |
MeshFactory ()=default | |
MeshFactory (const MeshFactory &)=default | |
MeshFactory (MeshFactory &&)=default | |
MeshFactory & | operator= (const MeshFactory &)=default |
MeshFactory & | operator= (MeshFactory &&)=default |
Implements mesh::MeshFactory interface and can be used to construct a hybrid mesh with dimMesh=2
.
A planar triangular mesh with affine triangles as cells can be completely specified by giving the list of vertex coordinates, an optional list of edges, and a list of cells (triangles, quadrilaterals). All entities can be supplied with a geometry. If this is missing, the mesh builder tries to infer it from sub-entities or super-entities. If this is not possible, an affine entity is built.
Definition at line 23 of file mesh_factory.h.
|
delete |
|
delete |
|
inlineexplicit |
Construct a new builder that can be used to construct a new hybrid2d mesh.
dim_world | The dimension of the euclidean space in which the mesh is embedded. |
check_completeness | If set to true, calling Build() will check that the mesh is topologically complete. That means that every entity with codimension codim>0 is a subentity of at least one entity with codimension codim-1 . If check_completeness = true and the mesh is not complete, an assert will fail. |
Definition at line 41 of file mesh_factory.h.
|
overridevirtualdefault |
Virtual destructor.
Reimplemented from lf::mesh::MeshFactory.
|
overridevirtual |
Add an an entity (codim>0) to the mesh.
ref_el | The reference element of the entity. |
nodes | The 0-based indices of the nodes that make up this entity (as returned from AddPoint()). This range should contain exactly ref_el.NumNodes() . |
geometry | The geometric description of the mesh entity. Can be a nullptr (see below). |
Use this method to add mesh elements (codim=0) and optionally entities with codim>0
if this entity
geometry == nullptr
If the geometry object is not specified, the mesh will try to deduce the geometry from super entities (i.e. entities that contain the given entity as a sub-entity). E.g. if you add an entity with ref_el=RefEl::kSegment
to a mesh with dimMesh=2
and you don't specify a geometry
, then the geometry of the entity will be deduced from any triangle/quadrilateral that contains this entity (using the method geometry::Geometry::SubGeometry()). If the MeshFactory cannot deduce the geometry from a father entity, an error will be raised when Build()
is called.
Since the geometry object is taken from a super entity, there is no guarantee that the node order of the created entity and the one passed trough the parameter nodes
are the same!
geometry != nullptr
If you specify a geometry explicitly, the created entity will have exactly this geometry object as a reference. Hence the node ordering of the created entity object agrees with the ordering of nodes
.
nodes
must have been obtained with AddPoint() before calling this method. Implements lf::mesh::MeshFactory.
Definition at line 45 of file mesh_factory.cc.
References dim_world_, lf::base::RefEl::Dimension(), edges_, elements_, lf::base::RefEl::kSegment(), nodes_, lf::base::RefEl::NumNodes(), and lf::base::RefEl::ToString().
|
overridevirtual |
Add a point to the mesh.
coord | The coordinate of the point (should have DimWorld() rows) |
Implements lf::mesh::MeshFactory.
Definition at line 18 of file mesh_factory.cc.
References dim_world_, and nodes_.
|
overridevirtual |
Add a point to the mesh.
geometry | unique pointer to geometry object giving location of point |
Implements lf::mesh::MeshFactory.
Definition at line 28 of file mesh_factory.cc.
References dim_world_, lf::base::RefEl::kPoint(), and nodes_.
|
overridevirtual |
Construct a mesh out of the specified nodes and elements.
Build()
. Implements lf::mesh::MeshFactory.
Definition at line 105 of file mesh_factory.cc.
References check_completeness_, dim_world_, edges_, elements_, Logger(), nodes_, and PrintLists().
|
inlineoverridevirtual |
Return the Mesh::DimMesh() of the mesh that will be returned.
Implements lf::mesh::MeshFactory.
Definition at line 46 of file mesh_factory.h.
|
inlineoverridevirtual |
Return the Mesh::DimWorld() of the mesh that will be returned.
Implements lf::mesh::MeshFactory.
Definition at line 44 of file mesh_factory.h.
References dim_world_.
|
static |
logger that is used by the build method to output additional information to the command line.
Definition at line 12 of file mesh_factory.cc.
References lf::base::InitLogger().
Referenced by Build().
|
delete |
|
delete |
void lf::mesh::hybrid2d::MeshFactory::PrintLists | ( | std::ostream & | o = std::cout | ) | const |
|
private |
Definition at line 74 of file mesh_factory.h.
Referenced by Build().
|
private |
Definition at line 67 of file mesh_factory.h.
Referenced by AddEntity(), AddPoint(), AddPoint(), Build(), and DimWorld().
|
private |
Definition at line 69 of file mesh_factory.h.
Referenced by AddEntity(), Build(), and PrintLists().
|
private |
Definition at line 70 of file mesh_factory.h.
Referenced by AddEntity(), Build(), and PrintLists().
|
private |
Definition at line 68 of file mesh_factory.h.
Referenced by AddEntity(), AddPoint(), AddPoint(), Build(), and PrintLists().