From aa8d751549a5a5abde21b015f60077eb4e557456 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Tue, 16 Mar 2021 15:57:19 -0600 Subject: [PATCH] Review p:fd:Tria::update_cell_relations(). --- source/distributed/fully_distributed_tria.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/source/distributed/fully_distributed_tria.cc b/source/distributed/fully_distributed_tria.cc index c49843ccd6..802d8b5996 100644 --- a/source/distributed/fully_distributed_tria.cc +++ b/source/distributed/fully_distributed_tria.cc @@ -408,20 +408,13 @@ namespace parallel Triangulation::update_cell_relations() { // Reorganize memory for local_cell_relations. - this->local_cell_relations.resize(this->n_locally_owned_active_cells()); - this->local_cell_relations.shrink_to_fit(); + this->local_cell_relations.clear(); + this->local_cell_relations.reserve(this->n_locally_owned_active_cells()); - unsigned int cell_id = 0; - - for (auto cell = this->begin_active(); cell != this->end(); ++cell) - { - if (!cell->is_locally_owned()) - continue; - - this->local_cell_relations[cell_id] = - std::make_pair(cell, Triangulation::CELL_PERSIST); - ++cell_id; - } + for (const auto &cell : this->active_cell_iterators()) + if (cell->is_locally_owned()) + this->local_cell_relations.emplace_back( + cell, Triangulation::CELL_PERSIST); } -- 2.39.5