From 2eb4b8b600f470ce3a51e71e4c9252cb65b4f4ed Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 20 May 1999 09:00:59 +0000 Subject: [PATCH] Fix thinko: we need to update the neighbor pointers of all descendents of a neighbor upon refinement in 1d, not only of the most refined one. git-svn-id: https://svn.dealii.org/trunk@1344 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/grid/tria.cc | 43 +++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index aea27aec7e..aaf3f7f385 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -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); + }; }; }; }; -- 2.39.5