From c701a265bc497fa1dc5040c06a2073a1efa5b0d4 Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 15 Jan 2025 12:08:06 -0500 Subject: [PATCH] Combine the quad_index() functions. --- include/deal.II/grid/tria_accessor.h | 43 ++++++++++------------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index 50708fbe07..75538b80ab 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -4899,32 +4899,6 @@ namespace internal */ struct Implementation { - /** - * Implementation of the function of some name in the parent class. - */ - template - inline static unsigned int - quad_index(const TriaAccessor &, - const unsigned int) - { - Assert(false, - ExcMessage("You can't ask for the index of a quad bounding " - "a one- or two-dimensional cell because it is not " - "bounded by quads.")); - return numbers::invalid_unsigned_int; - } - - - inline static unsigned int - quad_index(const TriaAccessor<3, 3, 3> &accessor, const unsigned int i) - { - return accessor.tria->levels[accessor.present_level] - ->cells - .cells[accessor.present_index * ReferenceCells::max_n_faces<3>() + i]; - } - - - /** * Implementation of the function of some name in the parent class. */ @@ -5417,8 +5391,21 @@ template inline unsigned int TriaAccessor::quad_index(const unsigned int i) const { - return dealii::internal::TriaAccessorImplementation::Implementation:: - quad_index(*this, i); + Assert(structdim == 3, + ExcMessage("You can't ask for the index of a quad bounding " + "a one- or two-dimensional cell because it is not " + "bounded by quads.")); + // work around a bogus GCC-9 warning which considers i unused except in 3d + (void)i; + if constexpr (structdim == 3) + { + AssertIndexRange(i, n_faces()); + return this->tria->levels[this->present_level] + ->cells + .cells[this->present_index * ReferenceCells::max_n_faces<3>() + i]; + } + else + return numbers::invalid_unsigned_int; } -- 2.39.5