]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MatrixFreeFunctions::HangingNodes: avoid face_flip() etc.
authorDavid Wells <drwells@email.unc.edu>
Sat, 25 Jan 2025 14:37:28 +0000 (09:37 -0500)
committerDavid Wells <drwells@email.unc.edu>
Tue, 28 Jan 2025 16:37:49 +0000 (11:37 -0500)
include/deal.II/matrix_free/hanging_nodes_internal.h

index 8b98585b04c17132f89bbb27ef719249c715f9aa..fda7ffa78de6d59c373bc98bc7bca1088469c88f 100644 (file)
@@ -327,8 +327,8 @@ namespace internal
       rotate_subface_index(int times, unsigned int &subface_index) const;
 
       void
-      rotate_face(int                                   times,
-                  unsigned int                          n_dofs_1d,
+      rotate_face(const types::geometric_orientation    combined_orientation,
+                  const unsigned int                    n_dofs_1d,
                   std::vector<types::global_dof_index> &dofs) const;
 
       unsigned int
@@ -747,20 +747,17 @@ namespace internal
                   // fix DoFs depending on orientation, rotation, and flip
                   if (dim == 2)
                     {
-                      // TODO: for mixed meshes we need to take care of
-                      // orientation here
-                      Assert(cell->face_orientation(face_no),
+                      // TODO: this needs to be implemented for simplices but
+                      // all-quad meshes are OK
+                      Assert(cell->combined_face_orientation(face_no) ==
+                               numbers::default_geometric_orientation,
                              ExcNotImplemented());
                     }
                   else if (dim == 3)
                     {
-                      int rotate = 0;                   // TODO
-                      if (cell->face_rotation(face_no)) //
-                        rotate -= 1;                    //
-                      if (cell->face_flip(face_no))     //
-                        rotate -= 2;                    //
-
-                      rotate_face(rotate, n_dofs_1d, neighbor_dofs);
+                      rotate_face(cell->combined_face_orientation(face_no),
+                                  n_dofs_1d,
+                                  neighbor_dofs);
 
                       if (cell->face_orientation(face_no) == false)
                         transpose_face(n_dofs_1d - 1, neighbor_dofs);
@@ -923,17 +920,20 @@ namespace internal
     template <int dim>
     inline void
     HangingNodes<dim>::rotate_face(
-      int                                   times,
-      unsigned int                          n_dofs_1d,
+      const types::geometric_orientation    combined_orientation,
+      const unsigned int                    n_dofs_1d,
       std::vector<types::global_dof_index> &dofs) const
     {
-      const unsigned int rot_mapping[4] = {2, 0, 3, 1};
+      const auto [orientation, rotation, flip] =
+        ::dealii::internal::split_face_orientation(combined_orientation);
+      (void)orientation;
+      const int n_rotations =
+        rotation || flip ? 4 - int(rotation) - 2 * int(flip) : 0;
 
-      times = times % 4;
-      times = times < 0 ? times + 4 : times;
+      const unsigned int rot_mapping[4] = {2, 0, 3, 1};
 
       std::vector<types::global_dof_index> copy(dofs.size());
-      for (int t = 0; t < times; ++t)
+      for (int t = 0; t < n_rotations; ++t)
         {
           std::swap(copy, dofs);
 

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.