From 0887e377c2048dc1fb7321a585a3f4292f8ba274 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 27 Dec 2024 12:55:44 -0500 Subject: [PATCH] Look up line orientations from combined orientations in 2d. We store the combined orientations so it is simpler to just refer to that function instead of translating back-and-forth. --- include/deal.II/grid/tria_accessor.h | 39 ++++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/include/deal.II/grid/tria_accessor.h b/include/deal.II/grid/tria_accessor.h index fd278c1e0e..1826d0f540 100644 --- a/include/deal.II/grid/tria_accessor.h +++ b/include/deal.II/grid/tria_accessor.h @@ -5537,9 +5537,18 @@ TriaAccessor::combined_face_orientation( if constexpr (structdim == 1) return ReferenceCell::default_combined_face_orientation(); else if constexpr (structdim == 2) - return this->line_orientation(face) == true ? - ReferenceCell::default_combined_face_orientation() : - ReferenceCell::reversed_combined_line_orientation(); + { + // if all elements are quads (or if we have a very special consistently + // oriented triangular mesh) then we do not store this array + if (this->tria->levels[this->present_level] + ->face_orientations.n_objects() == 0) + return ReferenceCell::default_combined_face_orientation(); + else + return this->tria->levels[this->present_level] + ->face_orientations.get_orientation( + this->present_index * GeometryInfo::faces_per_cell + + face); + } else return this->tria->levels[this->present_level] ->face_orientations.get_combined_orientation( @@ -5639,20 +5648,16 @@ TriaAccessor::line_orientation( else if constexpr (structdim == 2 && dim == 2) // lines in 2d are faces { - // if all elements are quads (or if we have a very special consistently - // oriented triangular mesh) then we do not store this array - if (this->tria->levels[this->present_level] - ->face_orientations.n_objects() == 0) - { - return true; - } - else - { - return this->tria->levels[this->present_level] - ->face_orientations.get_orientation( - this->present_index * GeometryInfo::faces_per_cell + - line); - } + const auto combined_orientation = combined_face_orientation(line); + Assert(combined_orientation == + ReferenceCell::default_combined_face_orientation() || + combined_orientation == + ReferenceCell::reversed_combined_line_orientation(), + ExcInternalError()); + return combined_orientation == + ReferenceCell::default_combined_face_orientation() ? + true : + false; } else if constexpr (structdim == 2 && dim == 3) { -- 2.39.5