67 return (fe_degree == 0) ? 0 : (fe_degree - 1) / 2;
72 inline std::vector<unsigned int>
75 std::vector<unsigned int> result(dim + 1, 0);
91 std::vector<unsigned int> &h2l);
98 const unsigned int regularity,
99 std::vector<unsigned int> &h2l)
101 const unsigned int node_dofs_1d = regularity + 1;
106 for (
unsigned int di = 0; di < 2; ++di)
107 for (
unsigned int i = 0; i < node_dofs_1d; ++i)
108 h2l[i + di * node_dofs_1d] = i + di * node_dofs_1d;
116 const unsigned int regularity,
117 std::vector<unsigned int> &h2l)
119 const unsigned int node_dofs_1d = regularity + 1;
120 const unsigned int dim_dofs_1d = 2 * node_dofs_1d;
121 unsigned int offset = 0;
126 for (
unsigned int di = 0; di < 2; ++di)
127 for (
unsigned int dj = 0; dj < 2; ++dj)
129 for (
unsigned int i = 0; i < node_dofs_1d; ++i)
130 for (
unsigned int j = 0; j < node_dofs_1d; ++j)
131 h2l[j + i * node_dofs_1d + offset] =
132 j + i * dim_dofs_1d + (dj + di * dim_dofs_1d) * node_dofs_1d;
134 offset += node_dofs_1d * node_dofs_1d;
143 const unsigned int regularity,
144 std::vector<unsigned int> &h2l)
146 const unsigned int node_dofs_1d = regularity + 1;
147 const unsigned int node_dofs_2d = node_dofs_1d * node_dofs_1d;
149 const unsigned int dim_dofs_1d = 2 * node_dofs_1d;
150 const unsigned int dim_dofs_2d = dim_dofs_1d * dim_dofs_1d;
152 unsigned int offset = 0;
157 for (
unsigned int di = 0; di < 2; ++di)
158 for (
unsigned int dj = 0; dj < 2; ++dj)
159 for (
unsigned int dk = 0; dk < 2; ++dk)
161 for (
unsigned int i = 0; i < node_dofs_1d; ++i)
162 for (
unsigned int j = 0; j < node_dofs_1d; ++j)
163 for (
unsigned int k = 0; k < node_dofs_1d; ++k)
164 h2l[k + j * node_dofs_1d + i * node_dofs_2d + offset] =
165 k + j * dim_dofs_1d + i * dim_dofs_2d +
166 node_dofs_1d * (dk + dj * dim_dofs_1d + di * dim_dofs_2d);
168 offset += node_dofs_1d * node_dofs_2d;
175 inline std::vector<unsigned int>
178 const std::vector<unsigned int> dpo =
180 const ::FiniteElementData<dim> face_data(dpo, 1, 2 * regularity + 1);
181 std::vector<unsigned int> renumbering(face_data.dofs_per_cell);
191 std::vector<unsigned int>
201 inline std::vector<unsigned int>
203 const unsigned int regularity)
206 if constexpr (dim > 1)
209 return std::vector<unsigned int>();
223 std::vector<unsigned int> renumber =
227 return polynomial_basis;
238 template <
int xdim,
int xspacedim = xdim,
typename xNumber =
double>
242 template <
int spacedim,
typename Number>
250 double cell_extent = 1.0;
254 &mapping_data) !=
nullptr)
266 const unsigned int n_q_points_out = value_list.size(1);
267 (void)n_dofs_per_cell;
272 std::vector<unsigned int> l2h =
275 for (
unsigned int q = 0; q < n_q_points_out; ++q)
277 double factor_1 = 1.0;
279 for (
unsigned int d1 = 0, d2 = regularity + 1; d2 < n_dofs_per_cell;
287 value_list(l2h[d1], q) *= factor_1;
288 value_list(l2h[d2], q) *= factor_1;
290 factor_1 *= cell_extent;
297 template <
int spacedim,
typename Number>
309 &mapping_data) !=
nullptr)
321 const unsigned int n_dofs_per_dim = 2 * regularity + 2;
322 const unsigned int n_q_points_out = value_list.size(1);
323 (void)n_dofs_per_cell;
328 std::vector<unsigned int> l2h =
333 for (
unsigned int q = 0; q < n_q_points_out; ++q)
335 double factor_2 = 1.0;
337 for (
unsigned int d3 = 0, d4 = regularity + 1; d4 < n_dofs_per_dim;
340 double factor_1 = factor_2;
342 for (
unsigned int d1 = 0, d2 = regularity + 1;
352 value_list(l2h[d1 + d3 * n_dofs_per_dim], q) *= factor_1;
353 value_list(l2h[d2 + d3 * n_dofs_per_dim], q) *= factor_1;
354 value_list(l2h[d1 + d4 * n_dofs_per_dim], q) *= factor_1;
355 value_list(l2h[d2 + d4 * n_dofs_per_dim], q) *= factor_1;
357 factor_1 *= cell_extents[0];
360 factor_2 *= cell_extents[1];
367 template <
int spacedim,
typename Number>
379 &mapping_data) !=
nullptr)
391 const unsigned int n_dofs_per_dim = 2 * regularity + 2;
392 const unsigned int n_dofs_per_quad = n_dofs_per_dim * n_dofs_per_dim;
393 const unsigned int n_q_points_out = value_list.size(1);
394 (void)n_dofs_per_cell;
399 std::vector<unsigned int> l2h =
402 for (
unsigned int q = 0; q < n_q_points_out; ++q)
404 double factor_3 = 1.0;
406 for (
unsigned int d5 = 0, d6 = regularity + 1; d6 < n_dofs_per_dim;
409 double factor_2 = factor_3;
411 for (
unsigned int d3 = 0, d4 = regularity + 1;
415 double factor_1 = factor_2;
417 for (
unsigned int d1 = 0, d2 = regularity + 1;
428 l2h[d1 + d3 * n_dofs_per_dim + d5 * n_dofs_per_quad],
431 l2h[d2 + d3 * n_dofs_per_dim + d5 * n_dofs_per_quad],
434 l2h[d1 + d4 * n_dofs_per_dim + d5 * n_dofs_per_quad],
437 l2h[d2 + d4 * n_dofs_per_dim + d5 * n_dofs_per_quad],
440 l2h[d1 + d3 * n_dofs_per_dim + d6 * n_dofs_per_quad],
443 l2h[d2 + d3 * n_dofs_per_dim + d6 * n_dofs_per_quad],
446 l2h[d1 + d4 * n_dofs_per_dim + d6 * n_dofs_per_quad],
449 l2h[d2 + d4 * n_dofs_per_dim + d6 * n_dofs_per_quad],
452 factor_1 *= cell_extents[0];
455 factor_2 *= cell_extents[1];
458 factor_3 *= cell_extents[2];
468template <
int dim,
int spacedim>
471 internal::get_hermite_polynomials<dim>(fe_degree),
474 internal::get_regularity_from_degree(fe_degree)),
476 std::max(1U, fe_degree),
484 , regularity(
internal::get_regularity_from_degree(fe_degree))
486 Assert((fe_degree % 2 == 1),
488 "ERROR: The current implementation of Hermite interpolation "
489 "polynomials is only defined for odd polynomial degrees. Running "
490 "in release mode will use a polynomial degree of max(1,fe_degree-1) "
491 "to protect against unexpected internal bugs."));
496template <
int dim,
int spacedim>
500 std::ostringstream name_buffer;
502 << this->degree <<
")";
503 return name_buffer.str();
508template <
int dim,
int spacedim>
509std::unique_ptr<FiniteElement<dim, spacedim>>
512 return std::make_unique<FE_Hermite<dim, spacedim>>(*this);
517template <
int dim,
int spacedim>
536template <
int dim,
int spacedim>
537std::vector<std::pair<unsigned int, unsigned int>>
591template <
int dim,
int spacedim>
592std::vector<std::pair<unsigned int, unsigned int>>
606template <
int dim,
int spacedim>
607std::vector<std::pair<unsigned int, unsigned int>>
610 const unsigned int face_no)
const
623template <
int dim,
int spacedim>
627 const unsigned int codim)
const
644 if (this->degree < fe_hermite_other->degree)
646 else if (this->degree == fe_hermite_other->degree)
654 if (fe_q_other->degree == 1)
656 if (this->degree == 1)
661 else if (this->degree <= fe_q_other->degree)
669 if (fe_p_other->degree == 1)
671 if (this->degree == 1)
676 else if (this->degree <= fe_p_other->degree)
684 if (fe_wp_other->degree == 1)
686 if (this->degree == 1)
691 else if (this->degree <= fe_wp_other->degree)
699 if (fe_pp_other->degree == 1)
701 if (this->degree == 1)
706 else if (this->degree <= fe_pp_other->degree)
714 if (fe_nothing->is_dominating())
729template <
int dim,
int spacedim>
730std::vector<unsigned int>
739template <
int dim,
int spacedim>
747 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
758 (
dynamic_cast<const typename FE_Hermite<dim, spacedim>::InternalData *
>(
759 &fe_internal) !=
nullptr),
761 const typename FE_Hermite<dim, spacedim>::InternalData &fe_data =
762 static_cast<const typename FE_Hermite<dim, spacedim>::InternalData &
>(
773 for (
unsigned int i = 0; i < output_data.shape_values.size(0); ++i)
774 for (
unsigned int q = 0; q < output_data.shape_values.size(1); ++q)
775 output_data.shape_values(i, q) = fe_data.shape_values(i, q);
779 output_data.shape_values);
785 for (
unsigned int k = 0; k < this->n_dofs_per_cell(); ++k)
795 output_data.shape_gradients);
801 for (
unsigned int k = 0; k < this->n_dofs_per_cell(); ++k)
811 output_data.shape_hessians);
817 for (
unsigned int k = 0; k < this->n_dofs_per_cell(); ++k)
829 output_data.shape_3rd_derivatives);
835template <
int dim,
int spacedim>
839 const unsigned int face_no,
843 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
856 (
dynamic_cast<const typename FE_Hermite<dim, spacedim>::InternalData *
>(
857 &fe_internal) !=
nullptr),
859 const typename FE_Hermite<dim, spacedim>::InternalData &fe_data =
860 static_cast<const typename FE_Hermite<dim, spacedim>::InternalData &
>(
865 &mapping_internal) !=
nullptr),
878 cell->combined_face_orientation(face_no),
879 quadrature[0].
size());
886 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
887 for (
unsigned int i = 0; i < quadrature[0].
size(); ++i)
888 output_data.shape_values(k, i) = fe_data.shape_values[k][i + offset];
894 output_data.shape_values);
899 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
903 quadrature[0].
size()),
912 output_data.shape_gradients);
917 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
921 quadrature[0].
size()),
930 output_data.shape_hessians);
935 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
939 quadrature[0].
size()),
950 output_data.shape_3rd_derivatives);
957#include "fe_hermite.inst"
ArrayView< std::remove_reference_t< typename std::iterator_traits< Iterator >::reference >, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
virtual std::unique_ptr< FiniteElement< dim, spacedim > > clone() const override
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_vertex_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
unsigned int get_regularity() const
virtual FiniteElementDomination::Domination compare_for_domination(const FiniteElement< dim, spacedim > &other_fe, const unsigned int codim) const override
virtual void fill_fe_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellSimilarity::Similarity cell_similarity, const Quadrature< dim > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const typename FiniteElement< dim, spacedim >::InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const override
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) const override
virtual std::string get_name() const override
std::vector< unsigned int > get_lexicographic_to_hierarchic_numbering() const
FE_Hermite(const unsigned int fe_degree)
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_quad_dof_identities(const FiniteElement< dim, spacedim > &fe_other, const unsigned int face_no=0) const override
virtual void fill_fe_face_values(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const hp::QCollection< dim - 1 > &quadrature, const Mapping< dim, spacedim > &mapping, const typename Mapping< dim, spacedim >::InternalDataBase &mapping_internal, const ::internal::FEValuesImplementation::MappingRelatedData< dim, spacedim > &mapping_data, const typename FiniteElement< dim, spacedim >::InternalDataBase &fe_internal, ::internal::FEValuesImplementation::FiniteElementRelatedData< dim, spacedim > &output_data) const override
virtual std::vector< std::pair< unsigned int, unsigned int > > hp_line_dof_identities(const FiniteElement< dim, spacedim > &fe_other) const override
virtual UpdateFlags requires_update_flags(const UpdateFlags update_flags) 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
Tensor< 1, dim > cell_extents
Abstract base class for mapping classes.
virtual void transform(const ArrayView< const Tensor< 1, dim > > &input, const MappingKind kind, const typename Mapping< dim, spacedim >::InternalDataBase &internal, const ArrayView< Tensor< 1, spacedim > > &output) const =0
static std::vector< Polynomial< double > > generate_complete_basis(const unsigned int regularity)
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)
void set_numbering(const std::vector< unsigned int > &renumber)
unsigned int size() const
void rescale_fe_hermite_values(Rescaler< 1, spacedim, Number > &, const FE_Hermite< 1, spacedim > &fe_herm, const typename Mapping< 1, spacedim >::InternalDataBase &mapping_data, Table< 2, Number > &value_list)
void rescale_fe_hermite_values(Rescaler< 2, spacedim, Number > &, const FE_Hermite< 2, spacedim > &fe_herm, const typename Mapping< 2, spacedim >::InternalDataBase &mapping_data, Table< 2, Number > &value_list)
void rescale_fe_hermite_values(Rescaler< 3, spacedim, Number > &, const FE_Hermite< 3, spacedim > &fe_herm, const typename Mapping< 3, spacedim >::InternalDataBase &mapping_data, Table< 2, Number > &value_list)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcImpossibleInDim(int arg1)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_3rd_derivatives
Third derivatives of shape functions.
@ update_gradients
Shape function gradients.
@ mapping_covariant_gradient
@ mapping_covariant_hessian
#define DEAL_II_ASSERT_UNREACHABLE()
#define DEAL_II_NOT_IMPLEMENTED()
@ either_element_can_dominate
@ other_element_dominates
@ neither_element_dominates
constexpr const ReferenceCell & get_hypercube()
std::string dim_string(const int dim, const int spacedim)
constexpr T pow(const T base, const int iexp)
std::vector< Integer > invert_permutation(const std::vector< Integer > &permutation)
std::vector< unsigned int > get_hermite_dpo_vector(const unsigned int dim, const unsigned int regularity)
void hermite_hierarchic_to_lexicographic_numbering< 1 >(const unsigned int regularity, std::vector< unsigned int > &h2l)
std::vector< unsigned int > hermite_face_lexicographic_to_hierarchic_numbering(const unsigned int regularity)
std::vector< unsigned int > hermite_lexicographic_to_hierarchic_numbering(const unsigned int regularity)
void hermite_hierarchic_to_lexicographic_numbering(const unsigned int regularity, std::vector< unsigned int > &h2l)
void hermite_hierarchic_to_lexicographic_numbering< 2 >(const unsigned int regularity, std::vector< unsigned int > &h2l)
void hermite_hierarchic_to_lexicographic_numbering< 3 >(const unsigned int regularity, std::vector< unsigned int > &h2l)
TensorProductPolynomials< dim > get_hermite_polynomials(const unsigned int fe_degree)
unsigned int get_regularity_from_degree(const unsigned int fe_degree)