From: Wolfgang Bangerth Date: Fri, 5 Jun 1998 13:38:42 +0000 (+0000) Subject: Fix two small bugs. X-Git-Tag: v8.0.0~22871 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c44e62a107da0389d8adba41f70cff08727da26;p=dealii.git Fix two small bugs. git-svn-id: https://svn.dealii.org/trunk@383 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 41963fa5c9..d7991d674b 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -2911,6 +2911,12 @@ void Triangulation::prepare_refinement () { // refine cell and // update vertex levels cell->set_refine_flag(); + // note that we can only + // enter this branch if the + // cell is not yet flagged, + // so we can't get into an + // endless loop by setting + // mesh_changed_in_... mesh_changed_in_this_loop = true; for (unsigned int v=0; v::vertices_per_cell; ++v) @@ -2926,6 +2932,12 @@ void Triangulation::prepare_refinement () { endc = end(); for (; cell!=endc; ++cell) { + // if cell is already flagged + // for refinement: nothing to + // do anymore + if (cell->refine_flag_set()) + continue; + unsigned int refined_neighbors = 0, unrefined_neighbors = 0; for (unsigned int face=0; face::faces_per_cell; ++face) @@ -2935,13 +2947,17 @@ void Triangulation::prepare_refinement () { // level below because of // the regularisation above if ((cell->neighbor_level(face) == cell->level()) && - (cell->neighbor(face)->refine_flag_set())) + (cell->neighbor(face)->refine_flag_set() || + cell->neighbor(face)->has_children())) ++refined_neighbors; else ++unrefined_neighbors; if (unrefined_neighbors < refined_neighbors) - cell->set_refine_flag (); + { + cell->set_refine_flag (); + mesh_changed_in_this_loop = true; + }; }; }; }