From bedd853dde8f1ff441a640097cbb74048aec4691 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 14 Apr 2015 16:46:55 -0500 Subject: [PATCH] Replace a double loop over cells and indices by a single loop and the use of cell->active_cell_index(). --- source/grid/grid_generator.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index a2d7665cbb..4c2439ecde 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -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::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()); -- 2.39.5