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

index e1a68ada61380339cac78645c29d78c57cdd31f5..1472c6c1a78d37cc22d936c9c076e2a003e6fe5c 100644 (file)
@@ -433,24 +433,21 @@ namespace internal
                 for (unsigned int f = 0; f < n_faces; ++f)
                   {
                     const unsigned int n_face_orientations =
-                      dim == 2 ?
-                        2 :
-                        (2 *
-                         reference_cell.face_reference_cell(f).n_vertices());
+                      reference_cell.n_face_orientations(f);
 
                     const unsigned int n_q_points_face =
                       quad_face[quad_face.size() == 1 ? 0 : f].size();
 
-                    for (unsigned int o = 0; o < n_face_orientations; ++o)
+                    for (types::geometric_orientation orientation = 0;
+                         orientation < n_face_orientations;
+                         ++orientation)
                       {
-                        const auto offset =
+                        // like elsewhere, the default in the matrix-free code
+                        // is 0, not 1, so flip the first bit
+                        const unsigned char mf_orientation = orientation ^ 1;
+                        const auto          offset =
                           QProjector<dim>::DataSetDescriptor::face(
-                            reference_cell,
-                            f,
-                            (o ^ 1) & 1,  // face_orientation
-                            (o >> 2) & 1, // face_flip
-                            (o >> 1) & 1, // face_rotation
-                            quad_face);
+                            reference_cell, f, orientation, quad_face);
 
                         for (unsigned int i = 0; i < n_dofs; ++i)
                           for (unsigned int q = 0; q < n_q_points_face; ++q)
@@ -458,14 +455,16 @@ namespace internal
                               const auto &point =
                                 projected_quad_face.point(q + offset);
 
-                              shape_values_face(f, o, i * n_q_points_face + q) =
+                              shape_values_face(f,
+                                                mf_orientation,
+                                                i * n_q_points_face + q) =
                                 fe.shape_value(i, point);
 
                               const auto grad = fe.shape_grad(i, point);
 
                               for (unsigned int d = 0; d < dim; ++d)
                                 shape_gradients_face(f,
-                                                     o,
+                                                     mf_orientation,
                                                      i * dim * n_q_points_face +
                                                        q * dim + d) = grad[d];
                             }

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.