Salome HOME
MEDFileFields::LoadSpecificEntities to improve perf when reading lots of TS.
[tools/medcoupling.git] / src / ParaMEDMEM / MPIAccess.cxx
index 75b0cabaf76a47e4d7420221e31184e08f3818fc..2ca867122e6c1dbb5ef75c7da9d0a91e3472b1c6 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -78,12 +78,13 @@ namespace ParaMEDMEM
     _comm_interface( ProcessorGroup->getCommInterface() ) ,
     _intra_communicator( ProcessorGroup->getComm() )
   {
+    void *v ;
     int mpitagub ;
     int flag ;
-    //MPI_Attr_get does not run with _IntraCommunicator ???
-    //MPI_Attr_get(*_IntraCommunicator,MPI_TAG_UB,&mpitagub,&flag) ;
-    MPI_Attr_get(MPI_COMM_WORLD,MPI_TAG_UB,&mpitagub,&flag) ;
-    mpitagub=abs(mpitagub);
+    //MPI_Comm_get_attr does not run with _IntraCommunicator ???
+    //MPI_Comm_get_attr(*_IntraCommunicator,MPID_TAG_UB,&mpitagub,&flag) ;
+    MPI_Comm_get_attr(MPI_COMM_WORLD,MPI_TAG_UB,&v,&flag) ;
+    mpitagub=*(reinterpret_cast<int*>(v));
     if ( BaseTag != 0 )
       BaseTag = (BaseTag/MODULO_TAG)*MODULO_TAG ;
     if ( MaxTag == 0 )
@@ -1032,6 +1033,30 @@ namespace ParaMEDMEM
       }
   }
 
+  // Returns the MPI size of a TimeMessage
+  MPI_Aint MPIAccess::timeExtent() const
+  {
+    MPI_Aint aextent ;
+    MPI_Type_extent( _MPI_TIME , &aextent ) ;
+    return aextent ;
+  }
+
+  // Returns the MPI size of a MPI_INT
+  MPI_Aint MPIAccess::intExtent() const
+  {
+    MPI_Aint aextent ;
+    MPI_Type_extent( MPI_INT , &aextent ) ;
+    return aextent ;
+  }
+
+  // Returns the MPI size of a MPI_DOUBLE
+  MPI_Aint MPIAccess::doubleExtent() const
+  {
+    MPI_Aint aextent ;
+    MPI_Type_extent( MPI_DOUBLE , &aextent ) ;
+    return aextent ;
+  }
+
   // Outputs fields of a TimeMessage structure
   ostream & operator<< (ostream & f ,const TimeMessage & aTimeMsg )
   {