]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Look up line orientations from combined orientations in 2d. 17959/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 27 Dec 2024 17:55:44 +0000 (12:55 -0500)
committerDavid Wells <drwells@email.unc.edu>
Fri, 27 Dec 2024 18:13:02 +0000 (13:13 -0500)
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

index fd278c1e0eaeb307f407c2b7273aa40fb3e9740c..1826d0f540cf2a6b91bead24cbf1176113e0d0da 100644 (file)
@@ -5537,9 +5537,18 @@ TriaAccessor<structdim, dim, spacedim>::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<structdim>::faces_per_cell +
+            face);
+    }
   else
     return this->tria->levels[this->present_level]
       ->face_orientations.get_combined_orientation(
@@ -5639,20 +5648,16 @@ TriaAccessor<structdim, dim, spacedim>::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<structdim>::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)
     {

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.