From 1ef4eac9465694cfacf2ce650044ed489e447a00 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 24 Mar 2024 23:52:17 -0400 Subject: [PATCH] GridTools::orthogonal_equality(): simplify. --- source/grid/grid_tools_dof_handlers.cc | 43 +++++--------------------- tests/bits/periodicity_09.cc | 4 +-- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/source/grid/grid_tools_dof_handlers.cc b/source/grid/grid_tools_dof_handlers.cc index f7cdc8f9f2..5ffef54767 100644 --- a/source/grid/grid_tools_dof_handlers.cc +++ b/source/grid/grid_tools_dof_handlers.cc @@ -2463,43 +2463,16 @@ namespace GridTools } } - // And finally, a lookup to determine the ordering bitmask: if (face2_vertices_set.empty()) { - const auto combined_orientation = - face1->reference_cell().get_combined_orientation( - make_array_view(face1_vertices.cbegin(), - face1_vertices.cbegin() + face1->n_vertices()), - make_array_view(face2_vertices.cbegin(), - face2_vertices.cbegin() + face2->n_vertices())); - unsigned char orientation = std::numeric_limits::max(); - if (dim == 1) - { - // In 1D things are always well-oriented - orientation = ReferenceCell::default_combined_face_orientation(); - } - // The original version of this doesn't use the standardized orientation - // value so we have to do an additional translation step - else if (dim == 2) - { - // In 2D only the first bit (orientation) is set - AssertIndexRange(combined_orientation, 2); - orientation = combined_orientation; - } - else - { - Assert(dim == 3, ExcInternalError()); - // Unlike the standard orientation, here the 90 degree rotations are - // always clockwise, so the third and seventh (in the combined - // orientation) are switched. - constexpr std::array translation{ - {0, 1, 2, 7, 4, 5, 6, 3}}; - AssertIndexRange(combined_orientation, translation.size()); - orientation = - translation[std::min(combined_orientation, 7u)]; - } - - return std::make_optional(orientation); + const auto reference_cell = face1->reference_cell(); + // We want the relative orientation of face1 with respect to face2 so + // the order is flipped here: + return std::make_optional(reference_cell.get_combined_orientation( + make_array_view(face2_vertices.cbegin(), + face2_vertices.cbegin() + face2->n_vertices()), + make_array_view(face1_vertices.cbegin(), + face1_vertices.cbegin() + face1->n_vertices()))); } else return std::nullopt; diff --git a/tests/bits/periodicity_09.cc b/tests/bits/periodicity_09.cc index 47922ee56f..b70c1cf87e 100644 --- a/tests/bits/periodicity_09.cc +++ b/tests/bits/periodicity_09.cc @@ -72,9 +72,7 @@ test() (std::next(dof_handler.begin(0)))->face(1), cm, ComponentMask(), - true, - false, - false, + ReferenceCell::default_combined_face_orientation(), FullMatrix(), std::vector(), periodicity_factor); -- 2.39.5