From fecd714f54e6ba1334e689dd9bf40526a36a3df5 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 11 May 2019 13:35:17 -0400 Subject: [PATCH] Use range-based for loops --- examples/step-42/step-42.cc | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) 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) -- 2.39.5