]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify a piece of code.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 18 May 2020 23:07:41 +0000 (17:07 -0600)
committerMatthias Maier <tamiko@43-1.org>
Tue, 19 May 2020 01:21:30 +0000 (20:21 -0500)
examples/step-70/step-70.cc

index 4dd8a1917d50af139169a17284b408617d3fe821..bf3a698e71fd0b146999939b5f295ca5a420114e 100644 (file)
@@ -896,14 +896,12 @@ namespace Step70
     // We construct this information by first building an index tree of boxes
     // bounding the locally owned cells, and then extracting one of the first
     // levels of the tree:
-    std::vector<BoundingBox<spacedim>> all_boxes(
-      fluid_tria.n_locally_owned_active_cells());
-    unsigned int i = 0;
+    std::vector<BoundingBox<spacedim>> all_boxes;
+    all_boxes.reserve(fluid_tria.n_locally_owned_active_cells());
     for (const auto cell : fluid_tria.active_cell_iterators())
       if (cell->is_locally_owned())
-        all_boxes[i++] = cell->bounding_box();
+        all_boxes.emplace_back(cell->bounding_box());
 
-    // We construct the tree
     const auto tree = pack_rtree(all_boxes);
 
     // extract the desired level

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.