From: wolf Date: Tue, 18 Jun 2002 09:09:10 +0000 (+0000) Subject: Fix an erroneous index access where we tried to access element -1. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76b3551d5f6a5181df6803c2cff5aa5f86c5f24;p=dealii-svn.git Fix an erroneous index access where we tried to access element -1. git-svn-id: https://svn.dealii.org/trunk@6156 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/grid_reordering.cc b/deal.II/deal.II/source/grid/grid_reordering.cc index 711c9b768c..8ec0ab4e26 100644 --- a/deal.II/deal.II/source/grid/grid_reordering.cc +++ b/deal.II/deal.II/source/grid/grid_reordering.cc @@ -1213,19 +1213,23 @@ GridReordering::presort_cells (typename std::vector &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::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::iterator i=faces.begin(); i!=faces.end(); ++i)