LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Attributes | List of all members
lf::mesh::utils::MeshFunctionGlobal< F > Class Template Reference

MeshFunction wrapper for a simple function of physical coordinates. More...

#include <lf/uscalfe/uscalfe.h>

Public Member Functions

 MeshFunctionGlobal (const MeshFunctionGlobal &)=default
 
 MeshFunctionGlobal (MeshFunctionGlobal &&) noexcept=default
 
MeshFunctionGlobaloperator= (const MeshFunctionGlobal &)=delete
 
MeshFunctionGlobaloperator= (MeshFunctionGlobal &&)=delete
 
 MeshFunctionGlobal (F f)
 
std::vector< F_return_typeoperator() (const mesh::Entity &e, const Eigen::MatrixXd &local) const
 MeshFunction compliant evaluation operator.
 
virtual ~MeshFunctionGlobal ()=default
 

Private Types

using F_return_type
 

Private Attributes

f_
 

Detailed Description

template<class F>
class lf::mesh::utils::MeshFunctionGlobal< F >

MeshFunction wrapper for a simple function of physical coordinates.

Template Parameters
Fa functor type, offering an evaluation operator that acccepts a single coordinate vector.

MeshFunctionGlobal essentially wraps a function object which represents a function defined on the mesh that depends only on the global coordinates. An example is e.g. the function \( \vec{x} \mapsto \norm{x}^2 \).

Requirements for F

F is a function object that should overload the call operator as follows:

auto operator()(const Eigen::Vector2d& x) const
std::vector< F_return_type > operator()(const mesh::Entity &e, const Eigen::MatrixXd &local) const
MeshFunction compliant evaluation operator.

which should return the value of the mesh function at the global coordinates x. The return type of the call operator can in principle be anything, but usually it is one of:

For instance, a MeshFunctionGlobal object may be instantiated with a lambda function.

Note
For DimGlobal==3, the call operator should of course accept a Eigen::Vector3d.

Use case

// Define a tensor field through a lambda function
auto alpha = [](Eigen::Vector2d x) -> Eigen::Matrix<double, 2, 2> {
return (Eigen::Matrix<double, 2, 2>() << (3.0 + x[1]), x[0], x[0],
(2.0 + x[0]))
.finished();
};
// Wrap the tensor field into a MeshFunction
// evaluate the tensor field at the nodes of the mesh
const Eigen::Matrix<double, 0, 1> dummy;
for (const lf::mesh::Entity* node : mesh.Entities(2)) {
const std::vector<Eigen::Matrix<double, 2, 2>> a{mf_alpha(*node, dummy)};
std::cout << a[0] << std::endl;
}

Definition at line 55 of file mesh_function_global.h.

Member Typedef Documentation

◆ F_return_type

template<class F >
using lf::mesh::utils::MeshFunctionGlobal< F >::F_return_type
private
Initial value:
decltype(std::declval<F>()(std::declval<Eigen::Vector2d>()))

Definition at line 56 of file mesh_function_global.h.

Constructor & Destructor Documentation

◆ MeshFunctionGlobal() [1/3]

template<class F >
lf::mesh::utils::MeshFunctionGlobal< F >::MeshFunctionGlobal ( const MeshFunctionGlobal< F > & )
default

◆ MeshFunctionGlobal() [2/3]

template<class F >
lf::mesh::utils::MeshFunctionGlobal< F >::MeshFunctionGlobal ( MeshFunctionGlobal< F > && )
defaultnoexcept

◆ MeshFunctionGlobal() [3/3]

template<class F >
lf::mesh::utils::MeshFunctionGlobal< F >::MeshFunctionGlobal ( F f)
inlineexplicit

Definition at line 72 of file mesh_function_global.h.

◆ ~MeshFunctionGlobal()

template<class F >
virtual lf::mesh::utils::MeshFunctionGlobal< F >::~MeshFunctionGlobal ( )
virtualdefault

Member Function Documentation

◆ operator()()

template<class F >
std::vector< F_return_type > lf::mesh::utils::MeshFunctionGlobal< F >::operator() ( const mesh::Entity & e,
const Eigen::MatrixXd & local ) const
inline

◆ operator=() [1/2]

template<class F >
MeshFunctionGlobal & lf::mesh::utils::MeshFunctionGlobal< F >::operator= ( const MeshFunctionGlobal< F > & )
delete

◆ operator=() [2/2]

template<class F >
MeshFunctionGlobal & lf::mesh::utils::MeshFunctionGlobal< F >::operator= ( MeshFunctionGlobal< F > && )
delete

Member Data Documentation

◆ f_

template<class F >
F lf::mesh::utils::MeshFunctionGlobal< F >::f_
private

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