From: Daniel Arndt Date: Tue, 22 Mar 2016 14:41:38 +0000 (+0100) Subject: Construct neighbors on all possible levels X-Git-Tag: v8.5.0-rc1~1151^2~9 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=751b62491c49c06efe56a1c0553f4066e67c873e;p=dealii.git Construct neighbors on all possible levels --- diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index bd6ece4cf1..83665a8c2c 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -3107,7 +3107,6 @@ protected: /** * Recreate information about periodic neighbors from periodic_face_pairs_level_0. - * Only faces that belong to locally owned or ghosted cells are stored. */ void update_periodic_face_map (); diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 69852420dc..c7760c1c8f 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -934,6 +934,16 @@ namespace Assert(face_1->at_boundary() &&face_2->at_boundary(), ExcMessage ("Periodic faces must be on the boundary")); + // insert periodic face pair for both cells + typedef std::pair::cell_iterator, unsigned int> CellFace; + const CellFace cell_face_1 (cell_1, n_face_1); + const CellFace cell_face_2 (cell_2, n_face_2); + const std::pair periodic_faces (cell_face_1, cell_face_2); + + // Only one periodic neighbor is allowed + Assert(periodic_face_map.count(cell_face_1) == 0, ExcInternalError()); + periodic_face_map.insert(periodic_faces); + // A lookup table on how to go through the child cells depending on the // orientation: // see Documentation of GeometryInfo for details @@ -1025,41 +1035,9 @@ namespace } } - else - { - // Otherwise at least one of the two faces is active and - // we need to do some work and enter the periodic face pairs! - - //periodic boundary can only be on the boundary of the domain - Assert(cell_1->at_boundary(n_face_1), ExcInternalError()); - Assert(cell_2->at_boundary(n_face_2), ExcInternalError()); - - //Ignore artificial cells, cell_2 may not be active - if (!cell_1->is_artificial()) - { - // if cell_2 is active it must not be artificial - if (!cell_2->has_children() && cell_2->is_artificial()) - { - std::cout<<"The artificial neighbor of the cell with center " <center() - <<" is the cell with center "<center()<is_artificial(), ExcInternalError()); - } - if (cell_2->has_children() || !cell_2->is_artificial()) - { - // insert periodic face pair for both cells - typedef std::pair::cell_iterator, unsigned int> CellFace; - const CellFace cell_face_1 (cell_1, n_face_1); - const CellFace cell_face_2 (cell_2, n_face_2); - const std::pair periodic_faces (cell_face_1, cell_face_2); - - // Only one periodic neighbor is allowed - Assert(periodic_face_map.count(cell_face_1) == 0, ExcInternalError()); - periodic_face_map.insert(periodic_faces); - } - } - } } + }// end of anonymous namespace @@ -11813,8 +11791,7 @@ Triangulation::execute_coarsening_and_refinement () cells_with_distorted_children); // For parallel::distributed::Triangulations we update - // periodic_face_map later. At this point cells might be - // artificial which prevents us from storing the correct faces + // periodic_face_map later. const parallel::Triangulation< dim, spacedim > *distributed_triangulation = dynamic_cast *> (this); if (!distributed_triangulation)