]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some logic in Triangulation::prepare_coarsening_and_refinement 7042/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 21 Aug 2018 08:35:55 +0000 (10:35 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 21 Aug 2018 08:35:55 +0000 (10:35 +0200)
source/grid/tria.cc

index 053a255cc01559831a27c8312604d088f115bf92..1f899779f8a488ce77ba54a276073358cec12de6 100644 (file)
@@ -14483,10 +14483,12 @@ Triangulation<dim, spacedim>::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<dim>::face_refinement_case(
-                           cell->refine_flag_set(), i) !=
-                         RefinementCase<dim - 1>::no_refinement))
+                    const bool has_neighbor_or_periodic_neighbor =
+                      !cell->at_boundary(i) || has_periodic_neighbor;
+                    if (has_neighbor_or_periodic_neighbor &&
+                        GeometryInfo<dim>::face_refinement_case(
+                          cell->refine_flag_set(), i) !=
+                          RefinementCase<dim - 1>::no_refinement)
                       {
                         // 1) if the neighbor has children: nothing to
                         // worry about.  2) if the neighbor is active
@@ -14707,7 +14709,7 @@ Triangulation<dim, spacedim>::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<dim, spacedim>::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 ==

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.