From fd875f66bb859b5965b5aaf6aaeeaa46968f75af Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 29 Aug 2019 00:18:31 -0400 Subject: [PATCH] Use range-based for loop --- source/distributed/tria.cc | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index bb9473154d..b12a32101b 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -4592,18 +4592,12 @@ namespace parallel Assert(this->n_levels() == 1, ExcMessage("The triangulation is refined!")); - using FaceVector = - std::vector>; - typename FaceVector::const_iterator it, periodic_end; - it = periodicity_vector.begin(); - periodic_end = periodicity_vector.end(); - - for (; it < periodic_end; ++it) + for (const auto &face_pair : periodicity_vector) { - const cell_iterator first_cell = it->cell[0]; - const cell_iterator second_cell = it->cell[1]; - const unsigned int face_left = it->face_idx[0]; - const unsigned int face_right = it->face_idx[1]; + const cell_iterator first_cell = face_pair.cell[0]; + const cell_iterator second_cell = face_pair.cell[1]; + const unsigned int face_left = face_pair.face_idx[0]; + const unsigned int face_right = face_pair.face_idx[1]; // respective cells of the matching faces in p4est const unsigned int tree_left = @@ -4620,7 +4614,7 @@ namespace parallel unsigned int p4est_orientation = 0; if (dim == 2) - p4est_orientation = it->orientation[1]; + p4est_orientation = face_pair.orientation[1]; else { const unsigned int face_idx_list[] = {face_left, face_right}; @@ -4681,9 +4675,9 @@ namespace parallel {1, 0, 3, 2}, {1, 3, 0, 2}}; const unsigned int second_dealii_idx_on_face = - lower_idx == 0 ? left_to_right[it->orientation.to_ulong()] + lower_idx == 0 ? left_to_right[face_pair.orientation.to_ulong()] [first_dealii_idx_on_face] : - right_to_left[it->orientation.to_ulong()] + right_to_left[face_pair.orientation.to_ulong()] [first_dealii_idx_on_face]; const unsigned int second_dealii_idx_on_cell = GeometryInfo::face_to_cell_vertices( -- 2.39.5