From ce190f175229cf04d8f2762e0296d09cc32b95b2 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sun, 5 Apr 2020 16:09:11 +0200 Subject: [PATCH] Use new functions in FE_Q and MappingQEulerian --- source/fe/fe_q_base.cc | 39 +++++---------------------------- source/fe/mapping_q_eulerian.cc | 12 +++------- 2 files changed, 8 insertions(+), 43 deletions(-) diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 14e5a3edcb..4ab6de7034 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -42,31 +42,6 @@ namespace internal { namespace { - // get the renumbering for faces - template - inline std::vector - face_lexicographic_to_hierarchic_numbering(const unsigned int degree) - { - std::vector dpo(dim, 1U); - for (unsigned int i = 1; i < dpo.size(); ++i) - dpo[i] = dpo[i - 1] * (degree - 1); - const dealii::FiniteElementData face_data(dpo, 1, degree); - std::vector face_renumber(face_data.dofs_per_cell); - FETools::lexicographic_to_hierarchic_numbering(face_data, - face_renumber); - return face_renumber; - } - - // dummy specialization for dim == 1 to avoid linker errors - template <> - inline std::vector - face_lexicographic_to_hierarchic_numbering<1>(const unsigned int) - { - return std::vector(); - } - - - // in get_restriction_matrix() and get_prolongation_matrix(), want to undo // tensorization on inner loops for performance reasons. this clears a // dim-array @@ -208,8 +183,7 @@ struct FE_Q_Base::Implementation const std::vector &index_map_inverse = fe.poly_space.get_numbering_inverse(); const std::vector face_index_map = - internal::FE_Q_Base::face_lexicographic_to_hierarchic_numbering( - q_deg); + FETools::lexicographic_to_hierarchic_numbering(q_deg); Assert(std::abs( fe.poly_space.compute_value(index_map_inverse[0], Point()) - 1.) < 1e-14, @@ -344,8 +318,7 @@ struct FE_Q_Base::Implementation const std::vector &index_map_inverse = fe.poly_space.get_numbering_inverse(); const std::vector face_index_map = - internal::FE_Q_Base::face_lexicographic_to_hierarchic_numbering( - q_deg); + FETools::lexicographic_to_hierarchic_numbering(q_deg); Assert(std::abs( fe.poly_space.compute_value(index_map_inverse[0], Point()) - 1.) < 1e-14, @@ -468,9 +441,8 @@ FE_Q_Base::initialize( ExcInternalError()); { - std::vector renumber(q_dofs_per_cell); - const FiniteElementData fe(get_dpo_vector(q_degree), 1, q_degree); - FETools::hierarchic_to_lexicographic_numbering(fe, renumber); + std::vector renumber = + FETools::hierarchic_to_lexicographic_numbering(q_degree); for (unsigned int i = q_dofs_per_cell; i < this->dofs_per_cell; ++i) renumber.push_back(i); this->poly_space.set_numbering(renumber); @@ -932,8 +904,7 @@ FE_Q_Base::initialize_unit_face_support_points( // find renumbering of faces and assign from values of quadrature const std::vector face_index_map = - internal::FE_Q_Base::face_lexicographic_to_hierarchic_numbering( - q_degree); + FETools::lexicographic_to_hierarchic_numbering(q_degree); // We can compute the support points by computing the tensor // product of the 1d set of points. We could do this by hand, but it's diff --git a/source/fe/mapping_q_eulerian.cc b/source/fe/mapping_q_eulerian.cc index c22770c625..bfa18d4865 100644 --- a/source/fe/mapping_q_eulerian.cc +++ b/source/fe/mapping_q_eulerian.cc @@ -106,15 +106,9 @@ MappingQEulerian::MappingQEulerianGeneric:: const unsigned int n_q_points = q_iterated.size(); // we then need to define a renumbering vector that allows us to go from a - // lexicographic numbering scheme to a hierarchic one. this fragment is - // taking almost verbatim from the MappingQ class. - std::vector renumber(n_q_points); - std::vector dpo(dim + 1, 1U); - for (unsigned int i = 1; i < dpo.size(); ++i) - dpo[i] = dpo[i - 1] * (map_degree - 1); - - FETools::lexicographic_to_hierarchic_numbering( - FiniteElementData(dpo, 1, map_degree), renumber); + // lexicographic numbering scheme to a hierarchic one. + const std::vector renumber = + FETools::lexicographic_to_hierarchic_numbering(map_degree); // finally we assign the quadrature points in the required order. for (unsigned int q = 0; q < n_q_points; ++q) -- 2.39.5