]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix bug for global coarsening: Must allow invalid proc id 13858/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 30 May 2022 15:06:11 +0000 (17:06 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Mon, 30 May 2022 15:07:09 +0000 (17:07 +0200)
include/deal.II/base/mpi_compute_index_owner_internal.h
source/base/mpi_compute_index_owner_internal.cc

index 88ea9c88bd7756f14c78a2d5c26155f76d475b74..195b19e15591e8e38fa5ad5c095a46b4c2fd1a5f 100644 (file)
@@ -45,7 +45,9 @@ namespace Utilities
           FlexibleIndexStorage(const bool use_vector = true);
 
           void
-          reinit(const bool use_vector, const std::size_t size);
+          reinit(const bool        use_vector,
+                 const bool        index_range_contiguous,
+                 const std::size_t size);
 
           void
           fill(const std::size_t start,
index 53ad820a52eaf0f1f6b9491a31ca223b32745537..c70898afa83196a24437f1eda3f90a9901c89bd5 100644 (file)
@@ -44,6 +44,7 @@ namespace Utilities
 
         void
         FlexibleIndexStorage::reinit(const bool        use_vector,
+                                     const bool        index_range_contiguous,
                                      const std::size_t size)
         {
           this->use_vector = use_vector;
@@ -52,8 +53,10 @@ namespace Utilities
           data = {};
           data_map.clear();
 
-          // do not initialize the vector but only upon first request in
-          // `fill`
+          // in case we have contiguous indices, only fill the vector upon
+          // first request in `fill`
+          if (!index_range_contiguous)
+            data.resize(size, invalid_index_value);
         }
 
 
@@ -263,6 +266,8 @@ namespace Utilities
 
           actually_owning_ranks.reinit((owned_indices_size_actual *
                                         sparsity_factor) > owned_indices.size(),
+                                       owned_indices_size_actual ==
+                                         owned_indices.size(),
                                        locally_owned_size);
 
           // 2) collect relevant processes and process local dict entries

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.