From afc43f9cb18f6baede20141e18f96fdd2bc01c5a Mon Sep 17 00:00:00 2001
From: Anna Wellmann <a.wellmann@tu-braunschweig.de>
Date: Tue, 21 Sep 2021 12:57:31 +0200
Subject: [PATCH] Call allocArrays_OffsetScale() before
 allocArrays_BoundaryValues()

needed for new method which reorder send and receive indices
---
 .../GridReaderGenerator/GridGenerator.cpp                      | 2 +-
 src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp                   | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
index 9dc20cceb..0debc795d 100644
--- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
+++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp
@@ -921,7 +921,7 @@ void GridGenerator::allocArrays_OffsetScale()
         builder->getOffsetFC(para->getParH(level)->offFC.xOffFC, para->getParH(level)->offFC.yOffFC, para->getParH(level)->offFC.zOffFC, level);
         builder->getGridInterfaceIndices(para->getParH(level)->intCF.ICellCFC, para->getParH(level)->intCF.ICellCFF, para->getParH(level)->intFC.ICellFCC, para->getParH(level)->intFC.ICellFCF, level);
         
-        if (para->getUseStreams()) {
+        if (para->getUseStreams() || para->getNumprocs() > 1) {
             // split fine-to-coarse indices into border and bulk
             para->getParH(level)->intFCBorder.ICellFCC = para->getParH(level)->intFC.ICellFCC; 
             para->getParH(level)->intFCBorder.ICellFCF = para->getParH(level)->intFC.ICellFCF; 
diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
index d50129fbb..4a7556499 100644
--- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
+++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp
@@ -139,10 +139,9 @@ void Simulation::init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, std
    cudaManager->setMemsizeGPU(0, true);
    //////////////////////////////////////////////////////////////////////////
    gridProvider->allocArrays_CoordNeighborGeo();
+   gridProvider->allocArrays_OffsetScale();
    gridProvider->allocArrays_BoundaryValues();
    gridProvider->allocArrays_BoundaryQs();
-   gridProvider->allocArrays_OffsetScale();
-
 
    //////////////////////////////////////////////////////////////////////////
    //Kernel init
-- 
GitLab