From 85da951b2f6360ddbb0ecf2e6bec1210c7f3a1c4 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Wed, 4 Dec 2013 05:30:53 +0000 Subject: [PATCH] improve comments for periodicity stuff git-svn-id: https://svn.dealii.org/trunk@31868 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/distributed/tria.h | 9 ++-- deal.II/include/deal.II/grid/grid_tools.h | 23 +++++---- deal.II/source/grid/grid_tools.cc | 56 +++++++++++----------- 3 files changed, 45 insertions(+), 43 deletions(-) diff --git a/deal.II/include/deal.II/distributed/tria.h b/deal.II/include/deal.II/distributed/tria.h index a4c0526529..1bfe32cd5a 100644 --- a/deal.II/include/deal.II/distributed/tria.h +++ b/deal.II/include/deal.II/distributed/tria.h @@ -706,17 +706,20 @@ namespace parallel /** - * Join faces in the p4est forest due to periodic boundary conditions. + * Join 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. * * The vector can be filled by the function * GridTools::collect_periodic_faces. * * @todo At the moment just default orientation is implemented. * - * @note Before this function can be used the triangulation has to be + * @note Before this function can be used the Triangulation has to be * initialized and must not be refined. * Calling this function more than once is possible, but not recommended: - * The function destroys and rebuilds the p4est forest each time it is called. + * The function destroys and rebuilds the p4est forest each time it is + * called. */ void add_periodicity diff --git a/deal.II/include/deal.II/grid/grid_tools.h b/deal.II/include/deal.II/grid/grid_tools.h index 61ce67c53d..29cefdfe52 100644 --- a/deal.II/include/deal.II/grid/grid_tools.h +++ b/deal.II/include/deal.II/grid/grid_tools.h @@ -1065,8 +1065,8 @@ namespace GridTools /** - * This function will collect periodic face pairs on the highest (i.e. - * coarsest) mesh level. + * This function will collect periodic face pairs on the + * coarsest mesh level of the given @p container (a Triangulation or DoFHandler). * * Define a 'first' boundary as all boundary faces having boundary_id * @p b_id1 and a 'second' boundary consisting of all faces belonging @@ -1095,14 +1095,14 @@ namespace GridTools * * @author Daniel Arndt, Matthias Maier, 2013 */ - template - std::vector > + template + std::vector > collect_periodic_faces - (const DH &dof_handler, + (const CONTAINER &container, const types::boundary_id b_id1, const types::boundary_id b_id2, const int direction, - const dealii::Tensor<1,DH::space_dimension> &offset = dealii::Tensor<1,DH::space_dimension>()); + const dealii::Tensor<1,CONTAINER::space_dimension> &offset = dealii::Tensor<1,CONTAINER::space_dimension>()); /** @@ -1116,8 +1116,7 @@ namespace GridTools * face with local face index 2*dimension+1 and boundary * indicator @p b_id. * - * This function will collect periodic face pairs on the highest (i.e. - * coarsest) mesh level. + * This function will collect periodic face pairs on the coarsest mesh level. * * @note This version of collect_periodic_face_pairs will not work on * meshes with cells not in @ref GlossFaceOrientation @@ -1125,13 +1124,13 @@ namespace GridTools * * @author Daniel Arndt, Matthias Maier, 2013 */ - template - std::vector > + template + std::vector > collect_periodic_faces - (const DH &dof_handler, + (const CONTAINER &container, const types::boundary_id b_id, const int direction, - const dealii::Tensor<1,DH::space_dimension> &offset = dealii::Tensor<1,DH::space_dimension>()); + const dealii::Tensor<1,CONTAINER::space_dimension> &offset = dealii::Tensor<1,CONTAINER::space_dimension>()); /** diff --git a/deal.II/source/grid/grid_tools.cc b/deal.II/source/grid/grid_tools.cc index 669dccb71b..1316387b53 100644 --- a/deal.II/source/grid/grid_tools.cc +++ b/deal.II/source/grid/grid_tools.cc @@ -2405,42 +2405,42 @@ next_cell: - template - std::vector > + template + std::vector > collect_periodic_faces - (const DH &dof_handler, + (const CONTAINER &container, const types::boundary_id b_id1, const types::boundary_id b_id2, const int direction, - const dealii::Tensor<1,DH::space_dimension> &offset) + const dealii::Tensor<1,CONTAINER::space_dimension> &offset) { - static const int dim = DH::dimension; - static const int space_dim = DH::space_dimension; + static const int dim = CONTAINER::dimension; + static const int space_dim = CONTAINER::space_dimension; Assert (0<=direction && direction > pairs1; - std::set > pairs2; + std::set > pairs1; + std::set > pairs2; - for (typename DH::cell_iterator cell = dof_handler.begin(0); - cell != dof_handler.end(0); ++cell) + for (typename CONTAINER::cell_iterator cell = container.begin(0); + cell != container.end(0); ++cell) { for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) { - const typename DH::face_iterator face = cell->face(i); + const typename CONTAINER::face_iterator face = cell->face(i); if (face->at_boundary() && face->boundary_indicator() == b_id1) { - const std::pair pair1 + const std::pair pair1 = std::make_pair(cell, i); pairs1.insert(pair1); } if (face->at_boundary() && face->boundary_indicator() == b_id2) { - const std::pair pair2 + const std::pair pair2 = std::make_pair(cell, i); pairs2.insert(pair2); } @@ -2456,15 +2456,15 @@ next_cell: - template - std::vector > - collect_periodic_faces (const DH &dof_handler, + template + std::vector > + collect_periodic_faces (const CONTAINER &container, const types::boundary_id b_id, const int direction, - const dealii::Tensor<1,DH::space_dimension> &offset) + const dealii::Tensor<1,CONTAINER::space_dimension> &offset) { - static const int dim = DH::dimension; - static const int space_dim = DH::space_dimension; + static const int dim = CONTAINER::dimension; + static const int space_dim = CONTAINER::space_dimension; Assert (0<=direction && direction > pairs1; - std::set > pairs2; + std::set > pairs1; + std::set > pairs2; - for (typename DH::cell_iterator cell = dof_handler.begin(0); - cell != dof_handler.end(0); ++cell) + for (typename CONTAINER::cell_iterator cell = container.begin(0); + cell != container.end(0); ++cell) { - const typename DH::face_iterator face_1 = cell->face(2*direction); - const typename DH::face_iterator face_2 = cell->face(2*direction+1); + const typename CONTAINER::face_iterator face_1 = cell->face(2*direction); + const typename CONTAINER::face_iterator face_2 = cell->face(2*direction+1); if (face_1->at_boundary() && face_1->boundary_indicator() == b_id) { - const std::pair pair1 + const std::pair pair1 = std::make_pair(cell, 2*direction); pairs1.insert(pair1); } if (face_2->at_boundary() && face_2->boundary_indicator() == b_id) { - const std::pair pair2 + const std::pair pair2 = std::make_pair(cell, 2*direction+1); pairs2.insert(pair2); } @@ -2503,7 +2503,7 @@ next_cell: // and call match_periodic_face_pairs that does the actual matching: - typedef std::vector > + typedef std::vector > FaceVector; FaceVector matching = match_periodic_face_pairs(pairs1, pairs2, -- 2.39.5