]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Range-based for loop
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 23 Mar 2019 03:01:02 +0000 (04:01 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 23 Mar 2019 03:01:02 +0000 (04:01 +0100)
examples/step-42/step-42.cc

index 5b6127b94263640ca92e68d243d142cbe373f9dc..32394d47b7bb02841425d4026fba508b09700d1b 100644 (file)
@@ -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)
                 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.