diff --git a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h index 7f4be24b9f39ae54916358880372f71ebf857069..55cfad75b7503b6873ffe58fea147814b81dc5f4 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/GridBuilder.h @@ -86,15 +86,9 @@ public: virtual uint getNumberOfReceiveIndices( int direction, uint level ) = 0; virtual void getSendIndices( int* sendIndices, int direction, int level ) = 0; virtual void getReceiveIndices( int* sendIndices, int direction, int level ) = 0; - virtual void reorderSendIndexForCommAfterFtoC(int *sendIndices, uint &numberOfSendNeighborsAfterFtoC, - uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, - int level) = 0; - virtual void reorderRecvIndexForCommAfterFtoC(int *recvIndices, uint &numberOfRecvNeighborsAfterFtoC, - uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, - int level) = 0; - virtual void getAndReorderSendIndices(int *sendIndices, uint &numberOfSendNeighborsAfterFtoC, uint *iCellFCCBorder, - uint sizeOfICellFCCBorder, int direction, int level, - bool sendIndicesNeedToBeReordered) = 0; + virtual std::vector<uint> getAndReorderSendIndices(int *sendIndices, uint &numberOfSendNeighborsAfterFtoC, + uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, + int level, bool sendIndicesNeedToBeReordered) = 0; virtual void getAndReorderReceiveIndices(int *recvIndices, uint &numberOfRecvNeighborsAfterFtoC, uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, int level, bool receiveIndicesNeedToBeReordered) = 0; diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index 2ccf96b4e9b03dca89d6bca7e0bdab38f18cdff0..0d52b68a6e0115b9e423b1171f2d0b4df599f495 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -265,17 +265,20 @@ GRIDGENERATOR_EXPORT void LevelGridBuilder::getReceiveIndices(int * receiveIndic receiveIndices[i] = grid->getSparseIndex( grid->getReceiveIndex(direction, i) ) + 1; } } -GRIDGENERATOR_EXPORT void LevelGridBuilder::getAndReorderSendIndices(int *sendIndices, - uint &numberOfSendNeighborsAfterFtoC, - uint *iCellFCCBorder, uint sizeOfICellFCCBorder, - int direction, int level, - bool sendIndicesNeedToBeReordered) +GRIDGENERATOR_EXPORT std::vector<uint> LevelGridBuilder::getAndReorderSendIndices(int *sendIndices, + uint &numberOfSendNeighborsAfterFtoC, + uint *iCellFCCBorder, uint sizeOfICellFCCBorder, + int direction, int level, + bool sendIndicesNeedToBeReordered) { + std::vector<uint> sendIndicesForCommAfterFtoCPositions; getSendIndices(sendIndices, direction, level); if (sendIndicesNeedToBeReordered) reorderSendIndexForCommAfterFtoC(sendIndices, numberOfSendNeighborsAfterFtoC, iCellFCCBorder, - sizeOfICellFCCBorder, direction, level); + sizeOfICellFCCBorder, direction, level, sendIndicesForCommAfterFtoCPositions); + return sendIndicesForCommAfterFtoCPositions; } + GRIDGENERATOR_EXPORT void LevelGridBuilder::getAndReorderReceiveIndices(int *recvIndices, uint &numberOfRecvNeighborsAfterFtoC, uint *iCellFCCBorder, uint sizeOfICellFCCBorder, @@ -289,8 +292,8 @@ GRIDGENERATOR_EXPORT void LevelGridBuilder::getAndReorderReceiveIndices(int *rec } GRIDGENERATOR_EXPORT void LevelGridBuilder::reorderSendIndexForCommAfterFtoC(int *sendIndices, uint &numberOfSendNeighborsAfterFtoC, - uint* iCellFCCBorder, uint sizeOfICellFCCBorder, - int direction, int level) + uint* iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, + int level, std::vector<uint> &sendIndicesForCommAfterFtoCPositions) { *logging::out << logging::Logger::INFO_INTERMEDIATE << "reorder send indices for communication after fine to coarse: level: " << level @@ -326,9 +329,10 @@ GRIDGENERATOR_EXPORT void LevelGridBuilder::reorderSendIndexForCommAfterFtoC(int } // add index to corresponding vector - if (isInICellFCCBorder) + if (isInICellFCCBorder) { sendIndicesAfterFtoC.push_back(sparseIndexSend); - else + sendIndicesForCommAfterFtoCPositions.push_back(i); + } else sendIndicesOther.push_back(sparseIndexSend); } diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h index ba4b09986bca320557c23135efec58083dda0dbc..ccff4cd5da202994d605e1c2c5a9442e2fdddd30 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h @@ -149,19 +149,23 @@ public: GRIDGENERATOR_EXPORT uint getNumberOfReceiveIndices( int direction, uint level ) override; GRIDGENERATOR_EXPORT void getSendIndices( int* sendIndices, int direction, int level ) override; GRIDGENERATOR_EXPORT void getReceiveIndices( int* sendIndices, int direction, int level ) override; - GRIDGENERATOR_EXPORT void getAndReorderSendIndices(int *sendIndices, uint &numberOfSendNeighborsAfterFtoC, - uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, - int level, bool sendIndicesNeedToBeReordered) override; - GRIDGENERATOR_EXPORT void getAndReorderReceiveIndices(int *recvIndices, uint &numberOfRecvNeighborsAfterFtoC, + GRIDGENERATOR_EXPORT std::vector<uint> getAndReorderSendIndices(int *sendIndices, + uint &numberOfSendNeighborsAfterFtoC, + uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, int level, + bool sendIndicesNeedToBeReordered) override; + ; + GRIDGENERATOR_EXPORT void getAndReorderReceiveIndices(int *recvIndices, + uint &numberOfRecvNeighborsAfterFtoC, uint *iCellFCCBorder, uint sizeOfICellFCCBorder, int direction, int level, bool receiveIndicesNeedToBeReordered) override; GRIDGENERATOR_EXPORT void reorderSendIndexForCommAfterFtoC(int *sendIndices, uint &numberOfSendNeighborsAfterFtoC, uint *iCellFCCBorder, uint sizeOfICellFCCBorder, - int direction, int level) override; + int direction, int level, + std::vector<uint> &sendIndicesForCommAfterFtoCPositions); GRIDGENERATOR_EXPORT void reorderRecvIndexForCommAfterFtoC(int *recvIndices, uint &numberOfRecvNeighborsAfterFtoC, uint *iCellFCCBorder, uint sizeOfICellFCCBorder, - int direction, int level) override; + int direction, int level); }; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index edd9d4eb63085d915136132412b57e7c78aefe89..c0532311eb85bba2bbca4fa97d5f9f77b095f939 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -322,7 +322,7 @@ void GridGenerator::allocArrays_BoundaryValues() //////////////////////////////////////////////////////////////////////////////////////// //init index arrays para->initNumberOfProcessNeighborsAfterFtoCX(level); - builder->getAndReorderSendIndices( + std::vector<uint> sendIndicesForCommAfterFtoCPositions = builder->getAndReorderSendIndices( para->getParH(level)->sendProcessNeighborX[j].index, para->getParH(level)->numberOfSendProcessNeighborsAfterFtoCX[j], para->getParH(level)->intFCBorder.ICellFCC, para->getParH(level)->intFCBorder.kFC, @@ -331,7 +331,7 @@ void GridGenerator::allocArrays_BoundaryValues() para->getParH(level)->recvProcessNeighborX[j].index, para->getParH(level)->numberOfRecvProcessNeighborsAfterFtoCX[j], para->getParH(level)->intFC.ICellFCC, para->getParH(level)->intFC.kFC, direction, level, - level!=builder->getNumberOfGridLevels()-1); + level != builder->getNumberOfGridLevels() - 1); para->getParD(level)->numberOfSendProcessNeighborsAfterFtoCX[j] = para->getParH(level)->numberOfSendProcessNeighborsAfterFtoCX[j]; para->getParD(level)->numberOfRecvProcessNeighborsAfterFtoCX[j] = @@ -395,7 +395,7 @@ void GridGenerator::allocArrays_BoundaryValues() //////////////////////////////////////////////////////////////////////////////////////// //init index arrays para->initNumberOfProcessNeighborsAfterFtoCY(level); - builder->getAndReorderSendIndices( + std::vector<uint> sendIndicesForCommAfterFtoCPositions = builder->getAndReorderSendIndices( para->getParH(level)->sendProcessNeighborY[j].index, para->getParH(level)->numberOfSendProcessNeighborsAfterFtoCY[j], para->getParH(level)->intFCBorder.ICellFCC, para->getParH(level)->intFCBorder.kFC, @@ -468,7 +468,7 @@ void GridGenerator::allocArrays_BoundaryValues() //////////////////////////////////////////////////////////////////////////////////////// //init index arrays para->initNumberOfProcessNeighborsAfterFtoCZ(level); - builder->getAndReorderSendIndices( + std::vector<uint> sendIndicesForCommAfterFtoCPositions = builder->getAndReorderSendIndices( para->getParH(level)->sendProcessNeighborZ[j].index, para->getParH(level)->numberOfSendProcessNeighborsAfterFtoCZ[j], para->getParH(level)->intFCBorder.ICellFCC, para->getParH(level)->intFCBorder.kFC,