From baca47c53c0c70cf6b82db437e823b5e65ef3196 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 11 May 2019 11:38:28 -0400 Subject: [PATCH] Use range-based for loops --- examples/step-46/step-46.cc | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/examples/step-46/step-46.cc b/examples/step-46/step-46.cc index 2e45fc9cde..e5494ddad6 100644 --- a/examples/step-46/step-46.cc +++ b/examples/step-46/step-46.cc @@ -280,20 +280,14 @@ namespace Step46 { GridGenerator::subdivided_hyper_cube(triangulation, 8, -1, 1); - for (typename Triangulation::active_cell_iterator cell = - triangulation.begin_active(); - cell != triangulation.end(); - ++cell) + for (const auto &cell : triangulation.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) if (cell->face(f)->at_boundary() && (cell->face(f)->center()[dim - 1] == 1)) cell->face(f)->set_all_boundary_ids(1); - for (typename Triangulation::active_cell_iterator cell = - dof_handler.begin_active(); - cell != dof_handler.end(); - ++cell) + for (const auto &cell : dof_handler.active_cell_iterators()) if (((std::fabs(cell->center()[0]) < 0.25) && (cell->center()[dim - 1] > 0.5)) || ((std::fabs(cell->center()[0]) >= 0.25) && @@ -317,10 +311,7 @@ namespace Step46 template void FluidStructureProblem::set_active_fe_indices() { - for (typename hp::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_in_fluid_domain(cell)) cell->set_active_fe_index(0); @@ -375,10 +366,7 @@ namespace Step46 { std::vector local_face_dof_indices( stokes_fe.dofs_per_face); - for (typename hp::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_in_fluid_domain(cell)) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) if (!cell->at_boundary(f)) @@ -544,10 +532,7 @@ namespace Step46 // initialization of the hp::FEValues object for the current cell and the // extraction of a FEValues object that is appropriate for the current // cell: - typename hp::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()) { hp_fe_values.reinit(cell); @@ -963,10 +948,7 @@ namespace Step46 // more. The structure of these nested conditions is much the same as we // encountered when assembling interface terms in // assemble_system. - for (typename hp::DoFHandler::active_cell_iterator cell = - dof_handler.begin_active(); - cell != dof_handler.end(); - ++cell) + for (const auto &cell : dof_handler.active_cell_iterators()) for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) if (cell_is_in_solid_domain(cell)) { -- 2.39.5