]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Give standard_vs_true_line_orientation() a better name. 18009/head
authorDavid Wells <drwells@email.unc.edu>
Sat, 18 Jan 2025 16:20:11 +0000 (11:20 -0500)
committerDavid Wells <drwells@email.unc.edu>
Wed, 22 Jan 2025 18:40:42 +0000 (13:40 -0500)
'Standard' is ambiguous in this context since we use both per-face and
per-cell line orientations in different contexts.

include/deal.II/grid/reference_cell.h
include/deal.II/grid/tria_accessor.h

index b080d14446c08dce613a44d5ea4453d1fe152889..2b739b983be6036adf3f6b4f01b89dab16bd034a 100644 (file)
@@ -593,7 +593,11 @@ public:
    * Return whether the line with index @p line is oriented in standard
    * direction within a cell, given the @p face_orientation of the face within
    * the current cell, and @p line_orientation for the line within that face.
+   *
+   * @deprecated Use face_to_cell_line_orientation() instead.
    */
+  DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(
+    "Use face_to_cell_line_orientation() instead.")
   types::geometric_orientation
   standard_vs_true_line_orientation(
     const unsigned int                 line,
@@ -601,6 +605,35 @@ public:
     const types::geometric_orientation face_orientation,
     const types::geometric_orientation line_orientation) const;
 
+  /**
+   * @brief Convert a line orientation defined relative to a face to the
+   * canonical per-cell line orientation.
+   *
+   * Line orientations are used in both face and line contexts. Since a line is
+   * always shared by two faces, it may need to be reversed (relative to the
+   * first face) on the second face to guarantee that the per-face lines always
+   * point in their canonical directions (e.g., so that lines 0 and 1 of a
+   * quadrilateral point up and lines 2 and 3 point right) and that the vertex
+   * ordering on that line remains correct.
+   *
+   * To achieve this, this function computes the per-cell line orientation based
+   * on the face's number, orientation and line number.
+   *
+   * @param[in] face_line_no The index of the line on the face.
+   *
+   * @param[in] face_no The number of the face.
+   *
+   * @param[in] face_orientation The orientation of the face.
+   *
+   * @param[in] line_orientation The orientation of the line on the given face.
+   */
+  types::geometric_orientation
+  face_to_cell_line_orientation(
+    const unsigned int                 face_line_no,
+    const unsigned int                 face_no,
+    const types::geometric_orientation face_orientation,
+    const types::geometric_orientation line_orientation) const;
+
   /**
    * @}
    */
@@ -3224,6 +3257,20 @@ ReferenceCell::standard_vs_true_line_orientation(
   const unsigned int                 face,
   const types::geometric_orientation combined_face_orientation,
   const types::geometric_orientation line_orientation) const
+{
+  return face_to_cell_line_orientation(line,
+                                       face,
+                                       combined_face_orientation,
+                                       line_orientation);
+}
+
+
+inline types::geometric_orientation
+ReferenceCell::face_to_cell_line_orientation(
+  const unsigned int                 face_line_no,
+  const unsigned int                 face_no,
+  const types::geometric_orientation combined_face_orientation,
+  const types::geometric_orientation line_orientation) const
 {
   constexpr auto D = ReferenceCell::default_combined_face_orientation();
   constexpr auto R = ReferenceCell::reversed_combined_line_orientation();
@@ -3231,10 +3278,10 @@ ReferenceCell::standard_vs_true_line_orientation(
     {
       static constexpr dealii::ndarray<types::geometric_orientation, 2, 8>
         table{{{{D, D, R, D, R, R, D, R}}, {{D, D, D, R, R, R, R, D}}}};
-      // We use line / 2 here since lines i and i + 1 are parallel and, on a
-      // given face, have the same relative orientations.
+      // We use face_line_no / 2 here since lines i and i + 1 are parallel and,
+      // on a given face, have the same relative orientations.
       const bool match =
-        line_orientation == table[line / 2][combined_face_orientation];
+        line_orientation == table[face_line_no / 2][combined_face_orientation];
 
       return match ? ReferenceCell::default_combined_face_orientation() :
                      ReferenceCell::reversed_combined_line_orientation();
@@ -3245,7 +3292,7 @@ ReferenceCell::standard_vs_true_line_orientation(
       static constexpr dealii::ndarray<unsigned int, 4, 3> combined_lines{
         {{{0, 0, 0}}, {{X, 0, 1}}, {{X, 0, X}}, {{X, X, X}}}};
 
-      const auto combined_line = combined_lines[face][line];
+      const auto combined_line = combined_lines[face_no][face_line_no];
 
       Assert(combined_line != X,
              ExcMessage(
index c08276b7175bdb0bbc18c3ea2a4a51028fe35fcc..6bd6ac1503f3b7bc5e8738d8cdd9d4bada09903d 100644 (file)
@@ -1004,7 +1004,7 @@ public:
    * @warning This function is really only for internal use in the library
    * unless you absolutely know what this is all about.
    *
-   * @note This function queries ReferenceCell::standard_vs_true_line_orientation().
+   * @note This function queries ReferenceCell::face_to_cell_line_orientation().
    */
   types::geometric_orientation
   line_orientation(const unsigned int line) const;
@@ -5109,22 +5109,22 @@ namespace internal
                    ref_cell.standard_to_real_face_line(3, f, orientation)}};
                 const auto quad = cell.quad(f);
                 const std::array<types::geometric_orientation, 4>
-                  my_orientations{{ref_cell.standard_vs_true_line_orientation(
+                  my_orientations{{ref_cell.face_to_cell_line_orientation(
                                      0,
                                      f,
                                      orientation,
                                      quad->line_orientation(my_indices[0])),
-                                   ref_cell.standard_vs_true_line_orientation(
+                                   ref_cell.face_to_cell_line_orientation(
                                      1,
                                      f,
                                      orientation,
                                      quad->line_orientation(my_indices[1])),
-                                   ref_cell.standard_vs_true_line_orientation(
+                                   ref_cell.face_to_cell_line_orientation(
                                      2,
                                      f,
                                      orientation,
                                      quad->line_orientation(my_indices[2])),
-                                   ref_cell.standard_vs_true_line_orientation(
+                                   ref_cell.face_to_cell_line_orientation(
                                      3,
                                      f,
                                      orientation,
@@ -5144,12 +5144,12 @@ namespace internal
                    ref_cell.standard_to_real_face_line(1, f, orientation)}};
                 const auto quad = cell.quad(f);
                 const std::array<types::geometric_orientation, 2>
-                  my_orientations{{ref_cell.standard_vs_true_line_orientation(
+                  my_orientations{{ref_cell.face_to_cell_line_orientation(
                                      0,
                                      f,
                                      orientation,
                                      quad->line_orientation(my_indices[0])),
-                                   ref_cell.standard_vs_true_line_orientation(
+                                   ref_cell.face_to_cell_line_orientation(
                                      1,
                                      f,
                                      orientation,
@@ -5171,32 +5171,32 @@ namespace internal
                ref_cell.standard_to_real_face_line(1, 1, orientations[1]),
                ref_cell.standard_to_real_face_line(2, 1, orientations[1]),
                ref_cell.standard_to_real_face_line(1, 2, orientations[2])}};
-            line_orientations[0] = ref_cell.standard_vs_true_line_orientation(
+            line_orientations[0] = ref_cell.face_to_cell_line_orientation(
               0,
               0,
               orientations[0],
               cell.quad(0)->line_orientation(my_indices[0]));
-            line_orientations[1] = ref_cell.standard_vs_true_line_orientation(
+            line_orientations[1] = ref_cell.face_to_cell_line_orientation(
               1,
               0,
               orientations[0],
               cell.quad(0)->line_orientation(my_indices[1]));
-            line_orientations[2] = ref_cell.standard_vs_true_line_orientation(
+            line_orientations[2] = ref_cell.face_to_cell_line_orientation(
               2,
               0,
               orientations[0],
               cell.quad(0)->line_orientation(my_indices[2]));
-            line_orientations[3] = ref_cell.standard_vs_true_line_orientation(
+            line_orientations[3] = ref_cell.face_to_cell_line_orientation(
               1,
               1,
               orientations[1],
               cell.quad(1)->line_orientation(my_indices[3]));
-            line_orientations[4] = ref_cell.standard_vs_true_line_orientation(
+            line_orientations[4] = ref_cell.face_to_cell_line_orientation(
               2,
               1,
               orientations[1],
               cell.quad(1)->line_orientation(my_indices[4]));
-            line_orientations[5] = ref_cell.standard_vs_true_line_orientation(
+            line_orientations[5] = ref_cell.face_to_cell_line_orientation(
               1,
               2,
               orientations[2],
@@ -5567,7 +5567,7 @@ TriaAccessor<structdim, dim, spacedim>::line_orientation(
           line_index, face_index, this->combined_face_orientation(face_index));
 
       // Then query how that line is oriented within that face:
-      return reference_cell.standard_vs_true_line_orientation(
+      return reference_cell.face_to_cell_line_orientation(
         line_index,
         face_index,
         this->combined_face_orientation(face_index),

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.