1#ifndef HLDO_SPHERE_MESH_FUNCTION_WHITNEY_ONE_H
2#define HLDO_SPHERE_MESH_FUNCTION_WHITNEY_ONE_H
7#include <lf/uscalfe/uscalfe.h>
17template <
typename SCALAR>
42 const std::shared_ptr<const lf::mesh::Mesh> mesh)
43 : mu_(mu), mesh_(mesh) {
46 int mu_size = mu.size();
49 "Not the right number of basis expansion coefficiants in mu expected: "
50 << n <<
" given: " << mu_size);
91 std::vector<Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>> operator()(
95 "Unsupported cell type " << e.
RefEl());
107 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> ref_grads =
112 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> J_inv_trans =
113 geom->JacobianInverseGramian(Eigen::VectorXd::Zero(2));
116 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> grad =
117 J_inv_trans * ref_grads;
120 const Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> lambda =
127 std::vector<Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>> vals(local.cols());
130 std::vector<lf::base::size_type> global_indices(3);
133 global_indices[i] = mesh_->Index(*edges[i]);
138 for (
int i = 0; i < local.cols(); i++) {
139 Eigen::Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> bs(grad.rows(), 3);
140 bs.col(0) = lambda(0, i) * grad.col(1) - lambda(1, i) * grad.col(0);
141 bs.col(1) = lambda(1, i) * grad.col(2) - lambda(2, i) * grad.col(1);
142 bs.col(2) = lambda(2, i) * grad.col(0) - lambda(0, i) * grad.col(2);
148 vals[i] = mu_(global_indices[0]) * bs.col(0) +
149 mu_(global_indices[1]) * bs.col(1) +
150 mu_(global_indices[2]) * bs.col(2);
157 const Eigen::Matrix<SCALAR, Eigen::Dynamic, 1>& mu_;
158 const std::shared_ptr<const lf::mesh::Mesh> mesh_;
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 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 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::Matrix< SCALAR, Eigen::Dynamic, Eigen::Dynamic > EvalReferenceShapeFunctions(const Eigen::MatrixXd &refcoords) const override
Evaluation of all reference shape functions in a number of points.
Provides Mesh Function for given basis expansion coefficients.
MeshFunctionWhitneyOne(const Eigen::Matrix< SCALAR, Eigen::Dynamic, 1 > &mu, const std::shared_ptr< const lf::mesh::Mesh > mesh)
basic constructor
unsigned int size_type
general type for variables related to size of arrays
int to_sign(Orientation o)
Postprocessing such as computing norms and Mesh Functions and plot scripts.