]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use range-based for loops in include/grid
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 7 Jan 2019 10:57:39 +0000 (11:57 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 11 Jan 2019 17:07:12 +0000 (18:07 +0100)
include/deal.II/grid/grid_generator.h
include/deal.II/grid/grid_tools.h

index 354037d6f20ac9f909e472193388754e988852cd..76b0f42a3a2551bd6d8d74afdbb6ef28251c99f4 100644 (file)
@@ -1228,7 +1228,7 @@ namespace GridGenerator
    * auto min_line_length = [](const Triangulation<dim> &tria) -> double
    * {
    *   double length = std::numeric_limits<double>::max();
-   *   for (const auto cell : tria.active_cell_iterators())
+   *   for (const auto &cell : tria.active_cell_iterators())
    *     for (unsigned int n = 0; n < GeometryInfo<dim>::lines_per_cell; ++n)
    *       length = std::min(length, (cell->line(n)->vertex(0) -
    *                                  cell->line(n)->vertex(1)).norm());
index eeb18420b69863d8f7833604541f63c3672d0ea8..c6642584b54622e56664c02c6509322083823fcb 100644 (file)
@@ -3581,9 +3581,9 @@ namespace GridTools
     // archive the cellids in an efficient binary format
     const std::size_t n_cells = cell_ids.size();
     ar &              n_cells;
-    for (auto &it : cell_ids)
+    for (const auto &id : cell_ids)
       {
-        CellId::binary_type binary_cell_id = it.template to_binary<dim>();
+        CellId::binary_type binary_cell_id = id.template to_binary<dim>();
         ar &                binary_cell_id;
       }
 
@@ -3649,7 +3649,7 @@ namespace GridTools
       vertices_with_ghost_neighbors =
         tria->compute_vertices_with_ghost_neighbors();
 
-    for (auto cell : tria->active_cell_iterators())
+    for (const auto &cell : tria->active_cell_iterators())
       if (cell->is_locally_owned())
         {
           std::set<dealii::types::subdomain_id> send_to;
@@ -3686,10 +3686,8 @@ namespace GridTools
                 {
                   const CellId cellid = cell->id();
 
-                  for (auto it : send_to)
+                  for (const auto subdomain : send_to)
                     {
-                      const dealii::types::subdomain_id subdomain = it;
-
                       // find the data buffer for proc "subdomain" if it exists
                       // or create an empty one otherwise
                       typename DestinationToBufferMap::iterator p =

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.