]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Replace a double loop over cells and indices by a single loop and the use of cell...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 14 Apr 2015 21:46:55 +0000 (16:46 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 15 Apr 2015 12:46:54 +0000 (07:46 -0500)
source/grid/grid_generator.cc

index a2d7665cbb767f62a00d141de8e66a9d70355a14..4c2439ecde4fa368045acb1595df2772ccde97cb 100644 (file)
@@ -2993,14 +2993,13 @@ namespace GridGenerator
         // now copy the resulting level 1 cells
         // into the new triangulation,
         cells.resize(tmp.n_active_cells(), CellData<3>());
-
-        unsigned int index = 0;
         for (Triangulation<3>::active_cell_iterator cell = tmp.begin_active();
-             cell != tmp.end(); ++cell, ++index)
+             cell != tmp.end(); ++cell)
           {
+            const unsigned int cell_index = cell->active_cell_index();
             for (unsigned int v=0; v<GeometryInfo<3>::vertices_per_cell; ++v)
-              cells[index].vertices[v] = cell->vertex_index(v);
-            cells[index].material_id = 0;
+              cells[cell_index].vertices[v] = cell->vertex_index(v);
+            cells[cell_index].material_id = 0;
           }
 
         tria.create_triangulation (tmp.get_vertices(), cells, SubCellData());

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.