LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
lf::mesh::MeshFactory Class Referenceabstract

Interface class for initialization of a mesh object. More...

#include <lf/mesh/mesh_factory.h>

Inheritance diagram for lf::mesh::MeshFactory:
lf::mesh::hybrid2d::MeshFactory

Public Types

using size_type = unsigned int
 
using coord_t = Eigen::VectorXd
 Coordinate type of a point.
 
using dim_t = base::dim_t
 

Public Member Functions

virtual dim_t DimWorld () const =0
 Return the Mesh::DimWorld() of the mesh that will be returned.
 
virtual dim_t DimMesh () const =0
 Return the Mesh::DimMesh() of the mesh that will be returned.
 
virtual size_type AddPoint (coord_t coord)=0
 Add a point to the mesh.
 
virtual size_type AddPoint (std::unique_ptr< geometry::Geometry > &&geometry)=0
 Add a point to the mesh.
 
virtual size_type AddEntity (base::RefEl ref_el, const std::span< const size_type > &nodes, std::unique_ptr< geometry::Geometry > &&geometry)=0
 Add an an entity (codim>0) to the mesh.
 
virtual std::shared_ptr< MeshBuild ()=0
 Construct a mesh out of the specified nodes and elements.
 
virtual ~MeshFactory ()=default
 Virtual destructor.
 

Protected Member Functions

 MeshFactory ()=default
 
 MeshFactory (const MeshFactory &)=default
 
 MeshFactory (MeshFactory &&)=default
 
MeshFactoryoperator= (const MeshFactory &)=default
 
MeshFactoryoperator= (MeshFactory &&)=default
 

Detailed Description

Interface class for initialization of a mesh object.

This class implements a factory pattern in order to make it possible for mesh builder facilities like those in the io module to generate different mesh objects. An example of a class that relies on the service of a MeshFactory object is lf::io::GmshReader, see also Example 2.7.1.13

Definition at line 25 of file mesh_factory.h.

Member Typedef Documentation

◆ coord_t

using lf::mesh::MeshFactory::coord_t = Eigen::VectorXd

Coordinate type of a point.

Definition at line 40 of file mesh_factory.h.

◆ dim_t

Definition at line 42 of file mesh_factory.h.

◆ size_type

using lf::mesh::MeshFactory::size_type = unsigned int

Auxiliary types

Definition at line 35 of file mesh_factory.h.

Constructor & Destructor Documentation

◆ MeshFactory() [1/3]

lf::mesh::MeshFactory::MeshFactory ( )
protecteddefault

◆ MeshFactory() [2/3]

lf::mesh::MeshFactory::MeshFactory ( const MeshFactory & )
protecteddefault

◆ MeshFactory() [3/3]

lf::mesh::MeshFactory::MeshFactory ( MeshFactory && )
protecteddefault

◆ ~MeshFactory()

virtual lf::mesh::MeshFactory::~MeshFactory ( )
virtualdefault

Virtual destructor.

Reimplemented in lf::mesh::hybrid2d::MeshFactory.

Member Function Documentation

◆ AddEntity()

virtual size_type lf::mesh::MeshFactory::AddEntity ( base::RefEl ref_el,
const std::span< const size_type > & nodes,
std::unique_ptr< geometry::Geometry > && geometry )
pure virtual

Add an an entity (codim>0) to the mesh.

Parameters
ref_elThe reference element of the entity.
nodesThe 0-based indices of the nodes that make up this entity (as returned from AddPoint()). This range should contain exactly ref_el.NumNodes().
geometryThe geometric description of the mesh entity. Can be a nullptr (see below).
Returns
The index of the entity that will be created. It is guaranteed that the indices are consecutive (per dimension).

Use this method to add mesh elements (codim=0) and optionally entities with codim>0 if this entity

  • should use a particular geometry object that cannot be deduced from its super-entities, or
  • if you need to know the index of this entity at a later stage, e.g. to assign flags.

If 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!

If 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.

Note
The node indices passed with the parameter nodes must have been obtained with AddPoint() before calling this method.

Implemented in lf::mesh::hybrid2d::MeshFactory.

◆ AddPoint() [1/2]

virtual size_type lf::mesh::MeshFactory::AddPoint ( coord_t coord)
pure virtual

Add a point to the mesh.

Parameters
coordThe coordinate of the point (should have DimWorld() rows)
Returns
The 0-based index of the entity that will be created. The first call to this method will return 0, the second call 1, ...

Implemented in lf::mesh::hybrid2d::MeshFactory.

◆ AddPoint() [2/2]

virtual size_type lf::mesh::MeshFactory::AddPoint ( std::unique_ptr< geometry::Geometry > && geometry)
pure virtual

Add a point to the mesh.

Parameters
geometryunique pointer to geometry object giving location of point
Returns
The 0-based index of the entity that will be created. The first call to this method will return 0, the second call 1, ...

Implemented in lf::mesh::hybrid2d::MeshFactory.

◆ Build()

virtual std::shared_ptr< Mesh > lf::mesh::MeshFactory::Build ( )
pure virtual

Construct a mesh out of the specified nodes and elements.

Returns
The created mesh.
Note
All data supplied to the MeshFactory will be cleared after a mesh has been built successfully. I.e. the mesh factory can be used to construct another mesh after calling Build().

Implemented in lf::mesh::hybrid2d::MeshFactory.

◆ DimMesh()

virtual dim_t lf::mesh::MeshFactory::DimMesh ( ) const
pure virtual

Return the Mesh::DimMesh() of the mesh that will be returned.

Implemented in lf::mesh::hybrid2d::MeshFactory.

◆ DimWorld()

virtual dim_t lf::mesh::MeshFactory::DimWorld ( ) const
pure virtual

Return the Mesh::DimWorld() of the mesh that will be returned.

Implemented in lf::mesh::hybrid2d::MeshFactory.

◆ operator=() [1/2]

MeshFactory & lf::mesh::MeshFactory::operator= ( const MeshFactory & )
protecteddefault

◆ operator=() [2/2]

MeshFactory & lf::mesh::MeshFactory::operator= ( MeshFactory && )
protecteddefault

The documentation for this class was generated from the following file: