]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a range-for in step-10. 6859/head
authorDavid Wells <wellsd2@rpi.edu>
Fri, 29 Jun 2018 13:04:11 +0000 (09:04 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Fri, 29 Jun 2018 14:37:10 +0000 (10:37 -0400)
This finishes the modernization started in commits 0ef6e96485b and 332a199f3f9.

examples/step-10/step-10.cc

index db6ed8ff5d0c05a62e9884a9c8320a8991ee4e36..8ddacbf912b230e94cbc14137dba5b48e649d765 100644 (file)
@@ -266,10 +266,7 @@ namespace Step10
             // Now we loop over all cells, reinitialize the FEValues object
             // for each cell, and add up all the `JxW' values for this cell to
             // `area'...
-            typename DoFHandler<dim>::active_cell_iterator
-              cell = dof_handler.begin_active(),
-              endc = dof_handler.end();
-            for (; cell != endc; ++cell)
+            for (const auto &cell : dof_handler.active_cell_iterators())
               {
                 fe_values.reinit(cell);
                 for (unsigned int i = 0; i < fe_values.n_quadrature_points; ++i)
@@ -359,11 +356,8 @@ namespace Step10
             // Now we run over all cells and over all faces of each cell. Only
             // the contributions of the `JxW' values on boundary faces are
             // added to the long double variable `perimeter'.
-            typename DoFHandler<dim>::active_cell_iterator
-              cell                = dof_handler.begin_active(),
-              endc                = dof_handler.end();
             long double perimeter = 0;
-            for (; cell != endc; ++cell)
+            for (const auto &cell : dof_handler.active_cell_iterators())
               for (unsigned int face_no = 0;
                    face_no < GeometryInfo<dim>::faces_per_cell;
                    ++face_no)

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.