]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid an array out-of-bounds warning. 17080/head
authorDavid Wells <drwells@email.unc.edu>
Sat, 25 May 2024 20:21:16 +0000 (16:21 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 25 May 2024 23:20:53 +0000 (19:20 -0400)
include/deal.II/matrix_free/evaluation_kernels_face.h

index f6468be33cc07cfe83d742b211fe153c9c395038..9ce0016485eec5ce1a0563e428204c4d23c0b4ab 100644 (file)
@@ -2828,29 +2828,33 @@ namespace internal
                                                     vector_ptr + ind,
                                                     dof_indices);
                     }
-                else if (n_face_orientations == 1)
-                  for (unsigned int i = 0; i < dofs_per_face; ++i)
-                    {
-                      const unsigned int ind = index_array_nodal[0][i];
-                      const unsigned int i_  = reorientate(0, i);
-
-                      for (unsigned int v = 0; v < n_filled_lanes; ++v)
-                        proc.value(temp1[i_][v], vector_ptrs[v][ind]);
-
-                      if (integrate == false)
-                        for (unsigned int v = n_filled_lanes; v < n_lanes; ++v)
-                          temp1[i_][v] = 0.0;
-                    }
                 else
                   {
-                    if (integrate == false && n_filled_lanes < n_lanes)
+                    if constexpr (n_face_orientations == 1)
                       for (unsigned int i = 0; i < dofs_per_face; ++i)
-                        temp1[i] = Number();
+                        {
+                          const unsigned int ind = index_array_nodal[0][i];
+                          const unsigned int i_  = reorientate(0, i);
 
-                    for (unsigned int v = 0; v < n_filled_lanes; ++v)
-                      for (unsigned int i = 0; i < dofs_per_face; ++i)
-                        proc.value(temp1[reorientate(v, i)][v],
-                                   vector_ptrs[v][index_array_nodal[v][i]]);
+                          for (unsigned int v = 0; v < n_filled_lanes; ++v)
+                            proc.value(temp1[i_][v], vector_ptrs[v][ind]);
+
+                          if constexpr (integrate == false)
+                            for (unsigned int v = n_filled_lanes; v < n_lanes;
+                                 ++v)
+                              temp1[i_][v] = 0.0;
+                        }
+                    else
+                      {
+                        if (integrate == false && n_filled_lanes < n_lanes)
+                          for (unsigned int i = 0; i < dofs_per_face; ++i)
+                            temp1[i] = Number();
+
+                        for (unsigned int v = 0; v < n_filled_lanes; ++v)
+                          for (unsigned int i = 0; i < dofs_per_face; ++i)
+                            proc.value(temp1[reorientate(v, i)][v],
+                                       vector_ptrs[v][index_array_nodal[v][i]]);
+                      }
                   }
               }
           }

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.