1#ifndef HLDO_SPHERE_ASSEMBLE_WHITNEY_ONE_VECTOR_PROVIDER_H
2#define HLDO_SPHERE_ASSEMBLE_WHITNEY_ONE_VECTOR_PROVIDER_H
9#include <lf/base/base.h>
10#include <lf/mesh/entity.h>
11#include <lf/mesh/utils/mesh_data_set.h>
12#include <lf/quad/quad.h>
13#include <lf/uscalfe/lagr_fe.h>
55template <
typename SCALAR>
68 const std::function<Eigen::Matrix<SCALAR, 3, 1>(
const Eigen::Vector3d &)>
79 Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>
Eval(
82 "Only Triangles are supported no " << entity.
RefEl());
84 const auto *
const geom = entity.
Geometry();
94 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> ref_grads =
97 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> J_inv_trans =
98 geom->JacobianInverseGramian(Eigen::VectorXd::Zero(2));
99 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> grads =
100 J_inv_trans * ref_grads;
109 const auto b_hat = [&](Eigen::Vector2d x_hat)
110 -> Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> {
111 Eigen::Matrix<SCALAR, 3, 3> b_hat;
112 Eigen::Matrix<SCALAR, 3, 1> lambda_hat =
114 for (
int i = 0; i < 3; i++) {
115 int ip1 = (i + 1) % 3;
117 b_hat.col(i) = s(i) * (lambda_hat(i) * grads.col(ip1) -
118 lambda_hat(ip1) * grads.col(i));
127 const auto f_tilde_hat =
128 [&](Eigen::Vector2d x_hat) -> Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> {
129 Eigen::Vector3d x = geom->Global(x_hat);
130 Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> result =
131 b_hat(x_hat).transpose() *
f_(x);
136 Eigen::Matrix<SCALAR, 3, 1> element_vector;
137 element_vector.setZero();
138 const Eigen::MatrixXd points = quadrule.Points();
139 const Eigen::VectorXd weights =
140 (geom->IntegrationElement(points).array() * quadrule.Weights().array())
143 const Eigen::Matrix<SCALAR, Eigen::Dynamic, 1> f_eval =
144 f_tilde_hat(points.col(n));
145 element_vector += weights[n] * f_eval;
147 return element_vector;
156 const std::function<Eigen::Matrix<SCALAR, 3, 1>(
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.
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.
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 > GradientsReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Computation of the gradients of all reference shape functions in a number of points.
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 Whitney one forms.
WhitneyOneVectorProvider(const std::function< Eigen::Matrix< SCALAR, 3, 1 >(const Eigen::Vector3d &)> &f)
Constructor.
const std::function< Eigen::Matrix< SCALAR, 3, 1 >(const Eigen::Vector3d &)> f_
Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > Eval(const lf::mesh::Entity &entity) const
Compute the element vector for a given triangle off the mesh.
bool isActive(const lf::mesh::Entity &entity) const
All entities are regarded as active.
unsigned int size_type
general type for variables related to size of arrays
QuadRule make_TriaQR_EdgeMidpointRule()
edge midpoint quadrature rule for reference triangles
int to_sign(Orientation o)
Implementation of the thesis Hogde Laplacians and Dirac Operators on the surface of the 3-Sphere.