68 ExcMessage(
"FE_Hermite only supports odd polynomial degrees."));
69 return (fe_degree == 0) ? 0 : (fe_degree - 1) / 2;
74 inline std::vector<unsigned int>
77 std::vector<unsigned int> result(dim + 1, 0);
93 std::vector<unsigned int> &h2l);
100 const unsigned int regularity,
101 std::vector<unsigned int> &h2l)
103 const unsigned int node_dofs_1d = regularity + 1;
108 for (
unsigned int di = 0; di < 2; ++di)
109 for (
unsigned int i = 0; i < node_dofs_1d; ++i)
110 h2l[i + di * node_dofs_1d] = i + di * node_dofs_1d;
118 const unsigned int regularity,
119 std::vector<unsigned int> &h2l)
121 const unsigned int node_dofs_1d = regularity + 1;
122 const unsigned int dim_dofs_1d = 2 * node_dofs_1d;
123 unsigned int offset = 0;
128 for (
unsigned int di = 0; di < 2; ++di)
129 for (
unsigned int dj = 0; dj < 2; ++dj)
131 for (
unsigned int i = 0; i < node_dofs_1d; ++i)
132 for (
unsigned int j = 0; j < node_dofs_1d; ++j)
133 h2l[j + i * node_dofs_1d + offset] =
134 j + i * dim_dofs_1d + (dj + di * dim_dofs_1d) * node_dofs_1d;
136 offset += node_dofs_1d * node_dofs_1d;
145 const unsigned int regularity,
146 std::vector<unsigned int> &h2l)
148 const unsigned int node_dofs_1d = regularity + 1;
149 const unsigned int node_dofs_2d = node_dofs_1d * node_dofs_1d;
151 const unsigned int dim_dofs_1d = 2 * node_dofs_1d;
152 const unsigned int dim_dofs_2d = dim_dofs_1d * dim_dofs_1d;
154 unsigned int offset = 0;
159 for (
unsigned int di = 0; di < 2; ++di)
160 for (
unsigned int dj = 0; dj < 2; ++dj)
161 for (
unsigned int dk = 0; dk < 2; ++dk)
163 for (
unsigned int i = 0; i < node_dofs_1d; ++i)
164 for (
unsigned int j = 0; j < node_dofs_1d; ++j)
165 for (
unsigned int k = 0; k < node_dofs_1d; ++k)
166 h2l[k + j * node_dofs_1d + i * node_dofs_2d + offset] =
167 k + j * dim_dofs_1d + i * dim_dofs_2d +
168 node_dofs_1d * (dk + dj * dim_dofs_1d + di * dim_dofs_2d);
170 offset += node_dofs_1d * node_dofs_2d;
177 inline std::vector<unsigned int>
180 const std::vector<unsigned int> dpo =
182 const ::FiniteElementData<dim> face_data(dpo, 1, 2 * regularity + 1);
183 std::vector<unsigned int> renumbering(face_data.dofs_per_cell);
185 hermite_hierarchic_to_lexicographic_numbering<dim>(regularity, renumbering);
193 std::vector<unsigned int>
197 hermite_hierarchic_to_lexicographic_numbering<dim>(regularity));
203 inline std::vector<unsigned int>
205 const unsigned int regularity)
208 if constexpr (dim > 1)
209 return hermite_lexicographic_to_hierarchic_numbering<dim - 1>(regularity);
211 return std::vector<unsigned int>();
225 std::vector<unsigned int> renumber =
226 internal::hermite_hierarchic_to_lexicographic_numbering<dim>(regularity);
229 return polynomial_basis;
240 template <
int xdim,
int xspacedim = xdim,
typename xNumber =
double>
244 template <
int spacedim,
typename Number>
252 double cell_extent = 1.0;
256 &mapping_data) !=
nullptr)
268 const unsigned int n_q_points_out = value_list.size(1);
269 (void)n_dofs_per_cell;
274 std::vector<unsigned int> l2h =
275 hermite_lexicographic_to_hierarchic_numbering<1>(regularity);
277 for (
unsigned int q = 0; q < n_q_points_out; ++q)
279 double factor_1 = 1.0;
281 for (
unsigned int d1 = 0, d2 = regularity + 1; d2 < n_dofs_per_cell;
289 value_list(l2h[d1], q) *= factor_1;
290 value_list(l2h[d2], q) *= factor_1;
292 factor_1 *= cell_extent;
299 template <
int spacedim,
typename Number>
311 &mapping_data) !=
nullptr)
316 cell_extents =
data->cell_extents;
323 const unsigned int n_dofs_per_dim = 2 * regularity + 2;
324 const unsigned int n_q_points_out = value_list.size(1);
325 (void)n_dofs_per_cell;
330 std::vector<unsigned int> l2h =
331 hermite_lexicographic_to_hierarchic_numbering<2>(regularity);
335 for (
unsigned int q = 0; q < n_q_points_out; ++q)
337 double factor_2 = 1.0;
339 for (
unsigned int d3 = 0, d4 = regularity + 1; d4 < n_dofs_per_dim;
342 double factor_1 = factor_2;
344 for (
unsigned int d1 = 0, d2 = regularity + 1;
354 value_list(l2h[d1 + d3 * n_dofs_per_dim], q) *= factor_1;
355 value_list(l2h[d2 + d3 * n_dofs_per_dim], q) *= factor_1;
356 value_list(l2h[d1 + d4 * n_dofs_per_dim], q) *= factor_1;
357 value_list(l2h[d2 + d4 * n_dofs_per_dim], q) *= factor_1;
359 factor_1 *= cell_extents[0];
362 factor_2 *= cell_extents[1];
369 template <
int spacedim,
typename Number>
381 &mapping_data) !=
nullptr)
386 cell_extents =
data->cell_extents;
393 const unsigned int n_dofs_per_dim = 2 * regularity + 2;
394 const unsigned int n_dofs_per_quad = n_dofs_per_dim * n_dofs_per_dim;
395 const unsigned int n_q_points_out = value_list.size(1);
396 (void)n_dofs_per_cell;
401 std::vector<unsigned int> l2h =
402 hermite_lexicographic_to_hierarchic_numbering<3>(regularity);
404 for (
unsigned int q = 0; q < n_q_points_out; ++q)
406 double factor_3 = 1.0;
408 for (
unsigned int d5 = 0, d6 = regularity + 1; d6 < n_dofs_per_dim;
411 double factor_2 = factor_3;
413 for (
unsigned int d3 = 0, d4 = regularity + 1;
417 double factor_1 = factor_2;
419 for (
unsigned int d1 = 0, d2 = regularity + 1;
430 l2h[d1 + d3 * n_dofs_per_dim + d5 * n_dofs_per_quad],
433 l2h[d2 + d3 * n_dofs_per_dim + d5 * n_dofs_per_quad],
436 l2h[d1 + d4 * n_dofs_per_dim + d5 * n_dofs_per_quad],
439 l2h[d2 + d4 * n_dofs_per_dim + d5 * n_dofs_per_quad],
442 l2h[d1 + d3 * n_dofs_per_dim + d6 * n_dofs_per_quad],
445 l2h[d2 + d3 * n_dofs_per_dim + d6 * n_dofs_per_quad],
448 l2h[d1 + d4 * n_dofs_per_dim + d6 * n_dofs_per_quad],
451 l2h[d2 + d4 * n_dofs_per_dim + d6 * n_dofs_per_quad],
454 factor_1 *= cell_extents[0];
457 factor_2 *= cell_extents[1];
460 factor_3 *= cell_extents[2];
470template <
int dim,
int spacedim>
473 internal::get_hermite_polynomials<dim>(fe_degree),
476 internal::get_regularity_from_degree(fe_degree)),
478 std::max(1U, fe_degree),
486 , regularity(
internal::get_regularity_from_degree(fe_degree))
488 Assert((fe_degree % 2 == 1),
490 "ERROR: The current implementation of Hermite interpolation "
491 "polynomials is only defined for odd polynomial degrees. Running "
492 "in release mode will use a polynomial degree of max(1,fe_degree-1) "
493 "to protect against unexpected internal bugs."));
498template <
int dim,
int spacedim>
502 std::ostringstream name_buffer;
504 << this->degree <<
")";
505 return name_buffer.str();
510template <
int dim,
int spacedim>
511std::unique_ptr<FiniteElement<dim, spacedim>>
514 return std::make_unique<FE_Hermite<dim, spacedim>>(*this);
519template <
int dim,
int spacedim>
538template <
int dim,
int spacedim>
539std::vector<std::pair<unsigned int, unsigned int>>
593template <
int dim,
int spacedim>
594std::vector<std::pair<unsigned int, unsigned int>>
608template <
int dim,
int spacedim>
609std::vector<std::pair<unsigned int, unsigned int>>
612 const unsigned int face_no)
const
625template <
int dim,
int spacedim>
629 const unsigned int codim)
const
646 if (this->degree < fe_hermite_other->degree)
648 else if (this->degree == fe_hermite_other->degree)
656 if (fe_q_other->degree == 1)
658 if (this->degree == 1)
663 else if (this->degree <= fe_q_other->degree)
671 if (fe_p_other->degree == 1)
673 if (this->degree == 1)
678 else if (this->degree <= fe_p_other->degree)
686 if (fe_wp_other->degree == 1)
688 if (this->degree == 1)
693 else if (this->degree <= fe_wp_other->degree)
701 if (fe_pp_other->degree == 1)
703 if (this->degree == 1)
708 else if (this->degree <= fe_pp_other->degree)
716 if (fe_nothing->is_dominating())
731template <
int dim,
int spacedim>
732std::vector<unsigned int>
735 return internal::hermite_lexicographic_to_hierarchic_numbering<dim>(
741template <
int dim,
int spacedim>
749 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
761 &fe_internal) !=
nullptr),
775 for (
unsigned int i = 0; i < output_data.shape_values.size(0); ++i)
776 for (
unsigned int q = 0; q < output_data.shape_values.size(1); ++q)
777 output_data.shape_values(i, q) = fe_data.
shape_values(i, q);
781 output_data.shape_values);
787 for (
unsigned int k = 0; k < this->n_dofs_per_cell(); ++k)
797 output_data.shape_gradients);
803 for (
unsigned int k = 0; k < this->n_dofs_per_cell(); ++k)
813 output_data.shape_hessians);
819 for (
unsigned int k = 0; k < this->n_dofs_per_cell(); ++k)
831 output_data.shape_3rd_derivatives);
837template <
int dim,
int spacedim>
841 const unsigned int face_no,
845 const ::internal::FEValuesImplementation::MappingRelatedData<dim,
859 &fe_internal) !=
nullptr),
867 &mapping_internal) !=
nullptr),
878 ReferenceCells::get_hypercube<dim>(),
880 cell->combined_face_orientation(face_no),
881 quadrature[0].
size());
888 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
889 for (
unsigned int i = 0; i < quadrature[0].
size(); ++i)
890 output_data.shape_values(k, i) = fe_data.
shape_values[k][i + offset];
896 output_data.shape_values);
901 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
905 quadrature[0].
size()),
914 output_data.shape_gradients);
919 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
923 quadrature[0].
size()),
932 output_data.shape_hessians);
937 for (
unsigned int k = 0; k < this->dofs_per_cell; ++k)
941 quadrature[0].
size()),
952 output_data.shape_3rd_derivatives);
959#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
Table< 2, double > shape_values
Table< 2, Tensor< 3, dim > > shape_3rd_derivatives
Table< 2, Tensor< 2, dim > > shape_hessians
Table< 2, Tensor< 1, dim > > shape_gradients
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()
std::vector< index_type > data
@ either_element_can_dominate
@ other_element_dominates
@ neither_element_dominates
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)