From bdde8af70f71024fc67da9c4137ca8b5ce7415a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com> Date: Thu, 7 Feb 2019 20:54:47 +0100 Subject: [PATCH] DistributedGridSynchronizer code reformating. --- .../DistributedGridSynchronizer.h | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h index 15d2eae06d..3bc695c3a0 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h @@ -149,13 +149,13 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension, neighbors, periodicBoundaries, PeriodicBoundariesMaskPointer( nullptr ) ); // the mask is used only when receiving data ); - + //async send and receive typename CommunicatorType::Request requests[2*this->getNeighborCount()]; typename CommunicatorType::CommunicationGroup group; group=*((typename CommunicatorType::CommunicationGroup *)(distributedGrid->getCommunicationGroup())); int requestsCount( 0 ); - + //send everything, recieve everything for( int i=0; i<this->getNeighborCount(); i++ ) if( neighbors[ i ] != -1 ) @@ -173,19 +173,19 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension, CommunicatorType::WaitAll( requests, requestsCount ); //copy data from receive buffers - copyBuffers(meshFunction, - recieveBuffers,recieveBegin,sendDimensions , + copyBuffers(meshFunction, + recieveBuffers,recieveBegin,sendDimensions , false, neighbors, periodicBoundaries, mask ); } - - private: - template< typename Real_, + + private: + template< typename Real_, typename MeshFunctionType, typename PeriodicBoundariesMaskPointer > - void copyBuffers( + void copyBuffers( MeshFunctionType& meshFunction, Containers::Array<Real_, Device, Index>* buffers, CoordinatesType* begins, @@ -199,29 +199,28 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension, for(int i=0;i<this->getNeighborCount();i++) { - bool isBoundary=( neighbor[ i ] == -1 ); + bool isBoundary=( neighbor[ i ] == -1 ); if( ! isBoundary || periodicBoundaries ) { - Helper::BufferEntities( meshFunction, mask, buffers[ i ].getData(), isBoundary, begins[i], sizes[i], toBuffer ); - } - } + Helper::BufferEntities( meshFunction, mask, buffers[ i ].getData(), isBoundary, begins[i], sizes[i], toBuffer ); + } + } } - + private: - + Containers::Array<RealType, Device, Index> sendBuffers[getNeighborCount()]; Containers::Array<RealType, Device, Index> recieveBuffers[getNeighborCount()]; Containers::StaticArray< getNeighborCount(), int > sendSizes; - + CoordinatesType sendDimensions[getNeighborCount()]; CoordinatesType recieveDimensions[getNeighborCount()]; CoordinatesType sendBegin[getNeighborCount()]; CoordinatesType recieveBegin[getNeighborCount()]; - + DistributedGridType *distributedGrid; bool isSet; - }; -- GitLab