]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix thinko: we need to update the neighbor pointers of all descendents of a neighbor...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 20 May 1999 09:00:59 +0000 (09:00 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 20 May 1999 09:00:59 +0000 (09:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@1344 0785d39b-7218-0410-832d-ea1e28bc413d

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

index aea27aec7ed6270c22e3dbf8c91caf3da30070df..aaf3f7f385ead65242cd603e548027b30dbcdf3d 100644 (file)
@@ -3844,13 +3844,17 @@ void Triangulation<1>::execute_refinement () {
              first_child->set_neighbor (0, cell->neighbor(0));
            else
              if (cell->neighbor(0)->active())
-                                                // since the neighbors level is
-                                                // always <=level, if the
-                                                // cell is active, then there
-                                                // are no cells to the left which
-                                                // may want to know about this
-                                                // new child cell.
-               first_child->set_neighbor (0, cell->neighbor(0));
+               {
+                                                  // since the neighbors level is
+                                                  // always <=level, if the
+                                                  // cell is active, then there
+                                                  // are no cells to the left which
+                                                  // may want to know about this
+                                                  // new child cell.
+                 Assert (cell->neighbor(0)->level() <= cell->level(),
+                         ExcInternalError());
+                 first_child->set_neighbor (0, cell->neighbor(0));
+               }
              else
                                                 // left neighbor is refined
                {
@@ -3859,12 +3863,14 @@ void Triangulation<1>::execute_refinement () {
                  first_child->set_neighbor (0, cell->neighbor(0)->child(1));
 
                                                   // reset neighbor info of
-                                                  // leftmost descendant of the
+                                                  // all right descendant of the
                                                   // left neighbor of cell
                  cell_iterator left_neighbor = cell->neighbor(0);
-                 while (left_neighbor->active() == false)
-                   left_neighbor = left_neighbor->child(1);
-                 left_neighbor->set_neighbor(1, first_child);
+                 while (left_neighbor->has_children())
+                   {
+                     left_neighbor = left_neighbor->child(1);
+                     left_neighbor->set_neighbor (1, first_child);
+                   };
                };
            
                                             // insert second child
@@ -3876,16 +3882,23 @@ void Triangulation<1>::execute_refinement () {
              second_child->set_neighbor (1, cell->neighbor(1));
            else
              if (cell->neighbor(1)->active())
-               second_child->set_neighbor (1, cell->neighbor(1));
+               {
+                 Assert (cell->neighbor(1)->level() <= cell->level(),
+                         ExcInternalError());
+                 second_child->set_neighbor (1, cell->neighbor(1));
+               }
              else
                                                 // right neighbor is refined
+                                                // same as above
                {
                  second_child->set_neighbor (1, cell->neighbor(1)->child(0));
                  
                  cell_iterator right_neighbor = cell->neighbor(1);
-                 while (right_neighbor->active() == false)
-                   right_neighbor = right_neighbor->child(0);
-                 right_neighbor->set_neighbor(0, second_child);
+                 while (right_neighbor->has_children())
+                   {
+                     right_neighbor = right_neighbor->child(0);
+                     right_neighbor->set_neighbor (0, second_child);
+                   };
                };
          };      
     };

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.