From 3f7a7659c1052d46918bc758e866705663613996 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 7 Aug 2019 10:50:01 -0600 Subject: [PATCH] step-50: use ranged-for --- examples/step-50/step-50.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index 14d782b080..19c3234966 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -420,10 +420,7 @@ namespace Step50 const Coefficient coefficient; std::vector coefficient_values(n_q_points); - typename DoFHandler::active_cell_iterator cell = mg_dof_handler - .begin_active(), - endc = mg_dof_handler.end(); - for (; cell != endc; ++cell) + for (const auto &cell : mg_dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) { cell_matrix = 0; @@ -555,13 +552,8 @@ namespace Step50 // assemble_system, with two exceptions: (i) we don't // need a right hand side, and more significantly (ii) we don't // just loop over all active cells, but in fact all cells, active - // or not. Consequently, the correct iterator to use is - // DoFHandler::cell_iterator rather than - // DoFHandler::active_cell_iterator. Let's go about it: - typename DoFHandler::cell_iterator cell = mg_dof_handler.begin(), - endc = mg_dof_handler.end(); - - for (; cell != endc; ++cell) + // or not. + for (const auto &cell : mg_dof_handler.cell_iterators()) if (cell->level_subdomain_id() == triangulation.locally_owned_subdomain()) { cell_matrix = 0; -- 2.39.5