From 675024b26465f8ddad9221bf49f27e16dea8509a Mon Sep 17 00:00:00 2001 From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz> Date: Tue, 12 Feb 2019 14:58:00 +0100 Subject: [PATCH] [WIP] Fixing distributed grid MPI tests. --- src/TNL/Functions/MeshFunction.h | 16 +++++++++++++--- .../DistributedGridSynchronizer.h | 5 +++++ .../DistributedMeshes/DistributedGridTest_1D.cpp | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/TNL/Functions/MeshFunction.h b/src/TNL/Functions/MeshFunction.h index 32d54ec213..9d67808e1e 100644 --- a/src/TNL/Functions/MeshFunction.h +++ b/src/TNL/Functions/MeshFunction.h @@ -163,6 +163,16 @@ class MeshFunction : using Object::boundLoad; + DistributedMeshSynchronizerType& getSynchronizer() + { + return this->synchronizer; + } + + const DistributedMeshSynchronizerType& getSynchronizer() const + { + return this->synchronizer; + } + template< typename CommunicatorType, typename PeriodicBoundariesMaskType = MeshFunction< Mesh, MeshEntityDimension, bool > > void synchronize( bool withPeriodicBoundaryConditions = false, @@ -171,8 +181,9 @@ class MeshFunction : protected: - //DistributedMeshSynchronizerType synchronizer; - Meshes::DistributedMeshes::DistributedMeshSynchronizer< Functions::MeshFunction< MeshType, MeshEntityDimension, RealType > > synchronizer; + // TODO: synchronizer should not be part of the mesh function - the way of synchronization + // depends rather on algorithm/method/scheme in hand than on data + DistributedMeshSynchronizerType synchronizer; MeshPointer meshPointer; @@ -182,7 +193,6 @@ class MeshFunction : private: void setupSynchronizer( DistributedMeshType *distributedMesh ); - }; template< typename Mesh, diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h index 3ca8cc5f3e..401d33bdd4 100644 --- a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h +++ b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h @@ -66,6 +66,11 @@ class DistributedMeshSynchronizer< Functions::MeshFunction< Grid< MeshDimension, setDistributedGrid( distributedGrid ); }; + void setPeriodicBoundariesCopyDirection( const PeriodicBoundariesCopyDirection dir ) + { + this->periodicBoundariesCopyDirection = dir; + } + void setDistributedGrid( DistributedGridType *distributedGrid ) { isSet = true; diff --git a/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp b/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp index fca8bb8cff..3d90a33701 100644 --- a/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp +++ b/src/UnitTests/Meshes/DistributedMeshes/DistributedGridTest_1D.cpp @@ -256,6 +256,8 @@ TEST_F(DistributedGridTest_1D, SynchronizePeriodicNeighborsWithoutMask ) setDof_1D( dof, -rank-1 ); maskDofs.setValue( true ); constFunctionEvaluator.evaluateAllEntities( meshFunctionPtr, constFunctionPtr ); + using Synchronizer = decltype( meshFunctionPtr->getSynchronizer() ); + meshFunctionPtr->getSynchronizer().setPeriodicBoundariesCopyDirection( Synchronizer::OverlapToBoundary ); meshFunctionPtr->template synchronize<CommunicatorType>( true ); if( rank == 0 ) -- GitLab