]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid a 'possibly dangling reference' warning.
authorDavid Wells <drwells@email.unc.edu>
Sat, 25 May 2024 20:20:54 +0000 (16:20 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 25 May 2024 23:20:52 +0000 (19:20 -0400)
source/grid/grid_tools_dof_handlers.cc

index aca115ca243139708d7bd6f7a1938a8d4037bd83..4f99ab7f8bae8dbb1658ccc92d6d0233e61a3b95 100644 (file)
@@ -270,23 +270,26 @@ namespace GridTools
               // (possibly) coarser neighbor. if this is the case,
               // then we need to also add this neighbor
               if (dim >= 2)
-                for (const auto face :
-                     cell->reference_cell().faces_for_given_vertex(v))
-                  if (!cell->at_boundary(face) &&
-                      cell->neighbor(face)->is_active())
-                    {
-                      // there is a (possibly) coarser cell behind a
-                      // face to which the vertex belongs. the
-                      // vertex we are looking at is then either a
-                      // vertex of that coarser neighbor, or it is a
-                      // hanging node on one of the faces of that
-                      // cell. in either case, it is adjacent to the
-                      // vertex, so add it to the list as well (if
-                      // the cell was already in the list then the
-                      // std::set makes sure that we get it only
-                      // once)
-                      adjacent_cells.insert(cell->neighbor(face));
-                    }
+                {
+                  const auto reference_cell = cell->reference_cell();
+                  for (const auto face :
+                       reference_cell.faces_for_given_vertex(v))
+                    if (!cell->at_boundary(face) &&
+                        cell->neighbor(face)->is_active())
+                      {
+                        // there is a (possibly) coarser cell behind a
+                        // face to which the vertex belongs. the
+                        // vertex we are looking at is then either a
+                        // vertex of that coarser neighbor, or it is a
+                        // hanging node on one of the faces of that
+                        // cell. in either case, it is adjacent to the
+                        // vertex, so add it to the list as well (if
+                        // the cell was already in the list then the
+                        // std::set makes sure that we get it only
+                        // once)
+                        adjacent_cells.insert(cell->neighbor(face));
+                      }
+                }
 
               // in any case, we have found a cell, so go to the next cell
               goto next_cell;

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.