From da6fb4c5443d72e790484e63a23e3e9b4e272860 Mon Sep 17 00:00:00 2001 From: Aidan Thompson Date: Fri, 8 Apr 2022 15:47:12 -0600 Subject: [PATCH] Added epsilon shift to eliminate uneven tiebreaks --- src/compute_grid_local.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/compute_grid_local.cpp b/src/compute_grid_local.cpp index 1b8de3c48a..e99a742c3b 100644 --- a/src/compute_grid_local.cpp +++ b/src/compute_grid_local.cpp @@ -191,6 +191,19 @@ void ComputeGridLocal::set_grid_local() zfrachi = comm->mysplit[2][1]; } + // not fully clear why this works + // without, sometimes get uneven assignments + // in case where ngridz is multiple of nprocz + + double MYEPS = 1.0e-10; + + xfraclo += MYEPS; + xfrachi += MYEPS; + yfraclo += MYEPS; + yfrachi += MYEPS; + zfraclo += MYEPS; + zfrachi += MYEPS; + nxlo = static_cast (xfraclo * nx); if (1.0*nxlo != xfraclo*nx) nxlo++; nxhi = static_cast (xfrachi * nx);