9#ifndef INCGb6997524e2834b5b8e4bba019fb35cc6
10#define INCGb6997524e2834b5b8e4bba019fb35cc6
11#include "scalar_fe_space.h"
46template <
class SCALAR_FE,
class SCALAR_COEFF>
49 using Scalar =
decltype(SCALAR_FE(0) * SCALAR_COEFF(0));
62 Eigen::Matrix<SCALAR_COEFF, Eigen::Dynamic, 1> dof_vector)
69 [[nodiscard]] std::shared_ptr<const mesh::Mesh>
getMesh()
const {
79 [[nodiscard]] std::shared_ptr<const ScalarFESpace<SCALAR_FE>>
getFESpace()
92 std::vector<Eigen::Matrix<Scalar, Eigen::Dynamic, 1>>
operator()(
96 fe_space_->ShapeFunctionLayout(e)->GradientsReferenceShapeFunctions(
100 Eigen::Matrix<SCALAR_COEFF, 1, Eigen::Dynamic> local_dofs(
101 1, grad_sf_eval.rows());
102 auto global_dofs =
fe_space_->LocGlobMap().GlobalDofIndices(e);
103 for (Eigen::Index i = 0; i < grad_sf_eval.rows(); ++i) {
107 auto local_grads = (local_dofs * grad_sf_eval).eval();
110 auto dim_local = base::narrow<Eigen::Index>(e.
RefEl().
Dimension());
111 std::vector<Eigen::Matrix<Scalar, Eigen::Dynamic, 1>> result(local.cols());
113 for (Eigen::Index i = 0; i < result.size(); ++i) {
114 result[i] = jac_t.block(0, dim_local * i, jac_t.rows(), dim_local) *
115 local_grads.block(0, i * dim_local, 1, dim_local).transpose();
122 std::shared_ptr<const ScalarFESpace<SCALAR_FE>>
fe_space_;
129template <
class T,
class SCALAR_COEFF>
131 const Eigen::Matrix<SCALAR_COEFF, Eigen::Dynamic, 1>&)
constexpr dim_t Dimension() const
Return the dimension of this reference element.
A MeshFunction representing the gradient of a function from a scalar finite element space (e....
std::shared_ptr< const ScalarFESpace< SCALAR_FE > > fe_space_
Pointer to underlying finite element space.
std::shared_ptr< const mesh::Mesh > getMesh() const
Convenience method to retrieve the underlying mesh.
std::shared_ptr< const ScalarFESpace< SCALAR_FE > > getFESpace() const
Convenience method to retrieve the finite element space to which the original function belongs (i....
std::vector< Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > > operator()(const lf::mesh::Entity &e, const Eigen::MatrixXd &local) const
Evaluate the mesh function on a MeshEntity.
Eigen::Matrix< SCALAR_COEFF, Eigen::Dynamic, 1 > dof_vector_
Reference to basis expansion coefficient vector for finite-element function
MeshFunctionGradFE(std::shared_ptr< const ScalarFESpace< SCALAR_FE > > fe_space, Eigen::Matrix< SCALAR_COEFF, Eigen::Dynamic, 1 > dof_vector)
Create a new MeshFunctionGradFE from a ScalarFESpace and a coefficient vector.
decltype(SCALAR_FE(0) *SCALAR_COEFF(0)) Scalar
Space of scalar valued finite element functions on a Mesh.
virtual Eigen::MatrixXd JacobianInverseGramian(const Eigen::MatrixXd &local) const =0
Evaluate the Jacobian * Inverse Gramian ( ) simultaneously at numPoints.
Interface class representing a topological entity in a cellular complex
virtual const geometry::Geometry * Geometry() const =0
Describes the geometry of this entity.
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Collects data structures and algorithms designed for scalar finite element methods primarily meant fo...
MeshFunctionGradFE(std::shared_ptr< T >, const Eigen::Matrix< SCALAR_COEFF, Eigen::Dynamic, 1 > &) -> MeshFunctionGradFE< typename T::Scalar, SCALAR_COEFF >