]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Introduce numbers::reverse_line_orientation. 18022/head
authorDavid Wells <drwells@email.unc.edu>
Thu, 23 Jan 2025 01:04:31 +0000 (20:04 -0500)
committerDavid Wells <drwells@email.unc.edu>
Thu, 23 Jan 2025 02:15:09 +0000 (21:15 -0500)
It is useful to have this value since lines only have two possible orientations.

include/deal.II/base/types.h
include/deal.II/grid/connectivity.h
include/deal.II/grid/reference_cell.h
include/deal.II/grid/tria_accessor.h
source/fe/fe.cc
source/fe/fe_poly_tensor.cc
source/grid/tria.cc
tests/dofs/dof_tools_21_b_x.cc
tests/dofs/dof_tools_21_b_x_q3.cc
tests/simplex/orientation_04.cc

index cd6863fe0a3e933508fb56bd865a889b6b274357..2b3e726d3faa7111a930db7ba3f41f626bceff58 100644 (file)
@@ -347,6 +347,19 @@ namespace numbers
   const types::geometric_orientation default_geometric_orientation =
     static_cast<types::geometric_orientation>(0b001);
 
+  /**
+   * Value indicating that a line is in the reverse orientation. Since lines can
+   * only have two possible orientations, this value and
+   * default_geometric_orientation completely encode the possible values for
+   * line orientations.
+   *
+   * See the
+   * @ref GlossFaceOrientation "glossary"
+   * for more information.
+   */
+  const types::geometric_orientation reverse_line_orientation =
+    static_cast<types::geometric_orientation>(0b000);
+
   /**
    * A special id for an invalid subdomain id. This value may not be used as a
    * valid id but is used, for example, for default arguments to indicate a
index 8ca6d35cfcffa6d9351fe8c3e02a328f716e4338..17884852a4bed415e22ab4bd88a44f28ffc2d1db 100644 (file)
@@ -1341,7 +1341,7 @@ namespace internal
                   ori_ql.set_combined_orientation(
                     con_ql.ptr[f] + l,
                     same ? numbers::default_geometric_orientation :
-                           ReferenceCell::reversed_combined_line_orientation());
+                           numbers::reverse_line_orientation);
                 }
             }
         }
index b5119fc40162e38271e9cce39619a230a66a400c..ed9bd6c832ed305a214ac83058f62a1940228b3c 100644 (file)
@@ -444,7 +444,11 @@ public:
    * lines only have two possible orientations, this function and
    * ReferenceCell::default_combined_face_orientation() encode all of its
    * possible orientation states.
+   *
+   * @deprecated Use numbers::reverse_line_orientation instead.
    */
+  DEAL_II_DEPRECATED_EARLY_WITH_COMMENT(
+    "Use numbers::reverse_line_orientation instead.")
   static constexpr types::geometric_orientation
   reversed_combined_line_orientation();
 
@@ -2075,7 +2079,7 @@ ReferenceCell::reversed_combined_line_orientation()
 {
   // For a reversed line 'orientation' is false and neither flip nor rotate are
   // defined.
-  return 0b000;
+  return numbers::reverse_line_orientation;
 }
 
 
@@ -3274,7 +3278,7 @@ ReferenceCell::face_to_cell_line_orientation(
   const types::geometric_orientation line_orientation) const
 {
   constexpr auto D = numbers::default_geometric_orientation;
-  constexpr auto R = ReferenceCell::reversed_combined_line_orientation();
+  constexpr auto R = numbers::reverse_line_orientation;
   if (*this == ReferenceCells::Hexahedron)
     {
       static constexpr dealii::ndarray<types::geometric_orientation, 2, 8>
@@ -3285,7 +3289,7 @@ ReferenceCell::face_to_cell_line_orientation(
         line_orientation == table[face_line_no / 2][combined_face_orientation];
 
       return match ? numbers::default_geometric_orientation :
-                     ReferenceCell::reversed_combined_line_orientation();
+                     numbers::reverse_line_orientation;
     }
   else if (*this == ReferenceCells::Tetrahedron)
     {
@@ -3307,7 +3311,7 @@ ReferenceCell::face_to_cell_line_orientation(
         line_orientation == table[combined_line][combined_face_orientation];
 
       return match ? numbers::default_geometric_orientation :
-                     ReferenceCell::reversed_combined_line_orientation();
+                     numbers::reverse_line_orientation;
     }
   else
     // TODO: This might actually be wrong for some of the other
index fd9d3bd6342614dac085f825fb8f0206bec5cc99..3c3d5ffeffe554990e2b74d7639af9913e680dcb 100644 (file)
@@ -2169,7 +2169,7 @@ public:
   face_rotation(const unsigned int face);
 
   /**
-   * @brief Always return ReferenceCell::reversed_combined_line_orientation()
+   * @brief Always return numbers::reverse_line_orientation
    */
   static types::geometric_orientation
   line_orientation(const unsigned int line);
@@ -2838,7 +2838,7 @@ public:
   face_rotation(const unsigned int face);
 
   /**
-   * @brief Always return ReferenceCell::reversed_combined_line_orientation()
+   * @brief Always return numbers::reverse_line_orientation
    */
   static types::geometric_orientation
   line_orientation(const unsigned int line);
@@ -4912,8 +4912,7 @@ namespace internal
         else if (dim == 2)
           Assert(combined_orientation ==
                      numbers::default_geometric_orientation ||
-                   combined_orientation ==
-                     ReferenceCell::reversed_combined_line_orientation(),
+                   combined_orientation == numbers::reverse_line_orientation,
                  ExcMessage(
                    "In 2d, the only valid values of the combined orientation "
                    "are the standard orientation or the reversed line "
@@ -5535,8 +5534,7 @@ TriaAccessor<structdim, dim, spacedim>::line_orientation(
     {
       const auto combined_orientation = combined_face_orientation(line);
       Assert(combined_orientation == numbers::default_geometric_orientation ||
-               combined_orientation ==
-                 ReferenceCell::reversed_combined_line_orientation(),
+               combined_orientation == numbers::reverse_line_orientation,
              ExcInternalError());
       return combined_orientation;
     }
@@ -5551,7 +5549,7 @@ TriaAccessor<structdim, dim, spacedim>::line_orientation(
              ExcInternalError());
       return this->tria->faces->quads_line_orientations[index] ?
                numbers::default_geometric_orientation :
-               ReferenceCell::reversed_combined_line_orientation();
+               numbers::reverse_line_orientation;
     }
   else if constexpr (structdim == 3 && dim == 3)
     {
@@ -6912,7 +6910,7 @@ template <int dim, int spacedim>
 inline types::geometric_orientation
 TriaAccessor<0, dim, spacedim>::line_orientation(const unsigned int /*line*/)
 {
-  return ReferenceCell::reversed_combined_line_orientation();
+  return numbers::reverse_line_orientation;
 }
 
 
@@ -7360,7 +7358,7 @@ template <int spacedim>
 inline types::geometric_orientation
 TriaAccessor<0, 1, spacedim>::line_orientation(const unsigned int /*line*/)
 {
-  return ReferenceCell::reversed_combined_line_orientation();
+  return numbers::reverse_line_orientation;
 }
 
 
index adfd95a439708dd0dd9c4a16438f706494320427..d1e918d19fe1c37478eea979e96aac069fb49b69 100644 (file)
@@ -678,8 +678,7 @@ FiniteElement<dim, spacedim>::adjust_line_dof_index_for_line_orientation(
   const types::geometric_orientation combined_orientation) const
 {
   Assert(combined_orientation == numbers::default_geometric_orientation ||
-           combined_orientation ==
-             ReferenceCell::reversed_combined_line_orientation(),
+           combined_orientation == numbers::reverse_line_orientation,
          ExcInternalError());
 
   AssertIndexRange(index, this->n_dofs_per_line());
index 846e87be37592071f81fccef6fc0fd5578d6242f..5f27d831a031442b80e0b12f1e65bf9549947086 100644 (file)
@@ -148,7 +148,7 @@ namespace internal
         // TODO: This fixes only lowest order
         for (unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
           if ((cell->line_orientation(l) ==
-               ReferenceCell::reversed_combined_line_orientation()) &&
+               numbers::reverse_line_orientation) &&
               mapping_kind[0] == mapping_nedelec)
             line_dof_sign[l] = -1.0;
       }
@@ -167,7 +167,7 @@ namespace internal
         // which all dofs are face dofs
         for (unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
           if ((cell->line_orientation(l) ==
-               ReferenceCell::reversed_combined_line_orientation()) &&
+               numbers::reverse_line_orientation) &&
               mapping_kind[0] == mapping_nedelec)
             line_dof_sign[l] = -1.0;
       }
index 987fe0d0fff1e86d716e6481f2efcd8ed0b45787..939024246487b7c395cd2974afdeca0f8d60dfaa 100644 (file)
@@ -1837,8 +1837,7 @@ namespace
   {
     AssertIndexRange(child_no, ReferenceCells::Line.template n_children<1>());
     Assert(line_orientation == numbers::default_geometric_orientation ||
-             line_orientation ==
-               ReferenceCell::reversed_combined_line_orientation(),
+             line_orientation == numbers::reverse_line_orientation,
            ExcInternalError());
     constexpr auto D = numbers::default_geometric_orientation;
     if (child_no == 0)
@@ -3326,12 +3325,11 @@ namespace internal
                         .get_combined_orientation(k);
                     // it doesn't make sense to set any flags except
                     // orientation for a line
-                    Assert(
-                      combined_orientation ==
-                          numbers::default_geometric_orientation ||
-                        combined_orientation ==
-                          ReferenceCell::reversed_combined_line_orientation(),
-                      ExcInternalError());
+                    Assert(combined_orientation ==
+                               numbers::default_geometric_orientation ||
+                             combined_orientation ==
+                               numbers::reverse_line_orientation,
+                           ExcInternalError());
                     // Same convention as TriaAccessor::set_line_orientation():
                     // store true for the default orientation and false for
                     // reversed.
@@ -5189,7 +5187,7 @@ namespace internal
               // the last one.
               std::fill(inherited_orientations.begin() + lmin,
                         inherited_orientations.begin() + lmax,
-                        ReferenceCell::reversed_combined_line_orientation());
+                        numbers::reverse_line_orientation);
             }
           else if (cell->reference_cell() == ReferenceCells::Quadrilateral)
             {
@@ -5224,7 +5222,7 @@ namespace internal
               Assert(combined_orientation ==
                          numbers::default_geometric_orientation ||
                        combined_orientation ==
-                         ReferenceCell::reversed_combined_line_orientation(),
+                         numbers::reverse_line_orientation,
                      ExcInternalError());
               for (unsigned int c = 0; c < 2; ++c)
                 {
@@ -5232,8 +5230,7 @@ namespace internal
                   inherited_orientations[2 * face_no + c] =
                     cell->combined_face_orientation(face_no);
                 }
-              if (combined_orientation ==
-                  ReferenceCell::reversed_combined_line_orientation())
+              if (combined_orientation == numbers::reverse_line_orientation)
                 std::swap(new_lines[2 * face_no], new_lines[2 * face_no + 1]);
             }
 
@@ -8782,8 +8779,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index((i + 1) % 2) ==
                                          middle_vertices[i % 2],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
 
                           // set up the new quad, line numbering is as
@@ -9010,8 +9007,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index((i + 1) % 2) ==
                                          middle_vertices[i % 2],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
 
                           // set up the new quad, line numbering is as
@@ -9240,8 +9237,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index((i + 1) % 2) ==
                                          middle_vertices[i % 2],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
 
                           // set up the new quad, line numbering is as
@@ -9558,8 +9555,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index(1) ==
                                          middle_vertices[i],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
 
                           // note: for lines 4 to 11 (inner lines of the
@@ -9581,8 +9578,8 @@ namespace internal
                                          (middle_vertex_index<dim, spacedim>(
                                            hex->face(3 + i / 4))),
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
                           // for the last line the line orientation is
                           // always true, since it was just constructed
@@ -9995,8 +9992,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index(1) ==
                                          middle_vertices[i],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
 
                           // note: for lines 4 to 11 (inner lines of the
@@ -10019,8 +10016,8 @@ namespace internal
                                          (middle_vertex_index<dim, spacedim>(
                                            hex->face(1 + i / 4))),
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
                           // for the last line the line orientation is
                           // always true, since it was just constructed
@@ -10448,8 +10445,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index(1) ==
                                          middle_vertices[i],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
 
                           // note: for lines 4 to 11 (inner lines of the
@@ -10471,8 +10468,8 @@ namespace internal
                                          (middle_vertex_index<dim, spacedim>(
                                            hex->face(i / 4 - 1))),
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
                           // for the last line the line orientation is always
                           // the default, since it was just constructed that way
@@ -11038,8 +11035,8 @@ namespace internal
                                 Assert(lines[i]->vertex_index(i % 2) ==
                                          vertex_indices[i / 4],
                                        ExcInternalError());
-                                line_orientation[i] = ReferenceCell::
-                                  reversed_combined_line_orientation();
+                                line_orientation[i] =
+                                  numbers::reverse_line_orientation;
                               }
                           // for the last 6 lines the line orientation is
                           // always true, since they were just constructed
index a6f8798b6e920aa91002935d68ce4e183a800dcb..22e58c02fe7fb0d24ff68b31b30983035d91c742 100644 (file)
@@ -195,12 +195,11 @@ print_matching(DoFHandler<dim, spacedim> &dof_handler)
     deallog << dofs_2[i] << " is located at " << support_points[dofs_2[i]]
             << std::endl;
 
-  DoFTools::make_periodicity_constraints(
-    face_1,
-    face_2,
-    constraint_matrix,
-    ComponentMask(),
-    ReferenceCell::reversed_combined_line_orientation());
+  DoFTools::make_periodicity_constraints(face_1,
+                                         face_2,
+                                         constraint_matrix,
+                                         ComponentMask(),
+                                         numbers::reverse_line_orientation);
   constraint_matrix.print(deallog.get_file_stream());
   constraint_matrix.close();
   deallog << "Matching:" << std::endl;
index 0280a5b65c24ccd16c62cf54cf8b116f344edf7a..e6ac2f4060c328745d97712eef7b4bc28d95c647 100644 (file)
@@ -229,12 +229,11 @@ print_matching(DoFHandler<dim, spacedim> &dof_handler)
     deallog << dofs_2[i] << " is located at " << support_points[dofs_2[i]]
             << std::endl;
 
-  DoFTools::make_periodicity_constraints(
-    face_1,
-    face_2,
-    constraint_matrix,
-    ComponentMask(),
-    ReferenceCell::reversed_combined_line_orientation());
+  DoFTools::make_periodicity_constraints(face_1,
+                                         face_2,
+                                         constraint_matrix,
+                                         ComponentMask(),
+                                         numbers::reverse_line_orientation);
   constraint_matrix.print(deallog.get_file_stream());
   constraint_matrix.close();
   deallog << "Matching:" << std::endl;
index ff4f4c2d84769d850160e7fb65d723f169e98249..fae603c31db0076c560b57aaf5e210251e714096 100644 (file)
@@ -161,8 +161,7 @@ test()
               p1.first  = cell->line(l)->vertex_index(0);
               p1.second = cell->line(l)->vertex_index(1);
 
-              if (orientation_exp ==
-                  ReferenceCell::reversed_combined_line_orientation())
+              if (orientation_exp == numbers::reverse_line_orientation)
                 std::swap(p1.first, p1.second);
 
               success &= (p0 == p1);

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.