Salome HOME
Various fixes for test runs - introducing MEDCOUPLING_RESOURCE_DIR env variable
[tools/medcoupling.git] / src / ParaMEDMEM / MxN_Mapping.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 8bc6a12..093a81c
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020  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
 
 using namespace std;
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
-  MxN_Mapping::MxN_Mapping()
-  {
-  }
-
 
   MxN_Mapping::MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group,const DECOptions& dec_options)
-    : DECOptions(dec_options),_union_group(source_group.fuse(target_group))
+    : DECOptions(dec_options),
+      _union_group(source_group.fuse(target_group)),
+      _nb_comps(0), _sending_ids(), _recv_ids()
   {
     _access_DEC = new MPIAccessDEC(source_group,target_group,getAsynchronous());
     _access_DEC->setTimeInterpolator(getTimeInterpolationMethod());
@@ -54,7 +52,7 @@ namespace ParaMEDMEM
     \param distant_proc proc rank of the distant processor (in terms of the union group)
     \param distant_element id of the element on the distant processor
   */
-  void MxN_Mapping::addElementFromSource(int distant_proc, int distant_element)
+  void MxN_Mapping::addElementFromSource(int distant_proc, mcIdType distant_element)
   {
     _sending_ids.push_back(make_pair(distant_proc,distant_element));
     for (int i=distant_proc; i<_union_group->size(); i++)
@@ -95,12 +93,12 @@ namespace ParaMEDMEM
     delete[] nbrecv;
 
     _recv_ids.resize(_recv_proc_offsets[_union_group->size()]);
-    int* isendbuf=0;
-    int* irecvbuf=0;
+    mcIdType* isendbuf=0;
+    mcIdType* irecvbuf=0;
     if (_sending_ids.size()>0)
-      isendbuf = new int[_sending_ids.size()];
+      isendbuf = new mcIdType[_sending_ids.size()];
     if (_recv_ids.size()>0)  
-      irecvbuf = new int[_recv_ids.size()];
+      irecvbuf = new mcIdType[_recv_ids.size()];
     int* sendcounts = new int[_union_group->size()];
     int* senddispls=new int[_union_group->size()];
     int* recvcounts=new int[_union_group->size()];
@@ -113,14 +111,14 @@ namespace ParaMEDMEM
         recvdispls[i]=_recv_proc_offsets[i];
       }
     vector<int> offsets = _send_proc_offsets;
-    for (int i=0; i<(int)_sending_ids.size();i++)
+    for (std::size_t i=0; i<_sending_ids.size();i++)
       {
         int iproc = _sending_ids[i].first;
         isendbuf[offsets[iproc]]=_sending_ids[i].second;
         offsets[iproc]++;
       }
-    comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_INT,
-                             irecvbuf, recvcounts, recvdispls, MPI_INT,
+    comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_ID_TYPE,
+                             irecvbuf, recvcounts, recvdispls, MPI_ID_TYPE,
                              *comm);
                            
     for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++)
@@ -148,7 +146,7 @@ namespace ParaMEDMEM
     CommInterface comm_interface=_union_group->getCommInterface();
     const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
  
-    int nbcomp=field.getArray()->getNumberOfComponents();
+    int nbcomp=(int)field.getArray()->getNumberOfComponents();
     double* sendbuf=0;
     double* recvbuf=0;
     if (_sending_ids.size() >0)
@@ -192,7 +190,7 @@ namespace ParaMEDMEM
         break;
       case PointToPoint:
         _access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE,
-                              recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
+                               recvbuf, recvcounts, recvdispls, MPI_DOUBLE);
         break;
       }
   
@@ -231,7 +229,7 @@ namespace ParaMEDMEM
     CommInterface comm_interface=_union_group->getCommInterface();
     const MPIProcessorGroup* group = static_cast<const MPIProcessorGroup*>(_union_group);
 
-    int nbcomp=field.getArray()->getNumberOfComponents();
+    int nbcomp=(int)field.getArray()->getNumberOfComponents();
     double* sendbuf=0;
     double* recvbuf=0;
     if (_recv_ids.size() >0)