Commit c2bb1809 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added Send and Receive to MpiCommunicator + MpiCommunicator refactoring.

parent 9a180ecb
Loading
Loading
Loading
Loading
+4 −6
Original line number Original line Diff line number Diff line
@@ -220,7 +220,7 @@ class MpiCommunicator
#endif
#endif
      }
      }


      static int GetRank(CommunicationGroup group)
      static int GetRank(CommunicationGroup group = AllGroup )
      {
      {
#ifdef HAVE_MPI
#ifdef HAVE_MPI
        TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized");
        TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized");
@@ -233,7 +233,7 @@ class MpiCommunicator
#endif
#endif
      }
      }


      static int GetSize(CommunicationGroup group)
      static int GetSize(CommunicationGroup group = AllGroup )
      {
      {
#ifdef HAVE_MPI
#ifdef HAVE_MPI
         TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized");
         TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized");
@@ -309,13 +309,13 @@ class MpiCommunicator
        }
        }


         template <typename T>
         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
#ifdef HAVE_MPI
            TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized");
            TNL_ASSERT_TRUE(IsInitialized(), "Fatal Error - MPI communicator is not initialized");
            TNL_ASSERT_NE(group, NullGroup, "IRecv cannot be called with NullGroup");
            TNL_ASSERT_NE(group, NullGroup, "IRecv cannot be called with NullGroup");
            Request req;
            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;
            return req;
#else
#else
            throw Exceptions::MPISupportMissing();
            throw Exceptions::MPISupportMissing();
@@ -522,8 +522,6 @@ class MpiCommunicator
    #endif
    #endif
#endif
#endif
      }
      }


};
};


#ifdef HAVE_MPI
#ifdef HAVE_MPI
+2 −2
Original line number Original line Diff line number Diff line
@@ -55,12 +55,12 @@ class NoDistrCommunicator
          return false;
          return false;
      }
      }


      static int GetRank(CommunicationGroup group)
      static int GetRank(CommunicationGroup group = AllGroup )
      {
      {
          return 0;
          return 0;
      }
      }


      static int GetSize(CommunicationGroup group)
      static int GetSize(CommunicationGroup group = AllGroup )
      {
      {
          return 1;
          return 1;
      }
      }