From 86749929b47a3417db9aeb3faa5af88d9ef8342b Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 30 Mar 2021 19:03:25 +0200 Subject: [PATCH] Avoid quadratic complexity in coarse grid cells. --- source/distributed/tria.cc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 583464bbfc..69a280d741 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -2322,18 +2322,12 @@ namespace parallel // set all cells to artificial. we will later set it to the correct // subdomain in match_tree_recursively - for (typename Triangulation::cell_iterator cell = - this->begin(0); - cell != this->end(0); - ++cell) + for (const auto &cell : this->cell_iterators_on_level(0)) cell->recursively_set_subdomain_id(numbers::artificial_subdomain_id); do { - for (typename Triangulation::cell_iterator cell = - this->begin(0); - cell != this->end(0); - ++cell) + for (const auto &cell : this->cell_iterators_on_level(0)) { // if this processor stores no part of the forest that comes out // of this coarse grid cell, then we need to delete all children @@ -3355,10 +3349,7 @@ namespace parallel this->local_cell_relations.shrink_to_fit(); // recurse over p4est - for (typename Triangulation::cell_iterator cell = - this->begin(0); - cell != this->end(0); - ++cell) + for (const auto &cell : this->cell_iterators_on_level(0)) { // skip coarse cells that are not ours if (tree_exists_locally( -- 2.39.5