]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Be less circumspect about resizing arrays when we want to add
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 Oct 2013 13:23:58 +0000 (13:23 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 Oct 2013 13:23:58 +0000 (13:23 +0000)
default-constructed elements.

git-svn-id: https://svn.dealii.org/trunk@31464 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/tria_objects.cc

index c153febdc1e8136f3bb617291c233fd9d846e0ac..d73503bac4b487910a3cae821b30ee01c83c8312 100644 (file)
@@ -192,15 +192,8 @@ namespace internal
                                        RefinementCase<G::dimension>::no_refinement);
             }
 
-          boundary_or_material_id.reserve (new_size);
-          boundary_or_material_id.insert (boundary_or_material_id.end(),
-                                          new_size-boundary_or_material_id.size(),
-                                          BoundaryOrMaterialId());
-
-          user_data.reserve (new_size);
-          user_data.insert (user_data.end(),
-                            new_size-user_data.size(),
-                            UserData());
+         boundary_or_material_id.resize (new_size);
+          user_data.resize (new_size);
         }
 
       if (n_unused_singles==0)
@@ -272,15 +265,8 @@ namespace internal
                            4*new_size-children.size(),
                            -1);
 
-          boundary_or_material_id.reserve (new_size);
-          boundary_or_material_id.insert (boundary_or_material_id.end(),
-                                          new_size-boundary_or_material_id.size(),
-                                          BoundaryOrMaterialId());
-
-          user_data.reserve (new_size);
-          user_data.insert (user_data.end(),
-                            new_size-user_data.size(),
-                            UserData());
+          boundary_or_material_id.resize (new_size);
+          user_data.resize (new_size);
 
           face_orientations.reserve (new_size * GeometryInfo<3>::faces_per_cell);
           face_orientations.insert (face_orientations.end(),

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.