]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Change some dereferences to pointer arithmetic.
authorDavid Wells <wellsd2@rpi.edu>
Thu, 17 May 2018 21:59:00 +0000 (17:59 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Thu, 17 May 2018 21:59:00 +0000 (17:59 -0400)
This avoids dereferencing (and then calculating the address of) an entry
one past the end.

source/grid/grid_tools.cc
tests/manifold/transfinite_manifold_07.cc

index 025e8b63b6318358af60b47ffe7606d60f578ad6..05c4d26961b974a9a091bd954b0add48808c21d6 100644 (file)
@@ -2269,7 +2269,7 @@ next_cell:
             const unsigned int local_pos_recv = vertices_recv_buffers[i][2*j];
             const types::global_vertex_index global_id_recv = vertices_recv_buffers[i][2*j+1];
             const std::string cellid_recv(&cellids_recv_buffers[i][max_cellid_size*j],
-                                          &cellids_recv_buffers[i][max_cellid_size*(j+1)]);
+                                          &cellids_recv_buffers[i][max_cellid_size*j] + max_cellid_size);
             bool found = false;
             typename std::set<active_cell_iterator>::iterator
             cell_set_it = missing_vert_cells.begin(),
index fe5687f580afa327a07bffab150466e1cc115a98..f6e634fd5e7cb2a85615d610a33269b53435dac4 100644 (file)
@@ -227,9 +227,7 @@ void concentric_disks(Triangulation<2>          &tria,
       cell_idx++;
     }
 
-  tria.create_triangulation(std::vector<Point<2>>(&vertices[0], &vertices[n_vert]),
-                            cells,
-                            SubCellData()); // no boundary information
+  tria.create_triangulation(vertices, cells, SubCellData()); // no boundary information
 
   double eps = 1e-5 * x[0];
   unsigned int label = 100;

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.