From: Daniel Arndt Date: Mon, 7 Jan 2019 10:57:39 +0000 (+0100) Subject: Use range-based for loops in include/grid X-Git-Tag: v9.1.0-rc1~445^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2eee3e868bf2b3b7cb6e69f8c2a31fb9ff9a61f;p=dealii.git Use range-based for loops in include/grid --- diff --git a/include/deal.II/grid/grid_generator.h b/include/deal.II/grid/grid_generator.h index 354037d6f2..76b0f42a3a 100644 --- a/include/deal.II/grid/grid_generator.h +++ b/include/deal.II/grid/grid_generator.h @@ -1228,7 +1228,7 @@ namespace GridGenerator * auto min_line_length = [](const Triangulation &tria) -> double * { * double length = std::numeric_limits::max(); - * for (const auto cell : tria.active_cell_iterators()) + * for (const auto &cell : tria.active_cell_iterators()) * for (unsigned int n = 0; n < GeometryInfo::lines_per_cell; ++n) * length = std::min(length, (cell->line(n)->vertex(0) - * cell->line(n)->vertex(1)).norm()); diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index eeb18420b6..c6642584b5 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -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(); + CellId::binary_type binary_cell_id = id.template to_binary(); 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 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 =