1#ifndef HLDO_SPHERE_ASSEMBLE_LOAD_VECTOR_PROVIDER_H
2#define HLDO_SPHERE_ASSEMBLE_LOAD_VECTOR_PROVIDER_H
8#include <lf/mesh/entity.h>
9#include <lf/mesh/utils/mesh_data_set.h>
10#include <lf/quad/quad.h>
11#include <lf/uscalfe/lagr_fe.h>
48template <
typename SCALAR>
69 Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>
Eval(
71 const auto *
const geom = entity.
Geometry();
75 "Unsupported cell type " << entity.
RefEl());
78 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> vertices =
86 const auto lambda_hat = [&](Eigen::Vector2d x_hat)
87 -> Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> {
93 const auto f_tilde_hat =
94 [&](Eigen::Vector2d x_hat) -> Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> {
95 Eigen::MatrixXd x = geom->Global(x_hat);
96 return lambda_hat(x_hat) *
f_(x);
100 Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> element_vector =
101 Eigen::Matrix<SCALAR, 3, 1>::Zero();
102 const Eigen::MatrixXd points = quadrule.Points();
103 const Eigen::VectorXd weights =
104 (geom->IntegrationElement(points).array() * quadrule.Weights().array())
107 const Eigen::Matrix<SCALAR, 3, 1> f_eval = f_tilde_hat(points.col(n));
108 element_vector += weights[n] * f_eval;
110 return element_vector;
119 const std::function<SCALAR(
const Eigen::Vector3d &)>
f_;
const Eigen::MatrixXd & NodeCoords() const
Get the coordinates of the nodes of this reference element.
static constexpr RefEl kTria()
Returns the reference triangle.
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.
Represents a Quadrature Rule over one of the Reference Elements.
Linear Lagrange finite element on triangular reference element.
Eigen::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > EvalReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Evaluation of all reference shape functions in a number of points.
Element Vector Provider for scalar valued load functions using picewise linear barycentric basis func...
const std::function< SCALAR(const Eigen::Vector3d &)> f_
bool isActive(const lf::mesh::Entity &entity) const
All entities are regarded as active.
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > Eval(const lf::mesh::Entity &entity) const
Compute the element vector for some cell on the mesh.
LoadVectorProvider(const std::function< SCALAR(const Eigen::Vector3d &)> &f)
Constructor setting the load function.
unsigned int size_type
general type for variables related to size of arrays
QuadRule make_TriaQR_EdgeMidpointRule()
edge midpoint quadrature rule for reference triangles
Implementation of the thesis Hogde Laplacians and Dirac Operators on the surface of the 3-Sphere.