]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Consolidate face_rotation() functions.
authorDavid Wells <drwells@email.unc.edu>
Sat, 4 May 2024 15:48:52 +0000 (11:48 -0400)
committerDavid Wells <drwells@email.unc.edu>
Mon, 6 May 2024 14:54:27 +0000 (10:54 -0400)
include/deal.II/grid/tria_accessor.templates.h

index bf4c53c9f6c09642ef1815073b5c44edab4801f6..2f6249fce78d570751e18366c5e12a2c6b1c365d 100644 (file)
@@ -757,35 +757,6 @@ namespace internal
 
 
 
-      /**
-       * Implementation of the function of some name in the mother class.
-       */
-      template <int structdim, int dim, int spacedim>
-      inline static bool
-      face_rotation(const TriaAccessor<structdim, dim, spacedim> &,
-                    const unsigned int)
-      {
-        /*
-         * Default implementation used in 1d and 2d
-         *
-         * In 1d and 2d, face_rotation is always false as there is no such
-         * concept as "rotated" faces in 1d and 2d.
-         */
-        return false;
-      }
-
-
-      inline static bool
-      face_rotation(const TriaAccessor<3, 3, 3> &accessor,
-                    const unsigned int           face)
-      {
-        AssertIndexRange(face, accessor.n_faces());
-
-        return accessor.tria->levels[accessor.present_level]
-          ->face_orientations.get_rotation(
-            accessor.present_index * GeometryInfo<3>::faces_per_cell + face);
-      }
-
       /**
        * Implementation of the function of some name in the mother class.
        */
@@ -1454,9 +1425,22 @@ TriaAccessor<structdim, dim, spacedim>::face_rotation(
   const unsigned int face) const
 {
   Assert(used(), TriaAccessorExceptions::ExcCellNotUsed());
+  Assert(structdim == dim,
+         ExcMessage("This function can only be used on objects "
+                    "that are cells, but not on faces or edges "
+                    "that bound cells."));
+  AssertIndexRange(face, n_faces());
+  // work around a bogus GCC-9 warning which considers face unused except in 3d
+  (void)face;
 
-  return dealii::internal::TriaAccessorImplementation::Implementation::
-    face_rotation(*this, face);
+  if constexpr (structdim == 3)
+    return this->tria->levels[this->present_level]
+      ->face_orientations.get_rotation(
+        this->present_index * GeometryInfo<3>::faces_per_cell + face);
+  else
+    // In 1d and 2d, face_rotation is always false as faces can only be
+    // 'rotated' in 3d.
+    return false;
 }
 
 

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.