From bb74bd280e3e0bb87468dc84f79cefec2fb892d8 Mon Sep 17 00:00:00 2001
From: Rafael Ravedutti <rafaelravedutti@gmail.com>
Date: Tue, 18 Oct 2022 13:01:40 +0200
Subject: [PATCH] Include small value in subdomain check to not remove
 intersection particles

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
---
 runtime/domain/regular_6d_stencil.hpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/runtime/domain/regular_6d_stencil.hpp b/runtime/domain/regular_6d_stencil.hpp
index 0658191..4542f2f 100644
--- a/runtime/domain/regular_6d_stencil.hpp
+++ b/runtime/domain/regular_6d_stencil.hpp
@@ -2,6 +2,8 @@
 
 #pragma once
 
+#define SMALL   0.00001
+
 typedef double real_t;
 
 namespace pairs {
@@ -96,9 +98,9 @@ public:
     int getWorldSize() const { return world_size; }
     int getRank() const { return rank; }
     int isWithinSubdomain(real_t x, real_t y, real_t z) {
-        return x > subdom_min[0] && x < subdom_max[0] &&
-               y > subdom_min[1] && y < subdom_max[1] &&
-               z > subdom_min[2] && z < subdom_max[2];
+        return x >= subdom_min[0] && x < subdom_max[0] - SMALL &&
+               y >= subdom_min[1] && y < subdom_max[1] - SMALL &&
+               z >= subdom_min[2] && z < subdom_max[2] - SMALL;
     }
 
     void fillArrays(int neighbor_ranks[], int pbc[], real_t subdom[]) {
-- 
GitLab