From: Daniel Arndt Date: Sat, 23 Mar 2019 03:01:02 +0000 (+0100) Subject: Range-based for loop X-Git-Tag: v9.1.0-rc1~255^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58d1cb115547e27141a38df25996d3cf155df3bf;p=dealii.git Range-based for loop --- diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index 5b6127b942..32394d47b7 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -1549,10 +1549,7 @@ namespace Step42 fraction_of_plastic_q_points_per_cell = 0; - auto cell = dof_handler.begin_active(); - const auto endc = dof_handler.end(); - unsigned int cell_number = 0; - for (; cell != endc; ++cell, ++cell_number) + for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) { fe_values.reinit(cell); @@ -1569,7 +1566,8 @@ namespace Step42 constitutive_law.get_stress_strain_tensor( strain_tensors[q_point], stress_strain_tensor); if (q_point_is_plastic) - ++fraction_of_plastic_q_points_per_cell(cell_number); + ++fraction_of_plastic_q_points_per_cell( + cell->active_cell_index()); for (unsigned int i = 0; i < dofs_per_cell; ++i) {