Added epsilon shift to eliminate uneven tiebreaks

This commit is contained in:
Aidan Thompson
2022-04-08 15:47:12 -06:00
parent 6ef7d19fc0
commit da6fb4c544

View File

@ -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<int> (xfraclo * nx);
if (1.0*nxlo != xfraclo*nx) nxlo++;
nxhi = static_cast<int> (xfrachi * nx);