LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
lf::mesh::hybrid2d::Point Class Reference

A node object for a 2D hybrid mesh. More...

#include <lf/mesh/hybrid2d/point.h>

Inheritance diagram for lf::mesh::hybrid2d::Point:
lf::mesh::Entity

Public Member Functions

 Point ()=default
 default constructors, needed by std::vector More...
 
 Point (size_type index, std::unique_ptr< geometry::Geometry > &&geometry)
 constructor, is called from MeshFactory More...
 
unsigned Codim () const override
 The codimension of this entity w.r.t. the Mesh.dimMesh() of the owning mesh manager. More...
 
nonstd::span< const Entity *const > SubEntities (unsigned rel_codim) const override
 Return all sub entities of this entity that have the given codimension (w.r.t. this entity!) More...
 
nonstd::span< const lf::mesh::OrientationRelativeOrientations () const override
 
const geometry::GeometryGeometry () const override
 return pointer to associated geometry object More...
 
size_type index () const
 access to index of an entity More...
 
base::RefEl RefEl () const override
 Describes the reference element type of this entity. More...
 
bool operator== (const mesh::Entity &rhs) const override
 Check if two entities are the same. More...
 
 ~Point () override=default
 
 Point (const Point &)=delete
 
 Point (Point &&) noexcept=default
 
Pointoperator= (const Point &)=delete
 
Pointoperator= (Point &&) noexcept=default
 
- Public Member Functions inherited from lf::mesh::Entity
virtual unsigned Codim () const =0
 The codimension of this entity w.r.t. the Mesh.dimMesh() of the owning mesh manager. More...
 
virtual nonstd::span< const Entity *const > SubEntities (unsigned rel_codim) const =0
 Return all sub entities of this entity that have the given codimension (w.r.t. this entity!) More...
 
virtual nonstd::span< const OrientationRelativeOrientations () const =0
 return span of relative orientations of sub-entities of the next higher co-dimension. More...
 
virtual const geometry::GeometryGeometry () const =0
 Describes the geometry of this entity. More...
 
virtual base::RefEl RefEl () const =0
 Describes the reference element type of this entity. More...
 
virtual bool operator== (const Entity &rhs) const =0
 Check if two entities are the same. More...
 
bool operator!= (const Entity &rhs) const
 Check if two entities are different. More...
 
virtual ~Entity ()=default
 Virtual Destructor. More...
 

Private Types

using size_type = mesh::Mesh::size_type
 

Private Attributes

size_type index_ = -1
 
std::unique_ptr< geometry::Geometrygeometry_ = nullptr
 
Entitythis_ = nullptr
 

Static Private Attributes

static constexpr std::array< lf::mesh::Orientation, 1 > dummy_or_
 

Additional Inherited Members

- Protected Member Functions inherited from lf::mesh::Entity
 Entity ()=default
 
 Entity (const Entity &)=default
 
 Entity (Entity &&)=default
 
Entityoperator= (const Entity &)=default
 
Entityoperator= (Entity &&)=default
 

Detailed Description

A node object for a 2D hybrid mesh.

Note
Every Entity object owns a smart pointer to an associated geometry object.

Due to the unidirectional storage scheme for incidence information the node object does not have much functionality, except for storing its index.

Definition at line 28 of file point.h.

Member Typedef Documentation

◆ size_type

Definition at line 29 of file point.h.

Constructor & Destructor Documentation

◆ Point() [1/4]

lf::mesh::hybrid2d::Point::Point ( )
default

default constructors, needed by std::vector

◆ Point() [2/4]

lf::mesh::hybrid2d::Point::Point ( const Point )
delete

@ brief Default and disabled constructors

◆ Point() [3/4]

lf::mesh::hybrid2d::Point::Point ( Point &&  )
defaultnoexcept

◆ Point() [4/4]

lf::mesh::hybrid2d::Point::Point ( size_type  index,
std::unique_ptr< geometry::Geometry > &&  geometry 
)
inlineexplicit

constructor, is called from MeshFactory

Parameters
indexindex of the entity to be created; will usually be retrieved via the Index() method of Mesh
geometrypointer to a geometry object providing the shape of the entity
Note
Note that you need to create a suitable geometry object for the entity before you can initialize the entity object itseld.

Definition at line 53 of file point.h.

References geometry_, and lf::base::RefEl::kPoint().

◆ ~Point()

lf::mesh::hybrid2d::Point::~Point ( )
overridedefault

Member Function Documentation

◆ Codim()

unsigned lf::mesh::hybrid2d::Point::Codim ( ) const
inlineoverridevirtual

The codimension of this entity w.r.t. the Mesh.dimMesh() of the owning mesh manager.

Implements lf::mesh::Entity.

Definition at line 65 of file point.h.

◆ Geometry()

const geometry::Geometry * lf::mesh::hybrid2d::Point::Geometry ( ) const
inlineoverridevirtual

return pointer to associated geometry object

Implements lf::mesh::Entity.

Definition at line 82 of file point.h.

References geometry_.

◆ index()

size_type lf::mesh::hybrid2d::Point::index ( ) const
inline

access to index of an entity

Definition at line 87 of file point.h.

References index_.

◆ operator=() [1/2]

Point & lf::mesh::hybrid2d::Point::operator= ( const Point )
delete

◆ operator=() [2/2]

Point & lf::mesh::hybrid2d::Point::operator= ( Point &&  )
defaultnoexcept

◆ operator==()

bool lf::mesh::hybrid2d::Point::operator== ( const mesh::Entity rhs) const
inlineoverridevirtual

Check if two entities are the same.

Parameters
rhsCheck if this entity is the same as the rhs entity.
Note
The behavior of this method is undefined if the rhs entity belongs to a different Mesh.

Implements lf::mesh::Entity.

Definition at line 93 of file point.h.

◆ RefEl()

base::RefEl lf::mesh::hybrid2d::Point::RefEl ( ) const
inlineoverridevirtual

Describes the reference element type of this entity.

Returns
An object of type lf::base::RefEl.

Implements lf::mesh::Entity.

Definition at line 89 of file point.h.

References lf::base::RefEl::kPoint().

◆ RelativeOrientations()

nonstd::span< const lf::mesh::Orientation > lf::mesh::hybrid2d::Point::RelativeOrientations ( ) const
inlineoverridevirtual

Must not be called: No sub-entities for a point

Implements lf::mesh::Entity.

Definition at line 75 of file point.h.

◆ SubEntities()

nonstd::span< const Entity *const > lf::mesh::hybrid2d::Point::SubEntities ( unsigned  rel_codim) const
inlineoverridevirtual

Return all sub entities of this entity that have the given codimension (w.r.t. this entity!)

Parameters
rel_codimThe relative co-dimension w.r.t. this entity
Returns
A span of pointers to the sub-entities with the specified relative co-dimension

Implicitly this function defines the numbering of sub-entities, see lf::base::RefEl and Lecture Document Paragraph 2.7.2.14.

Note
For a mesh covering a manifold of dimension 2, we have the following cases
  • For a cell (co-dimension 0 entity), the cell itself is a subentity of relative co-dimension 0, the edges have relative co-dimension 1, and the vertices relative co-dimension 2: in this case the usual co-dimension agrees with the relative co-dimension.
  • For an edge (co-dimension 1 entity), the edge itself is the only sub-entity with relative co-dimension 0, and the endpoints are the sub-entitities of relative co-dimension 1.
The lifetime of the returned span equals the lifetime of the Parent Entity.

Demonstration of usage

bool checkLocalTopology(const Entity &e) {
// Obtain basic information about current Entity
const lf::base::RefEl ref_el = e.RefEl();
const lf::base::dim_t dimension = ref_el.Dimension();
// What this function does in the case of a 2D cell entity (dimension = 2):
// It runs through all edges (co-dimension = 1), fetches their endnodes
// (co-dimension again 1 relative to an edge) and test whether they
// are also sub-entities of co-dimension 2 of the cell.
// Co-dimensions of sub-entities run from 1 to dimension
for (lf::base::dim_t sub_codim = 1; sub_codim <= dimension; sub_codim++) {
// Number of sub-entities with relative co-dimensjon sub_codim
const lf::base::size_type num_sub_entities =
ref_el.NumSubEntities(sub_codim);
// Obtain sequence of pointers to sub-entities of co-dimension sub_codim
nonstd::span<const Entity *const> sub_ent_range = e.SubEntities(sub_codim);
// Run through sub-entities
lf::base::size_type sub_ent_cnt{0};
for (const lf::mesh::Entity *sub_ent : sub_ent_range) {
const lf::base::RefEl sub_ref_el = sub_ent->RefEl();
const lf::base::dim_t sub_dim = sub_ref_el.Dimension();
if (sub_dim != dimension - sub_codim) return false;
// The sub-entity has further sub-entities of codimension 1 to sub_dim
for (lf::base::dim_t sub_sub_codim = 1; sub_sub_codim <= sub_dim;
sub_sub_codim++) {
sub_ent->SubEntities(sub_sub_codim);
for (const lf::mesh::Entity *sub_sub_ent : sub_sub_ent_range) {
// The entity pointed to by sub_sub_ent has co-dimension
// sub_codim + sub_sub_codim w.r.t. the entity referenced by e
// Hence get all corresponding sub-entities of e
e.SubEntities(sub_codim + sub_sub_codim);
// See whether we find sub_sub_ent in this range
int found = 0; // Count how many times we find the sub-entity
for (const Entity *e_sub_sub : e_sub_sub_range) {
if (e_sub_sub == sub_sub_ent) found++;
}
// Any sub-entity should occur exactly once.
if (found != 1) return false;
}
}
sub_ent_cnt++;
} // end loop over sub-entities
if (num_sub_entities != sub_ent_cnt) return false;
}
return true;
} // end checklocalTopology
Represents a reference element with all its properties.
Definition: ref_el.h:106
constexpr RefEl(RefElType type) noexcept
Create a RefEl from a lf::base::RefElType enum.
Definition: ref_el.h:172
constexpr size_type NumSubEntities(dim_t sub_codim) const
Get the number of sub-entities of this RefEl with the given codimension.
Definition: ref_el.h:305
constexpr dim_t Dimension() const
Return the dimension of this reference element.
Definition: ref_el.h:201
Interface class representing a topological entity in a cellular complex
Definition: entity.h:39
Entity()=default
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
Definition: base.h:36
unsigned int size_type
general type for variables related to size of arrays
Definition: base.h:24
void checkLocalTopology(const Entity &e)
Function for testing consistency of subentities.

Use of this method is also shown in Lecture Document Example 2.7.2.12.

Implements lf::mesh::Entity.

Definition at line 68 of file point.h.

References this_.

Member Data Documentation

◆ dummy_or_

constexpr std::array<lf::mesh::Orientation, 1> lf::mesh::hybrid2d::Point::dummy_or_
staticconstexprprivate
Initial value:

Definition at line 102 of file point.h.

◆ geometry_

std::unique_ptr<geometry::Geometry> lf::mesh::hybrid2d::Point::geometry_ = nullptr
private

Definition at line 101 of file point.h.

Referenced by Geometry(), and Point().

◆ index_

size_type lf::mesh::hybrid2d::Point::index_ = -1
private

Definition at line 100 of file point.h.

Referenced by index().

◆ this_

Entity* lf::mesh::hybrid2d::Point::this_ = nullptr
private

Definition at line 104 of file point.h.

Referenced by SubEntities().


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