1#ifndef HLDO_SPHERE_NORMS_L2NORM_H
2#define HLDO_SPHERE_NORMS_L2NORM_H
32template <
typename MF,
typename SQ_F>
33std::pair<double, lf::mesh::utils::CodimMeshDataSet<double>>
L2norm(
34 const std::shared_ptr<const lf::mesh::Mesh>& mesh_p,
const MF& f,
37 double squared_sum = 0;
43 const Eigen::MatrixXd loc_points = quadrule.
Points();
44 const Eigen::VectorXd weights = quadrule.
Weights();
50 Eigen::VectorXd det{e->Geometry()->IntegrationElement(loc_points)};
52 auto values = f(*e, loc_points);
54 double cell_error = 0;
56 cell_error += det[i] * weights[i] * sq_f(values[i]);
58 cellErrors(*e) = std::sqrt(cell_error);
59 squared_sum += cell_error;
62 return std::make_pair(sqrt(squared_sum), cellErrors);
83template <
typename MF,
typename SQ_F>
84std::pair<double, lf::mesh::utils::CodimMeshDataSet<double>>
SupNorm(
85 const std::shared_ptr<const lf::mesh::Mesh>& mesh_p,
const MF& f,
94 const Eigen::MatrixXd loc_points = quadrule.
Points();
100 auto values = f(*e, loc_points);
105 double temp = sq_f(values[i]);
106 if (temp > loc_max) loc_max = temp;
107 if (temp > glob_max) glob_max = temp;
109 cellErrors(*e) = sqrt(loc_max);
112 return std::make_pair(sqrt(glob_max), cellErrors);
Interface class representing a topological entity in a cellular complex
A MeshDataSet that attaches data of type T to every entity of a mesh that has a specified codimension...
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)
unsigned int size_type
general type for variables related to size of arrays
Postprocessing such as computing norms and Mesh Functions and plot scripts.
std::pair< double, lf::mesh::utils::CodimMeshDataSet< double > > SupNorm(const std::shared_ptr< const lf::mesh::Mesh > &mesh_p, const MF &f, const SQ_F &sq_f, const lf::quad::QuadRule &quadrule)
Computes the supremum norm of the squared values of some MeshFunction (type MF) f.
std::pair< double, lf::mesh::utils::CodimMeshDataSet< double > > L2norm(const std::shared_ptr< const lf::mesh::Mesh > &mesh_p, const MF &f, const SQ_F &sq_f, const lf::quad::QuadRule &quadrule)
Computes the L2Norm of some MeshFunction (type MF) f.