From: Marc Fehling Date: Fri, 30 Aug 2024 17:13:51 +0000 (-0600) Subject: Make sure stride_small_size is at least 1. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=034fee0c8bcf7a5b33683a97745c8b34eff22f7c;p=dealii.git Make sure stride_small_size is at least 1. --- diff --git a/source/base/mpi_compute_index_owner_internal.cc b/source/base/mpi_compute_index_owner_internal.cc index c7825de990..d6795a0f35 100644 --- a/source/base/mpi_compute_index_owner_internal.cc +++ b/source/base/mpi_compute_index_owner_internal.cc @@ -19,6 +19,8 @@ #include +#include + 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(dofs_per_process * n_procs / size, 1); + local_range.first = get_index_offset(my_rank); local_range.second = get_index_offset(my_rank + 1);