]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Review p:fd:Tria::update_cell_relations().
authorMarc Fehling <mafehling.git@gmail.com>
Tue, 16 Mar 2021 21:57:19 +0000 (15:57 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Wed, 17 Mar 2021 20:33:14 +0000 (14:33 -0600)
source/distributed/fully_distributed_tria.cc

index c49843ccd66b2b9de744d4bec238f71285140c84..802d8b599690c2c374f3e6a9b59fe0114b60fac7 100644 (file)
@@ -408,20 +408,13 @@ namespace parallel
     Triangulation<dim, spacedim>::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<dim, spacedim>::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<dim, spacedim>::CELL_PERSIST);
     }
 
 

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.