]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make sure stride_small_size is at least 1.
authorMarc Fehling <mafehling.git@gmail.com>
Fri, 30 Aug 2024 17:13:51 +0000 (11:13 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Fri, 30 Aug 2024 20:23:15 +0000 (14:23 -0600)
source/base/mpi_compute_index_owner_internal.cc

index c7825de9901a1cb160920c4be75c00d3dd994120..d6795a0f35f780b0fc17d7f37033ba8b39d04a68 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <boost/serialization/utility.hpp>
 
+#include <algorithm>
+
 DEAL_II_NAMESPACE_OPEN
 
 namespace Utilities
@@ -439,12 +441,11 @@ namespace Utilities
 
           dofs_per_process = (size + n_procs - 1) / n_procs;
           if (dofs_per_process < range_minimum_grain_size)
-            {
-              dofs_per_process  = range_minimum_grain_size;
-              stride_small_size = dofs_per_process * n_procs / size;
-            }
-          else
-            stride_small_size = 1;
+            dofs_per_process = range_minimum_grain_size;
+
+          stride_small_size =
+            std::max<unsigned int>(dofs_per_process * n_procs / size, 1);
+
           local_range.first  = get_index_offset(my_rank);
           local_range.second = get_index_offset(my_rank + 1);
 

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.