From f1356edaef4076c1047b8c0027e37a63b1980135 Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-bs.de>
Date: Fri, 22 Apr 2022 14:47:02 +0200
Subject: [PATCH] Only copy send nodes which are not part of the reduced
 communication (for reduced comm after fine to coarse)

---
 src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp
index 8420ee6f0..2d2573417 100644
--- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp
+++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27.cpp
@@ -317,6 +317,11 @@ void copyEdgeNodes(std::vector<LBMSimulationParameter::EdgeNodePositions> &edgeN
             numNodesInBufferX = recvProcessNeighborHostAllNodes[indexInSubdomainX].numberOfNodes;
             numNodesInBufferZ = sendProcessNeighborHostAllNodes[indexInSubdomainZ].numberOfNodes;
 
+            if(edgeNodes[i].indexInSendBuffer >= sendProcessNeighborHost[indexInSubdomainZ].numberOfNodes){
+                // for reduced communication after fine to coarse: only copy send nodes which are not part of the reduced comm
+                continue;
+            }
+
             for (uint direction = 0; direction <= dirEND; direction++) {
                 (sendProcessNeighborHostAllNodes[indexInSubdomainZ].f[0] + (direction * numNodesInBufferZ))[edgeNodes[i].indexInSendBuffer] =
                     (recvProcessNeighborHostAllNodes[indexInSubdomainX].f[0] + (direction * numNodesInBufferX))[edgeNodes[i].indexInRecvBuffer];
-- 
GitLab