]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid accessing elements past the end.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Jul 2011 03:36:17 +0000 (03:36 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 1 Jul 2011 03:36:17 +0000 (03:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@23902 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/grid/grid_generator.cc

index 08df26b1e60f7633eaa36bf863d86c7eaeb8e1f3..0bf9d6735895f2852e577bcbf3f596e7a4a24c29 100644 (file)
@@ -1820,10 +1820,11 @@ void GridGenerator::truncated_cone (Triangulation<3> &triangulation,
                                    const double half_length)
 {
                                   // Determine number of cells and vertices
-  const unsigned int n_cells = static_cast<unsigned int>(std::floor (half_length /
-                                                                    std::max (radius_0,
-                                                                              radius_1) +
-                                                                    0.5));
+  const unsigned int
+    n_cells = static_cast<unsigned int>(std::floor (half_length /
+                                                   std::max (radius_0,
+                                                             radius_1) +
+                                                   0.5));
   const unsigned int n_vertices = 4 * (n_cells + 1);
   std::vector<Point<3> > vertices_tmp(n_vertices);
 
@@ -1849,7 +1850,8 @@ void GridGenerator::truncated_cone (Triangulation<3> &triangulation,
       Point<3> (dx, 0, 0.5 * (radius_1 - radius_0) * dx / half_length);
   }
 
-  const std::vector<Point<3> > vertices (&vertices_tmp[0], &vertices_tmp[n_vertices]);
+  const std::vector<Point<3> > vertices (vertices_tmp.begin(),
+                                        vertices_tmp.end());
   Table<2,unsigned int> cell_vertices(n_cells,GeometryInfo<3>::vertices_per_cell);
 
   for (unsigned int i = 0; i < n_cells; ++i)

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.