LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
lf::assemble::EntityMatrixProvider Concept Reference

Provides the local element matrix for a mesh entity. More...

#include <lf/assemble/assemble.h>

Concept definition

template<class EMP>
concept lf::assemble::EntityMatrixProvider = requires(EMP& emp, const mesh::Entity& e) {
{ emp.isActive(e) } -> std::same_as<bool>;
{ emp.Eval(e) } -> base::EigenMatrix<void, -1, -1>;
}
Provides the local element matrix for a mesh entity.
Check if a given type T is an Eigen::Matrix.
Definition eigen_tools.h:70
void AssembleMatrixLocally(dim_t codim, const DofHandler &dof_handler_trial, const DofHandler &dof_handler_test, ENTITY_MATRIX_PROVIDER &entity_matrix_provider, TMPMATRIX &matrix)
Assembly function for standard assembly of finite element matrices.
Definition assembler.h:115

Detailed Description

Provides the local element matrix for a mesh entity.

Template Parameters
EMPEntity-Matrix-Provider (EMP) Type to be tested for satisfaction of the concept

Description

An EntityMatrixProvider is an object that provides a local element matrix for a given mesh entity. EntityMatrixProvider's are mostly used together with lf::assemble::AssembleMatrixLocally to assemble a sparse system matrix.

Requirements

The type EMP satisfies the Concept EntityMatrixProvider if given

the following expressions are valid:

expression return type semantics
emp.isActive(e) bool Defines whether the entity e is taken into account by the assembly routine.
emp.Eval(e) Eigen::Matrix<SCALAR, ROWS, COLS> Returns the local element matrix for mesh entity e. Is only called if emp.isActive(e)==true.

Typical class definition

class ElemMatProvider {
public:
// Constructor can be used to pass data required for local computations
ElemMatProvider() = default;
// Select cells taken into account during cell-oriented assembly
bool isActive(const lf::mesh::Entity& cell);
// Compute element matrix for a cell, here a fixed-size matrix
Eigen::Matrix<double, 3, 3> Eval(const lf::mesh::Entity& cell);
};
Note
returning a matrix object through Eval() may sacrifice efficiency because it may entail additional allocation of dynamic memory. However, this design was chosen for the sake of readability of the code and in order to avoid nasty memory access errors that often occur when passing a matrix by reference.

Usage scenarios

The concept of a EntityMatrixProvider is widely used in the lf::assemble and lf::uscalfe modules:

Archetype

See also

Classes modelling this concept

Definition at line 96 of file assemble_concepts.h.