1#include "whitney_one_mass_matrix_provider.h"
3#include <lf/uscalfe/lagr_fe.h>
15 "Unsupported cell type " << entity.
RefEl());
18 const auto *geom = entity.
Geometry();
26 const Eigen::MatrixXd ref_grads =
30 const Eigen::MatrixXd J_inv_trans =
31 geom->JacobianInverseGramian(Eigen::VectorXd::Zero(2));
34 Eigen::MatrixXd grads = J_inv_trans * ref_grads;
44 std::vector<Eigen::Matrix3d> elem_mats(4);
46 elem_mats[0] << 2, 1, 1,
49 elem_mats[1] << 1, 1, 2,
53 elem_mats[2] << 1, 2, 1,
57 elem_mats[3] << 2, 1, 1,
62 for (
int i = 0; i < 4; i++) {
67 auto index = [](
int i) ->
int {
return i % 3; };
70 for (
int i = 0; i < 3; i++) {
71 for (
int k = 0; k < 3; k++) {
73 (grads.col(index(i + 1)).transpose() * grads.col(index(k + 1)));
74 elem_mats[0](i, k) *= s(i) * s(k);
79 for (
int i = 0; i < 3; i++) {
80 for (
int k = 0; k < 3; k++) {
82 (grads.col(index(i + 1)).transpose() * grads.col(index(k)));
83 elem_mats[1](i, k) *= s(i) * s(k);
88 for (
int i = 0; i < 3; i++) {
89 for (
int k = 0; k < 3; k++) {
91 (grads.col(index(i)).transpose() * grads.col(index(k + 1)));
92 elem_mats[2](i, k) *= s(i) * s(k);
97 for (
int i = 0; i < 3; i++) {
98 for (
int k = 0; k < 3; k++) {
100 (grads.col(index(i)).transpose() * grads.col(index(k)));
101 elem_mats[3](i, k) *= s(i) * s(k);
106 Eigen::Matrix3d elem_mat = Eigen::MatrixXd::Zero(3, 3);
107 for (
int i = 0; i < 4; i++) {
108 elem_mat += elem_mats[i];
const Eigen::MatrixXd & NodeCoords() const
Get the coordinates of the nodes of this reference element.
static constexpr RefEl kTria()
Returns the reference triangle.
virtual Eigen::MatrixXd Global(const Eigen::MatrixXd &local) const =0
Map a number of points in local coordinates into the global coordinate system.
Interface class representing a topological entity in a cellular complex
virtual const geometry::Geometry * Geometry() const =0
Describes the geometry of this entity.
virtual nonstd::span< const Orientation > RelativeOrientations() const =0
return span of relative orientations of sub-entities of the next higher co-dimension.
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Linear Lagrange finite element on triangular reference element.
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > GradientsReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Computation of the gradients of all reference shape functions in a number of points.
Eigen::MatrixXd Eval(const lf::mesh::Entity &entity) const
Compute the element matrix for a given cell of a mesh.
double Volume(const Geometry &geo)
Compute the (approximate) volume (area) of a shape.
int to_sign(Orientation o)
Collection of matrix and vector element providers.