template<class F>
class lf::mesh::utils::MeshFunctionGlobal< F >
MeshFunction wrapper for a simple function of physical coordinates.
- Template Parameters
-
F | a 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:
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:
double
for a scalar valued mesh function
std::complex<double>
for complex valued mesh function
Eigen::Vector2d
for a tensor valued mesh function.
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
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();
};
const Eigen::Matrix<double, 0, 1> dummy;
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.