Salome HOME
Merge branch 'master' of https://codev-tuleap.cea.fr/plugins/git/salome/medcoupling
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_UtilsPara.cxx
index 65629addd8d4e410934764c3bbc741bf02060df4..ec036bbef1968bab8d0d88a9ed52f58ec162f650 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  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
@@ -26,7 +26,7 @@
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "InterpKernelException.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
 #include "InterpKernelAutoPtr.hxx"
 
 #include <fstream>
@@ -35,7 +35,7 @@
 #include <sstream>
 #include <string>
 
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
 #include <mpi.h>
 #endif
 
@@ -118,7 +118,7 @@ void MEDPARTITIONER::SendDoubleVec(const std::vector<double>& vec, const int tar
   int size=vec.size();
   if (MyGlobals::_Verbose>1000) 
     std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD);
   MPI_Send(const_cast<double*>(&vec[0]), size, MPI_DOUBLE, target, tag+100, MPI_COMM_WORLD);
 #endif
@@ -134,7 +134,7 @@ std::vector<double>* MEDPARTITIONER::RecvDoubleVec(const int source)
 {
   int tag = 111002;
   int size;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Status status;  
   MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
   if (MyGlobals::_Verbose>1000) 
@@ -150,7 +150,7 @@ void MEDPARTITIONER::RecvDoubleVec(std::vector<double>& vec, const int source)
 {
   int tag = 111002;
   int size;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Status status;  
   MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
   if (MyGlobals::_Verbose>1000)
@@ -170,7 +170,7 @@ void MEDPARTITIONER::SendIntVec(const std::vector<int>& vec, const int target)
   int size=vec.size();
   if (MyGlobals::_Verbose>1000)
     std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD);
   MPI_Send(const_cast<int*>(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD);
 #endif
@@ -185,7 +185,7 @@ std::vector<int> *MEDPARTITIONER::RecvIntVec(const int source)
 {
   int tag = 111003;
   int size;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Status status;  
   MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
   if (MyGlobals::_Verbose>1000)
@@ -201,7 +201,7 @@ void MEDPARTITIONER::RecvIntVec(std::vector<int>& vec, const int source)
 {
   int tag = 111003;
   int size;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Status status;  
   MPI_Recv(&size, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
   if (MyGlobals::_Verbose>1000)
@@ -217,7 +217,7 @@ void MEDPARTITIONER::RecvIntVec(std::vector<int>& vec, const int source)
   \param da dataArray to be sent
   \param target processor id of the target
 */
-void MEDPARTITIONER::SendDataArrayInt(const ParaMEDMEM::DataArrayInt *da, const int target)
+void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const int target)
 {
   if (da==0)
     throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL");
@@ -228,7 +228,7 @@ void MEDPARTITIONER::SendDataArrayInt(const ParaMEDMEM::DataArrayInt *da, const
   size[2]=da->getNumberOfComponents();
   if (MyGlobals::_Verbose>1000) 
     std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Send(&size, 3, MPI_INT, target, tag, MPI_COMM_WORLD);
   const int *p=da->getConstPointer();
   MPI_Send(const_cast<int*>(&p[0]), size[0] ,MPI_INT, target, tag+100, MPI_COMM_WORLD);
@@ -240,18 +240,18 @@ void MEDPARTITIONER::SendDataArrayInt(const ParaMEDMEM::DataArrayInt *da, const
   \param da dataArrayInt that is filled
   \param source processor id of the incoming messages
 */
-ParaMEDMEM::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source)
+MEDCoupling::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source)
 {
   int tag = 111004;
   int size[3];
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Status status;
   MPI_Recv(size, 3, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
   if (MyGlobals::_Verbose>1000)
     std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvDataArrayInt " << size[0] << std::endl;
   if (size[0]!=(size[1]*size[2]))
     throw INTERP_KERNEL::Exception("Problem in RecvDataArrayInt incoherent sizes");
-  ParaMEDMEM::DataArrayInt* da=ParaMEDMEM::DataArrayInt::New();
+  MEDCoupling::DataArrayInt* da=MEDCoupling::DataArrayInt::New();
   da->alloc(size[1],size[2]);
   int *p=da->getPointer();
   MPI_Recv(const_cast<int*>(&p[0]), size[0], MPI_INT, source, tag+100, MPI_COMM_WORLD, &status);
@@ -265,7 +265,7 @@ ParaMEDMEM::DataArrayInt *MEDPARTITIONER::RecvDataArrayInt(const int source)
   \param da dataArray to be sent
   \param target processor id of the target
 */
-void MEDPARTITIONER::SendDataArrayDouble(const ParaMEDMEM::DataArrayDouble *da, const int target)
+void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, const int target)
 {
   if (da==0)
     throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL");
@@ -276,7 +276,7 @@ void MEDPARTITIONER::SendDataArrayDouble(const ParaMEDMEM::DataArrayDouble *da,
   size[2]=da->getNumberOfComponents();
   if (MyGlobals::_Verbose>1000) 
     std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl;
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Send(&size, 3, MPI_INT, target, tag, MPI_COMM_WORLD);
   const double *p=da->getConstPointer();
   MPI_Send(const_cast<double*>(&p[0]), size[0] ,MPI_DOUBLE, target, tag+100, MPI_COMM_WORLD);
@@ -288,18 +288,18 @@ void MEDPARTITIONER::SendDataArrayDouble(const ParaMEDMEM::DataArrayDouble *da,
   \param da dataArrayDouble that is filled
   \param source processor id of the incoming messages
 */
-ParaMEDMEM::DataArrayDouble* MEDPARTITIONER::RecvDataArrayDouble(const int source)
+MEDCoupling::DataArrayDouble* MEDPARTITIONER::RecvDataArrayDouble(const int source)
 {
   int tag = 111005;
   int size[3];
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
   MPI_Status status;
   MPI_Recv(size, 3, MPI_INT, source, tag, MPI_COMM_WORLD, &status);
   if (MyGlobals::_Verbose>1000)
     std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvDataArrayDouble " << size[0] << std::endl;
   if (size[0]!=(size[1]*size[2]))
     throw INTERP_KERNEL::Exception("Problem in RecvDataArrayDouble incoherent sizes");
-  ParaMEDMEM::DataArrayDouble* da=ParaMEDMEM::DataArrayDouble::New();
+  MEDCoupling::DataArrayDouble* da=MEDCoupling::DataArrayDouble::New();
   da->alloc(size[1],size[2]);
   double *p=da->getPointer();
   MPI_Recv(const_cast<double*>(&p[0]), size[0], MPI_DOUBLE, source, tag+100, MPI_COMM_WORLD, &status);
@@ -458,8 +458,8 @@ void MEDPARTITIONER::TestDataArrayMpi()
   int rank=MyGlobals::_Rank;
   //int
   {
-    ParaMEDMEM::DataArrayInt* send=ParaMEDMEM::DataArrayInt::New();
-    ParaMEDMEM::DataArrayInt* recv=0;
+    MEDCoupling::DataArrayInt* send=MEDCoupling::DataArrayInt::New();
+    MEDCoupling::DataArrayInt* recv=0;
     int nbOfTuples=5;
     int numberOfComponents=3;
     send->alloc(nbOfTuples,numberOfComponents);
@@ -487,8 +487,8 @@ void MEDPARTITIONER::TestDataArrayMpi()
   }
   //double
   {
-    ParaMEDMEM::DataArrayDouble* send=ParaMEDMEM::DataArrayDouble::New();
-    ParaMEDMEM::DataArrayDouble* recv=0;
+    MEDCoupling::DataArrayDouble* send=MEDCoupling::DataArrayDouble::New();
+    MEDCoupling::DataArrayDouble* recv=0;
     int nbOfTuples=5;
     int numberOfComponents=3;
     send->alloc(nbOfTuples,numberOfComponents);