From: Daniel Arndt Date: Sat, 11 May 2019 17:35:17 +0000 (-0400) Subject: Use range-based for loops X-Git-Tag: v9.1.0-rc1~56^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fecd714f54e6ba1334e689dd9bf40526a36a3df5;p=dealii.git Use range-based for loops --- diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index ad4b53b5a8..19ea609cb2 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -938,10 +938,7 @@ namespace Step42 GridGenerator::hyper_rectangle(triangulation, p1, p2); - Triangulation<3>::active_cell_iterator cell = - triangulation.begin_active(), - endc = triangulation.end(); - for (; cell != endc; ++cell) + for (const auto &cell : triangulation.active_cell_iterators()) for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; ++face_no) @@ -1151,11 +1148,7 @@ namespace Step42 const FEValuesExtractors::Vector displacement(0); - typename DoFHandler::active_cell_iterator cell = - dof_handler.begin_active(), - endc = dof_handler.end(); - - for (; cell != endc; ++cell) + for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; ++face) @@ -1246,11 +1239,7 @@ namespace Step42 std::vector dof_indices(dofs_per_face); - typename DoFHandler::active_cell_iterator cell = - dof_handler.begin_active(), - endc = dof_handler.end(); - - for (; cell != endc; ++cell) + for (const auto &cell : dof_handler.active_cell_iterators()) if (!cell->is_artificial()) for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; ++face) @@ -1954,10 +1943,7 @@ namespace Step42 { std::vector vertex_touched(triangulation.n_vertices(), false); - for (typename DoFHandler::active_cell_iterator cell = - dof_handler.begin_active(); - cell != dof_handler.end(); - ++cell) + for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) for (unsigned int v = 0; v < GeometryInfo::vertices_per_cell; ++v) if (vertex_touched[cell->vertex_index(v)] == false) @@ -2142,10 +2128,7 @@ namespace Step42 const FEValuesExtractors::Vector displacement(0); - typename DoFHandler::active_cell_iterator cell = - dof_handler.begin_active(), - endc = dof_handler.end(); - for (; cell != endc; ++cell) + for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; ++face)