1#ifndef COMPUTE_HHO_NORMS_HPP
2#define COMPUTE_HHO_NORMS_HPP
6#include <boost/fusion/include/map.hpp>
7#include <boost/fusion/include/for_each.hpp>
19 template<TensorRankE Rank>
22 const std::vector<Eigen::VectorXd> &
vh,
28 std::stringstream message;
29 message <<
"The following local spaces are not available in '"
52 const Cell &
T = *
Vh.mesh().cell(
iT);
60 std::vector<Eigen::VectorXd>
vT(
nb_vectors, Eigen::VectorXd::Zero(
Vh.dimensionCell(
iT)));
61 std::transform(
vh.begin(),
vh.end(),
vT.begin(), [&
Vh, &
T](
const Eigen::VectorXd &
wh)->Eigen::VectorXd{ return Vh.restrict(T, wh); });
65 Eigen::VectorXd
cell_dofs =
vT[
i].tail(
Vh.numberOfLocalCellDofs());
74 for (
size_t iE = 0;
iE <
T.n_edges();
iE++) {
75 Edge & E = *
T.edge(
iE);
87 Eigen::VectorXd
cell_dofs =
vT[
i].segment(
Vh.localOffset(
T),
Vh.numberOfLocalCellDofs());
88 Eigen::VectorXd
edge_dofs =
vT[
i].segment(
Vh.localOffset(
T, E),
Vh.numberOfLocalEdgeDofs());
91 += (1. /
T.diam()) * (
114 template<TensorRankE Rank>
117 const std::vector<Eigen::MatrixXd> & potential,
118 const std::vector<Eigen::MatrixXd> & stabilization,
119 const std::vector<Eigen::VectorXd> &
vh,
124 std::stringstream message;
125 message <<
"The following local spaces are not available in '"
126 <<
Vh.name() <<
"': PotentialReconstructionBases"
144 const Cell &
T = *
Vh.mesh().cell(
iT);
151 std::vector<Eigen::VectorXd>
vT(
nb_vectors, Eigen::VectorXd::Zero(
Vh.dimensionCell(
iT)));
152 std::transform(
vh.begin(),
vh.end(),
vT.begin(),
153 [&
Vh, &
T](
const Eigen::VectorXd &
wh)->Eigen::VectorXd{ return Vh.restrict(T, wh); } );
163 +
vT[
i].dot(stabilization[
iT] *
vT[
i]);
181 template<
typename MeshEntity>
195 template<
typename DofType>
197 const auto &
dof_basis = m_discrete_space.
get<
typename DofType::first_type>(
dof_type.second)[m_mesh_entity.global_index()];
199 m_mass_matrices.push_back(
mass);
205 std::list<Eigen::MatrixXd> & m_mass_matrices;
209 template<
typename CellDofsMapType,
typename EdgeDofsMapType>
214 const std::vector<Eigen::VectorXd> &
vh,
225 const Cell &
T = *
Vh.mesh().cell(
iT);
226 double hT =
T.diam();
229 std::vector<Eigen::VectorXd>
vT(
nb_vectors, Eigen::VectorXd::Zero(
Vh.dimensionCell(
iT)));
230 std::transform(
vh.begin(),
vh.end(),
vT.begin(), [&
Vh, &
T](
const Eigen::VectorXd &
wh)->Eigen::VectorXd{ return Vh.restrict(T, wh); });
233 for (
size_t iE = 0;
iE <
T.n_edges();
iE++) {
234 const Edge & E = *
T.edge(
iE);
Definition discrete-space.hpp:20
const std::vector< std::unique_ptr< T > > & get(const std::string &name) const
Definition discrete-space.hpp:84
Basis for the space of gradients of polynomials.
Definition basis.hpp:1242
for i
Definition convergence_analysis.m:48
end
Definition convergence_analysis.m:110
Eigen::MatrixXd compute_gram_matrix(const boost::multi_array< VectorRd, 2 > &B1, const boost::multi_array< double, 2 > &B2, const QuadratureRule &qr)
Compute the Gram-like matrix given a family of vector-valued and one of scalar-valued functions by te...
Definition basis.cpp:239
static boost::multi_array< typename detail::basis_evaluation_traits< BasisType, BasisFunction >::ReturnValue, 2 > compute(const BasisType &basis, const QuadratureRule &quad)
Generic basis evaluation.
Definition basis.hpp:2425
static void parallel_for(unsigned nb_elements, std::function< void(size_t start, size_t end)> functor, bool use_threads=true, unsigned nb_threads_max=1e9)
Generic function to execute threaded processes.
Definition parallel_for.hpp:42
bool use_threads
Definition HHO_DiffAdvecReac.hpp:45
std::vector< QuadratureNode > QuadratureRule
Definition quadraturerule.hpp:55
std::vector< double > MonomialEdgeIntegralsType
Type for list of edge integrals of monomials.
Definition GMpoly_edge.hpp:34
std::unordered_map< VectorZd, double, VecHash > MonomialCellIntegralsType
Type for list of integrals of monomials.
Definition GMpoly_cell.hpp:53
MonomialEdgeIntegralsType IntegrateEdgeMonomials(const Edge &E, const size_t maxdeg)
Compute all integrals of edge monomials up to a total degree.
Definition GMpoly_edge.cpp:6
MonomialCellIntegralsType IntegrateCellMonomials(const Cell &T, const size_t maxdeg)
Compute all integrals on a cell of monomials up to a total degree, using vertex values.
Definition GMpoly_cell.cpp:7
Eigen::MatrixXd GramMatrix(const Cell &T, const MonomialScalarBasisCell &basis1, const MonomialScalarBasisCell &basis2, MonomialCellIntegralsType mono_int_map={})
Computes the Gram Matrix of a pair of local scalar monomial bases.
Definition GMpoly_cell.cpp:86
QuadratureRule generate_quadrature_rule(const Cell &T, const int doe, const bool force_split)
Generate quadrature rule on mesh element.
Definition quadraturerule.cpp:10
depending on the Matrix Market format indicated by or array(dense array storage). The data will be duplicated % as appropriate if symmetry is indicated in the header. % % Optionally
if(strcmp(field, 'real')) % real valued entries T
Definition mmread.m:93
std::vector< std::pair< double, double > > compute_hho_potential_norms(const DiscreteSpace &Vh, const std::vector< Eigen::MatrixXd > &potential, const std::vector< Eigen::MatrixXd > &stabilization, const std::vector< Eigen::VectorXd > &vh, bool use_threads=true)
Definition compute-hho-norms.hpp:115
std::vector< std::pair< double, double > > compute_hho_component_norms(const DiscreteSpace &Vh, const std::vector< Eigen::VectorXd > &vh, bool use_threads=true)
Definition compute-hho-norms.hpp:20
std::vector< double > compute_l2_dof_norms(const DiscreteSpace &Vh, const CellDofsMapType &cell_dofs_map, const EdgeDofsMapType &edge_dofs_map, const std::vector< Eigen::VectorXd > &vh, bool use_threads=true)
Compute L2 component norms for spaces with generic cell and edge DOFs.
Definition compute-hho-norms.hpp:210
Definition mhd-solutions.hpp:9
Definition compute-hho-norms.hpp:182
ComputeMass(const DiscreteSpace &discrete_space, const MeshEntity &mesh_entity, std::list< Eigen::MatrixXd > &mass_matrices)
Definition compute-hho-norms.hpp:183
void operator()(const DofType &dof_type) const
Definition compute-hho-norms.hpp:196
Definition discrete-space.hpp:113
Definition hho-dofs-types.hpp:11