From: Daniel Arndt Date: Tue, 21 Aug 2018 08:35:55 +0000 (+0200) Subject: Simplify some logic in Triangulation::prepare_coarsening_and_refinement X-Git-Tag: v9.1.0-rc1~798^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7042%2Fhead;p=dealii.git Simplify some logic in Triangulation::prepare_coarsening_and_refinement --- diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 053a255cc0..1f899779f8 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -14483,10 +14483,12 @@ Triangulation::prepare_coarsening_and_refinement() // the RefineCase currently flagged for const bool has_periodic_neighbor = cell->has_periodic_neighbor(i); - if ((!cell->at_boundary(i) || has_periodic_neighbor) && - (GeometryInfo::face_refinement_case( - cell->refine_flag_set(), i) != - RefinementCase::no_refinement)) + const bool has_neighbor_or_periodic_neighbor = + !cell->at_boundary(i) || has_periodic_neighbor; + if (has_neighbor_or_periodic_neighbor && + GeometryInfo::face_refinement_case( + cell->refine_flag_set(), i) != + RefinementCase::no_refinement) { // 1) if the neighbor has children: nothing to // worry about. 2) if the neighbor is active @@ -14707,7 +14709,7 @@ Triangulation::prepare_coarsening_and_refinement() const auto parent_face = [&]() { if (has_periodic_neighbor) { - const auto &neighbor = + const auto neighbor = cell->periodic_neighbor(i); const auto parent_face_no = neighbor @@ -14719,9 +14721,8 @@ Triangulation::prepare_coarsening_and_refinement() return parent->face(parent_face_no); } else - return cell - ->neighbor_or_periodic_neighbor(i) - ->face(nb_indices.first); + return cell->neighbor(i)->face( + nb_indices.first); }(); if ((this_face_index ==