From: Timo Heister Date: Wed, 7 Aug 2019 16:50:01 +0000 (-0600) Subject: step-50: use ranged-for X-Git-Tag: v9.2.0-rc1~1302^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f7a7659c1052d46918bc758e866705663613996;p=dealii.git step-50: use ranged-for --- 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;