1#ifndef HHO_INTERPOLATE_HPP
2#define HHO_INTERPOLATE_HPP
21 template<TensorRankE Rank,
typename F>
28 const auto & cell_dofs_bases = Vh.
get<
typename HHODOFsTypes<Rank>::CellDOFsType>(
"CellDOFs");
29 const auto & edge_dofs_bases = Vh.
get<
typename HHODOFsTypes<Rank>::EdgeDOFsType>(
"EdgeDOFs");
31 Eigen::VectorXd vh = Eigen::VectorXd::Zero(Vh.
dimension());
33 int doe_cell = (parameters.doe_cell > 0 ? parameters.doe_cell : 2 * cell_dofs_bases[0]->max_degree() + 3);
34 int doe_edge = (parameters.doe_edge > 0 ? parameters.doe_edge : 2 * edge_dofs_bases[0]->max_degree() + 3);
37 std::function<void(
size_t,
size_t)> interpolate_edges
38 = [&Vh, &edge_dofs_bases, &vh,
v, &doe_edge](
size_t start,
size_t end)->
void
40 for (
size_t iE = start; iE <
end; iE++) {
41 const Edge & E = *Vh.
mesh().
edge(iE);
44 vh.segment(Vh.
globalOffset(E), edge_dofs_bases[iE]->dimension())
51 std::function<void(
size_t,
size_t)> interpolate_cells
52 = [&Vh, &cell_dofs_bases, &vh,
v, &doe_cell](
size_t start,
size_t end)->
void
54 for (
size_t iT = start; iT <
end; iT++) {
58 vh.segment(Vh.
globalOffset(
T), cell_dofs_bases[iT]->dimension())
Definition discrete-space.hpp:20
const std::vector< std::unique_ptr< T > > & get(const std::string &name) const
Definition discrete-space.hpp:84
const Mesh & mesh() const
Definition discrete-space.hpp:68
size_t dimension() const
Returns the dimension of the global space (all DOFs for all geometric entities)
Definition local-dof-table.hpp:58
end
Definition compute_eigs.m:12
Eigen::VectorXd l2_projection(const std::function< typename BasisType::FunctionValue(const VectorRd &)> &f, const BasisType &basis, QuadratureRule &quad, const boost::multi_array< typename BasisType::FunctionValue, 2 > &basis_quad, const Eigen::MatrixXd &mass_basis=Eigen::MatrixXd::Zero(1, 1))
Compute the L2-projection of a function.
Definition basis.hpp:2886
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:2288
size_t globalOffset(const Vertex &V) const
Return the global offset for the unknowns on the vertex V.
Definition global-dof-table.hpp:28
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
Polytope< DIMENSION > Cell
Definition Polytope2D.hpp:151
Cell * cell(std::size_t index) const
get a constant pointer to a cell using its global index
Definition Mesh2D.hpp:178
Edge * edge(std::size_t index) const
get a constant pointer to a edge using its global index
Definition Mesh2D.hpp:168
std::size_t n_cells() const
number of cells in the mesh.
Definition Mesh2D.hpp:63
std::size_t n_edges() const
number of edges in the mesh.
Definition Mesh2D.hpp:61
std::vector< QuadratureNode > QuadratureRule
Definition quadraturerule.hpp:55
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
if(strcmp(field, 'real')) % real valued entries T
Definition mmread.m:93
Eigen::VectorXd hho_interpolate(const DiscreteSpace &Vh, const F &v, const InterpolateParameters ¶meters={})
Definition hho-interpolate.hpp:22
Definition ddr-klplate.hpp:27
static auto v
Definition ddrcore-test.hpp:32
Definition hho-interpolate.hpp:15
int doe_cell
Definition hho-interpolate.hpp:17
bool use_threads
Definition hho-interpolate.hpp:16
int doe_edge
Definition hho-interpolate.hpp:18