From b9368d4992b5e7f541ce34586975dba0838545d7 Mon Sep 17 00:00:00 2001 From: Anna Wellmann <a.wellmann@tu-bs.de> Date: Tue, 26 Apr 2022 15:09:29 +0200 Subject: [PATCH] Modify test for copyEdgeNodes to adapt to amended method --- .../Communication/ExchangeData27Test.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp index fbd244a2a..0da86e64d 100644 --- a/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp +++ b/src/gpu/VirtualFluids_GPU/Communication/ExchangeData27Test.cpp @@ -37,20 +37,30 @@ TEST(ExchangeData27Test, copyEdgeNodes_XZ_CommunicationAfterFtoC) para->getParH(level)->edgeNodesXtoZ.emplace_back(0,2,0,3); para->getParH(level)->edgeNodesXtoZ.emplace_back(0,7,0,8); - int numNodes = 5; + int numNodes = 10; + int numNodesAfterFtoC = 5; + std::vector<ProcessNeighbor27> recvProcessNeighborHost(1); - std::vector<real> recvFs(27*numNodes, 0.1); + std::vector<real> recvFs(numNodes, 0.5); + for (LBMSimulationParameter::EdgeNodePositions edgeNode : para->getParH(level)->edgeNodesXtoZ){ + recvFs[edgeNode.indexInRecvBuffer] = 0.1; + } + for (uint direction = 0; direction <= dirEND; direction ++){ + recvFs.insert(recvFs.end(), recvFs.begin(), recvFs.begin()+10); + } recvProcessNeighborHost[0].f[0] = recvFs.data(); recvProcessNeighborHost[0].numberOfNodes = numNodes; + + std::vector<ProcessNeighbor27> sendProcessNeighborHost(1); - std::vector<real> sendFs(27*numNodes, 0.0); + std::vector<real> sendFs(27*numNodesAfterFtoC, 0.0); sendProcessNeighborHost[0].f[0] = sendFs.data(); - sendProcessNeighborHost[0].numberOfNodes = numNodes; + sendProcessNeighborHost[0].numberOfNodes = numNodesAfterFtoC; // expected - std::vector<real> expectedFs(numNodes, 0.0); + std::vector<real> expectedFs(numNodesAfterFtoC, 0.0); expectedFs[1] = 0.1; expectedFs[3] = 0.1; std::vector<real> expectedFsAllDirections; @@ -63,7 +73,7 @@ TEST(ExchangeData27Test, copyEdgeNodes_XZ_CommunicationAfterFtoC) // convert result to std::vector std::vector<real> result; - result.assign(sendProcessNeighborHost[0].f[0], sendProcessNeighborHost[0].f[0] + 27*numNodes); + result.assign(sendProcessNeighborHost[0].f[0], sendProcessNeighborHost[0].f[0] + 27*numNodesAfterFtoC); EXPECT_THAT(result, testing::Eq(expectedFsAllDirections)); } -- GitLab