]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use types::geometric_orientation for lines.
authorDavid Wells <drwells@email.unc.edu>
Sat, 4 Jan 2025 22:27:31 +0000 (17:27 -0500)
committerDavid Wells <drwells@email.unc.edu>
Wed, 22 Jan 2025 18:25:54 +0000 (13:25 -0500)
14 files changed:
include/deal.II/dofs/dof_accessor.h
include/deal.II/grid/reference_cell.h
include/deal.II/grid/tria_accessor.h
include/deal.II/numerics/vector_tools_boundary.templates.h
source/fe/fe_poly_tensor.cc
source/grid/tria.cc
tests/fe/fe_conformity_test.h
tests/grid/extrude_orientation_01.cc
tests/grid/extrude_orientation_02.cc
tests/grid/extrude_orientation_03.cc
tests/grid/grid_generator_10.cc
tests/grid/grid_generator_non_standard_orientation_mesh_2d.cc
tests/grid/grid_generator_non_standard_orientation_mesh_3d.cc
tests/simplex/orientation_04.cc

index 1584668420168f78df93267c1ad5bf8ebebd5b80..decc6960679742e010d3629e229d670f9dac8d6f 100644 (file)
@@ -3168,8 +3168,9 @@ namespace internal
 
             for (const auto line : accessor.line_indices())
               {
-                const bool line_orientation = line_orientations[line];
-                if (line_orientation)
+                const auto line_orientation = line_orientations[line];
+                if (line_orientation ==
+                    ReferenceCell::default_combined_face_orientation())
                   dof_operation.process_dofs(
                     accessor.get_dof_handler(),
                     0,
index f4220363f1566cdecdbc28bcc87718ae00fa1e86..b080d14446c08dce613a44d5ea4453d1fe152889 100644 (file)
@@ -439,10 +439,6 @@ public:
    * lines only have two possible orientations, this function and
    * ReferenceCell::default_combined_face_orientation() encode all of its
    * possible orientation states.
-   *
-   * @note Line orientations are typically stored as booleans, but to better
-   * enable dimension-independent programming relevant functions typically
-   * present these values as the standard orientation type.
    */
   static constexpr types::geometric_orientation
   reversed_combined_line_orientation();
@@ -594,21 +590,16 @@ public:
     const types::geometric_orientation face_orientation) const;
 
   /**
-   * 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 flag
-   * for the line within that face. @p true indicates that the line is
-   * oriented from vertex 0 to vertex 1, whereas it is the other way
-   * around otherwise. In 1d and 2d, this is always @p true, but in 3d
-   * it may be different, see the respective discussion in the
-   * documentation of the GeometryInfo class.
+   * 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.
    */
-  bool
+  types::geometric_orientation
   standard_vs_true_line_orientation(
     const unsigned int                 line,
     const unsigned int                 face,
     const types::geometric_orientation face_orientation,
-    const bool                         line_orientation) const;
+    const types::geometric_orientation line_orientation) const;
 
   /**
    * @}
@@ -3227,21 +3218,26 @@ ReferenceCell::n_face_orientations(const unsigned int face_no) const
 
 
 
-inline bool
+inline types::geometric_orientation
 ReferenceCell::standard_vs_true_line_orientation(
   const unsigned int                 line,
   const unsigned int                 face,
   const types::geometric_orientation combined_face_orientation,
-  const bool                         line_orientation) const
+  const types::geometric_orientation line_orientation) const
 {
+  constexpr auto D = ReferenceCell::default_combined_face_orientation();
+  constexpr auto R = ReferenceCell::reversed_combined_line_orientation();
   if (*this == ReferenceCells::Hexahedron)
     {
-      static constexpr dealii::ndarray<bool, 2, 8> bool_table{
-        {{{true, true, false, true, false, false, true, false}},
-         {{true, true, true, false, false, false, false, true}}}};
-
-      return (line_orientation ==
-              bool_table[line / 2][combined_face_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.
+      const bool match =
+        line_orientation == table[line / 2][combined_face_orientation];
+
+      return match ? ReferenceCell::default_combined_face_orientation() :
+                     ReferenceCell::reversed_combined_line_orientation();
     }
   else if (*this == ReferenceCells::Tetrahedron)
     {
@@ -3256,17 +3252,19 @@ ReferenceCell::standard_vs_true_line_orientation(
                "This function can only be called for following face-line "
                "combinations: (0,0), (0,1), (0,2), (1,1), (1,2), (2,1),"));
 
-      static constexpr dealii::ndarray<bool, 2, 6> bool_table{
-        {{{false, true, false, true, false, true}},
-         {{true, false, true, false, true, false}}}};
+      static constexpr dealii::ndarray<types::geometric_orientation, 2, 6>
+        table{{{{R, D, R, D, R, D}}, {{D, R, D, R, D, R}}}};
+
+      const bool match =
+        line_orientation == table[combined_line][combined_face_orientation];
 
-      return (line_orientation ==
-              bool_table[combined_line][combined_face_orientation]);
+      return match ? ReferenceCell::default_combined_face_orientation() :
+                     ReferenceCell::reversed_combined_line_orientation();
     }
   else
     // TODO: This might actually be wrong for some of the other
     // kinds of objects. We should check this
-    return true;
+    return ReferenceCell::default_combined_face_orientation();
 }
 
 
index ce1fa600df0ef1a4fa21bac30ff3b2eaf9bf6530..c08276b7175bdb0bbc18c3ea2a4a51028fe35fcc 100644 (file)
@@ -999,17 +999,14 @@ public:
 
   /**
    * Return whether the line with index @p line is oriented in standard
-   * direction. @p true indicates, that the line is oriented from vertex 0 to
-   * vertex 1, whereas it is the other way around otherwise. In 1d and 2d,
-   * this is always @p true, but in 3d it may be different, see the respective
-   * discussion in the documentation of the GeometryInfo class.
+   * direction.
    *
-   * This function is really only for internal use in the library unless you
-   * absolutely know what this is all about.
+   * @warning This function is really only for internal use in the library
+   * unless you absolutely know what this is all about.
    *
-   * This function queries ReferenceCell::standard_vs_true_line_orientation().
+   * @note This function queries ReferenceCell::standard_vs_true_line_orientation().
    */
-  bool
+  types::geometric_orientation
   line_orientation(const unsigned int line) const;
   /**
    * @}
@@ -1813,7 +1810,8 @@ private:
    * <code>structdim==2 && dim==3</code>).
    */
   void
-  set_line_orientation(const unsigned int line, const bool orientation) const;
+  set_line_orientation(const unsigned int                 line,
+                       const types::geometric_orientation orientation) const;
 
   /**
    * Set the combined face orientation (i.e., the integer that uniquely encodes
@@ -2171,9 +2169,9 @@ public:
   face_rotation(const unsigned int face);
 
   /**
-   * @brief Always return false
+   * @brief Always return ReferenceCell::reversed_combined_line_orientation()
    */
-  static bool
+  static types::geometric_orientation
   line_orientation(const unsigned int line);
 
   /**
@@ -2840,9 +2838,9 @@ public:
   face_rotation(const unsigned int face);
 
   /**
-   * @brief Always return false
+   * @brief Always return ReferenceCell::reversed_combined_line_orientation()
    */
-  static bool
+  static types::geometric_orientation
   line_orientation(const unsigned int line);
 
   /**
@@ -5068,10 +5066,7 @@ namespace internal
         // efficient
         std::array<types::geometric_orientation, 4> line_orientations = {};
         for (const unsigned int line : cell.line_indices())
-          line_orientations[line] =
-            cell.line_orientation(line) == true ?
-              ReferenceCell::default_combined_face_orientation() :
-              ReferenceCell::reversed_combined_line_orientation();
+          line_orientations[line] = cell.line_orientation(line);
         return line_orientations;
       }
 
@@ -5112,19 +5107,28 @@ namespace internal
                    ref_cell.standard_to_real_face_line(1, f, orientation),
                    ref_cell.standard_to_real_face_line(2, f, orientation),
                    ref_cell.standard_to_real_face_line(3, f, orientation)}};
-                const auto                quad = cell.quad(f);
-                const std::array<bool, 4> my_orientations{
-                  {ref_cell.standard_vs_true_line_orientation(
-                     0, f, orientation, quad->line_orientation(my_indices[0])),
-                   ref_cell.standard_vs_true_line_orientation(
-                     1, f, orientation, quad->line_orientation(my_indices[1])),
-                   ref_cell.standard_vs_true_line_orientation(
-                     2, f, orientation, quad->line_orientation(my_indices[2])),
-                   ref_cell.standard_vs_true_line_orientation(
-                     3,
-                     f,
-                     orientation,
-                     quad->line_orientation(my_indices[3]))}};
+                const auto quad = cell.quad(f);
+                const std::array<types::geometric_orientation, 4>
+                  my_orientations{{ref_cell.standard_vs_true_line_orientation(
+                                     0,
+                                     f,
+                                     orientation,
+                                     quad->line_orientation(my_indices[0])),
+                                   ref_cell.standard_vs_true_line_orientation(
+                                     1,
+                                     f,
+                                     orientation,
+                                     quad->line_orientation(my_indices[1])),
+                                   ref_cell.standard_vs_true_line_orientation(
+                                     2,
+                                     f,
+                                     orientation,
+                                     quad->line_orientation(my_indices[2])),
+                                   ref_cell.standard_vs_true_line_orientation(
+                                     3,
+                                     f,
+                                     orientation,
+                                     quad->line_orientation(my_indices[3]))}};
                 for (unsigned int l = 0; l < 4; ++l)
                   line_orientations[4 * (f - 4) + l] = my_orientations[l];
               }
@@ -5138,15 +5142,18 @@ namespace internal
                 const std::array<unsigned int, 2> my_indices{
                   {ref_cell.standard_to_real_face_line(0, f, orientation),
                    ref_cell.standard_to_real_face_line(1, f, orientation)}};
-                const auto                quad = cell.quad(f);
-                const std::array<bool, 2> my_orientations{
-                  {ref_cell.standard_vs_true_line_orientation(
-                     0, f, orientation, quad->line_orientation(my_indices[0])),
-                   ref_cell.standard_vs_true_line_orientation(
-                     1,
-                     f,
-                     orientation,
-                     quad->line_orientation(my_indices[1]))}};
+                const auto quad = cell.quad(f);
+                const std::array<types::geometric_orientation, 2>
+                  my_orientations{{ref_cell.standard_vs_true_line_orientation(
+                                     0,
+                                     f,
+                                     orientation,
+                                     quad->line_orientation(my_indices[0])),
+                                   ref_cell.standard_vs_true_line_orientation(
+                                     1,
+                                     f,
+                                     orientation,
+                                     quad->line_orientation(my_indices[1]))}};
                 line_orientations[8 + f]  = my_orientations[0];
                 line_orientations[10 + f] = my_orientations[1];
               }
@@ -5297,11 +5304,7 @@ TriaAccessor<structdim, dim, spacedim>::vertex_index(
         this->reference_cell().standard_vertex_to_face_and_vertex_index(corner);
       const auto vertex_within_line_index =
         this->reference_cell().standard_to_real_face_vertex(
-          vertex_index,
-          line_index,
-          this->line_orientation(line_index) == true ?
-            ReferenceCell::default_combined_face_orientation() :
-            ReferenceCell::reversed_combined_line_orientation());
+          vertex_index, line_index, this->line_orientation(line_index));
 
       return this->line(line_index)->vertex_index(vertex_within_line_index);
     }
@@ -5457,7 +5460,8 @@ TriaAccessor<structdim, dim, spacedim>::face_orientation(
     // in 1d 'faces' are vertices and those are always consistently oriented
     return true;
   else if constexpr (structdim == 2)
-    return this->line_orientation(face);
+    return this->line_orientation(face) ==
+           ReferenceCell::default_combined_face_orientation();
   else
     return this->tria->levels[this->present_level]
       ->face_orientations.get_orientation(
@@ -5516,7 +5520,7 @@ TriaAccessor<structdim, dim, spacedim>::face_rotation(
 
 
 template <int structdim, int dim, int spacedim>
-inline bool
+inline types::geometric_orientation
 TriaAccessor<structdim, dim, spacedim>::line_orientation(
   const unsigned int line) const
 {
@@ -5526,7 +5530,7 @@ TriaAccessor<structdim, dim, spacedim>::line_orientation(
   (void)line;
 
   if constexpr (structdim == 1)
-    return true;
+    return ReferenceCell::default_combined_face_orientation();
   else if constexpr (structdim == 2 && dim == 2)
     // lines in 2d are faces
     {
@@ -5536,19 +5540,20 @@ TriaAccessor<structdim, dim, spacedim>::line_orientation(
                combined_orientation ==
                  ReferenceCell::reversed_combined_line_orientation(),
              ExcInternalError());
-      return combined_orientation ==
-                 ReferenceCell::default_combined_face_orientation() ?
-               true :
-               false;
+      return combined_orientation;
     }
   else if constexpr (structdim == 2 && dim == 3)
     {
-      // line orientations in 3d are stored in their own array
-      Assert(this->present_index * ReferenceCells::max_n_lines<2>() + line <
-               this->tria->faces->quads_line_orientations.size(),
+      // line orientations in 3d are stored in their own array as bools: here
+      // 'true' is the default orientation and 'false' is the reversed one
+      // (which matches set_line_orientation())
+      const auto index =
+        this->present_index * ReferenceCells::max_n_lines<2>() + line;
+      Assert(index < this->tria->faces->quads_line_orientations.size(),
              ExcInternalError());
-      return this->tria->faces->quads_line_orientations
-        [this->present_index * ReferenceCells::max_n_lines<2>() + line];
+      return this->tria->faces->quads_line_orientations[index] ?
+               ReferenceCell::default_combined_face_orientation() :
+               ReferenceCell::reversed_combined_line_orientation();
     }
   else if constexpr (structdim == 3 && dim == 3)
     {
@@ -5580,8 +5585,8 @@ TriaAccessor<structdim, dim, spacedim>::line_orientation(
 template <int structdim, int dim, int spacedim>
 inline void
 TriaAccessor<structdim, dim, spacedim>::set_line_orientation(
-  const unsigned int line,
-  const bool         value) const
+  const unsigned int                 line,
+  const types::geometric_orientation value) const
 {
   Assert(used(), TriaAccessorExceptions::ExcCellNotUsed());
   AssertIndexRange(line, this->n_lines());
@@ -5600,13 +5605,14 @@ TriaAccessor<structdim, dim, spacedim>::set_line_orientation(
   if constexpr (dim == 3)
     {
       // We set line orientations per face, not per cell, so this only works for
-      // faces in 3d
+      // faces in 3d.
       Assert(structdim == 2, ExcNotImplemented());
-      Assert(this->present_index * ReferenceCells::max_n_lines<2>() + line <
-               this->tria->faces->quads_line_orientations.size(),
+      const auto index =
+        this->present_index * ReferenceCells::max_n_lines<2>() + line;
+      Assert(index < this->tria->faces->quads_line_orientations.size(),
              ExcInternalError());
-      this->tria->faces->quads_line_orientations
-        [this->present_index * ReferenceCells::max_n_lines<2>() + line] = value;
+      this->tria->faces->quads_line_orientations[index] =
+        value == ReferenceCell::default_combined_face_orientation();
     }
 }
 
@@ -6905,10 +6911,10 @@ TriaAccessor<0, dim, spacedim>::face_rotation(const unsigned int /*face*/)
 
 
 template <int dim, int spacedim>
-inline bool
+inline types::geometric_orientation
 TriaAccessor<0, dim, spacedim>::line_orientation(const unsigned int /*line*/)
 {
-  return false;
+  return ReferenceCell::reversed_combined_line_orientation();
 }
 
 
@@ -7353,10 +7359,10 @@ TriaAccessor<0, 1, spacedim>::face_rotation(const unsigned int /*face*/)
 
 
 template <int spacedim>
-inline bool
+inline types::geometric_orientation
 TriaAccessor<0, 1, spacedim>::line_orientation(const unsigned int /*line*/)
 {
-  return false;
+  return ReferenceCell::reversed_combined_line_orientation();
 }
 
 
index d1b5dd86edbef64ef42944a9a35d436b901b9627..26f248aada0844730a98084e6705f4d5ec527e9d 100644 (file)
@@ -1122,14 +1122,14 @@ namespace VectorTools
             GeometryInfo<dim>::vertices_per_face * fe.n_dofs_per_vertex() +
             line * fe.n_dofs_per_line() + line_dof_idx;
 
-          // Note, assuming that the edge orientations are "standard"
-          //       i.e. cell->line_orientation(line) = true.
-          Assert(cell->line_orientation(line),
+          // Note, assuming that the edge orientations are "standard", i.e.,
+          //       cell->line_orientation(line) =
+          //       ReferenceCell::default_combined_face_orientation()
+          Assert(cell->line_orientation(line) ==
+                   ReferenceCell::default_combined_face_orientation(),
                  ExcMessage("Edge orientation does not meet expectation."));
           // Next, translate from face to cell. Note, this might be assuming
-          // that the edge orientations are "standard" (not sure any more at
-          // this time), i.e.
-          //       cell->line_orientation(line) = true.
+          // that the edge orientations are "standard"
           const unsigned int cell_dof_idx =
             fe.face_to_cell_index(face_dof_idx, face);
 
@@ -1558,9 +1558,7 @@ namespace VectorTools
                         line * fe.n_dofs_per_line() + line_dof_idx;
 
                       // Next, translate from face to cell. Note, this might be
-                      // assuming that the edge orientations are "standard" (not
-                      // sure any more at this time), i.e.
-                      //       cell->line_orientation(line) = true.
+                      // assuming that the edge orientations are "standard"
                       const unsigned int cell_dof_idx =
                         fe.face_to_cell_index(face_dof_idx, face);
 
index 476517aa6296a2982dd40494d1684ed418b9917b..846e87be37592071f81fccef6fc0fd5578d6242f 100644 (file)
@@ -147,7 +147,8 @@ namespace internal
         const unsigned int dim = 2;
         // TODO: This fixes only lowest order
         for (unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
-          if (!(cell->line_orientation(l)) &&
+          if ((cell->line_orientation(l) ==
+               ReferenceCell::reversed_combined_line_orientation()) &&
               mapping_kind[0] == mapping_nedelec)
             line_dof_sign[l] = -1.0;
       }
@@ -165,7 +166,8 @@ namespace internal
         // TODO: This is probably only going to work for those elements for
         // which all dofs are face dofs
         for (unsigned int l = 0; l < GeometryInfo<dim>::lines_per_cell; ++l)
-          if (!(cell->line_orientation(l)) &&
+          if ((cell->line_orientation(l) ==
+               ReferenceCell::reversed_combined_line_orientation()) &&
               mapping_kind[0] == mapping_nedelec)
             line_dof_sign[l] = -1.0;
       }
index 9b930baed3d76eb282b981caf71ecc804ceebd0b..64e5390fc8a446c3e1f915d86f7f030e81b0a9ad 100644 (file)
@@ -3314,6 +3314,9 @@ namespace internal
                         combined_orientation ==
                           ReferenceCell::reversed_combined_line_orientation(),
                       ExcInternalError());
+                    // Same convention as TriaAccessor::set_line_orientation():
+                    // store true for the default orientation and false for
+                    // reversed.
                     faces.quads_line_orientations
                       [q * ReferenceCells::max_n_lines<2>() + j] =
                       combined_orientation ==
@@ -4304,11 +4307,12 @@ namespace internal
                                   switch_1->line_index(2)),
                                 static_cast<signed int>(
                                   switch_1->line_index(3))};
-                              const bool switch_1_line_orientations[4] = {
-                                switch_1->line_orientation(0),
-                                switch_1->line_orientation(1),
-                                switch_1->line_orientation(2),
-                                switch_1->line_orientation(3)};
+                              const types::geometric_orientation
+                                switch_1_line_orientations[4] = {
+                                  switch_1->line_orientation(0),
+                                  switch_1->line_orientation(1),
+                                  switch_1->line_orientation(2),
+                                  switch_1->line_orientation(3)};
                               const types::boundary_id switch_1_boundary_id =
                                 switch_1->boundary_id();
                               const unsigned int switch_1_user_index =
@@ -6449,11 +6453,7 @@ namespace internal
                             s.insert(i);
 #endif
 
-                          new_quad->set_line_orientation(
-                            f,
-                            orientation ==
-                              ReferenceCell::
-                                default_combined_face_orientation());
+                          new_quad->set_line_orientation(f, orientation);
                         }
 #ifdef DEBUG
                       AssertDimension(s.size(), 3);
@@ -6567,7 +6567,8 @@ namespace internal
                       numbers::internal_face_boundary_id);
                     new_quad->set_manifold_id(hex->manifold_id());
                     for (const auto j : new_quads[i]->line_indices())
-                      new_quad->set_line_orientation(j, true);
+                      new_quad->set_line_orientation(
+                        j, ReferenceCell::default_combined_face_orientation());
                   }
 
                 // we always get 8 children per refined cell
@@ -6912,11 +6913,7 @@ namespace internal
                                 make_array_view(vertices_0),
                                 make_array_view(vertices_1));
 
-                            new_quad->set_line_orientation(
-                              l,
-                              orientation ==
-                                ReferenceCell::
-                                  default_combined_face_orientation());
+                            new_quad->set_line_orientation(l, orientation);
 
                             // on a hex, inject the status of the current line
                             // also to the line on the other quad along the
@@ -6925,11 +6922,7 @@ namespace internal
                                 ReferenceCells::Hexahedron)
                               new_quads[representative_lines[q % 4][1] + q -
                                         (q % 4)]
-                                ->set_line_orientation(
-                                  l,
-                                  orientation ==
-                                    ReferenceCell::
-                                      default_combined_face_orientation());
+                                ->set_line_orientation(l, orientation);
                           }
                       }
                   }
@@ -7726,7 +7719,9 @@ namespace internal
                         for (unsigned int j = 0;
                              j < GeometryInfo<dim>::lines_per_face;
                              ++j)
-                          new_quad->set_line_orientation(j, true);
+                          new_quad->set_line_orientation(
+                            j,
+                            ReferenceCell::default_combined_face_orientation());
                       }
                     // now set the line orientation of children of
                     // outer lines correctly, the lines in the
@@ -7949,11 +7944,12 @@ namespace internal
                               switch_1->line_index(1),
                               switch_1->line_index(2),
                               switch_1->line_index(3)};
-                            const bool switch_1_line_orientations[4] = {
-                              switch_1->line_orientation(0),
-                              switch_1->line_orientation(1),
-                              switch_1->line_orientation(2),
-                              switch_1->line_orientation(3)};
+                            const types::geometric_orientation
+                              switch_1_line_orientations[4] = {
+                                switch_1->line_orientation(0),
+                                switch_1->line_orientation(1),
+                                switch_1->line_orientation(2),
+                                switch_1->line_orientation(3)};
                             const types::boundary_id switch_1_boundary_id =
                               switch_1->boundary_id();
                             const unsigned int switch_1_user_index =
@@ -8399,7 +8395,9 @@ namespace internal
                         for (unsigned int j = 0;
                              j < GeometryInfo<dim>::lines_per_face;
                              ++j)
-                          new_quad->set_line_orientation(j, true);
+                          new_quad->set_line_orientation(
+                            j,
+                            ReferenceCell::default_combined_face_orientation());
                       }
                     // now set the line orientation of children of
                     // outer lines correctly, the lines in the
@@ -8550,7 +8548,9 @@ namespace internal
                       for (unsigned int j = 0;
                            j < GeometryInfo<dim>::lines_per_face;
                            ++j)
-                        new_quads[i]->set_line_orientation(j, true);
+                        new_quads[i]->set_line_orientation(
+                          j,
+                          ReferenceCell::default_combined_face_orientation());
                     }
 
                   types::subdomain_id subdomainid = hex->subdomain_id();
@@ -8769,7 +8769,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[4];
+                          types::geometric_orientation line_orientation[4]{};
 
                           // the middle vertex marked as m0 above is the
                           // start vertex for lines 0 and 2 in standard
@@ -8782,15 +8782,16 @@ namespace internal
                           for (unsigned int i = 0; i < 4; ++i)
                             if (lines[i]->vertex_index(i % 2) ==
                                 middle_vertices[i % 2])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
-                                // it must be the other
-                                // way round then
+                                // it must be the other way round then
                                 Assert(lines[i]->vertex_index((i + 1) % 2) ==
                                          middle_vertices[i % 2],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
 
                           // set up the new quad, line numbering is as
@@ -8996,7 +8997,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[4];
+                          types::geometric_orientation line_orientation[4]{};
 
                           // the middle vertex marked as m0 above is the
                           // start vertex for lines 0 and 2 in standard
@@ -9009,14 +9010,16 @@ namespace internal
                           for (unsigned int i = 0; i < 4; ++i)
                             if (lines[i]->vertex_index(i % 2) ==
                                 middle_vertices[i % 2])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way round then
                                 Assert(lines[i]->vertex_index((i + 1) % 2) ==
                                          middle_vertices[i % 2],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
 
                           // set up the new quad, line numbering is as
@@ -9224,7 +9227,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[4];
+                          types::geometric_orientation line_orientation[4]{};
 
                           // the middle vertex marked as m0 above is the
                           // start vertex for lines 0 and 2 in standard
@@ -9237,14 +9240,16 @@ namespace internal
                           for (unsigned int i = 0; i < 4; ++i)
                             if (lines[i]->vertex_index(i % 2) ==
                                 middle_vertices[i % 2])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way round then
                                 Assert(lines[i]->vertex_index((i + 1) % 2) ==
                                          middle_vertices[i % 2],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
 
                           // set up the new quad, line numbering is as
@@ -9537,7 +9542,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[13];
+                          types::geometric_orientation line_orientation[13]{};
 
                           // the middle vertices of the lines of our
                           // bottom face
@@ -9553,14 +9558,16 @@ namespace internal
                           // face
                           for (unsigned int i = 0; i < 4; ++i)
                             if (lines[i]->vertex_index(0) == middle_vertices[i])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way round then
                                 Assert(lines[i]->vertex_index(1) ==
                                          middle_vertices[i],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
 
                           // note: for lines 4 to 11 (inner lines of the
@@ -9573,21 +9580,23 @@ namespace internal
                             if (lines[i]->vertex_index((i + 1) % 2) ==
                                 middle_vertex_index<dim, spacedim>(
                                   hex->face(3 + i / 4)))
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
-                                // it must be the other way
-                                // round then
+                                // it must be the other way round then
                                 Assert(lines[i]->vertex_index(i % 2) ==
                                          (middle_vertex_index<dim, spacedim>(
                                            hex->face(3 + i / 4))),
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
                           // for the last line the line orientation is
                           // always true, since it was just constructed
                           // that way
-                          line_orientation[12] = true;
+                          line_orientation[12] =
+                            ReferenceCell::default_combined_face_orientation();
 
                           // set up the 4 quads, numbered as follows (left
                           // quad numbering, right line numbering
@@ -9971,7 +9980,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[13];
+                          types::geometric_orientation line_orientation[13]{};
 
                           // the middle vertices of the
                           // lines of our front face
@@ -9986,14 +9995,16 @@ namespace internal
                           // line is 'true', if vertex 0 is on the front
                           for (unsigned int i = 0; i < 4; ++i)
                             if (lines[i]->vertex_index(0) == middle_vertices[i])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way round then
                                 Assert(lines[i]->vertex_index(1) ==
                                          middle_vertices[i],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
 
                           // note: for lines 4 to 11 (inner lines of the
@@ -10006,7 +10017,8 @@ namespace internal
                             if (lines[i]->vertex_index((i + 1) % 2) ==
                                 middle_vertex_index<dim, spacedim>(
                                   hex->face(1 + i / 4)))
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way
@@ -10015,12 +10027,14 @@ namespace internal
                                          (middle_vertex_index<dim, spacedim>(
                                            hex->face(1 + i / 4))),
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
                           // for the last line the line orientation is
                           // always true, since it was just constructed
                           // that way
-                          line_orientation[12] = true;
+                          line_orientation[12] =
+                            ReferenceCell::default_combined_face_orientation();
 
                           // set up the 4 quads, numbered as follows (left
                           // quad numbering, right line numbering
@@ -10419,7 +10433,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[13];
+                          types::geometric_orientation line_orientation[13]{};
 
                           // the middle vertices of the lines of our front
                           // face
@@ -10434,14 +10448,16 @@ namespace internal
                           // line is 'true', if vertex 0 is on the front
                           for (unsigned int i = 0; i < 4; ++i)
                             if (lines[i]->vertex_index(0) == middle_vertices[i])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way round then
                                 Assert(lines[i]->vertex_index(1) ==
                                          middle_vertices[i],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
 
                           // note: for lines 4 to 11 (inner lines of the
@@ -10454,21 +10470,22 @@ namespace internal
                             if (lines[i]->vertex_index((i + 1) % 2) ==
                                 middle_vertex_index<dim, spacedim>(
                                   hex->face(i / 4 - 1)))
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
-                                // it must be the other way
-                                // round then
+                                // it must be the other way round then
                                 Assert(lines[i]->vertex_index(i % 2) ==
                                          (middle_vertex_index<dim, spacedim>(
                                            hex->face(i / 4 - 1))),
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
-                          // for the last line the line orientation is
-                          // always true, since it was just constructed
-                          // that way
-                          line_orientation[12] = true;
+                          // for the last line the line orientation is always
+                          // the default, since it was just constructed that way
+                          line_orientation[12] =
+                            ReferenceCell::default_combined_face_orientation();
 
                           // set up the 4 quads, numbered as follows (left
                           // quad numbering, right line numbering
@@ -11009,7 +11026,7 @@ namespace internal
                           // created ones and thus have no parents, they
                           // cannot inherit this property. set up an array
                           // and fill it with the respective values
-                          bool line_orientation[30];
+                          types::geometric_orientation line_orientation[30]{};
 
                           // note: for the first 24 lines (inner lines of
                           // the outer quads) the following holds: the
@@ -11020,7 +11037,8 @@ namespace internal
                           for (unsigned int i = 0; i < 24; ++i)
                             if (lines[i]->vertex_index((i + 1) % 2) ==
                                 vertex_indices[i / 4])
-                              line_orientation[i] = true;
+                              line_orientation[i] = ReferenceCell::
+                                default_combined_face_orientation();
                             else
                               {
                                 // it must be the other way
@@ -11028,13 +11046,15 @@ namespace internal
                                 Assert(lines[i]->vertex_index(i % 2) ==
                                          vertex_indices[i / 4],
                                        ExcInternalError());
-                                line_orientation[i] = false;
+                                line_orientation[i] = ReferenceCell::
+                                  reversed_combined_line_orientation();
                               }
                           // for the last 6 lines the line orientation is
                           // always true, since they were just constructed
                           // that way
                           for (unsigned int i = 24; i < 30; ++i)
-                            line_orientation[i] = true;
+                            line_orientation[i] = ReferenceCell::
+                              default_combined_face_orientation();
 
                           // set up the 12 quads, numbered as follows
                           // (left quad numbering, right line numbering
@@ -15971,10 +15991,10 @@ void Triangulation<dim, spacedim>::reset_cell_vertex_indices_cache()
           if (ref_cell == ReferenceCells::Hexahedron)
             for (unsigned int face = 4; face < 6; ++face)
               {
-                const auto                face_iter = cell->face(face);
-                const std::array<bool, 2> line_orientations{
-                  {face_iter->line_orientation(0),
-                   face_iter->line_orientation(1)}};
+                const auto face_iter = cell->face(face);
+                const std::array<types::geometric_orientation, 2>
+                  line_orientations{{face_iter->line_orientation(0),
+                                     face_iter->line_orientation(1)}};
                 std::array<unsigned int, 4> raw_vertex_indices{
                   {face_iter->line(0)->vertex_index(1 - line_orientations[0]),
                    face_iter->line(1)->vertex_index(1 - line_orientations[1]),
@@ -16003,8 +16023,9 @@ void Triangulation<dim, spacedim>::reset_cell_vertex_indices_cache()
               }
           else if (ref_cell == ReferenceCells::Quadrilateral)
             {
-              const std::array<bool, 2> line_orientations{
-                {cell->line_orientation(0), cell->line_orientation(1)}};
+              const std::array<types::geometric_orientation, 2>
+                line_orientations{
+                  {cell->line_orientation(0), cell->line_orientation(1)}};
               std::array<unsigned int, 4> raw_vertex_indices{
                 {cell->line(0)->vertex_index(1 - line_orientations[0]),
                  cell->line(1)->vertex_index(1 - line_orientations[1]),
index 9859c9027b215ba075911b7dfac59bdec7067aa6..df239860cdd173ab674d1b38b26fb4f31f47bc6c 100644 (file)
@@ -191,8 +191,9 @@ namespace FEConforimityTest
                  ++line_index)
               {
                 deallog << "      {" << line_index << " -> "
-                        << cell->line_orientation(line_index) << "}"
-                        << std::endl;
+                        << (cell->line_orientation(line_index) ==
+                            ReferenceCell::default_combined_face_orientation())
+                        << "}" << std::endl;
               } // line_index
           }     // cell
       }         // plot_mesh_properties
@@ -243,8 +244,9 @@ namespace FEConforimityTest
                  ++line_index)
               {
                 deallog << "      {" << line_index << " -> "
-                        << cell->line_orientation(line_index) << "}"
-                        << std::endl;
+                        << (cell->line_orientation(line_index) ==
+                            ReferenceCell::default_combined_face_orientation())
+                        << "}" << std::endl;
               } // line_index
           }     // cell
       }         // plot_mesh_properties
index 903a6e3159591fae18e6b9385b46ae88ec08cd7c..45f6748fe9b44b74fbc9edd0972dc1df40267b6c 100644 (file)
@@ -68,7 +68,10 @@ test(std::ostream &out)
                 << (c->face_flip(f) ? "/true" : "/false") << std::endl;
       for (unsigned int e = 0; e < GeometryInfo<3>::lines_per_cell; ++e)
         deallog << "    edge=" << e
-                << (c->line_orientation(e) ? " -> true" : " -> false")
+                << (c->line_orientation(e) ==
+                        ReferenceCell::default_combined_face_orientation() ?
+                      " -> true" :
+                      " -> false")
                 << std::endl;
     }
 }
index c02814650bf1302abab8d9dce6cd4d314b0559da..571f5cc87812249712e78cc29db1b0b531646600 100644 (file)
@@ -61,7 +61,10 @@ test()
                 << (c->face_flip(f) ? "/true" : "/false") << std::endl;
       for (unsigned int e = 0; e < GeometryInfo<3>::lines_per_cell; ++e)
         deallog << "    edge=" << e
-                << (c->line_orientation(e) ? " -> true" : " -> false")
+                << (c->line_orientation(e) ==
+                        ReferenceCell::default_combined_face_orientation() ?
+                      " -> true" :
+                      " -> false")
                 << std::endl;
     }
 }
index 6cff3332987646595769f0d81a0202a7e251fbe9..48b2dd8ed2de287ee5d59bde1a77ccf538429aa2 100644 (file)
@@ -60,7 +60,10 @@ test()
                 << (c->face_flip(f) ? "/true" : "/false") << std::endl;
       for (unsigned int e = 0; e < GeometryInfo<3>::lines_per_cell; ++e)
         deallog << "    edge=" << e
-                << (c->line_orientation(e) ? " -> true" : " -> false")
+                << (c->line_orientation(e) ==
+                        ReferenceCell::default_combined_face_orientation() ?
+                      " -> true" :
+                      " -> false")
                 << std::endl;
     }
 }
index 70d1072abb5221f5f81250f166af0d5743b8a72c..16f776486fceffba50174de7948e876a32fd3e26 100644 (file)
@@ -107,9 +107,14 @@ check_grid()
            ++line)
         {
           deallog << line << ": "
-                  << (cell->line_orientation(line) ? "true" : "false")
+                  << (cell->line_orientation(line) ==
+                          ReferenceCell::default_combined_face_orientation() ?
+                        "true" :
+                        "false")
                   << std::endl;
-          Assert(cell->line_orientation(line) == true, ExcInternalError());
+          Assert(cell->line_orientation(line) ==
+                   ReferenceCell::default_combined_face_orientation(),
+                 ExcInternalError());
         }
     }
 }
index 2d64faed2c52209564c7cf0c43a6f1b4483bbd9c..07b0c71f8fda43d2ff6faf65be65ff5938414ccb 100644 (file)
@@ -55,7 +55,9 @@ plot_all_info(const Triangulation<dim> &tria)
            line_index < GeometryInfo<dim>::lines_per_cell;
            ++line_index)
         {
-          deallog << cell->line_orientation(line_index) << "  ";
+          deallog << (cell->line_orientation(line_index) ==
+                      ReferenceCell::default_combined_face_orientation())
+                  << "  ";
         } // line_index
       deallog << '}' << std::endl << std::endl;
     } // cell
index 87b2ef5e31763c3bffce1668800dcb247494e2ed..d8d87fb994ff20738406acecd6e4e899e369eea0 100644 (file)
@@ -56,7 +56,9 @@ plot_all_info(const Triangulation<dim> &tria)
            line_index < GeometryInfo<dim>::lines_per_cell;
            ++line_index)
         {
-          deallog << cell->line_orientation(line_index) << "  ";
+          deallog << (cell->line_orientation(line_index) ==
+                      ReferenceCell::default_combined_face_orientation())
+                  << "  ";
         } // line_index
       deallog << '}' << std::endl << std::endl;
     } // cell
index c348ea19b624b3df920a2a9597fabb652ff2e0ce..7f3025ada9df5a74d2c84e19bb40ed68f8893d26 100644 (file)
@@ -161,7 +161,8 @@ test()
               p1.first  = cell->line(l)->vertex_index(0);
               p1.second = cell->line(l)->vertex_index(1);
 
-              if (orientation_exp == false)
+              if (orientation_exp ==
+                  ReferenceCell::reversed_combined_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.