From: Marc Fehling Date: Tue, 16 Mar 2021 21:57:19 +0000 (-0600) Subject: Review p:fd:Tria::update_cell_relations(). X-Git-Tag: v9.3.0-rc1~294^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa8d751549a5a5abde21b015f60077eb4e557456;p=dealii.git Review p:fd:Tria::update_cell_relations(). --- 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); }