LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
lf::assemble::UniformFEDofHandler Class Reference

Dofhandler for uniform finite element spaces. More...

#include <lf/assemble/dofhandler.h>

Inheritance diagram for lf::assemble::UniformFEDofHandler:
lf::assemble::DofHandler

Public Types

using dof_map_t = std::map<lf::base::RefEl, base::size_type>
 Map data type for telling number of global shape functions associated with every topological kind of mesh entity.
 

Public Member Functions

 UniformFEDofHandler (UniformFEDofHandler &&)=default
 UniformFEDofHandler can be moved.
 
 UniformFEDofHandler (const UniformFEDofHandler &)=delete
 Copy Construction doesn't make much sense for UniformFEDofHandler.
 
UniformFEDofHandleroperator= (UniformFEDofHandler &&)=default
 Uniform FEDofHandler can be move assigned to.
 
UniformFEDofHandleroperator= (const UniformFEDofHandler &)=delete
 Copy assigning a UniformFEDofHandler doesn't make much sense.
 
 ~UniformFEDofHandler () override=default
 Virtual Destructor.
 
size_type NumDofs () const override
 total number of dof's handled by the object
 
size_type NumLocalDofs (const lf::mesh::Entity &entity) const override
 tells the number of degrees of freedom subordinate/_belonging_ to to an entity
 
size_type NumInteriorDofs (const lf::mesh::Entity &entity) const override
 provides number of shape functions associated with an entity
 
std::span< const gdof_idx_tGlobalDofIndices (const lf::mesh::Entity &entity) const override
 access to indices of global dof's belonging to an entity
 
std::span< const gdof_idx_tInteriorGlobalDofIndices (const lf::mesh::Entity &entity) const override
 global indices of shape functions associated with an entity_
 
const lf::mesh::EntityEntity (gdof_idx_t dofnum) const override
 retrieve unique entity at which a basis function is located
 
std::shared_ptr< const lf::mesh::MeshMesh () const override
 Acess to underlying mesh object.
 
Constructors

Construction from local dof layout

 UniformFEDofHandler (std::shared_ptr< const lf::mesh::Mesh > mesh, dof_map_t dofmap, bool check_edge_orientation=true)
 Construction from a map object.
 
- Public Member Functions inherited from lf::assemble::DofHandler
virtual ~DofHandler ()=default
 virtual Destructor
 

Private Member Functions

void initIndexArrays ()
 initialization of internal index arrays
 
void InitTotalNumDofs ()
 compute number of shape functions covering an entity type
 
std::span< const gdof_idx_tGlobalDofIndices (lf::base::RefEl ref_el_type, glb_idx_t entity_index) const
 
std::span< const gdof_idx_tInteriorGlobalDofIndices (lf::base::RefEl ref_el_type, glb_idx_t entity_index) const
 
size_type GetNumLocalDofs (lf::base::RefEl ref_el_type, glb_idx_t) const
 
size_type NumCoveredDofs (lf::base::RefEl ref_el_type) const
 
size_type NumInteriorDofs (lf::base::RefEl ref_el_type) const
 

Private Attributes

std::shared_ptr< const lf::mesh::Meshmesh_
 
size_type num_dof_ {0}
 
std::vector< const lf::mesh::Entity * > dof_entities_
 
std::array< std::vector< gdof_idx_t >, 3 > dofs_
 
std::array< size_type, 3 > num_dofs_
 
size_type num_dofs_tria_ {0}
 
size_type num_dofs_quad_ {0}
 
bool check_edge_orientation_
 
size_type kNodeOrd = 2
 
size_type kEdgeOrd = 1
 
size_type kCellOrd = 0
 
size_type num_loc_dof_point_ {0}
 
size_type num_loc_dof_segment_ {0}
 
size_type num_loc_dof_tria_ {0}
 
size_type num_loc_dof_quad_ {0}
 

Additional Inherited Members

- Protected Member Functions inherited from lf::assemble::DofHandler
 DofHandler ()=default
 Default constructor, can only be called from derived class.
 
 DofHandler (const DofHandler &)=default
 
 DofHandler (DofHandler &&)=default
 
DofHandleroperator= (const DofHandler &)=default
 
DofHandleroperator= (DofHandler &&)=default
 

Detailed Description

Dofhandler for uniform finite element spaces.

This management class for indices of global shape functions is suitable for situations where every geometric entity of a particular type has exactly the same number of shape functions belonging to it.

Definition at line 260 of file dofhandler.h.

Member Typedef Documentation

◆ dof_map_t

Map data type for telling number of global shape functions associated with every topological kind of mesh entity.

Ddetailed explanations with examples are given in Paragraph 2.7.4.16 of the Lecture Document.

Definition at line 269 of file dofhandler.h.

Constructor & Destructor Documentation

◆ UniformFEDofHandler() [1/3]

lf::assemble::UniformFEDofHandler::UniformFEDofHandler ( std::shared_ptr< const lf::mesh::Mesh > mesh,
dof_map_t dofmap,
bool check_edge_orientation = true )

Construction from a map object.

Parameters
mesh(shared) pointer to underlying mesh
dofmapmap telling number of interior dofs for every type of entity
check_edge_orientationif true, reverse ordering of local d.o.f.s in case of negative orientation of the edge.

Detailed information about the construction from a map object is given in Lecture Document Paragraph 2.7.4.16. Also study Lecture Document Example 2.7.4.18.

In the case of Lagrangian fintie element space of polynomial degree \(\geq 3\) several global shape functions are associated with every edge. Conveniently, they are numbered based on the orientation/direction of the edge. In case the local and global orientations do not match, this will lead to a wrong local -> global index mapping.

The following example demonstrates this for a mesh consisting of two triangles and cubic Lagrangian finite elements. the indices of global shape functions are written in red, those of the local shape functions in light blue for the left triangle, in dark blue for the right triangle. The ordering of the shape functions associated with the common edge id different for the two triangles.

If the flag check_edge_orientation is set, then the member functions GlobalDofIndices and InteriorGlobalDofIndices (when called for a cell) will reverse the ordering of edge-internal d.o.f.s, if the relative orientation of the edge is negative.

Definition at line 86 of file dofhandler.cc.

References lf::assemble::AssembleMatrixLocally(), initIndexArrays(), InitTotalNumDofs(), lf::base::RefEl::kPoint(), lf::base::RefEl::kQuad(), lf::base::RefEl::kSegment(), lf::base::RefEl::kTria(), mesh_, num_loc_dof_point_, num_loc_dof_quad_, num_loc_dof_segment_, and num_loc_dof_tria_.

◆ UniformFEDofHandler() [2/3]

lf::assemble::UniformFEDofHandler::UniformFEDofHandler ( UniformFEDofHandler && )
default

UniformFEDofHandler can be moved.

◆ UniformFEDofHandler() [3/3]

lf::assemble::UniformFEDofHandler::UniformFEDofHandler ( const UniformFEDofHandler & )
delete

Copy Construction doesn't make much sense for UniformFEDofHandler.

◆ ~UniformFEDofHandler()

lf::assemble::UniformFEDofHandler::~UniformFEDofHandler ( )
overridedefault

Virtual Destructor.

Member Function Documentation

◆ Entity()

const lf::mesh::Entity & lf::assemble::UniformFEDofHandler::Entity ( gdof_idx_t dofnum) const
inlineoverridevirtual

retrieve unique entity at which a basis function is located

Parameters
dofnumglobal index of the basis function/degree of freedom

This function returns the unique geometric entity to which a particular basis function = degree of freedom is associated.

This function is hardly ever needed in finite element codes and is supplied for debugging purposes.

See also
GlobalDofIndices()
GlobalDofIndices()

Implements lf::assemble::DofHandler.

Definition at line 376 of file dofhandler.h.

References lf::assemble::AssembleMatrixLocally(), dof_entities_, and num_dof_.

◆ GetNumLocalDofs()

size_type lf::assemble::UniformFEDofHandler::GetNumLocalDofs ( lf::base::RefEl ref_el_type,
glb_idx_t  ) const
inlineprivate

Definition at line 411 of file dofhandler.h.

References lf::assemble::AssembleMatrixLocally(), and NumCoveredDofs().

Referenced by NumLocalDofs().

◆ GlobalDofIndices() [1/2]

std::span< const gdof_idx_t > lf::assemble::UniformFEDofHandler::GlobalDofIndices ( const lf::mesh::Entity & entity) const
overridevirtual

access to indices of global dof's belonging to an entity

Parameters
entityreference to the entity for which the dof's are to be fetched. This entity must belong to the underlying mesh.
Returns
cardinal number range of global dof indices, see std::span data type documentation.

The basis functions of every finite element space must be associated with a unique geometric entity. Conversely, every entity can possess a finite number of basis functions = degrees of freedom. This member function returns the global indices of all basis functions associated with the entity and its sub-entitites (the covering local shape functions).

The size of the returned range must agree with the value returned by NumLocalDofs() when supplied with the same arguments.

Consult Lecture Document Paragraph 2.7.4.13 for more information.

Note
If the check_edge_orientation flag was set in the costructor, the ordering of local shape functions associated with edges will be reversed if the relative orientation of the edge is negative.

Implements lf::assemble::DofHandler.

Definition at line 302 of file dofhandler.cc.

References lf::assemble::AssembleMatrixLocally(), GlobalDofIndices(), and mesh_.

Referenced by GlobalDofIndices().

◆ GlobalDofIndices() [2/2]

std::span< const gdof_idx_t > lf::assemble::UniformFEDofHandler::GlobalDofIndices ( lf::base::RefEl ref_el_type,
glb_idx_t entity_index ) const
private

◆ initIndexArrays()

void lf::assemble::UniformFEDofHandler::initIndexArrays ( )
private

◆ InitTotalNumDofs()

void lf::assemble::UniformFEDofHandler::InitTotalNumDofs ( )
private

compute number of shape functions covering an entity type

This method assumes that the variables num_loc_dof_point_, num_loc_dof_segment_, num_loc_dof_tria_, num_loc_dof_quad_ have already been set.

See also
LocalStaticDOFs2D::TotalNoLocDofs()

Definition at line 131 of file dofhandler.cc.

References kCellOrd, kEdgeOrd, kNodeOrd, num_dofs_, num_dofs_quad_, num_dofs_tria_, num_loc_dof_point_, num_loc_dof_quad_, num_loc_dof_segment_, and num_loc_dof_tria_.

Referenced by UniformFEDofHandler().

◆ InteriorGlobalDofIndices() [1/2]

std::span< const gdof_idx_t > lf::assemble::UniformFEDofHandler::InteriorGlobalDofIndices ( const lf::mesh::Entity & entity) const
overridevirtual

global indices of shape functions associated with an entity_

Parameters
entityentity for which shape functin indices are queried
Returns
cardinal number range of global indices of shape functions, see std::span data type documentation.

Each global shape function is associated with a unique mesh entity. This method provides all the global indices of the shape function associated to the entity specified by the function arguments, see Lecture Document Paragraph 2.7.4.13 for additional explanations.

Note
Be aware of the difference of GlobalDofIndices() and InteriorGlobalDofIndices()
If the check_edge_orientation flag was set in the costructor, the ordering of local shape functions associated with edges will be reversed if the relative orientation of the edge is negative.

Implements lf::assemble::DofHandler.

Definition at line 325 of file dofhandler.cc.

References lf::assemble::AssembleMatrixLocally(), InteriorGlobalDofIndices(), and mesh_.

Referenced by InteriorGlobalDofIndices().

◆ InteriorGlobalDofIndices() [2/2]

std::span< const gdof_idx_t > lf::assemble::UniformFEDofHandler::InteriorGlobalDofIndices ( lf::base::RefEl ref_el_type,
glb_idx_t entity_index ) const
private

◆ Mesh()

std::shared_ptr< const lf::mesh::Mesh > lf::assemble::UniformFEDofHandler::Mesh ( ) const
inlineoverridevirtual

Acess to underlying mesh object.

Every DofHandler object has to be associated with a unique mesh. All entities passed to the DofHandler object must belong to that mesh.

Implements lf::assemble::DofHandler.

Definition at line 385 of file dofhandler.h.

References mesh_.

Referenced by lf::uscalfe::UniformScalarFESpace< SCALAR >::Mesh().

◆ NumCoveredDofs()

size_type lf::assemble::UniformFEDofHandler::NumCoveredDofs ( lf::base::RefEl ref_el_type) const
inlineprivate

◆ NumDofs()

size_type lf::assemble::UniformFEDofHandler::NumDofs ( ) const
inlineoverridevirtual

total number of dof's handled by the object

Implements lf::assemble::DofHandler.

Definition at line 336 of file dofhandler.h.

References num_dof_.

◆ NumInteriorDofs() [1/2]

size_type lf::assemble::UniformFEDofHandler::NumInteriorDofs ( const lf::mesh::Entity & entity) const
overridevirtual

provides number of shape functions associated with an entity

Parameters
entityentity of underlying mesh whose number of shape functions is queried

The return value of this method must be equal to the length of the range built by InteriorGlobalDofIndices().

See also
InteriorGlobalDofIndices()
InteriorGlobalDofIndices

Implements lf::assemble::DofHandler.

Definition at line 335 of file dofhandler.cc.

References lf::assemble::AssembleMatrixLocally(), and NumInteriorDofs().

Referenced by InteriorGlobalDofIndices(), and NumInteriorDofs().

◆ NumInteriorDofs() [2/2]

size_type lf::assemble::UniformFEDofHandler::NumInteriorDofs ( lf::base::RefEl ref_el_type) const
inlineprivate

◆ NumLocalDofs()

size_type lf::assemble::UniformFEDofHandler::NumLocalDofs ( const lf::mesh::Entity & entity) const
overridevirtual

tells the number of degrees of freedom subordinate/_belonging_ to to an entity

Parameters
entityreference to an entity of the underlying mesh

This method informs about the length of the vector returned by GlobalDofIndices().

See also
GlobalDofIndices()
GlobalDofIndices()

Implements lf::assemble::DofHandler.

Definition at line 330 of file dofhandler.cc.

References lf::assemble::AssembleMatrixLocally(), and GetNumLocalDofs().

◆ operator=() [1/2]

UniformFEDofHandler & lf::assemble::UniformFEDofHandler::operator= ( const UniformFEDofHandler & )
delete

Copy assigning a UniformFEDofHandler doesn't make much sense.

◆ operator=() [2/2]

UniformFEDofHandler & lf::assemble::UniformFEDofHandler::operator= ( UniformFEDofHandler && )
default

Uniform FEDofHandler can be move assigned to.

Member Data Documentation

◆ check_edge_orientation_

bool lf::assemble::UniformFEDofHandler::check_edge_orientation_
private

Flag for reversing numbering of internal edge d.o.f.s

Definition at line 502 of file dofhandler.h.

Referenced by initIndexArrays().

◆ dof_entities_

std::vector<const lf::mesh::Entity *> lf::assemble::UniformFEDofHandler::dof_entities_
private

Vector of entities to which global basis functions are associated

Definition at line 484 of file dofhandler.h.

Referenced by Entity(), and initIndexArrays().

◆ dofs_

std::array<std::vector<gdof_idx_t>, 3> lf::assemble::UniformFEDofHandler::dofs_
private

Vectors of global indices of dofs belonging to entities of different topological type

Definition at line 487 of file dofhandler.h.

Referenced by GlobalDofIndices(), initIndexArrays(), and InteriorGlobalDofIndices().

◆ kCellOrd

size_type lf::assemble::UniformFEDofHandler::kCellOrd = 0
private

Definition at line 420 of file dofhandler.h.

Referenced by initIndexArrays(), and InitTotalNumDofs().

◆ kEdgeOrd

size_type lf::assemble::UniformFEDofHandler::kEdgeOrd = 1
private

Definition at line 419 of file dofhandler.h.

Referenced by initIndexArrays(), InitTotalNumDofs(), and NumCoveredDofs().

◆ kNodeOrd

size_type lf::assemble::UniformFEDofHandler::kNodeOrd = 2
private

co-dimensions of different geometric entities in a 2D mesh

Definition at line 418 of file dofhandler.h.

Referenced by initIndexArrays(), InitTotalNumDofs(), and NumCoveredDofs().

◆ mesh_

std::shared_ptr<const lf::mesh::Mesh> lf::assemble::UniformFEDofHandler::mesh_
private

The mesh on which the degrees of freedom are defined

Definition at line 480 of file dofhandler.h.

Referenced by GlobalDofIndices(), GlobalDofIndices(), initIndexArrays(), InteriorGlobalDofIndices(), InteriorGlobalDofIndices(), Mesh(), and UniformFEDofHandler().

◆ num_dof_

size_type lf::assemble::UniformFEDofHandler::num_dof_ {0}
private

The total number of degrees of freedom

Definition at line 482 of file dofhandler.h.

Referenced by Entity(), initIndexArrays(), and NumDofs().

◆ num_dofs_

std::array<size_type, 3> lf::assemble::UniformFEDofHandler::num_dofs_
private

Number of dofs covering entities of a particular type

Definition at line 489 of file dofhandler.h.

Referenced by GlobalDofIndices(), initIndexArrays(), InitTotalNumDofs(), InteriorGlobalDofIndices(), and NumCoveredDofs().

◆ num_dofs_quad_

size_type lf::assemble::UniformFEDofHandler::num_dofs_quad_ {0}
private

Definition at line 492 of file dofhandler.h.

Referenced by InitTotalNumDofs(), and NumCoveredDofs().

◆ num_dofs_tria_

size_type lf::assemble::UniformFEDofHandler::num_dofs_tria_ {0}
private

(Maximum) number of shape functions covering entities of a particular co-dimension

Definition at line 492 of file dofhandler.h.

Referenced by InitTotalNumDofs(), and NumCoveredDofs().

◆ num_loc_dof_point_

size_type lf::assemble::UniformFEDofHandler::num_loc_dof_point_ {0}
private

Numbers of local interior shape functions associated with different types of entities

Definition at line 496 of file dofhandler.h.

Referenced by initIndexArrays(), InitTotalNumDofs(), NumInteriorDofs(), and UniformFEDofHandler().

◆ num_loc_dof_quad_

size_type lf::assemble::UniformFEDofHandler::num_loc_dof_quad_ {0}
private

◆ num_loc_dof_segment_

size_type lf::assemble::UniformFEDofHandler::num_loc_dof_segment_ {0}
private

◆ num_loc_dof_tria_

size_type lf::assemble::UniformFEDofHandler::num_loc_dof_tria_ {0}
private

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