From eb1202a544bfa7030b49a2db3d193a65abbde8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com> Date: Tue, 12 Feb 2019 21:06:15 +0100 Subject: [PATCH] Fixed periodic boundary overlap set-up for distributed mesh synchronizer. --- .../DistributedGridSynchronizer.h | 4 +++- .../DistributedGridTest_1D.cpp | 18 +++++++++--------- .../DistributedGridTest_2D.cpp | 12 ++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h index 286694e9fc..9ff025c409 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h @@ -157,7 +157,9 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension, //send everything, recieve everything for( int i=0; i<this->getNeighborCount(); i++ ) { - TNL_MPI_PRINT( "Sending data... " << i << " sizes -> " << sendSizes[ i ] ); + TNL_MPI_PRINT( "Sending data... " << i << " sizes -> " + << sendSizes[ i ] << "sendDimensions -> " << sendDimensions[ i ] + << " upperOverlap -> " << this->distributedGrid->getUpperOverlap() ); if( neighbors[ i ] != -1 ) { TNL_MPI_PRINT( "Sending data to node " << neighbors[ i ] ); diff --git a/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp b/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp index 9f9fdcd39c..0587667e71 100644 --- a/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp +++ b/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp @@ -247,7 +247,7 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithoutMask ) // TODO: I do not know how to do it better with GTEST typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridptr); dof.setSize( gridptr->template getEntitiesCount< Cell >() ); @@ -259,14 +259,14 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithoutMask ) maskDofs.setValue( true ); //constFunctionEvaluator.evaluateAllEntities( meshFunctionPtr, constFunctionPtr ); meshFunctionPtr->getSynchronizer().setPeriodicBoundariesCopyDirection( Synchronizer::OverlapToBoundary ); - TNL_MPI_PRINT( ">>>>>>>>>>>>>> " << dof[ 1 ] << " : " << -rank - 1 ); + //TNL_MPI_PRINT( ">>>>>>>>>>>>>> " << dof[ 1 ] << " : " << -rank - 1 ); meshFunctionPtr->template synchronize<CommunicatorType>( true ); - TNL_MPI_PRINT( "#########" << dof[ 1 ] ); - /*if( rank == 0 ) + //TNL_MPI_PRINT( "#########" << dof[ 1 ] ); + if( rank == 0 ) EXPECT_EQ( dof[ 1 ], -nproc ) << "Left Overlap was filled by wrong process."; if( rank == nproc-1 ) - EXPECT_EQ( dof[ dof.getSize() - 2 ], -1 )<< "Right Overlap was filled by wrong process.";*/ + EXPECT_EQ( dof[ dof.getSize() - 2 ], -1 )<< "Right Overlap was filled by wrong process."; } #ifdef UNDEF @@ -276,7 +276,7 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithActiveMask ) // TODO: I do not know how to do it better with GTEST typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridptr); dof.setSize( gridptr->template getEntitiesCount< Cell >() ); @@ -301,7 +301,7 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithInactiveMaskOnLef // TODO: I do not know how to do it better with GTEST typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridptr); dof.setSize( gridptr->template getEntitiesCount< Cell >() ); @@ -328,7 +328,7 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithInactiveMask ) // TODO: I do not know how to do it better with GTEST typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridptr); dof.setSize( gridptr->template getEntitiesCount< Cell >() ); @@ -358,7 +358,7 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicBoundariesLinearTest ) // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridptr); dof.setSize( gridptr->template getEntitiesCount< Cell >() ); diff --git a/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_2D.cpp b/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_2D.cpp index 94fb099533..94057a7555 100644 --- a/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_2D.cpp +++ b/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_2D.cpp @@ -533,7 +533,7 @@ TEST_F(DistributedGridTest_2D, SynchronizerNeighborPeriodicBoundariesWithoutMask // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridPtr); dof->setSize( gridPtr->template getEntitiesCount< Cell >() ); @@ -605,7 +605,7 @@ TEST_F(DistributedGridTest_2D, SynchronizerNeighborPeriodicBoundariesWithActiveM // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridPtr); dof->setSize( gridPtr->template getEntitiesCount< Cell >() ); @@ -680,7 +680,7 @@ TEST_F(DistributedGridTest_2D, SynchronizerNeighborPeriodicBoundariesWithInactiv // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridPtr); dof->setSize( gridPtr->template getEntitiesCount< Cell >() ); @@ -765,7 +765,7 @@ TEST_F(DistributedGridTest_2D, SynchronizerNeighborPeriodicBoundariesWithInActiv // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridPtr); dof->setSize( gridPtr->template getEntitiesCount< Cell >() ); @@ -850,7 +850,7 @@ TEST_F(DistributedGridTest_2D, SynchronizerNeighborPeriodicBoundariesWithInActiv // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridPtr); dof->setSize( gridPtr->template getEntitiesCount< Cell >() ); @@ -935,7 +935,7 @@ TEST_F(DistributedGridTest_2D, SynchronizerNeighborPeriodicBoundariesWithInActiv // of the periodic boundaries typename DistributedGridType::SubdomainOverlapsType lowerOverlap, upperOverlap; SubdomainOverlapsGetter< GridType, CommunicatorType >:: - getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1 ); + getOverlaps( distributedGrid, lowerOverlap, upperOverlap, 1, 1, 1 ); distributedGrid->setOverlaps( lowerOverlap, upperOverlap ); distributedGrid->setupGrid(*gridPtr); dof->setSize( gridPtr->template getEntitiesCount< Cell >() ); -- GitLab