91 const unsigned int face_no = 0;
96 for (
auto &face_embedding : face_embeddings)
97 face_embedding.reinit(this->n_dofs_per_face(face_no),
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)
137 std::ostringstream namebuf;
138 namebuf <<
"FE_RaviartThomas<" << dim <<
">(" << this->degree - 1 <<
")";
140 return namebuf.str();
145std::unique_ptr<FiniteElement<dim, dim>>
148 return std::make_unique<FE_RaviartThomas<dim>>(*this);
162 const unsigned int n_interior_points = (deg > 0) ? cell_quadrature.size() : 0;
167 const unsigned int face_no = 0;
169 unsigned int n_face_points = (dim > 1) ? 1 : 0;
171 for (
unsigned int d = 1; d < dim; ++d)
172 n_face_points *= deg + 1;
175 this->generalized_support_points.resize(
176 this->reference_cell().n_faces() * n_face_points + n_interior_points);
177 this->generalized_face_support_points[face_no].resize(n_face_points);
180 unsigned int current = 0;
184 const QGauss<dim - 1> face_points(deg + 1);
188 boundary_weights.reinit(n_face_points, legendre.n());
190 for (
unsigned int k = 0; k < n_face_points; ++k)
192 this->generalized_face_support_points[face_no][k] =
193 face_points.point(k);
197 for (
unsigned int i = 0; i < legendre.n(); ++i)
199 boundary_weights(k, i) =
200 face_points.weight(k) *
201 legendre.compute_value(i, face_points.point(k));
209 for (; current < GeometryInfo<dim>::faces_per_cell * n_face_points;
213 this->generalized_support_points[current] = faces.
point(
215 this->reference_cell(),
226 std::unique_ptr<AnisotropicPolynomials<dim>> polynomials[dim];
227 for (
unsigned int dd = 0; dd < dim; ++dd)
229 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
230 for (
unsigned int d = 0; d < dim; ++d)
234 polynomials[dd] = std::make_unique<AnisotropicPolynomials<dim>>(poly);
237 interior_weights.reinit(
240 for (
unsigned int k = 0; k < cell_quadrature.size(); ++k)
242 this->generalized_support_points[current++] = cell_quadrature.point(k);
243 for (
unsigned int i = 0; i < polynomials[0]->n(); ++i)
244 for (
unsigned int d = 0; d < dim; ++d)
245 interior_weights(k, i, d) =
246 cell_quadrature.weight(k) *
247 polynomials[d]->compute_value(i, cell_quadrature.point(k));
250 Assert(current == this->generalized_support_points.size(),
271 const unsigned int face_no = 0;
274 this->adjust_quad_dof_index_for_face_orientation_table[0].n_elements() ==
275 this->reference_cell().n_face_orientations(face_no) *
276 this->n_dofs_per_quad(face_no),
280 const unsigned int n = this->tensor_degree();
334 for (
unsigned int local_face_dof = 0;
335 local_face_dof < this->n_dofs_per_quad(face_no);
339 unsigned int i = local_face_dof % n;
340 unsigned int j = local_face_dof / n;
345 for (
const bool face_orientation : {
false,
true})
346 for (
const bool face_flip : {
false,
true})
347 for (
const bool face_rotation : {
false,
true})
354 if (((!face_orientation) && (!face_rotation)) ||
355 ((face_orientation) && (face_rotation)))
360 ->adjust_quad_dof_index_for_face_orientation_table[face_no](
361 local_face_dof, case_no) = j + i * n - local_face_dof;
367 ->adjust_quad_dof_index_for_face_orientation_table[face_no](
368 local_face_dof, case_no) = 0;
372 const unsigned int new_local_face_dof =
374 this->adjust_quad_dof_index_for_face_orientation_table[face_no](
375 local_face_dof, case_no);
377 i = new_local_face_dof % n;
378 j = new_local_face_dof / n;
385 if (!face_flip && face_rotation)
388 ->adjust_quad_dof_sign_for_face_orientation_table[face_no](
389 local_face_dof, case_no) = ((j % 2) == 1);
392 else if (face_flip && !face_rotation)
397 ->adjust_quad_dof_sign_for_face_orientation_table[face_no](
398 local_face_dof, case_no) =
399 ((j % 2) == 1) != ((i % 2) == 1);
402 else if (face_flip && face_rotation)
405 ->adjust_quad_dof_sign_for_face_orientation_table[face_no](
406 local_face_dof, case_no) = ((i % 2) == 1);
416 if (!face_orientation)
417 this->adjust_quad_dof_sign_for_face_orientation_table[face_no](
418 local_face_dof, case_no) =
420 ->adjust_quad_dof_sign_for_face_orientation_table[face_no](
421 local_face_dof, case_no);
434 for (
auto &restriction_matrix : this->restriction[0])
435 restriction_matrix.reinit(0, 0);
456 const QGauss<dim - 1> q_base(this->degree);
457 const unsigned int n_face_points = q_base.size();
460 for (
const unsigned int face : this->reference_cell().face_indices())
473 for (
unsigned int k = 0; k < q_face.
size(); ++k)
474 for (
unsigned int i = 0; i < this->n_dofs_per_cell(); ++i)
475 cached_values_on_face(i, k) = this->shape_value_component(
478 for (
unsigned int sub = 0; sub < this->reference_cell()
479 .face_reference_cell(face)
480 .template n_children<dim - 1>();
488 this->reference_cell(), q_base, face, sub);
504 for (
unsigned int k = 0; k < n_face_points; ++k)
505 for (
unsigned int i_child = 0; i_child < this->n_dofs_per_cell();
507 for (
unsigned int i_face = 0;
508 i_face < this->n_dofs_per_face(face);
516 this->restriction[iso][child](
517 face * this->n_dofs_per_face(face) + i_face, i_child) +=
518 Utilities::fixed_power<dim - 1>(.5) * q_sub.
weight(k) *
519 cached_values_on_face(i_child, k) *
520 this->shape_value_component(
521 face * this->n_dofs_per_face(face) + i_face,
528 if (this->degree == 1)
533 std::unique_ptr<AnisotropicPolynomials<dim>> polynomials[dim];
534 for (
unsigned int dd = 0; dd < dim; ++dd)
536 std::vector<std::vector<Polynomials::Polynomial<double>>> poly(dim);
537 for (
unsigned int d = 0; d < dim; ++d)
543 polynomials[dd] = std::make_unique<AnisotropicPolynomials<dim>>(poly);
549 const unsigned int face_no = 0;
552 const unsigned int start_cell_dofs =
553 this->reference_cell().n_faces() * this->n_dofs_per_face(face_no);
561 for (
unsigned int k = 0; k < q_cell.size(); ++k)
562 for (
unsigned int i = 0; i < this->n_dofs_per_cell(); ++i)
563 for (
unsigned int d = 0; d < dim; ++d)
564 cached_values_on_cell(i, k, d) =
565 this->shape_value_component(i, q_cell.point(k), d);
567 for (
unsigned int child = 0;
568 child < this->reference_cell().template n_children<dim>();
576 for (
unsigned int k = 0; k < q_sub.
size(); ++k)
577 for (
unsigned int i_child = 0; i_child < this->n_dofs_per_cell();
579 for (
unsigned int d = 0; d < dim; ++d)
580 for (
unsigned int i_weight = 0; i_weight < polynomials[d]->n();
583 this->restriction[iso][child](start_cell_dofs + i_weight * dim +
586 q_sub.
weight(k) * cached_values_on_cell(i_child, k, d) *
587 polynomials[d]->compute_value(i_weight, q_sub.
point(k));
595std::vector<unsigned int>
600 unsigned int dofs_per_face = 1;
601 for (
unsigned int d = 1; d < dim; ++d)
602 dofs_per_face *= deg + 1;
605 const unsigned int interior_dofs = dim * deg * dofs_per_face;
607 std::vector<unsigned int> dpo(dim + 1);
608 dpo[dim - 1] = dofs_per_face;
609 dpo[dim] = interior_dofs;
617std::pair<Table<2, bool>, std::vector<unsigned int>>
621 for (
unsigned int d = 0; d < dim; ++d)
622 for (
unsigned int i = 0; i < this->n_dofs_per_cell(); ++i)
623 constant_modes(d, i) =
true;
624 std::vector<unsigned int> components;
625 for (
unsigned int d = 0; d < dim; ++d)
626 components.push_back(d);
627 return std::pair<Table<2, bool>, std::vector<unsigned int>>(constant_modes,
641 const unsigned int face_index)
const
649 switch (this->degree)
662 return (face_index !=
684 std::vector<double> &nodal_values)
const
686 Assert(support_point_values.size() == this->generalized_support_points.size(),
688 this->generalized_support_points.size()));
689 Assert(nodal_values.size() == this->n_dofs_per_cell(),
691 Assert(support_point_values[0].
size() == this->n_components(),
693 this->n_components()));
695 std::fill(nodal_values.begin(), nodal_values.end(), 0.);
697 const unsigned int n_face_points = boundary_weights.size(0);
698 for (
const unsigned int face : this->reference_cell().face_indices())
699 for (
unsigned int k = 0; k < n_face_points; ++k)
700 for (
unsigned int i = 0; i < boundary_weights.size(1); ++i)
702 nodal_values[i + face * this->n_dofs_per_face(face)] +=
703 boundary_weights(k, i) *
704 support_point_values[face * n_face_points + k](
711 const unsigned int face_no = 0;
713 const unsigned int start_cell_dofs =
714 this->reference_cell().n_faces() * this->n_dofs_per_face(face_no);
715 const unsigned int start_cell_points =
716 this->reference_cell().n_faces() * n_face_points;
718 for (
unsigned int k = 0; k < interior_weights.size(0); ++k)
719 for (
unsigned int i = 0; i < interior_weights.size(1); ++i)
720 for (
unsigned int d = 0; d < dim; ++d)
721 nodal_values[start_cell_dofs + i * dim + d] +=
722 interior_weights(k, i, d) *
723 support_point_values[k + start_cell_points](d);
739#include "fe_raviart_thomas.inst"
ArrayView< std::remove_reference_t< typename std::iterator_traits< Iterator >::reference >, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
FullMatrix< double > inverse_node_matrix
std::vector< MappingKind > mapping_kind
virtual std::size_t memory_consumption() 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 bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const override
void initialize_restriction()
virtual std::pair< Table< 2, bool >, std::vector< unsigned int > > get_constant_modes() const override
void initialize_quad_dof_index_permutation_and_sign_change()
virtual std::unique_ptr< FiniteElement< dim, dim > > clone() const override
friend class FE_RaviartThomas
void initialize_support_points(const unsigned int rt_degree)
static std::vector< unsigned int > get_dpo_vector(const unsigned int degree)
virtual std::string get_name() const override
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 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
static constexpr types::geometric_orientation default_combined_face_orientation()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#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)
#define DEAL_II_NOT_IMPLEMENTED()
types::geometric_orientation combined_face_orientation(const bool face_orientation, const bool face_rotation, const bool face_flip)
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)