91 const unsigned int face_no = 0;
95 std::vector<FullMatrix<double>> face_embeddings(
106 unsigned int target_row = 0;
107 for (
const auto &face_embedding : face_embeddings)
108 for (
unsigned int i = 0; i < face_embedding.m(); ++i)
110 for (
unsigned int j = 0; j < face_embedding.n(); ++j)
145 std::ostringstream namebuf;
147 namebuf <<
"FE_ABF<" << dim <<
">(" << rt_order <<
")";
149 return namebuf.str();
155std::unique_ptr<FiniteElement<dim, dim>>
158 return std::make_unique<FE_ABF<dim>>(rt_order);
174 const unsigned int n_interior_points = cell_quadrature.
size();
179 const unsigned int face_no = 0;
181 unsigned int n_face_points = (dim > 1) ? 1 : 0;
183 for (
unsigned int d = 1; d < dim; ++d)
184 n_face_points *= deg + 1;
186 this->generalized_support_points.resize(
188 this->generalized_face_support_points[face_no].resize(n_face_points);
193 std::array<std::unique_ptr<AnisotropicPolynomials<dim>>, dim> polynomials_abf;
196 for (
unsigned int dd = 0; dd < dim; ++dd)
198 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
199 for (
unsigned int d = 0; d < dim; ++d)
203 polynomials_abf[dd] = std::make_unique<AnisotropicPolynomials<dim>>(poly);
207 unsigned int current = 0;
211 QGauss<dim - 1> face_points(deg + 1);
215 boundary_weights.reinit(n_face_points, legendre.n());
220 for (
unsigned int k = 0; k < n_face_points; ++k)
222 this->generalized_face_support_points[face_no][k] =
223 face_points.point(k);
227 for (
unsigned int i = 0; i < legendre.n(); ++i)
229 boundary_weights(k, i) =
230 face_points.weight(k) *
231 legendre.compute_value(i, face_points.point(k));
238 for (; current < GeometryInfo<dim>::faces_per_cell * n_face_points;
243 this->generalized_support_points[current] = faces.
point(current);
252 boundary_weights_abf.reinit(faces.
size(), polynomials_abf[0]->n() * dim);
253 for (
unsigned int k = 0; k < faces.
size(); ++k)
255 for (
unsigned int i = 0; i < polynomials_abf[0]->n() * dim; ++i)
257 boundary_weights_abf(k, i) =
258 polynomials_abf[i % dim]->compute_value(i / dim,
269 std::array<std::unique_ptr<AnisotropicPolynomials<dim>>, dim> polynomials;
271 for (
unsigned int dd = 0; dd < dim; ++dd)
273 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
274 for (
unsigned int d = 0; d < dim; ++d)
278 polynomials[dd] = std::make_unique<AnisotropicPolynomials<dim>>(poly);
281 interior_weights.reinit(
284 for (
unsigned int k = 0; k < cell_quadrature.
size(); ++k)
286 for (
unsigned int i = 0; i < polynomials[0]->n(); ++i)
287 for (
unsigned int d = 0; d < dim; ++d)
288 interior_weights(k, i, d) =
289 cell_quadrature.
weight(k) *
290 polynomials[d]->compute_value(i, cell_quadrature.
point(k));
297 for (
unsigned int k = 0; k < cell_quadrature.
size(); ++k)
298 this->generalized_support_points[current++] = cell_quadrature.
point(k);
305 polynomials_abf[0]->n() * dim,
309 for (
unsigned int k = 0; k < cell_quadrature.
size(); ++k)
311 for (
unsigned int i = 0; i < polynomials_abf[0]->n() * dim; ++i)
314 polynomials_abf[i % dim]->compute_grad(i / dim,
315 cell_quadrature.
point(k)) *
316 cell_quadrature.
weight(k);
319 for (
unsigned int d = 0; d < dim; ++d)
320 interior_weights_abf(k, i, d) = -poly_grad[d];
324 Assert(current == this->generalized_support_points.size(),
347 for (
unsigned int i = 0; i < GeometryInfo<dim>::max_children_per_cell;
349 this->restriction[iso][i].reinit(0, 0);
353 QGauss<dim - 1> q_base(rt_order + 1);
354 const unsigned int n_face_points = q_base.size();
370 for (
unsigned int k = 0; k < q_face.
size(); ++k)
371 for (
unsigned int i = 0; i < this->n_dofs_per_cell(); ++i)
372 cached_values_face(i, k) = this->shape_value_component(
375 for (
unsigned int sub = 0; sub < GeometryInfo<dim>::max_children_per_face;
383 this->reference_cell(), q_base, face, sub);
399 for (
unsigned int k = 0; k < n_face_points; ++k)
400 for (
unsigned int i_child = 0; i_child < this->n_dofs_per_cell();
402 for (
unsigned int i_face = 0;
403 i_face < this->n_dofs_per_face(face);
411 this->restriction[iso][child](
412 face * this->n_dofs_per_face(face) + i_face, i_child) +=
413 Utilities::fixed_power<dim - 1>(.5) * q_sub.
weight(k) *
414 cached_values_face(i_child, k) *
415 this->shape_value_component(
416 face * this->n_dofs_per_face(face) + i_face,
429 std::array<std::unique_ptr<AnisotropicPolynomials<dim>>, dim> polynomials;
430 for (
unsigned int dd = 0; dd < dim; ++dd)
432 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
433 for (
unsigned int d = 0; d < dim; ++d)
437 polynomials[dd] = std::make_unique<AnisotropicPolynomials<dim>>(poly);
443 const unsigned int face_no = 0;
446 const unsigned int start_cell_dofs =
455 for (
unsigned int k = 0; k < q_cell.
size(); ++k)
456 for (
unsigned int i = 0; i < this->n_dofs_per_cell(); ++i)
457 for (
unsigned int d = 0; d < dim; ++d)
458 cached_values_cell(i, k, d) =
459 this->shape_value_component(i, q_cell.
point(k), d);
461 for (
unsigned int child = 0; child < GeometryInfo<dim>::max_children_per_cell;
469 for (
unsigned int k = 0; k < q_sub.
size(); ++k)
470 for (
unsigned int i_child = 0; i_child < this->n_dofs_per_cell();
472 for (
unsigned int d = 0; d < dim; ++d)
473 for (
unsigned int i_weight = 0; i_weight < polynomials[d]->n();
476 this->restriction[iso][child](start_cell_dofs + i_weight * dim +
479 q_sub.
weight(k) * cached_values_cell(i_child, k, d) *
480 polynomials[d]->compute_value(i_weight, q_sub.
point(k));
488std::vector<unsigned int>
494 return std::vector<unsigned int>();
502 unsigned int dofs_per_face = 1;
503 for (
unsigned int d = 0; d < dim - 1; ++d)
504 dofs_per_face *= rt_order + 1;
507 const unsigned int interior_dofs = dim * (rt_order + 1) * dofs_per_face;
509 std::vector<unsigned int> dpo(dim + 1);
510 dpo[dim - 1] = dofs_per_face;
511 dpo[dim] = interior_dofs;
523 const unsigned int face_index)
const
544 return (face_index !=
566 std::vector<double> & nodal_values)
const
568 Assert(support_point_values.size() == this->generalized_support_points.size(),
570 this->generalized_support_points.size()));
571 Assert(support_point_values[0].size() == this->n_components(),
573 this->n_components()));
574 Assert(nodal_values.size() == this->n_dofs_per_cell(),
577 std::fill(nodal_values.begin(), nodal_values.end(), 0.);
579 const unsigned int n_face_points = boundary_weights.size(0);
581 for (
unsigned int k = 0; k < n_face_points; ++k)
582 for (
unsigned int i = 0; i < boundary_weights.size(1); ++i)
584 nodal_values[i + face * this->n_dofs_per_face(face)] +=
585 boundary_weights(k, i) *
586 support_point_values[face * n_face_points + k][
GeometryInfo<
587 dim>::unit_normal_direction[face]];
593 const unsigned int face_no = 0;
595 const unsigned int start_cell_dofs =
597 const unsigned int start_cell_points =
600 for (
unsigned int k = 0; k < interior_weights.size(0); ++k)
601 for (
unsigned int i = 0; i < interior_weights.size(1); ++i)
602 for (
unsigned int d = 0; d < dim; ++d)
603 nodal_values[start_cell_dofs + i * dim + d] +=
604 interior_weights(k, i, d) *
605 support_point_values[k + start_cell_points][d];
607 const unsigned int start_abf_dofs =
608 start_cell_dofs + interior_weights.size(1) * dim;
611 for (
unsigned int k = 0; k < interior_weights_abf.size(0); ++k)
612 for (
unsigned int i = 0; i < interior_weights_abf.size(1); ++i)
613 for (
unsigned int d = 0; d < dim; ++d)
614 nodal_values[start_abf_dofs + i] +=
615 interior_weights_abf(k, i, d) *
616 support_point_values[k + start_cell_points][d];
622 for (
unsigned int fp = 0; fp < n_face_points; ++fp)
627 this->reference_cell(), face,
false,
false,
false, n_face_points);
628 for (
unsigned int i = 0; i < boundary_weights_abf.size(1); ++i)
629 nodal_values[start_abf_dofs + i] +=
630 n_orient * boundary_weights_abf(k + fp, i) *
631 support_point_values[face * n_face_points + fp][
GeometryInfo<
632 dim>::unit_normal_direction[face]];
637 for (
unsigned int i = 0; i < boundary_weights_abf.size(1); ++i)
638 if (std::fabs(nodal_values[start_abf_dofs + i]) < 1.0e-16)
639 nodal_values[start_abf_dofs + i] = 0.0;
655#include "fe_abf.inst"
void initialize_quad_dof_index_permutation_and_sign_change()
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const override
virtual void convert_generalized_support_point_values_to_dof_values(const std::vector< Vector< double > > &support_point_values, std::vector< double > &nodal_values) const override
virtual std::size_t memory_consumption() const override
void initialize_restriction()
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const override
virtual std::string get_name() const override
static std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
void initialize_support_points(const unsigned int rt_degree)
FullMatrix< double > inverse_node_matrix
std::vector< MappingKind > mapping_kind
unsigned int n_dofs_per_cell() const
unsigned int n_dofs_per_face(unsigned int face_no=0, unsigned int child=0) const
unsigned int n_unique_faces() const
void reinit_restriction_and_prolongation_matrices(const bool isotropic_restriction_only=false, const bool isotropic_prolongation_only=false)
FullMatrix< double > interface_constraints
std::vector< std::vector< FullMatrix< double > > > prolongation
void invert(const FullMatrix< number2 > &M)
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int degree)
static std::vector< Polynomial< number > > generate_complete_basis(const unsigned int degree)
static DataSetDescriptor face(const ReferenceCell &reference_cell, const unsigned int face_no, const bool face_orientation, const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points)
static Quadrature< dim > project_to_child(const ReferenceCell &reference_cell, const Quadrature< dim > &quadrature, const unsigned int child_no)
static Quadrature< dim > project_to_all_faces(const ReferenceCell &reference_cell, const hp::QCollection< dim - 1 > &quadrature)
static void project_to_subface(const ReferenceCell &reference_cell, const SubQuadrature &quadrature, const unsigned int face_no, const unsigned int subface_no, std::vector< Point< dim > > &q_points, const RefinementCase< dim - 1 > &ref_case=RefinementCase< dim - 1 >::isotropic_refinement)
static void project_to_face(const ReferenceCell &reference_cell, const SubQuadrature &quadrature, const unsigned int face_no, std::vector< Point< dim > > &q_points)
const Point< dim > & point(const unsigned int i) const
double weight(const unsigned int i) const
unsigned int size() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static unsigned int child_cell_on_face(const RefinementCase< dim > &ref_case, const unsigned int face, const unsigned int subface, const bool face_orientation=true, const bool face_flip=false, const bool face_rotation=false, const RefinementCase< dim - 1 > &face_refinement_case=RefinementCase< dim - 1 >::isotropic_refinement)
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()