From ce0a162f5224c46fedff7afaca5e2dae138ef5cd Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Tue, 21 Aug 2018 10:35:55 +0200 Subject: [PATCH] Simplify some logic in Triangulation::prepare_coarsening_and_refinement --- source/grid/tria.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 == -- 2.39.5