Salome HOME
Numpy optionnal dependancies + getNumberOfCells porting
[tools/medcoupling.git] / src / MEDPartitioner / Test / MEDPARTITIONERTest.cxx
index c49dcc6fde6107a2d833d19c8473c4ffa603151c..e8059978d8705cd270ebcaa59c5dd646381641d3 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
@@ -29,7 +29,7 @@
 #include "MEDLoader.hxx"
 #include "MEDLoaderBase.hxx"
 #include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingMemArray.hxx"
 #include "MEDCouplingMultiFields.hxx"
 #include <cppunit/TestAssert.h>
 
 #include <sstream>
+#include <fstream>
 #include <cmath>
 #include <list>
 #include <stdexcept>
 #include <cstdlib>
 #include <vector>
+#ifdef WIN32
+#include<direct.h>
+#define getcwd _getcwd
+#else
+#include <unistd.h>
+#endif
 
-#ifdef HAVE_MPI2
+#ifdef HAVE_MPI
 #include <mpi.h>
 #endif
 
 using namespace std;
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
 using namespace MEDPARTITIONER;
 
 void MEDPARTITIONERTest::setSize(int ni, int nj, int nk)
@@ -83,20 +90,18 @@ void MEDPARTITIONERTest::setbigSize()
 std::string MEDPARTITIONERTest::getPartitionerExe() const
 {
   std::string execName;
-  if ( getenv("top_builddir")) // make distcheck
-    {
-      execName = getenv("top_builddir");
-      execName += "/src/MEDPartitioner/medpartitioner";
-    }
-  else if ( getenv("MED_ROOT_DIR") )
-    {
-      execName=getenv("MED_ROOT_DIR");  //.../INSTALL/MED
-      execName+="/bin/salome/medpartitioner";
-    }
-  else
+  if ( getenv("MEDCOUPLING_ROOT_DIR") )
     {
-      CPPUNIT_FAIL("Can't find medpartitioner, neither MED_ROOT_DIR nor top_builddir is set");
+      execName=getenv("MEDCOUPLING_ROOT_DIR");  //.../INSTALL/MED
+      execName+="/bin/medpartitioner";
+      std::ifstream my_file(execName.c_str());
+      if (my_file.good())
+        return execName;
     }
+  execName = getcwd(NULL, 0);
+  execName += "/../../MEDPartitioner/medpartitioner";
+  if (! std::ifstream(execName.c_str()))
+    CPPUNIT_FAIL("Can't find medpartitioner, please set MEDCOUPLING_ROOT_DIR");
   return execName;
 }
 
@@ -108,7 +113,7 @@ std::string MEDPARTITIONERTest::getPartitionerExe() const
 void MEDPARTITIONERTest::setUp()
 {
   this->_verbose=0;
-#if defined(HAVE_MPI2)
+#if defined(HAVE_MPI)
   if (MyGlobals::_Rank==-1)  //do once only
     {
       MPI_Init(0,0);
@@ -123,10 +128,10 @@ void MEDPARTITIONERTest::setUp()
 
   if (_verbose>10)
     {
-#if defined(HAVE_MPI2)
-      cout<<"\ndefined(HAVE_MPI2)"<<endl;
+#if defined(HAVE_MPI)
+      cout<<"\ndefined(HAVE_MPI)"<<endl;
 #else
-      cout<<"\nNOT defined(HAVE_MPI2)"<<endl;
+      cout<<"\nNOT defined(HAVE_MPI)"<<endl;
 #endif
 #if defined(MED_ENABLE_PARMETIS)
       cout<<"defined(MED_ENABLE_PARMETIS)"<<endl;
@@ -155,7 +160,7 @@ void MEDPARTITIONERTest::tearDown()
 {
 }
 
-ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
+MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
 //only hexa8
 {
   vector<int> conn;
@@ -179,7 +184,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
           ii=ii + _ni + 2 ;
           conn.push_back(ii);
           conn.push_back(ii-1);
-    
+
           ii=i + j*(_ni+1) + (k+1)*(_ni+1)*(_nj+1);
           conn.push_back(ii);
           conn.push_back(ii+1);
@@ -197,7 +202,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
       cout << endl;
       cout << "\nnb conn " << (_ni)*(_nj)*(_nk)*8 << " " << conn.size() << endl;
       for (int i=0; i<(int)conn.size(); i=i+8)
-        { 
+        {
           for (int j=0; j<8; j++)
             cout << conn[i+j] << " ";
           cout << endl;
@@ -205,7 +210,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
       cout << endl;
     }
   */
-  
+
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(3);
   int nbc=conn.size()/8; //nb of cells
@@ -229,11 +234,11 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
   mesh->setCoords(myCoords);
   mesh->setName(_mesh_name.c_str());
   myCoords->decrRef();
-  mesh->checkCoherency();
+  mesh->checkConsistencyLight();
   return mesh;
 }
 
-ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
+MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
 //only quad4 in oblique (k=j)
 {
   vector<int> conn;
@@ -267,13 +272,13 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
       cout<<endl;
       cout<<"\nnb conn "<<(_ni)*(_nj)*4<<" "<<conn.size()<<endl;
       for (int i=0; i<(int)conn.size(); i=i+4)
-        { 
+        {
           for (int j=0; j<4; j++) cout<<conn[i+j]<<" ";
           cout<<endl;
         }
       cout<<endl;
     }
-  
+
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(2);
   int nbc=conn.size()/4; //nb of cells
@@ -297,11 +302,11 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
   mesh->setCoords(myCoords);
   mesh->setName(_mesh_name.c_str());
   myCoords->decrRef();
-  mesh->checkCoherency();
+  mesh->checkConsistencyLight();
   return mesh;
 }
 
-ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh()
+MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh()
 //only quad4 on a global face of the CUBE3D (k=0)
 {
   vector<int> conn;
@@ -335,14 +340,14 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh()
       cout<<endl;
       cout<<"\nnb conn "<<(_ni)*(_nj)*4<<" "<<conn.size()<<endl;
       for (int i=0; i<(int)conn.size(); i=i+4)
-        { 
+        {
           for (int j=0; j<4; j++)
             cout << conn[i+j] << " ";
           cout << endl;
         }
       cout << endl;
     }
-  
+
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(2);
   int nbc=conn.size()/4; //nb of cells
@@ -366,7 +371,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh()
   mesh->setCoords(myCoords);
   mesh->setName(_mesh_name.c_str());
   myCoords->decrRef();
-  mesh->checkCoherency();
+  mesh->checkConsistencyLight();
   return mesh;
 }
 
@@ -383,7 +388,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnCells(string myfileN
           field.push_back(k+.3);
         }
 
-  MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
+  MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
   int nbOfCells=mesh->getNumberOfCells();
   MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   f1->setName("VectorFieldOnCells");
@@ -398,7 +403,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnCells(string myfileN
   myField->setInfoOnComponent(2,"vz");
   myField->decrRef();
   f1->setTime(2.,0,1);
-  f1->checkCoherency();
+  f1->checkConsistencyLight();
   mesh->decrRef();
   return f1;
 }
@@ -415,8 +420,8 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes()
           field.push_back(j+.2);
           field.push_back(k+.3);
         }
-  
-  MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
+
+  MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
   int nbOfNodes=mesh->getNumberOfNodes();
   MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
   f1->setName("VectorFieldOnNodes");
@@ -431,7 +436,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes()
   myField->setInfoOnComponent(2,"vz");
   myField->decrRef();
   f1->setTime(2.,0,1);
-  f1->checkCoherency();
+  f1->checkConsistencyLight();
   mesh->decrRef();
   return f1;
 }
@@ -441,32 +446,32 @@ void MEDPARTITIONERTest::createTestMeshWithoutField()
 {
   {
     MEDCouplingUMesh * mesh = buildCUBE3DMesh();
-    MEDLoader::WriteUMesh(_file_name.c_str(),mesh,true);
+    WriteUMesh(_file_name.c_str(),mesh,true);
     if (_verbose) cout<<endl<<_file_name<<" created"<<endl;
     if (_ntot<1000000) //too long
       {
-        MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name.c_str(),mesh->getName().c_str(),0);
+        MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name.c_str(),mesh->getName().c_str(),0);
         if (_verbose) cout<<_file_name<<" reread"<<endl;
         CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
         mesh_rw->decrRef();
       }
     mesh->decrRef();
   }
-  
+
   {
-    vector<const ParaMEDMEM::MEDCouplingUMesh*> meshes;
+    vector<const MEDCoupling::MEDCouplingUMesh*> meshes;
     MEDCouplingUMesh * mesh1 = buildCUBE3DMesh();
     MEDCouplingUMesh * mesh2 = buildFACE3DMesh();
     mesh1->setName("testMesh");
     mesh2->setName("theFaces");
     mesh2->tryToShareSameCoordsPermute(*mesh1, 1e-9);
-    mesh2->checkCoherency();
-    mesh1->checkCoherency();
+    mesh2->checkConsistencyLight();
+    mesh1->checkConsistencyLight();
     meshes.push_back(mesh1);
     meshes.push_back(mesh2);
-    MEDLoader::WriteUMeshes(_file_name_with_faces.c_str(), meshes, true);
-  
-    ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str());
+    WriteUMeshes(_file_name_with_faces.c_str(), meshes, true);
+
+    MEDCoupling::MEDFileUMesh* mfm=MEDCoupling::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str());
     DataArrayInt* FacesFam=DataArrayInt::New();
     FacesFam->alloc(mfm->getSizeAtLevel(-1),1);
     FacesFam->fillWithValue(-1);
@@ -487,19 +492,19 @@ void MEDPARTITIONERTest::createTestMeshWithoutField()
     mfm->write(_file_name_with_faces.c_str(),0);
     FacesFam->decrRef();
     CellsFam->decrRef();
-  
+
     /*ce truc marche pas!
-      ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName());
-      vector<const ParaMEDMEM::MEDCouplingUMesh*> ms;
+      MEDCoupling::MEDFileUMesh* mfm=MEDCoupling::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName());
+      vector<const MEDCoupling::MEDCouplingUMesh*> ms;
       ms.push_back(mesh2);
       mfm->setGroupsFromScratch(-1, ms);
       mfm->write(_file_name_with_faces.c_str(),0);
     */
-  
+
     if (_verbose) cout<<endl<<_file_name_with_faces<<" created"<<endl;
     if (_ntot<1000000) //too long
       {
-        MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name_with_faces.c_str(),mesh1->getName().c_str(),0);
+        MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name_with_faces.c_str(),mesh1->getName().c_str(),0);
         if (_verbose) cout<<_file_name_with_faces<<" reread"<<endl;
         CPPUNIT_ASSERT(mesh1->isEqual(mesh_rw,1e-12));
         mesh_rw->decrRef();
@@ -508,12 +513,12 @@ void MEDPARTITIONERTest::createTestMeshWithoutField()
     mesh2->decrRef();
     mfm->decrRef();
   }
-   
+
   {
     MEDCouplingUMesh * mesh = buildCARRE3DMesh();
-    MEDLoader::WriteUMesh(_file_name2.c_str(),mesh,true);
+    WriteUMesh(_file_name2.c_str(),mesh,true);
     if (_verbose) cout<<endl<<_file_name2<<" created"<<endl;
-    MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name2.c_str(),mesh->getName().c_str(),0);
+    MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name2.c_str(),mesh->getName().c_str(),0);
     if (_verbose) cout<<_file_name2<<" reread"<<endl;
     CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
     mesh_rw->decrRef();
@@ -553,7 +558,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
   <mapping>\n$tagMesh \
   </mapping>\n \
 </root>\n";
-  
+
   string tagSubfiles, tagSubfile="\
     <subfile id=\"$xyz\">\n \
       <name>$fileName</name>\n \
@@ -565,15 +570,15 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
         <name>testMesh</name>\n \
       </chunk>\n \
     </mesh>\n";
-  
+
   int xyz=1;
   string sxyz;
-  DataArrayDouble* coordsInit=mesh->getCoords()->deepCpy();
+  DataArrayDouble* coordsInit=mesh->getCoords()->deepCopy();
   double* ptrInit=coordsInit->getPointer();
   double deltax=cooFin[0]-cooDep[0];
   double deltay=cooFin[1]-cooDep[1];
   double deltaz=cooFin[2]-cooDep[2];
-  
+
   double dz=0.;
   for (int z=0; z<nbz; z++)
     {
@@ -586,7 +591,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
               string fileName;
               sxyz=IntToStr(xyz);
               fileName="tmp_testMeshHuge_"+IntToStr(_ni)+"x"+IntToStr(_nj)+"x"+IntToStr(_nk)+"_"+sxyz+".med";
-        
+
               DataArrayDouble* coords=mesh->getCoords();
               //int nbOfComp=coords->getNumberOfComponents();  //be 3D
               int nbOfTuple=coords->getNumberOfTuples();
@@ -599,12 +604,12 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
                   *ptr=(*ptrini)+dz; ptr++; ptrini++;
                 }
 
-              MEDLoader::WriteUMesh(fileName.c_str(),mesh,true);
-        
+              WriteUMesh(fileName.c_str(),mesh,true);
+
               tagSubfiles+=tagSubfile;
               tagSubfiles.replace(tagSubfiles.find("$xyz"),4,sxyz);
               tagSubfiles.replace(tagSubfiles.find("$fileName"),9,fileName);
-        
+
               tagMeshes+=tagMesh;
               tagMeshes.replace(tagMeshes.find("$xyz"),4,sxyz);
               xyz++;
@@ -615,7 +620,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
       dz+=deltaz;
     }
   coordsInit->decrRef();
-  
+
   tagXml.replace(tagXml.find("$subdomainNumber"),16,sxyz);
   tagXml.replace(tagXml.find("$tagSubfile"),11,tagSubfiles);
   tagXml.replace(tagXml.find("$tagMesh"),8,tagMeshes);
@@ -626,7 +631,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
   f<<tagXml;
   f.close();
   //cout<<"\n"<<tagXml<<endl;
-  if (_verbose) 
+  if (_verbose)
     cout<<endl<<nameFileXml<<" created"<<endl;
   mesh->decrRef();
 }
@@ -637,18 +642,17 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     string name=_file_name;
     MEDCouplingFieldDouble *f1=buildVecFieldOnCells(name);
     name.replace(name.find(".med"),4,"_WithVecFieldOnCells.med");
-    MEDLoader::WriteField(name.c_str(),f1,true);
+    WriteField(name.c_str(),f1,true);
     f1->setTime(3.,1,1);  //time,it,order
     f1->applyFunc("x/2.");
-    MEDLoader::WriteField(name.c_str(),f1,false);
+    WriteField(name.c_str(),f1,false);
     if (_verbose) cout<<endl<<name<<" created"<<endl;
     if (_ntot<1000000) //too long
       {
-        MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+        MCAuto<MEDCouplingFieldDouble> f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
         //DataArrayDouble *res=f2->getArray();
         if (_verbose) cout<<name<<" reread"<<endl;
         //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
-        f2->decrRef();
       }
     f1->decrRef();
   }
@@ -666,17 +670,17 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     f3->setDescription("MyDescriptionNE");
     DataArrayDouble *array=DataArrayDouble::New();
     //int nb=f1->getMesh()->getNumberOfNodes();
-  
+
     /*8 pt de gauss by cell
       int nb=f3->getMesh()->getNumberOfCells()*8;
       array->alloc(nb,2);
       double *ptr=array->getPointer();
       for (int i=0; i<nb*2; i=i+2) {ptr[i]=(double)(i/8) ; ptr[i]=2.*(double)(i/8);}
     */
-  
+
     //more nbptgauss=8 by default needs set MEDCouplingFieldDiscretizationPerCell
     //theory: (may be) http://www.code-aster.org/V2/doc/v9/fr/man_r/r3/r3.06.03.pdf
-    int nbptgauss=8; //nb pt de gauss by cell 
+    int nbptgauss=8; //nb pt de gauss by cell
     int nbcell=f3->getMesh()->getNumberOfCells();
     int nb=nbcell*nbptgauss;
     int nbcomp=2;
@@ -696,16 +700,14 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     f3->setTime(4.,5,6);
     f3->setArray(array);
     array->decrRef();
-    MEDLoader::WriteField(name.c_str(),f3,true);
+    WriteField(name.c_str(),f3,true);
     if (_verbose) cout<<endl<<name<<" created"<<endl;
-    f3->checkCoherency();
+    f3->checkConsistencyLight();
     f1->decrRef();
     if (_ntot<1000000) //too long
       {
-        MEDCouplingFieldDouble* f4=MEDLoader::ReadField(ON_GAUSS_NE,
-                                                        name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6);
+        MCAuto<MEDCouplingFieldDouble> f4=ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6);
         if (_verbose) cout<<"MyFieldOnGaussNE reread"<<endl;
-        f4->decrRef();
       }
     f3->decrRef();
   }
@@ -713,14 +715,13 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     string name=_file_name_with_faces;
     MEDCouplingFieldDouble *f1=buildVecFieldOnCells(name);
     name.replace(name.find(".med"),4,"_WithVecFieldOnCells.med");
-    MEDLoader::WriteField(name.c_str(),f1,true);
+    WriteField(name.c_str(),f1,true);
     if (_verbose) cout<<endl<<name<<" created"<<endl;
     if (_ntot<1000000) //too long
       {
-        MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+        MCAuto<MEDCouplingFieldDouble> f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
         if (_verbose) cout<<name<<" reread"<<endl;
         //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
-        f2->decrRef();
       }
     f1->decrRef();
   }
@@ -731,14 +732,13 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnNodes()
   MEDCouplingFieldDouble *f1=buildVecFieldOnNodes();
   string name=_file_name;
   name.replace(name.find(".med"),4,"_WithVecFieldOnNodes.med");
-  MEDLoader::WriteField(name.c_str(),f1,true);
+  WriteField(name.c_str(),f1,true);
   if (_verbose) cout<<endl<<name<<" created"<<endl;
   if (_ntot<1000000) //too long
     {
-      MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+      MCAuto<MEDCouplingFieldDouble> f2=ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
       if (_verbose) cout<<name<<" reread"<<endl;
       //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
-      f2->decrRef();
     }
   f1->decrRef();
 }
@@ -747,13 +747,13 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes()
 {
   string name=_file_name;
   name.replace(name.find(".med"),4,"_WithVecFieldOnNodes.med");
-  MEDCouplingUMesh * m=MEDLoader::ReadUMeshFromFile(name.c_str(),_mesh_name.c_str(),0);
+  MEDCouplingUMesh * m=ReadUMeshFromFile(name.c_str(),_mesh_name.c_str(),0);
   std::set<INTERP_KERNEL::NormalizedCellType> types(m->getAllGeoTypes());
   if (_verbose)
     {
       cout<<"\n types in "<<name<<" : ";
       //for (std::set<INTERP_KERNEL::NormalizedCellType>::iterator t=types.begin(); t!=types.end(); ++t) cout<<" "<<*t;
-      for (std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator t=types.begin(); t!=types.end(); ++t) 
+      for (std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator t=types.begin(); t!=types.end(); ++t)
         {
           //INTERP_KERNEL::CellModel essai=INTERP_KERNEL::CellModel::GetCellModel(*t);
           cout<<" "<<(INTERP_KERNEL::CellModel::GetCellModel(*t)).getRepr();
@@ -761,7 +761,7 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes()
       cout<<endl;
     }
   m->decrRef();
-  
+
   MEDFileUMesh * mf = MEDFileUMesh::New(_file_name.c_str(),_mesh_name.c_str(),-1,-1);
   vector<int> lev;
   lev=mf->getNonEmptyLevels();
@@ -839,7 +839,7 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionMetis()
   bool empty_groups=false;
   MEDPARTITIONER::ParaDomainSelector parallelizer(false);
   MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
-  
+
   MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
   //Creating the graph and partitioning it
@@ -847,13 +847,13 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionMetis()
   new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS) );
   //Creating a new mesh collection from the partitioning
   MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
-  
+
   //example to create files
   //MyGlobals::_General_Informations.clear();
   //MyGlobals::_General_Informations.push_back(SerializeFromString("finalMeshName=Merge"));
   //if (MyGlobals::_Verbose>100) cout << "generalInformations : \n"<<ReprVectorOfString(MyGlobals::_General_Informations);
   //new_collection.write("ttmp")
-  
+
   CPPUNIT_ASSERT(new_collection.isParallelMode());
   CPPUNIT_ASSERT_EQUAL(3, new_collection.getMeshDimension());
   CPPUNIT_ASSERT(new_collection.getName()==collection.getName());
@@ -872,10 +872,10 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis()
   bool empty_groups=false;
   MEDPARTITIONER::ParaDomainSelector parallelizer(false);
   MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
-  
+
   MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
-  
+
   for (int ndomains=2 ; ndomains<=16 ; ndomains++)
     {
       //Creating the graph and partitioning it
@@ -883,7 +883,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis()
       new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS) );
       //Creating a new mesh collection from the partitioning
       MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
-      
+
       CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes());
       CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes());
       CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells());
@@ -893,7 +893,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis()
 
 void MEDPARTITIONERTest::testMetisSmallSize()
 {
-  //#if !defined(HAVE_MPI2)
+  //#if !defined(HAVE_MPI)
   setSmallSize();
   createTestMeshes();
   std::string MetisOrScotch("metis");
@@ -921,7 +921,7 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionScotch()
   bool empty_groups=false;
   MEDPARTITIONER::ParaDomainSelector parallelizer(false);
   MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
-  
+
   MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
   //Creating the graph and partitioning it
@@ -929,13 +929,13 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionScotch()
   new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH) );
   //Creating a new mesh collection from the partitioning
   MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
-  
+
   //example to create files
   //MyGlobals::_General_Informations.clear();
   //MyGlobals::_General_Informations.push_back(SerializeFromString("finalMeshName=Merge"));
   //if (MyGlobals::_Verbose>100) cout << "generalInformations : \n"<<ReprVectorOfString(MyGlobals::_General_Informations);
   //new_collection.write("ttmp")
-  
+
   CPPUNIT_ASSERT(new_collection.isParallelMode());
   CPPUNIT_ASSERT_EQUAL(3, new_collection.getMeshDimension());
   CPPUNIT_ASSERT(new_collection.getName()==collection.getName());
@@ -954,10 +954,10 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionScotch()
   bool empty_groups=false;
   MEDPARTITIONER::ParaDomainSelector parallelizer(false);
   MEDPARTITIONER::MeshCollection collection(fileName,parallelizer);
-  
+
   MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
-  
+
   for (int ndomains=2 ; ndomains<=16 ; ndomains++)
     {
       //Creating the graph and partitioning it
@@ -965,7 +965,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionScotch()
       new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH) );
       //Creating a new mesh collection from the partitioning
       MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups);
-      
+
       CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes());
       CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes());
       CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells());
@@ -975,7 +975,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionScotch()
 
 void MEDPARTITIONERTest::testScotchSmallSize()
 {
-  //#if !defined(HAVE_MPI2)
+  //#if !defined(HAVE_MPI)
   setSmallSize();
   createTestMeshes();
   std::string MetisOrScotch("scotch");
@@ -991,13 +991,13 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri
 {
   int res;
   string cmd,execName,sourceName,targetName;
-  
+
   execName=getPartitionerExe();
-  
+
   cmd="which "+execName+" 2>/dev/null 1>/dev/null";  //no trace
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL_MESSAGE(execName + " - INVALID PATH TO medpartitioner", 0, res);
-  
+
   cmd=execName+" --ndomains=2 --split-method="+MetisOrScotch;  //on same proc
   sourceName=_file_name;
   targetName=_file_name;
@@ -1006,7 +1006,7 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri
   if (_verbose) cout<<endl<<cmd<<endl;
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
-  
+
   cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch; //on less proc
   sourceName=_file_name;
   targetName=_file_name;
@@ -1015,7 +1015,7 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri
   if (_verbose) cout<<endl<<cmd<<endl;
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
-  
+
   cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch;  //on 1 proc
   sourceName=targetName+".xml";
   targetName=_file_name;
@@ -1033,7 +1033,7 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri
   if (_verbose) cout<<endl<<cmd<<endl;
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
-}  
+}
 
 void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std::string MetisOrScotch)
 {
@@ -1041,11 +1041,11 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   string fileName,cmd,execName,sourceName,targetName,input;
   execName=getPartitionerExe();
   fileName=_file_name_with_faces;
-  
-  ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
-  ParaMEDMEM::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false);
-  
+
+  MEDCoupling::MEDFileUMesh* initialMesh=MEDCoupling::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
+  MEDCoupling::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
+  MEDCoupling::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false);
+
   cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch;  //on same proc
   sourceName=fileName;
   targetName=fileName;
@@ -1055,24 +1055,24 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
   input=targetName+".xml";
-  
+
   MEDPARTITIONER::ParaDomainSelector parallelizer(false);
   MEDPARTITIONER::MeshCollection collection(input,parallelizer);
   CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
-  std::vector<ParaMEDMEM::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
+  std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
   CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size());
   int nbcells=0;
   for (std::size_t i = 0; i < cellMeshes.size(); i++)
     nbcells+=cellMeshes[i]->getNumberOfCells();
-  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
-  
-  std::vector<ParaMEDMEM::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh();
+  CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
+
+  std::vector<MEDCoupling::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh();
   CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size());
   int nbfaces=0;
   for (std::size_t i=0; i < faceMeshes.size(); i++)
     nbfaces+=faceMeshes[i]->getNumberOfCells();
-  CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces);
-  
+  CPPUNIT_ASSERT_EQUAL((int)faceMesh->getNumberOfCells(), nbfaces);
+
   //merge split meshes and test equality
   cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch;  //on same proc
   sourceName=targetName+".xml";
@@ -1082,25 +1082,25 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   if (_verbose) cout<<endl<<cmd<<endl;
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
-  
+
   string refusedName=targetName+"1.med";
-  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
-  ParaMEDMEM::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false);
-  
+  MEDCoupling::MEDFileUMesh* refusedMesh=MEDCoupling::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
+  MEDCoupling::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
+  MEDCoupling::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false);
+
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
   CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), refusedFaceMesh->getNumberOfCells());
-  
+
   /*not the good job
-    ParaMEDMEM::MEDCouplingMesh* mergeCell=cellMesh->mergeMyselfWith(refusedCellMesh);
+    MEDCoupling::MEDCouplingMesh* mergeCell=cellMesh->mergeMyselfWith(refusedCellMesh);
     CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), mergeCell->getNumberOfCells());
-  
-    ParaMEDMEM::MEDCouplingMesh* mergeFace=faceMesh->mergeMyselfWith(refusedFaceMesh);
+
+    MEDCoupling::MEDCouplingMesh* mergeFace=faceMesh->mergeMyselfWith(refusedFaceMesh);
     CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), mergeFace->getNumberOfCells());
-  
+
     CPPUNIT_ASSERT(faceMesh->isEqual(refusedFaceMesh,1e-12));
   */
-  
+
   std::vector<const MEDCouplingUMesh *> meshes;
   std::vector<DataArrayInt *> corr;
   meshes.push_back(cellMesh);
@@ -1108,7 +1108,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   meshes.push_back(refusedCellMesh);
   MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells());
-  
+
   meshes.resize(0);
   for (std::size_t i = 0; i < corr.size(); i++)
     corr[i]->decrRef();
@@ -1118,7 +1118,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   meshes.push_back(refusedFaceMesh);
   MEDCouplingUMesh* fusedFace=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
   CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), fusedFace->getNumberOfCells());
-  
+
   for (std::size_t i = 0; i < corr.size(); i++)
     corr[i]->decrRef();
   fusedFace->decrRef();
@@ -1141,10 +1141,10 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
   execName=getPartitionerExe();
   fileName=_file_name;
   fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med");
-  
-  ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
-  
+
+  MEDCoupling::MEDFileUMesh* initialMesh=MEDCoupling::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
+  MEDCoupling::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
+
   cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch;  //on same proc
   sourceName=fileName;
   targetName=fileName;
@@ -1154,7 +1154,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
   input=targetName+".xml";
-  
+
   //merge split meshes and test equality
   cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch;  //on same proc
   sourceName=targetName+".xml";
@@ -1164,13 +1164,13 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
   if (_verbose) cout<<endl<<cmd<<endl;
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
-  
+
   string refusedName=targetName+"1.med";
-  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
-  
+  MEDCoupling::MEDFileUMesh* refusedMesh=MEDCoupling::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
+  MEDCoupling::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
+
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
-  
+
   std::vector<const MEDCouplingUMesh *> meshes;
   std::vector<DataArrayInt *> corr;
   meshes.push_back(cellMesh);
@@ -1178,22 +1178,22 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
   meshes.push_back(refusedCellMesh);
   MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells());
-  
-  MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1);
-  MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1);
-  
+
+  MCAuto<MEDCouplingFieldDouble> field1=ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1);
+  MCAuto<MEDCouplingFieldDouble> field2=ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1);
+
   int nbcells=corr[1]->getNumberOfTuples();
-  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
+  CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
   //use corr to test equality of field
   DataArrayDouble* f1=field1->getArray();
   DataArrayDouble* f2=field2->getArray();
-  if (_verbose>300) 
+  if (_verbose>300)
     {
       cout<<"\nf1 : "<<f1->reprZip();
       cout<<"\nf2 : "<<f2->reprZip(); //field2->advancedRepradvancedRepr();
       for (std::size_t i = 0; i < corr.size(); i++)
         cout << "\ncorr " << i << " : " << corr[i]->reprZip();
-    
+
     }
   int nbequal=0;
   int nbcomp=field1->getNumberOfComponents();
@@ -1211,11 +1211,9 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
         }
     }
   CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal);
-  
+
   for (std::size_t i = 0; i < corr.size(); i++)
     corr[i]->decrRef();
-  field1->decrRef();
-  field2->decrRef();
   fusedCell->decrRef();
   refusedMesh->decrRef();
   refusedCellMesh->decrRef();
@@ -1230,10 +1228,10 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
   execName=getPartitionerExe();
   fileName=_file_name;
   fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med");
-  
-  ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
-  
+
+  MEDCoupling::MEDFileUMesh* initialMesh=MEDCoupling::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str());
+  MEDCoupling::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false);
+
   cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch;  //on same proc
   sourceName=fileName;
   targetName=fileName;
@@ -1243,7 +1241,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
   input=targetName+".xml";
-  
+
   //merge split meshes and test equality
   cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch;  //on same proc
   sourceName=targetName+".xml";
@@ -1253,13 +1251,13 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
   if (_verbose) cout<<endl<<cmd<<endl;
   res=system(cmd.c_str());
   CPPUNIT_ASSERT_EQUAL(0, res);
-  
+
   string refusedName=targetName+"1.med";
-  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
-  
+  MEDCoupling::MEDFileUMesh* refusedMesh=MEDCoupling::MEDFileUMesh::New(refusedName.c_str(),_mesh_name.c_str());
+  MEDCoupling::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
+
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
-  
+
   std::vector<const MEDCouplingUMesh *> meshes;
   std::vector<DataArrayInt *> corr;
   meshes.push_back(cellMesh);
@@ -1267,22 +1265,22 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
   meshes.push_back(refusedCellMesh);
   MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr);
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells());
-  
-  MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
-  MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
-  
+
+  MCAuto<MEDCouplingFieldDouble> field1=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+  MCAuto<MEDCouplingFieldDouble> field2=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+
   int nbcells=corr[1]->getNumberOfTuples();
-  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
+  CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells);
   //use corr to test equality of field
   DataArrayDouble* f1=field1->getArray();
   DataArrayDouble* f2=field2->getArray();
-  if (_verbose>300) 
+  if (_verbose>300)
     {
       cout << "\nf1 : " << f1->reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint
       cout << "\nf2 : " << f2->reprZip(); //field2->advancedRepradvancedRepr();
       for (std::size_t i = 0; i < corr.size(); i++)
         cout << "\ncorr " << i << " : " << corr[i]->reprZip();
-    
+
     }
   int nbequal=0;
   int nbptgauss=8;
@@ -1301,11 +1299,9 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
         }
     }
   CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal);
-  
+
   for (std::size_t i = 0; i < corr.size(); i++)
     corr[i]->decrRef();
-  field1->decrRef();
-  field2->decrRef();
   fusedCell->decrRef();
   refusedMesh->decrRef();
   refusedCellMesh->decrRef();
@@ -1370,7 +1366,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
     mesh->setCoords(myCoords);
     mesh->setName("FacesIn2D");
     myCoords->decrRef();
-    mesh->checkCoherency();
+    mesh->checkConsistencyLight();
 
     // groups of cells
     DataArrayInt* cellsFam=DataArrayInt::New();
@@ -1445,10 +1441,10 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   std::map< int, int > famId2nb; // count total nb of cells in divided families
   std::map< int, int >::iterator id2nn;
   {
-    const std::vector<ParaMEDMEM::DataArrayInt*>& famIdsVec = new_collection.getCellFamilyIds();
+    const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getCellFamilyIds();
     for ( size_t i = 0; i < famIdsVec.size(); ++i )
       {
-        ParaMEDMEM::DataArrayInt* famIdsArr = famIdsVec[i];
+        MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
         for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
           {
             id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
@@ -1467,10 +1463,10 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   // Check that "creates boundary faces option is handled"
 
   famId2nb.clear();
-  const std::vector<ParaMEDMEM::DataArrayInt*>& famIdsVec = new_collection.getFaceFamilyIds();
+  const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getFaceFamilyIds();
   for ( size_t i = 0; i < famIdsVec.size(); ++i )
     {
-      ParaMEDMEM::DataArrayInt* famIdsArr = famIdsVec[i];
+      MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
       for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
         {
           id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;