From abb192c5d6349f605fe6b01b50279732506b7b14 Mon Sep 17 00:00:00 2001 From: "daniel.arndt" Date: Thu, 19 Sep 2013 16:33:50 +0000 Subject: [PATCH] Added tests for collect_periodic_face_pairs and unified code in make_periodicity_constraints git-svn-id: https://svn.dealii.org/trunk@30832 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/dofs/dof_tools_constraints.cc | 74 +++++--------------- deal.II/source/grid/grid_tools.cc | 8 +-- tests/bits/dof_tools_21_b.cc | 2 +- tests/bits/dof_tools_21_b_x.cc | 2 +- tests/bits/dof_tools_21_b_x_q3.cc | 2 +- tests/bits/dof_tools_21_b_y.cc | 2 +- 6 files changed, 25 insertions(+), 65 deletions(-) diff --git a/deal.II/source/dofs/dof_tools_constraints.cc b/deal.II/source/dofs/dof_tools_constraints.cc index adaf93b7f0..4909d3a7b5 100644 --- a/deal.II/source/dofs/dof_tools_constraints.cc +++ b/deal.II/source/dofs/dof_tools_constraints.cc @@ -2014,38 +2014,12 @@ namespace DoFTools > FaceVector; // Collect matching periodic cells on the coarsest level: - FaceVector matched_cells = + FaceVector matched_faces = GridTools::collect_periodic_faces(dof_handler, b_id1, b_id2, direction, offset); - // And apply the low level make_periodicity_constraints function to - // every matching pair: - for (typename FaceVector::iterator it = matched_cells.begin(); - it != matched_cells.end(); ++it) - { - typedef typename DH::face_iterator FaceIterator; - const FaceIterator &face_1 = it->cell[0]->face(it->face_idx[0]); - const FaceIterator &face_2 = it->cell[1]->face(it->face_idx[1]); - const std::bitset<3> &orientation = it->orientation; - - Assert(face_1->at_boundary() && face_2->at_boundary(), - ExcInternalError()); - - Assert (face_1->boundary_indicator() == b_id1 && - face_2->boundary_indicator() == b_id2, - ExcInternalError()); - - Assert (face_1 != face_2, - ExcInternalError()); - - make_periodicity_constraints(face_1, - face_2, - constraint_matrix, - component_mask, - orientation[0], - orientation[1], - orientation[2]); - } + make_periodicity_constraints + (matched_faces, constraint_matrix, component_mask); } @@ -2091,35 +2065,12 @@ namespace DoFTools > FaceVector; // Collect matching periodic cells on the coarsest level: - const FaceVector matched_cells = + const FaceVector matched_faces = GridTools::collect_periodic_faces(dof_handler, b_id, direction, offset); - // And apply the low level make_periodicity_constraints function to - // every matching pair: - for (typename FaceVector::const_iterator it = matched_cells.begin(); - it != matched_cells.end(); ++it) - { - typedef typename DH::face_iterator FaceIterator; - const FaceIterator &face_1 = it->cell[0]->face(it->face_idx[0]); - const FaceIterator &face_2 = it->cell[1]->face(it->face_idx[1]); - - Assert(face_1->at_boundary() && face_2->at_boundary(), - ExcInternalError()); - - Assert (face_1->boundary_indicator() == b_id && - face_2->boundary_indicator() == b_id, - ExcInternalError()); - - Assert (face_1 != face_2, - ExcInternalError()); - - make_periodicity_constraints(face_1, - face_2, - constraint_matrix, - component_mask - /* standard orientation */); - } + make_periodicity_constraints + (matched_faces, constraint_matrix, component_mask); } @@ -2137,13 +2088,22 @@ namespace DoFTools typename FaceVector::const_iterator it, end_periodic; it = periodic_faces.begin(); end_periodic = periodic_faces.end(); - + + + // And apply the low level make_periodicity_constraints function to + // every matching pair: for(; it!=end_periodic; ++it) { typedef typename DH::face_iterator FaceIterator; const FaceIterator face_1 = it->cell[0]->face(it->face_idx[0]); const FaceIterator face_2 = it->cell[1]->face(it->face_idx[1]); - + + Assert(face_1->at_boundary() && face_2->at_boundary(), + ExcInternalError()); + + Assert (face_1 != face_2, + ExcInternalError()); + make_periodicity_constraints(face_1, face_2, constraint_matrix, diff --git a/deal.II/source/grid/grid_tools.cc b/deal.II/source/grid/grid_tools.cc index f072a4d3dc..4f6981479d 100644 --- a/deal.II/source/grid/grid_tools.cc +++ b/deal.II/source/grid/grid_tools.cc @@ -2547,15 +2547,15 @@ next_cell: if (face_1->at_boundary() && face_1->boundary_indicator() == b_id) { const std::pair pair1 - = std::make_pair(cell, 2*direction); + = std::make_pair(cell, 2*direction); pairs1.insert(pair1); } if (face_2->at_boundary() && face_2->boundary_indicator() == b_id) { - const std::pair pair1 - = std::make_pair(cell, 2*direction+1); - pairs1.insert(pair1); + const std::pair pair2 + = std::make_pair(cell, 2*direction+1); + pairs2.insert(pair2); } } diff --git a/tests/bits/dof_tools_21_b.cc b/tests/bits/dof_tools_21_b.cc index 59cd7bb6dd..8ea53210b8 100644 --- a/tests/bits/dof_tools_21_b.cc +++ b/tests/bits/dof_tools_21_b.cc @@ -49,7 +49,7 @@ using namespace dealii; /* * Generate a grid consisting of two disjoint cells, colorize the two - * outermost faces. They will be matched via collect_periodic_face_pairs + * outermost faces. They will be matched via collect_periodic_faces * * The integer orientation determines the orientation of the second cell * to get something else than the boring default orientation. diff --git a/tests/bits/dof_tools_21_b_x.cc b/tests/bits/dof_tools_21_b_x.cc index c6d8ef6c68..0e5dba1308 100644 --- a/tests/bits/dof_tools_21_b_x.cc +++ b/tests/bits/dof_tools_21_b_x.cc @@ -52,7 +52,7 @@ using namespace dealii; /* * Generate a grid consisting of two disjoint cells, colorize the two - * outermost faces. They will be matched via collect_periodic_face_pairs + * outermost faces. They will be matched via collect_periodic_faces * * The integer orientation determines the orientation of the second cell * to get something else than the boring default orientation. diff --git a/tests/bits/dof_tools_21_b_x_q3.cc b/tests/bits/dof_tools_21_b_x_q3.cc index 9324ce51c5..df47f64bed 100644 --- a/tests/bits/dof_tools_21_b_x_q3.cc +++ b/tests/bits/dof_tools_21_b_x_q3.cc @@ -86,7 +86,7 @@ using namespace dealii; /* * Generate a grid consisting of two disjoint cells, colorize the two - * outermost faces. They will be matched via collect_periodic_face_pairs + * outermost faces. They will be matched via collect_periodic_faces * * The integer orientation determines the orientation of the second cell * to get something else than the boring default orientation. diff --git a/tests/bits/dof_tools_21_b_y.cc b/tests/bits/dof_tools_21_b_y.cc index ca82a6cbac..e819ff257e 100644 --- a/tests/bits/dof_tools_21_b_y.cc +++ b/tests/bits/dof_tools_21_b_y.cc @@ -50,7 +50,7 @@ using namespace dealii; /* * Generate a grid consisting of two disjoint cells, colorize the two - * outermost faces. They will be matched via collect_periodic_face_pairs + * outermost faces. They will be matched via collect_periodic_faces * * The integer orientation determines the orientation of the second cell * to get something else than the boring default orientation. -- 2.39.5