]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix two small bugs.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 5 Jun 1998 13:38:42 +0000 (13:38 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 5 Jun 1998 13:38:42 +0000 (13:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@383 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/tria.cc

index 41963fa5c949b596c135f40815aa8fcbd02991bc..d7991d674beab45355e8b9d74e81e9af31d884cc 100644 (file)
@@ -2911,6 +2911,12 @@ void Triangulation<dim>::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<GeometryInfo<dim>::vertices_per_cell;
                           ++v)
@@ -2926,6 +2932,12 @@ void Triangulation<dim>::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<GeometryInfo<dim>::faces_per_cell; ++face)
@@ -2935,13 +2947,17 @@ void Triangulation<dim>::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;
+                   };
                };
            };
        }

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.