]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Combine the set_line_orientation() functions. 17958/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 27 Dec 2024 17:38:51 +0000 (12:38 -0500)
committerDavid Wells <drwells@email.unc.edu>
Fri, 27 Dec 2024 18:52:08 +0000 (13:52 -0500)
Part of 14667.

include/deal.II/grid/tria_accessor.h

index fd278c1e0eaeb307f407c2b7273aa40fb3e9740c..d4fc68c5d2da0c2485661493b2af04a05bb0f26e 100644 (file)
@@ -4999,59 +4999,6 @@ namespace internal
               combined_orientation);
       }
 
-      /**
-       * Implementation of the function of some name in the parent class.
-       */
-      template <int dim, int spacedim>
-      inline static void
-      set_line_orientation(const TriaAccessor<1, dim, spacedim> &,
-                           const unsigned int,
-                           const bool)
-      {
-        DEAL_II_ASSERT_UNREACHABLE();
-      }
-
-
-      template <int spacedim>
-      inline static void
-      set_line_orientation(const TriaAccessor<2, 2, spacedim> &,
-                           const unsigned int,
-                           const bool)
-      {
-        // quads in 2d have no
-        // non-standard orientation
-        DEAL_II_ASSERT_UNREACHABLE();
-      }
-
-
-      template <int spacedim>
-      inline static void
-      set_line_orientation(const TriaAccessor<2, 3, spacedim> &accessor,
-                           const unsigned int                  line,
-                           const bool                          value)
-      {
-        Assert(accessor.used(), TriaAccessorExceptions::ExcCellNotUsed());
-        AssertIndexRange(line, accessor.n_lines());
-        Assert(accessor.present_index * GeometryInfo<3>::lines_per_face + line <
-                 accessor.tria->faces->quads_line_orientations.size(),
-               ExcInternalError());
-
-        // quads as part of 3d hexes can have non-standard orientation
-        accessor.tria->faces->quads_line_orientations
-          [accessor.present_index * GeometryInfo<3>::lines_per_face + line] =
-          value;
-      }
-
-
-      inline static void
-      set_line_orientation(const TriaAccessor<3, 3, 3> &,
-                           const unsigned int,
-                           const bool)
-      {
-        // it seems like we don't need this
-        // one
-        DEAL_II_NOT_IMPLEMENTED();
-      }
 
 
       /**
@@ -5698,9 +5645,29 @@ TriaAccessor<structdim, dim, spacedim>::set_line_orientation(
 {
   Assert(used(), TriaAccessorExceptions::ExcCellNotUsed());
   AssertIndexRange(line, this->n_lines());
+  Assert(dim != 1,
+         ExcMessage("In 1d lines are cells and thus do not need to have their "
+                    "orientations set."));
+  Assert(dim != 2,
+         ExcMessage("In 2d lines are faces, and, for compatibility with other "
+                    "dimensions, their orientations should be set via "
+                    "set_combined_orientation()."));
+  // work around a bogus GCC-9 warning which considers line and value unused
+  // except in 3d
+  (void)line;
+  (void)value;
 
-  dealii::internal::TriaAccessorImplementation::Implementation::
-    set_line_orientation(*this, line, value);
+  if constexpr (dim == 3)
+    {
+      // We set line orientations per face, not per cell, so this only works for
+      // faces in 3d
+      Assert(structdim == 2, ExcNotImplemented());
+      Assert(this->present_index * GeometryInfo<3>::lines_per_face + line <
+               this->tria->faces->quads_line_orientations.size(),
+             ExcInternalError());
+      this->tria->faces->quads_line_orientations
+        [this->present_index * GeometryInfo<3>::lines_per_face + line] = value;
+    }
 }
 
 

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.