From 58d1cb115547e27141a38df25996d3cf155df3bf Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 23 Mar 2019 04:01:02 +0100 Subject: [PATCH] Range-based for loop --- examples/step-42/step-42.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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) { -- 2.39.5