41 std::ostream & output = std::cout
88 const std::vector<Eigen::ArrayXd>&
f_quad,
89 const std::vector<Eigen::ArrayXd>&
g_quad,
99 const std::vector<Eigen::ArrayXXd>&
F_quad,
100 const std::vector<Eigen::ArrayXXd>&
G_quad,
105 std::vector<Eigen::Matrix2d>
L2Weight = {}
109 template<
typename Function>
113 template<
typename Function>
116 Eigen::VectorXd
nc_restr(
const Eigen::VectorXd &
Xh,
size_t iT)
const;
129 const Eigen::VectorXd
Xh,
135 std::tuple<std::vector<cell_basis_type>,
136 std::vector<cell_gradient_type>,
138 create_nc_basis(
size_t iT)
const;
140 std::vector<VectorRd> create_ml_nodes(
size_t iT)
const;
143 std::vector<std::vector<cell_basis_type> > _nc_bases;
144 std::vector<std::vector<cell_gradient_type> > _nc_gradients;
146 std::vector<Eigen::MatrixXd> _M_basis;
149 std::vector<std::vector<VectorRd>> _ml_nodes;
152 double sign(
const double s)
const;
155 std::ostream & m_output;
170 std::ostream & output):
179 _nc_bases.reserve(
ncells);
180 _nc_gradients.reserve(
ncells);
181 _ml_nodes.reserve(
ncells);
185 std::vector<VectorRd>
ml_nodes = create_ml_nodes(
iT);
187 std::tuple<std::vector<cell_basis_type>, std::vector<cell_gradient_type>, Eigen::MatrixXd>
nc_basis = create_nc_basis(
iT);
188 _nc_bases.push_back(std::get<0>(
nc_basis));
189 _nc_gradients.push_back(std::get<1>(
nc_basis));
190 _M_basis.push_back(std::get<2>(
nc_basis));
198std::vector<VectorRd> LEPNCCore::create_ml_nodes(
size_t iT)
const {
200 Cell* cell = mesh->
cell(
iT);
202 std::vector<VectorRd>
ml_cell(mesh->
dim()+1,VectorRd::Zero());
206 std::vector<VectorRd>
v_cur(mesh->
dim()+1,VectorRd::Zero());
209 v_cur[0] = cell->vertex(
i)->coords();
211 v_cur[1] = cell->vertex(
j)->coords();
213 v_cur[2] = cell->vertex(
k)->coords();
214 Eigen::MatrixXd
matv = Eigen::MatrixXd::Zero(mesh->
dim(), mesh->
dim());
215 for (
size_t ll=0;
ll < mesh->
dim();
ll++){
220 for (
size_t z=0;
z < mesh->
dim()+1;
z++){
236std::tuple<std::vector<LEPNCCore::cell_basis_type>,
237 std::vector<LEPNCCore::cell_gradient_type>,
239 LEPNCCore::create_nc_basis(
size_t iT)
const {
258 std::vector<VectorRd>
Nint_edge(2, VectorRd::Zero());
287 m_output <<
"Scaling factor of non-conforming basis function too small: " << std::abs(
scaling_factor_phi) <<
"\n";
359 for (
size_t k=0;
k < mesh->dim() + 1;
k++){
413 return _nc_bases[
iT][
i];
419 return _nc_gradients[
iT][
i];
425 return _ml_nodes[
iT][
i];
537 for (
size_t j = 0;
j <
jcut;
j++){
558 for (
size_t j = 0;
j <
jcut;
j++){
586template<
typename Function>
634 Eigen::VectorXd
UT =
MT.ldlt().solve(
bT);
644template<
typename Function>
805 for (Edge* edge :
eList){
822double LEPNCCore::sign(
const double s)
const {
Definition hybridcore.hpp:179
Definition lepnccore.hpp:33
for i
Definition convergence_analysis.m:48
for j
Definition convergence_analysis.m:19
end Sort data by mesh size(finest to coarsest or vice versa) for i
y
Definition generate_cartesian_mesh.m:23
Create grid points x
Definition generate_cartesian_mesh.m:22
GradientValue gradient(size_t i, const VectorRd &x) const
Evaluate the gradient of the i-th function at point x.
Definition basis.hpp:383
FunctionValue function(size_t i, const VectorRd &x) const
Evaluate the i-th function at point x.
Definition basis.hpp:356
Eigen::Vector2d VectorRd
Definition basis.hpp:55
@ Function
Definition basis.hpp:1741
size_t L
Definition HHO_DiffAdvecReac.hpp:44
size_t K
Definition HHO_DiffAdvecReac.hpp:44
const size_t DimPoly< Cell >(const int m)
Compute the size of the basis of 2-variate polynomials up to degree m.
Definition hybridcore.hpp:63
const Mesh * get_mesh() const
Returns a pointer to the mesh.
Definition hybridcore.hpp:201
const PolyCellBasisType & CellBasis(size_t iT) const
Return cell basis for element with global index iT.
Definition hybridcore.hpp:210
Eigen::VectorXd nc_VertexValues(const Eigen::VectorXd Xh, const double weight=0)
From a non-conforming discrete function, computes a vector of values at the vertices of the mesh.
Definition lepnccore.hpp:783
Eigen::MatrixXd gram_matrix(const std::vector< Eigen::ArrayXd > &f_quad, const std::vector< Eigen::ArrayXd > &g_quad, const size_t &nrows, const size_t &ncols, const QuadratureRule &quad, const bool &sym, std::vector< double > L2weight={}) const
Definition lepnccore.hpp:517
double nc_L2norm(const Eigen::VectorXd &Xh) const
Compute L2 norm of a discrete function (given by coefficients on the basis functions)
Definition lepnccore.hpp:695
LEPNCCore(const Mesh *mesh_ptr, const size_t K, const size_t L, std::ostream &output=std::cout)
Class constructor: initialise the LEPNCCore class, and creates non-conforming basis functions (and gr...
Definition lepnccore.hpp:167
const std::vector< Eigen::ArrayXd > nc_basis_quad(const size_t iT, const QuadratureRule quad) const
Computes non-conforming basis functions at the given quadrature nodes.
Definition lepnccore.hpp:432
Eigen::VectorXd nc_restr(const Eigen::VectorXd &Xh, size_t iT) const
Extract from a global vector Xh of unknowns the non-conforming unknowns corresponding to cell iT.
Definition lepnccore.hpp:678
const std::vector< Eigen::ArrayXXd > grad_nc_basis_quad(const size_t iT, const QuadratureRule quad) const
Compute at the quadrature nodes, where are the cell basis functions.
Definition lepnccore.hpp:471
std::function< VectorRd(double, double)> cell_gradient_type
type for gradients of cell basis
Definition lepnccore.hpp:46
const cell_gradient_type & nc_gradient(size_t iT, size_t i) const
Return a reference to the gradient of the i'th non-conforming basis function of the cell iT.
Definition lepnccore.hpp:416
double nc_evaluate_in_cell(const Eigen::VectorXd XTF, size_t iT, double x, double y) const
Evaluates a non-conforming discrete function in the cell iT at point (x,y)
Definition lepnccore.hpp:763
std::function< double(double, double)> cell_basis_type
type for cell basis
Definition lepnccore.hpp:45
double nc_L2norm_ml(const Eigen::VectorXd &Xh) const
Compute L2 norm of the mass-lumped discrete function (given by coefficients on the basis functions)
Definition lepnccore.hpp:720
const VectorRd ml_node(size_t iT, size_t i) const
Return the i'th nodal point in cell iT (for mass lumping)
Definition lepnccore.hpp:422
Eigen::VectorXd nc_interpolate_ml(const Function &f, size_t doe) const
Interpolates a continuous function on the degrees of freedom, using the moments on the basis function...
Definition lepnccore.hpp:645
Eigen::VectorXd nc_interpolate_moments(const Function &f, size_t doe) const
Interpolates a continuous function on the degrees of freedom, using the moments on the basis function...
Definition lepnccore.hpp:587
const cell_basis_type & nc_basis(size_t iT, size_t i) const
Return a reference to the i'th non-conforming basis function of the cell iT.
Definition lepnccore.hpp:410
double nc_H1norm(const Eigen::VectorXd &Xh) const
Compute broken H1 norm of a discrete function (given by coefficients on the basis functions)
Definition lepnccore.hpp:739
double measure() const
Return the Lebesgue measure of the Polytope.
Definition Polytope2D.hpp:77
Polytope< DIMENSION > Cell
Definition Polytope2D.hpp:152
std::vector< Polytope< DIMENSION > * > get_cells() const
Return the cells of the Polytope.
Definition Polytope2D.hpp:86
std::size_t n_vertices() const
number of vertices in the mesh.
Definition Mesh2D.hpp:60
std::size_t dim() const
dimension of the mesh
Definition Mesh2D.hpp:58
Cell * cell(std::size_t index) const
get a constant pointer to a cell using its global index
Definition Mesh2D.hpp:178
size_t n_edges() const
Return the number of edges of the Polytope.
Definition Polytope2D.hpp:89
Edge * edge(std::size_t index) const
get a constant pointer to a edge using its global index
Definition Mesh2D.hpp:168
Polytope< 1 > Edge
A Face is a Polytope with object_dim = DIMENSION - 1.
Definition Polytope2D.hpp:148
Polytope< 1 > * edge(const size_t i) const
Return the i-th edge of the Polytope.
Definition Polytope2D.hpp:304
std::size_t n_cells() const
number of cells in the mesh.
Definition Mesh2D.hpp:63
std::vector< Polytope< 1 > * > get_edges() const
Return the edges of the Polytope.
Definition Polytope2D.hpp:84
Vertex * vertex(std::size_t index) const
get a constant pointer to a vertex using its global index
Definition Mesh2D.hpp:163
std::size_t n_edges() const
number of edges in the mesh.
Definition Mesh2D.hpp:61
VectorRd coords() const
Return the coordinates of a Vertex.
Definition Polytope2D.hpp:371
std::vector< QuadratureNode > QuadratureRule
Definition quadraturerule.hpp:55
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
Definition mhd-solutions.hpp:9
Description of one node and one weight from a quadrature rule.
Definition quadraturerule.hpp:41