]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix an erroneous index access where we tried to access element -1.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Jun 2002 09:09:10 +0000 (09:09 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 18 Jun 2002 09:09:10 +0000 (09:09 +0000)
git-svn-id: https://svn.dealii.org/trunk@6156 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_reordering.cc

index 711c9b768cfba5deb9fc774d44a6c48d9ddc8d61..8ec0ab4e262fc73a071365292850d5b6b6e78656 100644 (file)
@@ -1213,19 +1213,23 @@ GridReordering<dim>::presort_cells (typename std::vector<Cell>       &cells,
   
                                   // now we still have to convert all
                                   // old cell numbers to new cells
-                                  // numbers
+                                  // numbers. non-existent neighbors
+                                  // (with index -1) are mapped to
+                                  // non-existent neighbors, so we
+                                  // need not touch these indices
   for (unsigned int c=0; c<cells.size(); ++c)
     {
       cells[c].cell_no = new_cell_numbers[cells[c].cell_no];
       Assert (cells[c].cell_no == c, ExcInternalError());
 
       for (unsigned int n=0; n<GeometryInfo<dim>::faces_per_cell; ++n)
-       {
-         Assert (cells[c].neighbors[n] < new_cell_numbers.size(),
-                 ExcIndexRange(cells[c].neighbors[n], 0, 
-                               new_cell_numbers.size()));
-         cells[c].neighbors[n] = new_cell_numbers[cells[c].neighbors[n]];
-       };
+       if (cells[c].neighbors[n] != Cell::invalid_neighbor)
+         {
+           Assert (cells[c].neighbors[n] < new_cell_numbers.size(),
+                   ExcIndexRange(cells[c].neighbors[n], 0, 
+                                 new_cell_numbers.size()));
+           cells[c].neighbors[n] = new_cell_numbers[cells[c].neighbors[n]];
+         };
     };
 
   for (typename std::map<Face,FaceData>::iterator i=faces.begin(); i!=faces.end(); ++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.