From 406ceab69a6d0257d0ce1ce4c76fd6e4380fcdcb Mon Sep 17 00:00:00 2001
From: Rafael Ravedutti <rafaelravedutti@gmail.com>
Date: Wed, 28 Sep 2022 14:08:10 +0200
Subject: [PATCH] Fix checking for last rank in specific dimension

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
---
 runtime/domain/regular_6d_stencil.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/runtime/domain/regular_6d_stencil.hpp b/runtime/domain/regular_6d_stencil.hpp
index 6414e4c..ddff6e8 100644
--- a/runtime/domain/regular_6d_stencil.hpp
+++ b/runtime/domain/regular_6d_stencil.hpp
@@ -69,7 +69,7 @@ public:
         for(int d = 0; d < ndims; d++) {
             MPI_Cart_shift(cartesian, d, 1, &(this->prev[d]), &(this->next[d]));
             this->pbc_prev[d] = (myloc[d] == 0) ? 1 : 0;
-            this->pbc_next[d] = (myloc[d] == this->nranks[d]) ? -1 : 0;
+            this->pbc_next[d] = (myloc[d] == this->nranks[d] - 1) ? -1 : 0;
             this->subdom_min[d] = this->grid_min[d] + rank_length[d] * (real_t)myloc[d];
             this->subdom_max[d] = this->subdom_min[d] + rank_length[d];
         }
-- 
GitLab