From: Daniel Arndt Date: Thu, 25 Feb 2016 10:20:34 +0000 (+0100) Subject: Move add_periodicity and member variables to the base class X-Git-Tag: v8.5.0-rc1~1151^2~11 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=741c3bf7fcf6987e0d4ebe0086f5ec9eed976ab8;p=dealii.git Move add_periodicity and member variables to the base class --- diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index 5e0afca59d..95e5859e65 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -757,7 +757,8 @@ namespace parallel get_coarse_cell_to_p4est_tree_permutation() const; /** - * Join faces in the p4est forest for periodic boundary conditions. As a + * In addition to the action in the base class Triangulation, this function + * joins faces in the p4est forest for periodic boundary conditions. As a * result, each pair of faces will differ by at most one refinement * level and ghost neighbors will be available across these faces. * @@ -773,7 +774,7 @@ namespace parallel * once is possible, but not recommended: The function destroys and * rebuilds the p4est forest each time it is called. */ - void + virtual void add_periodicity (const std::vector > &); diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index ba09331327..0678a6abfb 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -1465,6 +1465,18 @@ public: distorted_cells; }; + /** + * If add_periodicity() is called, this variable stores the given + * periodic face pairs on level 0 for later access during the + * identification of ghost cells for the multigrid hierarchy. + */ + std::vector > periodic_face_pairs_level_0; + + /** + * If add_periodicity() is called, this variable stores the active periodic face pairs. + * The variable is updated on refinement. + */ + std::map, GridTools::PeriodicFacePair > periodic_face_map; /** * Make the dimension available in function templates. @@ -2961,6 +2973,28 @@ public: void load (Archive &ar, const unsigned int version); + + /** + * Declare the (coarse) face pairs given in the argument of this function + * as periodic. This way it it possible to obtain neighbors across periodic + * boundaries. + * This function initializes ActivePeriodicFacePairs and on refinement this + * + * The vector can be filled by the function + * GridTools::collect_periodic_faces. + * + * For more information on periodic boundary conditions see + * GridTools::collect_periodic_faces, + * DoFTools::make_periodicity_constraints and step-45. + * + * @note Before this function can be used the Triangulation has to be + * initialized and must not be refined. + */ + virtual void + add_periodicity + (const std::vector > &); + + BOOST_SERIALIZATION_SPLIT_MEMBER() /** diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 59f9f93504..3423854a29 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -4861,10 +4861,8 @@ namespace parallel AssertThrow (false, ExcInternalError()); } - periodic_face_pairs_level_0.insert(periodic_face_pairs_level_0.end(), - periodicity_vector.begin(), - periodicity_vector.end()); - + //finally call the base class for storing the periodicity information + Triangulation::add_periodicity(periodicity_vector); #else Assert(false, ExcMessage ("Need p4est version >= 0.3.4.1!")); #endif diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 5e37a357c4..78c065079c 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -11587,6 +11587,14 @@ Triangulation::get_triangulation () const } +template +virtual void +Triangulation::add_periodicity() +{ + periodic_face_pairs_level_0.insert(periodic_face_pairs_level_0.end(), + periodicity_vector.begin(), + periodicity_vector.end()); +} template void