]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use the combined orientation in another FiniteElement function. 16388/head
authorDavid Wells <drwells@email.unc.edu>
Thu, 28 Dec 2023 01:24:52 +0000 (20:24 -0500)
committerDavid Wells <drwells@email.unc.edu>
Thu, 28 Dec 2023 02:17:42 +0000 (21:17 -0500)
doc/news/changes/incompatibilities/20231221DavidWells
include/deal.II/fe/fe.h
include/deal.II/grid/tria_accessor.templates.h
source/fe/fe.cc

index 4c1e189688cb65ea42d905ed8268faecd2eefefe..7714e394b435891f1d8cc717ef14dff227cd4292 100644 (file)
@@ -1,6 +1,7 @@
-Changed: FiniteElement::adjust_quad_dof_index_for_face_orientation() and
-FiniteElement::face_to_cell_index() now use the standardized
-<tt>combined_orientation</tt> orientation encoding as input arguments rather
-than three booleans.
+Changed: FiniteElement::adjust_quad_dof_index_for_face_orientation(),
+FiniteElement::face_to_cell_index(), and
+FiniteElement::adjust_line_dof_index_for_line_orientation() now use the
+standardized <tt>combined_orientation</tt> orientation encoding as input
+arguments rather than one or three booleans.
 <br>
 (David Wells, 2023/12/21)
index 3c448ee5c404ac545b48537722418c944c23ccff..a44e0ca838e459552e297e6bb86a5b36aed23496 100644 (file)
@@ -1524,15 +1524,17 @@ public:
       ReferenceCell::default_combined_face_orientation()) const;
 
   /**
-   * For lines with non-standard line_orientation in 3d, the dofs on lines
-   * have to be permuted in order to be combined with the correct shape
-   * functions. Given a local dof @p index on a line, return the local index,
-   * if the line has non-standard line_orientation. In 2d and 1d there is no
-   * need for permutation, so the given index is simply returned.
+   * Given a local dof @p index on a line and the orientation @p
+   * combined_orientation of that line, return the local dof which accounts for
+   * @p combined_orientation.
+   *
+   * @note In both 1d and all-quadrilateral meshes in 2d all lines have the
+   * standard orientation.
    */
   unsigned int
-  adjust_line_dof_index_for_line_orientation(const unsigned int index,
-                                             const bool line_orientation) const;
+  adjust_line_dof_index_for_line_orientation(
+    const unsigned int  index,
+    const unsigned char combined_orientation) const;
 
   /**
    * Return in which of the vector components of this finite element the @p
index ddac77f8c7c5c4775526ab2403b231d9d77593bf..2466498a59752ad84e0d7f558f90f0f0bbe78b01 100644 (file)
@@ -1104,7 +1104,7 @@ namespace internal
        * cell->line_orientation(), 1d specialization
        */
       template <int dim, int spacedim>
-      static std::array<unsigned int, 1>
+      static std::array<unsigned char, 1>
       get_line_orientations_of_cell(const TriaAccessor<1, dim, spacedim> &)
       {
         Assert(false, ExcInternalError());
@@ -1118,14 +1118,17 @@ namespace internal
        * cell->line_orientation(), 2d specialization
        */
       template <int dim, int spacedim>
-      static std::array<bool, 4>
+      static std::array<unsigned char, 4>
       get_line_orientations_of_cell(const TriaAccessor<2, dim, spacedim> &cell)
       {
         // For 2d cells the access cell->line_orientation() is already
         // efficient
-        std::array<bool, 4> line_orientations = {};
+        std::array<unsigned char, 4> line_orientations = {};
         for (const unsigned int line : cell.line_indices())
-          line_orientations[line] = cell.line_orientation(line);
+          line_orientations[line] =
+            cell.line_orientation(line) == true ?
+              ReferenceCell::default_combined_face_orientation() :
+              ReferenceCell::reversed_combined_line_orientation();
         return line_orientations;
       }
 
@@ -1136,10 +1139,10 @@ namespace internal
        * cell->line_orientation(), 3d specialization
        */
       template <int dim, int spacedim>
-      static std::array<bool, 12>
+      static std::array<unsigned char, 12>
       get_line_orientations_of_cell(const TriaAccessor<3, dim, spacedim> &cell)
       {
-        std::array<bool, 12> line_orientations = {};
+        std::array<unsigned char, 12> line_orientations = {};
 
         // For hexahedra, the classical access via quads -> lines is too
         // inefficient. Unroll this code here to allow the compiler to inline
index aadcaf7bfab58a64dc5b980d10f6484942d24b7a..91911b6113568f740efd9822601ddbc235bf1d1e 100644 (file)
@@ -683,14 +683,19 @@ FiniteElement<dim, spacedim>::adjust_quad_dof_index_for_face_orientation(
 template <int dim, int spacedim>
 unsigned int
 FiniteElement<dim, spacedim>::adjust_line_dof_index_for_line_orientation(
-  const unsigned int index,
-  const bool         line_orientation) const
+  const unsigned int  index,
+  const unsigned char combined_orientation) const
 {
   // We orient quads (and 1D meshes are always oriented) so always skip those
   // cases
   //
   // TODO - we may want to change this in the future: see also the notes in
   // face_to_cell_index()
+  Assert(combined_orientation ==
+             ReferenceCell::default_combined_face_orientation() ||
+           combined_orientation ==
+             ReferenceCell::reversed_combined_line_orientation(),
+         ExcInternalError());
   if (this->reference_cell() == ReferenceCells::Line ||
       this->reference_cell() == ReferenceCells::Quadrilateral)
     return index;
@@ -699,7 +704,8 @@ FiniteElement<dim, spacedim>::adjust_line_dof_index_for_line_orientation(
   Assert(adjust_line_dof_index_for_line_orientation_table.size() ==
            this->n_dofs_per_line(),
          ExcInternalError());
-  if (line_orientation)
+  if (combined_orientation ==
+      ReferenceCell::default_combined_face_orientation())
     return index;
   else
     return index + adjust_line_dof_index_for_line_orientation_table[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.