From c2bb18090a28546bd0b35f78dc9b0e02fbdc6762 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:52:04 +0100 Subject: [PATCH] Added Send and Receive to MpiCommunicator + MpiCommunicator refactoring. --- src/TNL/Communicators/MpiCommunicator.h | 10 ++++------ src/TNL/Communicators/NoDistrCommunicator.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/TNL/Communicators/MpiCommunicator.h b/src/TNL/Communicators/MpiCommunicator.h index 0a711a58ac..1cb98926c5 100644 --- a/src/TNL/Communicators/MpiCommunicator.h +++ b/src/TNL/Communicators/MpiCommunicator.h @@ -220,7 +220,7 @@ class MpiCommunicator #endif } - static int GetRank(CommunicationGroup group) + static int GetRank(CommunicationGroup group = AllGroup ) { #ifdef HAVE_MPI TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized"); @@ -233,7 +233,7 @@ class MpiCommunicator #endif } - static int GetSize(CommunicationGroup group) + static int GetSize(CommunicationGroup group = AllGroup ) { #ifdef HAVE_MPI TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized"); @@ -309,13 +309,13 @@ class MpiCommunicator } template <typename T> - static Request IRecv( T* data, int count, int src, int tag, CommunicationGroup group) + static Request IRecv( T* data, int count, int src, int tag, CommunicationGroup group = AllGroup ) { #ifdef HAVE_MPI TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized"); TNL_ASSERT_NE(group, NullGroup, "IRecv cannot be called with NullGroup"); Request req; - MPI_Irecv((void*) data, count, MPITypeResolver< T >::getType() , src, tag, group, &req); + MPI_Irecv( const_cast< void* >( ( const void* ) data ), count, MPITypeResolver< T >::getType() , src, tag, group, &req); return req; #else throw Exceptions::MPISupportMissing(); @@ -522,8 +522,6 @@ class MpiCommunicator #endif #endif } - - }; #ifdef HAVE_MPI diff --git a/src/TNL/Communicators/NoDistrCommunicator.h b/src/TNL/Communicators/NoDistrCommunicator.h index 5b2fb9049f..5628522c3e 100644 --- a/src/TNL/Communicators/NoDistrCommunicator.h +++ b/src/TNL/Communicators/NoDistrCommunicator.h @@ -55,12 +55,12 @@ class NoDistrCommunicator return false; } - static int GetRank(CommunicationGroup group) + static int GetRank(CommunicationGroup group = AllGroup ) { return 0; } - static int GetSize(CommunicationGroup group) + static int GetSize(CommunicationGroup group = AllGroup ) { return 1; } -- GitLab