LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
lf::uscalfe Namespace Reference

Collects data structures and algorithms designed for scalar finite element methods primarily meant for second-order elliptic boundary value problems. More...

Classes

class  FeLagrangeO1Quad
 Linear Lagrange finite element on the quadrilateral reference element. More...
 
class  FeLagrangeO1Segment
 Linear Lagrange finite element on a line segment. More...
 
class  FeLagrangeO1Tria
 Linear Lagrange finite element on triangular reference element. More...
 
class  FeLagrangeO2Quad
 Quadratic Lagrangian finite element on a quadrilateral reference element. More...
 
class  FeLagrangeO2Segment
 Quadratic Lagrangian finite element on a line segment. More...
 
class  FeLagrangeO2Tria
 Quadratic Lagrangian finite element on a triangular reference element. More...
 
class  FeLagrangeO3Quad
 Cubic Lagrangian finite element on a quadrilateral reference element. More...
 
class  FeLagrangeO3Segment
 Cubic Lagrangian finite element on a line segment. More...
 
class  FeLagrangeO3Tria
 Cubic Lagrangian finite elment on a triangular reference element. More...
 
class  FeSpaceLagrangeO1
 (Bi)Linear Lagrangian Finite Element space More...
 
class  FeSpaceLagrangeO2
 Quadratic Lagrangian Finite Element space. More...
 
class  FeSpaceLagrangeO3
 Cubic Lagrangian Finite Element space. More...
 
class  LinearFELaplaceElementMatrix
 Computing the element matrix for the (negative) Laplacian and linear finite elements. More...
 
class  LinearFELocalLoadVector
 Class for computation of local load vector for linear finite elements. More...
 
class  MassEdgeMatrixProvider
 Quadrature-based computation of local mass matrix for an edge. More...
 
class  PrecomputedScalarReferenceFiniteElement
 Helper class which stores a ScalarReferenceFiniteElement with precomputed values at the nodes of a quadrature rule. More...
 
class  ReactionDiffusionElementMatrixProvider
 Class for local quadrature based computations for Lagrangian finite elements and second-order scalar elliptic BVPs. More...
 
class  ScalarLoadEdgeVectorProvider
 Local edge contributions to element vector. More...
 
class  ScalarLoadElementVectorProvider
 Local computation of general element (load) vector for scalar finite elements; volume contributions only. More...
 
class  UniformScalarFESpace
 Space of scalar valued finite element functions on a hybrid 2D mesh More...
 

Typedefs

using gdof_idx_t = lf::assemble::gdof_idx_t
 
using ldof_idx_t = lf::assemble::ldof_idx_t
 
using size_type = lf::assemble::size_type
 
using dim_t = lf::assemble::dim_t
 
using glb_idx_t = lf::assemble::glb_idx_t
 
using sub_idx_t = lf::base::sub_idx_t
 
using quad_rule_collection_t = std::map<lf::base::RefEl, lf::quad::QuadRule>
 Auxiliary data structure for passing collections of quadrature rules.
 

Functions

std::shared_ptr< spdlog::logger > & LinearFeLocalLoadVectorLogger ()
 Used by LinearFELocalLoadVector to log additional (debug) information during vector assembly.
 
std::shared_ptr< spdlog::logger > & ReactionDiffusionElementMatrixProviderLogger ()
 logger for ReactionDiffusionElementMatrixProvider
 
std::shared_ptr< spdlog::logger > & MassEdgeMatrixProviderLogger ()
 logger for MassEdgeMatrixProvider
 
std::shared_ptr< spdlog::logger > & ScalarLoadElementVectorProviderLogger ()
 logger used by ScalarLoadElementVectorProvider
 
std::shared_ptr< spdlog::logger > & ScalarLoadEdgeVectorProviderLogger ()
 logger for ScalarLoadEdgeVectorProvider class template.
 
template<class PTR, class DIFF_COEFF, class REACTION_COEFF>
 ReactionDiffusionElementMatrixProvider (PTR fe_space, DIFF_COEFF alpha, REACTION_COEFF gamma) -> ReactionDiffusionElementMatrixProvider< typename PTR::element_type::Scalar, DIFF_COEFF, REACTION_COEFF >
 
template<class PTR, class DIFF_COEFF, class REACTION_COEFF>
 ReactionDiffusionElementMatrixProvider (PTR fe_space, DIFF_COEFF alpha, REACTION_COEFF gamma, std::map< lf::base::RefEl, lf::quad::QuadRule >) -> ReactionDiffusionElementMatrixProvider< typename PTR::element_type::Scalar, DIFF_COEFF, REACTION_COEFF >
 
template<class PTR, mesh::utils::MeshFunction COEFF, class EDGESELECTOR = base::PredicateTrue>
 MassEdgeMatrixProvider (PTR, COEFF coeff, EDGESELECTOR edge_predicate=base::PredicateTrue{}) -> MassEdgeMatrixProvider< typename PTR::element_type::Scalar, COEFF, EDGESELECTOR >
 
template<class PTR, class MESH_FUNCTION>
 ScalarLoadElementVectorProvider (PTR fe_space, MESH_FUNCTION mf) -> ScalarLoadElementVectorProvider< typename PTR::element_type::Scalar, MESH_FUNCTION >
 
template<class PTR, class FUNCTOR, class EDGESELECTOR = base::PredicateTrue>
 ScalarLoadEdgeVectorProvider (PTR, FUNCTOR, EDGESELECTOR=base::PredicateTrue{}) -> ScalarLoadEdgeVectorProvider< typename PTR::element_type::Scalar, FUNCTOR, EDGESELECTOR >
 
template<typename SCALAR>
void PrintInfo (std::ostream &o, const UniformScalarFESpace< SCALAR > &fes, unsigned ctrl)
 
template<typename SCALAR>
std::ostream & operator<< (std::ostream &o, const UniformScalarFESpace< SCALAR > &fes)
 
template<class SCALAR>
void PrintInfo (std::ostream &o, const UniformScalarFESpace< SCALAR > &fes, unsigned int ctrl=0)
 Print information about a UniformScalarFESpace to the given stream object.
 
template<typename SCALAR>
std::ostream & operator<< (std::ostream &o, const UniformScalarFESpace< SCALAR > &fes)
 output operator for scalar parametric finite element space
 
template<MeshFunction A, MeshFunction B>
auto operator* (const A &a, const B &b) -> MeshFunctionBinary< internal::OperatorMultiplication, A, B >
 Multiply two mesh functions with each other.
 
template<MeshFunction A, MeshFunction B>
auto operator+ (const A &a, const B &b) -> MeshFunctionBinary< internal::OperatorAddition, A, B >
 Add's two mesh functions.
 
template<MeshFunction A, MeshFunction B>
auto operator- (const A &a, const B &b) -> MeshFunctionBinary< internal::OperatorSubtraction, A, B >
 Subtracts two mesh functions.
 
template<MeshFunction A>
auto adjoint (const A &a) -> MeshFunctionUnary< internal::UnaryOpAdjoint, A >
 Pointwise adjoint of an Eigen::Matrix, i.e. the conjugate transposed of the matrix.
 
template<MeshFunction A>
auto conjugate (const A &a) -> MeshFunctionUnary< internal::UnaryOpConjugate, A >
 Pointwise conjuagte of an Eigen::Matrix, Eigen::Array or scalar valued mesh function.
 
template<MeshFunction A>
auto squaredNorm (const A &a) -> MeshFunctionUnary< internal::UnaryOpSquaredNorm, A >
 Pointwise squared norm of another mesh function.
 
template<MeshFunction A>
auto transpose (const A &a) -> MeshFunctionUnary< internal::UnaryOpTranspose, A >
 Pointwise transpose of an Eigen::Matrix or Eigen::Array
 

Variables

template<typename SCALAR>
const FeLagrangeO2Segment< SCALAR > FeLagrangeO2Quad< SCALAR >::krsf_segment_
 
template<typename SCALAR>
const Eigen::Matrix< int, 9, 2 > FeLagrangeO2Quad< SCALAR >::ksegment_to_quad_mapping_
 
template<typename SCALAR>
const FeLagrangeO3Segment< SCALAR > FeLagrangeO3Quad< SCALAR >::krsf_segment_
 
template<typename SCALAR>
const Eigen::Matrix< int, 16, 2 > FeLagrangeO3Quad< SCALAR >::ksegment_to_quad_mapping_
 
const unsigned int kUniformScalarFESpaceOutMesh = 1
 mesh information will be printed
 
const unsigned int kUniformScalarFESpaceOutDofh = 2
 information about the dof handler will be printed.
 
const unsigned int kUniformScalarFESpaceOutRsfs = 4
 information about the reference shape functions will be printed
 

Detailed Description

Collects data structures and algorithms designed for scalar finite element methods primarily meant for second-order elliptic boundary value problems.

This namespace contains a number of classes/functions which can be used to solve boundary value problems with uniform, scalar Finite elements:

  • Uniform means that the approximation space has uniform order of approximation over the whole mesh. Or in other words: The shape functions of a given approximation space depend only on the underlying reference element of a mesh entity.
  • Scalar means that the approximation space is always scalar valued, the shape functions are scalar valued.

Examples of approximation spaces that the methods/classes in this namespace can represent/handle are:

  • n-th order Lagrangian Shape functions
  • 1st order Crouzeix-Raviart approximation space
  • Broken spaces (e.g. for Discontinuous Galerkin Approximations)

Here are examples of use cases not supported by lf::uscalfe:

  • Approximation spaces where the polynomial degree depends on the mesh, respectively hierarchic approximation spaces (e.g. for hp-fem)
  • Non-Scalar valued approximation spaces such as EdgeFunctions/Nedelec elements or Thomas-Raviart elements.

Typedef Documentation

◆ dim_t

Type for (co-)dimensions

Definition at line 32 of file lagr_fe.h.

◆ gdof_idx_t

Type for indices into global matrices/vectors

Definition at line 26 of file lagr_fe.h.

◆ glb_idx_t

Type for global index of entities

Definition at line 34 of file lagr_fe.h.

◆ ldof_idx_t

Type for indices referring to entity matrices/vectors

Definition at line 28 of file lagr_fe.h.

◆ quad_rule_collection_t

Auxiliary data structure for passing collections of quadrature rules.

This type can be used to pass several quadrature rules to a function, when different quadrature rules for different types of entities are required.

Definition at line 32 of file loc_comp_ellbvp.h.

◆ size_type

Type for vector length/matrix sizes

Definition at line 30 of file lagr_fe.h.

◆ sub_idx_t

Type for indexing sub-entities

Definition at line 36 of file lagr_fe.h.

Function Documentation

◆ adjoint()

template<MeshFunction A>
auto adjoint ( const A & a) -> MeshFunctionUnary<internal::UnaryOpAdjoint, A>
related

Pointwise adjoint of an Eigen::Matrix, i.e. the conjugate transposed of the matrix.

Template Parameters
AThe type of the original mesh function.
Parameters
aThe original mesh function whose adjoint should be taken.
Returns
MeshFunction representing the pointwise adjoint of a.

Definition at line 308 of file mesh_function_unary.h.

◆ conjugate()

template<MeshFunction A>
auto conjugate ( const A & a) -> MeshFunctionUnary<internal::UnaryOpConjugate, A>
related

Pointwise conjuagte of an Eigen::Matrix, Eigen::Array or scalar valued mesh function.

Template Parameters
AThe type of the original mesh function.
Parameters
aThe original mesh function that should be conjugated.
Returns
MeshFunction representing the pointwise conjugate of a.

Definition at line 325 of file mesh_function_unary.h.

◆ LinearFeLocalLoadVectorLogger()

std::shared_ptr< spdlog::logger > & lf::uscalfe::LinearFeLocalLoadVectorLogger ( )

Used by LinearFELocalLoadVector to log additional (debug) information during vector assembly.

Definition at line 167 of file lin_fe.cc.

References lf::base::InitLogger().

Referenced by lf::uscalfe::LinearFELocalLoadVector< SCALAR, FUNCTOR >::Eval().

◆ MassEdgeMatrixProvider()

template<class PTR, mesh::utils::MeshFunction COEFF, class EDGESELECTOR = base::PredicateTrue>
lf::uscalfe::MassEdgeMatrixProvider ( PTR ,
COEFF coeff,
EDGESELECTOR edge_predicate = base::PredicateTrue{} ) -> MassEdgeMatrixProvider< typename PTR::element_type::Scalar, COEFF, EDGESELECTOR >

◆ MassEdgeMatrixProviderLogger()

std::shared_ptr< spdlog::logger > & lf::uscalfe::MassEdgeMatrixProviderLogger ( )

logger for MassEdgeMatrixProvider

Definition at line 27 of file loc_comp_ellbvp.cc.

References lf::base::InitLogger().

◆ operator*()

template<MeshFunction A, MeshFunction B>
auto operator* ( const A & a,
const B & b ) -> MeshFunctionBinary<internal::OperatorMultiplication, A, B>

Multiply two mesh functions with each other.

Template Parameters
AThe type of the lhs MeshFunction
BThe type of the rhs MeshFunction
Parameters
athe lhs MeshFunction
bthe rhs MeshFunction
Returns
Return a*b, i.e. a new mesh function which represents the pointwise product of a and b.
Note
if A and B are Eigen::Matrix valued, the resulting MeshFunction will also be Matrix/Vector valued and will represent the Matrix product of a and b.
If you want to apply this operator overload to meshfunctions" which do not reside in the lf::uscalfe namespace, it will not be found by Argument Dependent Lookup (ADL). You can get around this by explicitly importing the operator overload: using lf::uscalfe::operator*;

Example

auto mesh_factory = std::make_unique<mesh::hybrid2d::MeshFactory>(2);
auto gmsh_reader = io::GmshReader(std::move(mesh_factory), "mesh.msh");
// a mesh function which takes the value 1 everywhere
auto mf_one = mesh::utils::MeshFunctionConstant(1.);
// a mesh function which represents the radial vector field (x,y)
auto mf_radial = mesh::utils::MeshFunctionGlobal(
[](const Eigen::Vector2d& x) { return x; });
// a matrix valued mesh function ((x,y),(x^2,y^2))
auto mf_matrix =
mesh::utils::MeshFunctionGlobal([](const Eigen::Vector2d& x) {
return (Eigen::Matrix2d() << x[0], x[1], x[0] * x[0], x[1] * x[1])
.finished();
});
// product of two scalar valued mesh functions:
auto p0 = mf_one * mesh::utils::MeshFunctionConstant(3.);
// product of a scalar valued mesh function with a matrix valued one:
auto p1 = mf_one * mf_matrix;
// product of matrix valued with a vector valued mesh function:
auto p2 = mf_matrix * mf_radial; // will be vector valued
// product of a matrix valued mesh function with itself:
auto p3 = mf_matrix * mf_matrix;

Definition at line 722 of file mesh_function_binary.h.

◆ operator+()

template<MeshFunction A, MeshFunction B>
auto operator+ ( const A & a,
const B & b ) -> MeshFunctionBinary<internal::OperatorAddition, A, B>

Add's two mesh functions.

Template Parameters
AType of the lhs MeshFunction
BType of the rhs MeshFunction
Parameters
athe lhs MeshFunction
bthe rhs MeshFunction
Returns
a + b, i.e. a new mesh function which represents the pointwise addition of a and b
Note
the two mesh functions a and b should produce the same type of values, e.g. both should be scalar valued or both matrix/vector/array valued.
If you want to apply this operator overload to meshfunctions" which do not reside in the lf::uscalfe namespace, it will not be found by Argument Dependent Lookup. You can get around this by explictly importing the operator overload: using lf::uscalfe::operator+;

Example

auto mesh_factory = std::make_unique<mesh::hybrid2d::MeshFactory>(2);
auto gmsh_reader = io::GmshReader(std::move(mesh_factory), "mesh.msh");
// a mesh function that takes the value 1 everywhere
auto mf_one = mesh::utils::MeshFunctionConstant(1.);
// a mesh function which represents the function `sin(x)*cos(y)` (x,y are
// global coordinates)
auto mf_trig = mesh::utils::MeshFunctionGlobal(
[](const Eigen::Vector2d& x) { return std::sin(x[0]) * std::cos(x[1]); });
// mesh function `1+sin(x)*cos(y)`
auto mf_one_trig = mf_one + mf_trig;

Definition at line 664 of file mesh_function_binary.h.

◆ operator-()

template<MeshFunction A, MeshFunction B>
auto operator- ( const A & a,
const B & b ) -> MeshFunctionBinary<internal::OperatorSubtraction, A, B>

Subtracts two mesh functions.

Template Parameters
AType of the lhs MeshFunction
BType of the rhs MeshFunction
Parameters
athe lhs MeshFunction
bthe rhs MeshFunction
Returns
a - b, i.e. a new mesh function which represents the pointwise difference of a minus b
Note
the two mesh functions a and b should produce the same type of values, e.g. both should be scalar valued or both matrix/vector valued.
If you want to apply this operator overload to meshfunctions" which do not reside in the lf::uscalfe namespace, it will not be found by Argument Dependent Lookup (ADL). You can get around this by explicitly importing the operator overload: using lf::uscalfe::operator-;

Example

auto mesh_factory = std::make_unique<mesh::hybrid2d::MeshFactory>(2);
auto gmsh_reader = io::GmshReader(std::move(mesh_factory), "mesh.msh");
// a mesh function that takes the value 1 everywhere
auto mf_one = mesh::utils::MeshFunctionConstant(1.);
// a mesh function which represents the function `sin(x)*cos(y)` (x,y are
// global coordinates)
auto mf_trig = mesh::utils::MeshFunctionGlobal(
[](const Eigen::Vector2d& x) { return std::sin(x[0]) * std::cos(x[1]); });
// mesh function `1-sin(x)*cos(y)`
auto mf_one_minus_trig = mf_one - mf_trig;

Definition at line 693 of file mesh_function_binary.h.

◆ operator<<() [1/2]

template<typename SCALAR>
std::ostream & lf::uscalfe::operator<< ( std::ostream & o,
const UniformScalarFESpace< SCALAR > & fes )
related

output operator for scalar parametric finite element space

Definition at line 445 of file uniform_scalar_fe_space.h.

◆ PrintInfo() [1/2]

◆ ReactionDiffusionElementMatrixProvider() [1/2]

template<class PTR, class DIFF_COEFF, class REACTION_COEFF>
lf::uscalfe::ReactionDiffusionElementMatrixProvider ( PTR fe_space,
DIFF_COEFF alpha,
REACTION_COEFF gamma ) -> ReactionDiffusionElementMatrixProvider< typename PTR::element_type::Scalar, DIFF_COEFF, REACTION_COEFF >

◆ ReactionDiffusionElementMatrixProvider() [2/2]

template<class PTR, class DIFF_COEFF, class REACTION_COEFF>
lf::uscalfe::ReactionDiffusionElementMatrixProvider ( PTR fe_space,
DIFF_COEFF alpha,
REACTION_COEFF gamma,
std::map< lf::base::RefEl, lf::quad::QuadRule >  ) -> ReactionDiffusionElementMatrixProvider< typename PTR::element_type::Scalar, DIFF_COEFF, REACTION_COEFF >

◆ ReactionDiffusionElementMatrixProviderLogger()

std::shared_ptr< spdlog::logger > & lf::uscalfe::ReactionDiffusionElementMatrixProviderLogger ( )

◆ ScalarLoadEdgeVectorProvider()

template<class PTR, class FUNCTOR, class EDGESELECTOR = base::PredicateTrue>
lf::uscalfe::ScalarLoadEdgeVectorProvider ( PTR ,
FUNCTOR ,
EDGESELECTOR = base::PredicateTrue{} ) -> ScalarLoadEdgeVectorProvider< typename PTR::element_type::Scalar, FUNCTOR, EDGESELECTOR >

◆ ScalarLoadEdgeVectorProviderLogger()

std::shared_ptr< spdlog::logger > & lf::uscalfe::ScalarLoadEdgeVectorProviderLogger ( )

logger for ScalarLoadEdgeVectorProvider class template.

Definition at line 39 of file loc_comp_ellbvp.cc.

References lf::base::InitLogger().

◆ ScalarLoadElementVectorProvider()

template<class PTR, class MESH_FUNCTION>
lf::uscalfe::ScalarLoadElementVectorProvider ( PTR fe_space,
MESH_FUNCTION mf ) -> ScalarLoadElementVectorProvider< typename PTR::element_type::Scalar, MESH_FUNCTION >

◆ ScalarLoadElementVectorProviderLogger()

std::shared_ptr< spdlog::logger > & lf::uscalfe::ScalarLoadElementVectorProviderLogger ( )

◆ squaredNorm()

template<MeshFunction A>
auto squaredNorm ( const A & a) -> MeshFunctionUnary<internal::UnaryOpSquaredNorm, A>
related

Pointwise squared norm of another mesh function.

Template Parameters
AThe type of the wrapped mesh function.
Parameters
aThe original mesh function
Returns
MeshFunction representing |a|^2 (pointwise)
Note
This operator requires a to be either scalar or (eigen-) vector valued.

Definition at line 278 of file mesh_function_unary.h.

◆ transpose()

template<MeshFunction A>
auto transpose ( const A & a) -> MeshFunctionUnary<internal::UnaryOpTranspose, A>
related

Pointwise transpose of an Eigen::Matrix or Eigen::Array

Template Parameters
AThe type of the wrapped mesh function.
Parameters
aThe original MeshFunction
Returns
MeshFunction representing the pointwise transpose of a.

Definition at line 291 of file mesh_function_unary.h.

Referenced by lf::uscalfe::LinearFELaplaceElementMatrix::Eval().

Variable Documentation

◆ FeLagrangeO2Quad< SCALAR >::krsf_segment_

template<typename SCALAR>
const FeLagrangeO2Segment<SCALAR> lf::uscalfe::FeLagrangeO2Quad< SCALAR >::krsf_segment_
Initial value:
=
Quadratic Lagrangian finite element on a line segment.
Definition lagr_fe.h:564

Definition at line 909 of file lagr_fe.h.

◆ FeLagrangeO2Quad< SCALAR >::ksegment_to_quad_mapping_

template<typename SCALAR>
const Eigen::Matrix<int, 9, 2> lf::uscalfe::FeLagrangeO2Quad< SCALAR >::ksegment_to_quad_mapping_
Initial value:
=
(Eigen::Matrix<int,9,2>() << 0, 0,
1, 0,
1, 1,
0, 1,
2, 0,
1, 2,
2, 1,
0, 2,
2, 2).finished()

Definition at line 914 of file lagr_fe.h.

◆ FeLagrangeO3Quad< SCALAR >::krsf_segment_

template<typename SCALAR>
const FeLagrangeO3Segment<SCALAR> lf::uscalfe::FeLagrangeO3Quad< SCALAR >::krsf_segment_
Initial value:
=
Cubic Lagrangian finite element on a line segment.
Definition lagr_fe.h:1156

Definition at line 1457 of file lagr_fe.h.

◆ FeLagrangeO3Quad< SCALAR >::ksegment_to_quad_mapping_

template<typename SCALAR>
const Eigen::Matrix<int, 16, 2> lf::uscalfe::FeLagrangeO3Quad< SCALAR >::ksegment_to_quad_mapping_
Initial value:
=
(Eigen::Matrix<int,16,2>() << 0, 0,
1, 0,
1, 1,
0, 1,
2, 0,
3, 0,
1, 2,
1, 3,
3, 1,
2, 1,
0, 3,
0, 2,
2, 2,
3, 2,
3, 3,
2, 3).finished()

Definition at line 1462 of file lagr_fe.h.

◆ kUniformScalarFESpaceOutDofh

const unsigned int lf::uscalfe::kUniformScalarFESpaceOutDofh = 2

information about the dof handler will be printed.

To be used with PrintInfo(std::ostream&, const UniformScalarFESpace<SCALAR>&, unsigned int)

Definition at line 199 of file uniform_scalar_fe_space.h.

Referenced by PrintInfo().

◆ kUniformScalarFESpaceOutMesh

const unsigned int lf::uscalfe::kUniformScalarFESpaceOutMesh = 1

mesh information will be printed

Output control variables for PrintInfo:

To be used with PrintInfo(std::ostream&, const UniformScalarFESpace<SCALAR>&, unsigned int)

Definition at line 191 of file uniform_scalar_fe_space.h.

Referenced by PrintInfo().

◆ kUniformScalarFESpaceOutRsfs

const unsigned int lf::uscalfe::kUniformScalarFESpaceOutRsfs = 4

information about the reference shape functions will be printed

To be used with PrintInfo(std::ostream&, const UniformScalarFESpace<SCALAR>&, unsigned int)

Definition at line 207 of file uniform_scalar_fe_space.h.

Referenced by PrintInfo().