]> https://gitweb.dealii.org/ - dealii.git/commitdiff
TriangulationBase::reset_global_cell_indices(): collect indices manually 11756/head
authorPeter Munch <peterrmuench@gmail.com>
Mon, 15 Feb 2021 11:45:21 +0000 (12:45 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 15 Feb 2021 12:53:57 +0000 (13:53 +0100)
source/distributed/tria_base.cc

index 9d3fa9eb946e8a7984f69d87f95f8cef70257c0e..a27a626cee34db7b96a6e530a882b9d3c9e5bde8 100644 (file)
@@ -417,8 +417,8 @@ namespace parallel
       });
 
     // 5) set up new partitioner
-    IndexSet is_local(this->n_global_active_cells());
-    IndexSet is_ghost(this->n_global_active_cells());
+    std::vector<types::global_dof_index> is_local_vector;
+    std::vector<types::global_dof_index> is_ghost_vector;
 
     for (const auto &cell : this->active_cell_iterators())
       if (!cell->is_artificial())
@@ -429,11 +429,19 @@ namespace parallel
             continue;
 
           if (cell->is_locally_owned())
-            is_local.add_index(index);
+            is_local_vector.push_back(index);
           else
-            is_ghost.add_index(index);
+            is_ghost_vector.push_back(index);
         }
 
+    std::sort(is_local_vector.begin(), is_local_vector.end());
+    IndexSet is_local(this->n_global_active_cells());
+    is_local.add_indices(is_local_vector.begin(), is_local_vector.end());
+
+    std::sort(is_ghost_vector.begin(), is_ghost_vector.end());
+    IndexSet is_ghost(this->n_global_active_cells());
+    is_ghost.add_indices(is_ghost_vector.begin(), is_ghost_vector.end());
+
     number_cache.active_cell_index_partitioner =
       Utilities::MPI::Partitioner(is_local, is_ghost, this->mpi_communicator);
 
@@ -497,8 +505,8 @@ namespace parallel
         // 6) set up cell partitioners for each level
         for (unsigned int l = 0; l < this->n_global_levels(); ++l)
           {
-            IndexSet is_local(n_cells_level[l]);
-            IndexSet is_ghost(n_cells_level[l]);
+            std::vector<types::global_dof_index> is_local_vector;
+            std::vector<types::global_dof_index> is_ghost_vector;
 
             for (const auto &cell : this->cell_iterators_on_level(l))
               if (cell->level_subdomain_id() !=
@@ -511,11 +519,22 @@ namespace parallel
 
                   if (cell->level_subdomain_id() ==
                       this->locally_owned_subdomain())
-                    is_local.add_index(index);
+                    is_local_vector.push_back(index);
                   else
-                    is_ghost.add_index(index);
+                    is_ghost_vector.push_back(index);
+                  ;
                 }
 
+            IndexSet is_local(n_cells_level[l]);
+            std::sort(is_local_vector.begin(), is_local_vector.end());
+            is_local.add_indices(is_local_vector.begin(),
+                                 is_local_vector.end());
+
+            IndexSet is_ghost(n_cells_level[l]);
+            std::sort(is_ghost_vector.begin(), is_ghost_vector.end());
+            is_ghost.add_indices(is_ghost_vector.begin(),
+                                 is_ghost_vector.end());
+
             number_cache.level_cell_index_partitioners[l] =
               Utilities::MPI::Partitioner(is_local,
                                           is_ghost,

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.