]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify step-48 a bit. 16033/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 22 Sep 2023 14:44:34 +0000 (08:44 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 22 Sep 2023 15:02:18 +0000 (09:02 -0600)
examples/step-48/step-48.cc

index ea993a580005ea9d8ee6d040b6333a8bae1b87e4..7c6f14ae6d40d0bf0d7ecee909263ef4c34589a2 100644 (file)
@@ -375,18 +375,13 @@ namespace Step48
     GridGenerator::hyper_cube(triangulation, -15, 15);
     triangulation.refine_global(n_global_refinements);
     {
-      typename Triangulation<dim>::active_cell_iterator
-        cell     = triangulation.begin_active(),
-        end_cell = triangulation.end();
-      for (; cell != end_cell; ++cell)
+      for (const auto &cell : triangulation.active_cell_iterators())
         if (cell->is_locally_owned())
           if (cell->center().norm() < 11)
             cell->set_refine_flag();
       triangulation.execute_coarsening_and_refinement();
 
-      cell     = triangulation.begin_active();
-      end_cell = triangulation.end();
-      for (; cell != end_cell; ++cell)
+      for (const auto &cell : triangulation.active_cell_iterators())
         if (cell->is_locally_owned())
           if (cell->center().norm() < 6)
             cell->set_refine_flag();
@@ -394,12 +389,7 @@ namespace Step48
     }
 
     pcout << "   Number of global active cells: "
-#ifdef DEAL_II_WITH_P4EST
-          << triangulation.n_global_active_cells()
-#else
-          << triangulation.n_active_cells()
-#endif
-          << std::endl;
+          << triangulation.n_global_active_cells() << std::endl;
 
     dof_handler.distribute_dofs(fe);
 

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.