]> https://gitweb.dealii.org/ - dealii.git/commitdiff
GridTools::orthogonal_equality(): simplify.
authorDavid Wells <drwells@email.unc.edu>
Mon, 25 Mar 2024 03:52:17 +0000 (23:52 -0400)
committerDavid Wells <drwells@email.unc.edu>
Mon, 25 Mar 2024 14:08:38 +0000 (10:08 -0400)
source/grid/grid_tools_dof_handlers.cc
tests/bits/periodicity_09.cc

index f7cdc8f9f218213543433d61b82d508333a17df1..5ffef547672b457f7af306c00c8714fce97e6f89 100644 (file)
@@ -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<unsigned char>::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<unsigned int, 8> translation{
-              {0, 1, 2, 7, 4, 5, 6, 3}};
-            AssertIndexRange(combined_orientation, translation.size());
-            orientation =
-              translation[std::min<unsigned int>(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;
index 47922ee56f9dcb8b0ca8be826a2d908eeb77509f..b70c1cf87efe51698c3db3f757356eab5390f48a 100644 (file)
@@ -72,9 +72,7 @@ test()
     (std::next(dof_handler.begin(0)))->face(1),
     cm,
     ComponentMask(),
-    true,
-    false,
-    false,
+    ReferenceCell::default_combined_face_orientation(),
     FullMatrix<double>(),
     std::vector<unsigned int>(),
     periodicity_factor);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.