]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Also move combine_face_and_line_orientation() into ReferenceCell. 11776/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 18 Feb 2021 19:54:49 +0000 (12:54 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 19 Feb 2021 19:04:43 +0000 (12:04 -0700)
include/deal.II/grid/reference_cell.h
include/deal.II/grid/tria_accessor.templates.h

index 979dc3545b881af9a04f34a278a1ad07c1ebbfc7..9afa30c3115de1d42d2c5ff21fe092cb01b4c805 100644 (file)
@@ -373,6 +373,14 @@ public:
                              const unsigned int  face,
                              const unsigned char face_orientation) const;
 
+  /**
+   * Combine face and line orientation.
+   */
+  bool
+  combine_face_and_line_orientation(const unsigned int  line,
+                                    const unsigned char face_orientation,
+                                    const unsigned char line_orientation) const;
+
   /**
    * @}
    */
@@ -1725,6 +1733,43 @@ ReferenceCell::unit_normal_vectors(const unsigned int face_no) const
 }
 
 
+
+inline bool
+ReferenceCell::combine_face_and_line_orientation(
+  const unsigned int  line,
+  const unsigned char face_orientation_raw,
+  const unsigned char line_orientation) const
+{
+  if (*this == ReferenceCells::Hexahedron)
+    {
+      static const bool bool_table[2][2][2][2] = {
+        {{{true, false},    // lines 0/1, face_orientation=false,
+                            // face_flip=false, face_rotation=false and true
+          {false, true}},   // lines 0/1, face_orientation=false,
+                            // face_flip=true, face_rotation=false and true
+         {{true, true},     // lines 0/1, face_orientation=true,
+                            // face_flip=false, face_rotation=false and true
+          {false, false}}}, // lines 0/1, face_orientation=true,
+                            // face_flip=true, face_rotation=false and true
+
+        {{{true, true}, // lines 2/3 ...
+          {false, false}},
+         {{true, false}, {false, true}}}};
+
+      const bool face_orientation = Utilities::get_bit(face_orientation_raw, 0);
+      const bool face_flip        = Utilities::get_bit(face_orientation_raw, 2);
+      const bool face_rotation    = Utilities::get_bit(face_orientation_raw, 1);
+
+      return (static_cast<bool>(line_orientation) ==
+              bool_table[line / 2][face_orientation][face_flip][face_rotation]);
+    }
+  else
+    // TODO: This might actually be wrong for some of the other
+    // kinds of objects. We should check this
+    return true;
+}
+
+
 namespace internal
 {
   /**
@@ -1867,7 +1912,6 @@ namespace internal
         return 0;
       }
 
-    public:
       /**
        * Combine face and line orientation.
        */
@@ -1886,7 +1930,6 @@ namespace internal
         return true;
       }
 
-    private:
       /**
        * Return reference-cell type of face @p face_no.
        */
index cf6edc1f6726c2700a0c35dcf9045c45a7a149ee..3267b39d123722014da02e65623fe6a89ec2670e 100644 (file)
@@ -839,7 +839,7 @@ namespace internal
           accessor.reference_cell().standard_to_real_face_line(
             pair[1], pair[0], face_orientation_raw(accessor, quad_index));
 
-        return accessor.reference_cell_info().combine_face_and_line_orientation(
+        return accessor.reference_cell().combine_face_and_line_orientation(
           pair[1],
           face_orientation_raw(accessor, quad_index),
           accessor.quad(quad_index)->line_orientation(line_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.