1#include "piecewise_const_element_vector_provider.h"
3#include <lf/base/base.h>
4#include <lf/uscalfe/lagr_fe.h>
12 double sigma, std::function<Eigen::Vector2d(
const Eigen::Vector2d &)> f,
18 quadrule_(std::move(quadrule)),
20 dirichlet_data_(dirichlet_data) {}
24 const auto *
const geom = entity.
Geometry();
27 const Eigen::MatrixXd ref_grads =
30 const Eigen::MatrixXd J_inv_trans =
31 geom->JacobianInverseGramian(Eigen::VectorXd::Zero(2));
32 const Eigen::MatrixXd grads = J_inv_trans * ref_grads;
33 Eigen::MatrixXd basis_funct(2, 3);
34 basis_funct << grads.row(1), -grads.row(0);
36 Eigen::VectorXd element_vector = Eigen::VectorXd::Zero(6);
38 const Eigen::VectorXd weights =
43 const auto f_eval =
f_(points.col(n));
44 element_vector.head(3) += basis_funct.transpose() * weights[n] * f_eval;
49 const Eigen::Matrix<double, 2, 3> normals =
54 for (
int edge_idx = 0; edge_idx < 3; ++edge_idx) {
55 const auto &edge = *edges[edge_idx];
58 t << -normals(1, edge_idx), normals(0, edge_idx);
62 return element_vector;
const Eigen::MatrixXd & NodeCoords() const
Get the coordinates of the nodes of this reference element.
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 Entity *const > SubEntities(unsigned rel_codim) const =0
Return all sub entities of this entity that have the given codimension (w.r.t. this entity!...
virtual base::RefEl RefEl() const =0
Describes the reference element type of this entity.
Represents a Quadrature Rule over one of the Reference Elements.
const Eigen::VectorXd & Weights() const
All quadrature weights as a vector.
const Eigen::MatrixXd & Points() const
All quadrature points as column vectors.
base::size_type NumPoints() const
Return the total number of quadrature points (num of columns of points/weights)
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::VectorXd Eval(const lf::mesh::Entity &entity) const
Compute the element vector for some entity of the mesh.
const std::function< Eigen::Vector2d(const Eigen::Vector2d &)> f_
const lf::mesh::utils::MeshDataSet< bool > & boundary_
const lf::mesh::utils::MeshDataSet< Eigen::Vector2d > & dirichlet_data_
PiecewiseConstElementVectorProvider(double sigma, std::function< Eigen::Vector2d(const Eigen::Vector2d &)> f, lf::quad::QuadRule quadrule, const lf::mesh::utils::MeshDataSet< bool > &boundary, const lf::mesh::utils::MeshDataSet< Eigen::Vector2d > &dirichlet_data)
Constructor.
const lf::quad::QuadRule quadrule_
unsigned int size_type
general type for variables related to size of arrays
Eigen::Matrix< double, 2, 3 > computeOutwardNormals(const lf::mesh::Entity &entity)
Compute the outward pointing normals of a triangle.