]> SALOME platform Git repositories - tools/medcoupling.git/blobdiff - src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx
Salome HOME
Various fixes for test runs - introducing MEDCOUPLING_RESOURCE_DIR env variable
[tools/medcoupling.git] / src / MEDPartitioner / Test / MEDPARTITIONERTest.cxx
index 145867be8e67d98acc36c4e9ec5fb5c94565c1e8..64dcff0227b68f3eb4410f06a815b0a3479844e2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  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
@@ -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"
@@ -94,7 +94,7 @@ std::string MEDPARTITIONERTest::getPartitionerExe() const
     {
       execName=getenv("MEDCOUPLING_ROOT_DIR");  //.../INSTALL/MED
       execName+="/bin/medpartitioner";
-      std::ifstream my_file(execName);
+      std::ifstream my_file(execName.c_str());
       if (my_file.good())
         return execName;
     }
@@ -163,7 +163,7 @@ void MEDPARTITIONERTest::tearDown()
 MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
 //only hexa8
 {
-  vector<int> conn;
+  vector<mcIdType> conn;
   vector<double> coor;
   for (int k=0; k<=_nk; k++)
     for (int j=0; j<=_nj; j++)
@@ -213,12 +213,12 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
 
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(3);
-  int nbc=conn.size()/8; //nb of cells
-  int nbv=coor.size()/3; //nb of vertices
-  mesh->allocateCells(nbc);
-  for(int i=0; i<nbc; i++)
+  std::size_t nbc=conn.size()/8; //nb of cells
+  std::size_t nbv=coor.size()/3; //nb of vertices
+  mesh->allocateCells(ToIdType(nbc));
+  for(std::size_t i=0; i<nbc; i++)
     {
-      int onehexa[8];
+      mcIdType onehexa[8];
       std::copy(conn.begin()+i*8,conn.begin()+(i+1)*8,onehexa);
       if (false) //(_verbose)
         {
@@ -234,14 +234,14 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh()
   mesh->setCoords(myCoords);
   mesh->setName(_mesh_name.c_str());
   myCoords->decrRef();
-  mesh->checkCoherency();
+  mesh->checkConsistencyLight();
   return mesh;
 }
 
 MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
 //only quad4 in oblique (k=j)
 {
-  vector<int> conn;
+  vector<mcIdType> conn;
   vector<double> coor;
   for (int j=0; j<=_nj; j++)
     for (int i=0; i<=_ni; i++)
@@ -281,12 +281,12 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
 
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(2);
-  int nbc=conn.size()/4; //nb of cells
-  int nbv=coor.size()/3; //nb of vertices
-  mesh->allocateCells(nbc);
-  for(int i=0; i<nbc; i++)
+  std::size_t nbc=conn.size()/4; //nb of cells
+  std::size_t nbv=coor.size()/3; //nb of vertices
+  mesh->allocateCells(ToIdType(nbc));
+  for(std::size_t i=0; i<nbc; i++)
     {
-      int onequa[4];
+      mcIdType onequa[4];
       std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
       if (false) //(_verbose)
         {
@@ -302,7 +302,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh()
   mesh->setCoords(myCoords);
   mesh->setName(_mesh_name.c_str());
   myCoords->decrRef();
-  mesh->checkCoherency();
+  mesh->checkConsistencyLight();
   return mesh;
 }
 
@@ -350,12 +350,12 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh()
 
   MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
   mesh->setMeshDimension(2);
-  int nbc=conn.size()/4; //nb of cells
-  int nbv=coor.size()/3; //nb of vertices
-  mesh->allocateCells(nbc);
-  for(int i=0; i<nbc; i++)
+  std::size_t nbc=conn.size()/4; //nb of cells
+  std::size_t nbv=coor.size()/3; //nb of vertices
+  mesh->allocateCells(ToIdType(nbc));
+  for(std::size_t i=0; i<nbc; i++)
     {
-      int onequa[4];
+      mcIdType onequa[4];
       std::copy(conn.begin()+i*4,conn.begin()+(i+1)*4,onequa);
       if (false) //(_verbose)
         {
@@ -371,7 +371,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh()
   mesh->setCoords(myCoords);
   mesh->setName(_mesh_name.c_str());
   myCoords->decrRef();
-  mesh->checkCoherency();
+  mesh->checkConsistencyLight();
   return mesh;
 }
 
@@ -388,8 +388,8 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnCells(string myfileN
           field.push_back(k+.3);
         }
 
-  MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
-  int nbOfCells=mesh->getNumberOfCells();
+  MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0);
+  mcIdType nbOfCells=mesh->getNumberOfCells();
   MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   f1->setName("VectorFieldOnCells");
   f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file?
@@ -403,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;
 }
@@ -421,8 +421,8 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes()
           field.push_back(k+.3);
         }
 
-  MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
-  int nbOfNodes=mesh->getNumberOfNodes();
+  MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0);
+  mcIdType nbOfNodes=mesh->getNumberOfNodes();
   MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME);
   f1->setName("VectorFieldOnNodes");
   f1->setDescription("DescriptionOfFieldOnNodes"); //not saved in file?
@@ -436,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;
 }
@@ -446,11 +446,11 @@ 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();
@@ -465,22 +465,22 @@ void MEDPARTITIONERTest::createTestMeshWithoutField()
     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);
+    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();
+    DataArrayIdType* FacesFam=DataArrayIdType::New();
     FacesFam->alloc(mfm->getSizeAtLevel(-1),1);
     FacesFam->fillWithValue(-1);
-    DataArrayInt* CellsFam=DataArrayInt::New();
+    DataArrayIdType* CellsFam=DataArrayIdType::New();
     CellsFam->alloc(mfm->getSizeAtLevel(0),1);
     CellsFam->fillWithValue(1);
     mfm->setFamilyFieldArr(-1,FacesFam);
     mfm->setFamilyFieldArr(0,CellsFam);
-    map<string,int> theFamilies;
+    map<string,mcIdType> theFamilies;
     theFamilies["FAMILLE_ZERO"]=0;
     theFamilies["FamilyFaces"]=-1;
     theFamilies["FamilyCells"]=1;
@@ -504,7 +504,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField()
     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();
@@ -516,9 +516,9 @@ void MEDPARTITIONERTest::createTestMeshWithoutField()
 
   {
     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();
@@ -573,7 +573,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
 
   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];
@@ -594,17 +594,17 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int
 
               DataArrayDouble* coords=mesh->getCoords();
               //int nbOfComp=coords->getNumberOfComponents();  //be 3D
-              int nbOfTuple=coords->getNumberOfTuples();
+              mcIdType nbOfTuple=coords->getNumberOfTuples();
               double* ptr=coords->getPointer();
               double* ptrini=ptrInit;
-              for (int i=0; i<nbOfTuple; i++)
+              for (mcIdType i=0; i<nbOfTuple; i++)
                 {
                   *ptr=(*ptrini)+dx; ptr++; ptrini++; //be 3D
                   *ptr=(*ptrini)+dy; ptr++; ptrini++;
                   *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);
@@ -642,18 +642,18 @@ 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<MEDCoupling::MEDCouplingField> f2Tmp(ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1));
+        MCAuto<MEDCoupling::MEDCouplingFieldDouble> f2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f2Tmp));
         //DataArrayDouble *res=f2->getArray();
         if (_verbose) cout<<name<<" reread"<<endl;
         //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
-        f2->decrRef();
       }
     f1->decrRef();
   }
@@ -682,8 +682,8 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells()
     //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 nbcell=f3->getMesh()->getNumberOfCells();
-    int nb=nbcell*nbptgauss;
+    mcIdType nbcell=f3->getMesh()->getNumberOfCells();
+    mcIdType nb=nbcell*nbptgauss;
     int nbcomp=2;
     array->alloc(nb,nbcomp);
     double *ptr=array->getPointer();
@@ -701,16 +701,15 @@ 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<MEDCoupling::MEDCouplingField> f4Tmp(ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6));
+        MCAuto<MEDCoupling::MEDCouplingFieldDouble> f4(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f4Tmp));
         if (_verbose) cout<<"MyFieldOnGaussNE reread"<<endl;
-        f4->decrRef();
       }
     f3->decrRef();
   }
@@ -718,14 +717,14 @@ 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<MEDCouplingField> f2Tmp=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1);
+        MCAuto<MEDCoupling::MEDCouplingFieldDouble> f2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(f2Tmp));
         if (_verbose) cout<<name<<" reread"<<endl;
         //CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
-        f2->decrRef();
       }
     f1->decrRef();
   }
@@ -736,14 +735,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<MEDCouplingField> 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();
 }
@@ -752,7 +750,7 @@ 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)
     {
@@ -807,8 +805,8 @@ void MEDPARTITIONERTest::testMeshCollectionSingle()
   CPPUNIT_ASSERT(collection.getName()=="testMesh");
   CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfLocalMeshes());
   CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfGlobalMeshes());
-  CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk,collection.getNbOfLocalCells());
-  CPPUNIT_ASSERT_EQUAL(_ni*_nj,collection.getNbOfLocalFaces());
+  CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk),collection.getNbOfLocalCells());
+  CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj),collection.getNbOfLocalFaces());
 }
 
 void MEDPARTITIONERTest::testMeshCollectionXml()
@@ -823,8 +821,8 @@ void MEDPARTITIONERTest::testMeshCollectionXml()
   CPPUNIT_ASSERT(collection.getName()=="testMesh");
   CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfLocalMeshes());
   CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfGlobalMeshes());
-  CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk*8,collection.getNbOfLocalCells());
-  CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces());
+  CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk*8),collection.getNbOfLocalCells());
+  CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces());
 }
 
 
@@ -884,7 +882,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis()
   for (int ndomains=2 ; ndomains<=16 ; ndomains++)
     {
       //Creating the graph and partitioning it
-      auto_ptr< MEDPARTITIONER::Topology > new_topo;
+      std::unique_ptr< MEDPARTITIONER::Topology > new_topo;
       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);
@@ -930,7 +928,7 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionScotch()
   MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
   //Creating the graph and partitioning it
-  auto_ptr< MEDPARTITIONER::Topology > new_topo;
+  std::unique_ptr< MEDPARTITIONER::Topology > new_topo;
   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);
@@ -966,7 +964,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionScotch()
   for (int ndomains=2 ; ndomains<=16 ; ndomains++)
     {
       //Creating the graph and partitioning it
-      auto_ptr< MEDPARTITIONER::Topology > new_topo;
+      std::unique_ptr< MEDPARTITIONER::Topology > new_topo;
       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);
@@ -1066,14 +1064,14 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
   std::vector<MEDCoupling::MEDCouplingUMesh*>cellMeshes=collection.getMesh();
   CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size());
-  int nbcells=0;
+  mcIdType nbcells=0;
   for (std::size_t i = 0; i < cellMeshes.size(); i++)
     nbcells+=cellMeshes[i]->getNumberOfCells();
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
 
   std::vector<MEDCoupling::MEDCouplingUMesh*>faceMeshes=collection.getFaceMesh();
   CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size());
-  int nbfaces=0;
+  mcIdType nbfaces=0;
   for (std::size_t i=0; i < faceMeshes.size(); i++)
     nbfaces+=faceMeshes[i]->getNumberOfCells();
   CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces);
@@ -1107,7 +1105,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std
   */
 
   std::vector<const MEDCouplingUMesh *> meshes;
-  std::vector<DataArrayInt *> corr;
+  std::vector<DataArrayIdType *> corr;
   meshes.push_back(cellMesh);
   refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
   meshes.push_back(refusedCellMesh);
@@ -1177,17 +1175,18 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
 
   std::vector<const MEDCouplingUMesh *> meshes;
-  std::vector<DataArrayInt *> corr;
+  std::vector<DataArrayIdType *> corr;
   meshes.push_back(cellMesh);
   refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
   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<MEDCouplingField> field1Tmp(ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1));
+  MCAuto<MEDCouplingField> field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1));
+  MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
 
-  int nbcells=corr[1]->getNumberOfTuples();
+  mcIdType nbcells=corr[1]->getNumberOfTuples();
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
   //use corr to test equality of field
   DataArrayDouble* f1=field1->getArray();
@@ -1201,26 +1200,24 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC
 
     }
   int nbequal=0;
-  int nbcomp=field1->getNumberOfComponents();
+  std::size_t nbcomp=field1->getNumberOfComponents();
   double* p1=f1->getPointer();
   double* p2=f2->getPointer();
-  int* pc=corr[1]->getPointer();
+  mcIdType* pc=corr[1]->getPointer();
   for (int i = 0; i < nbcells; i++)
     {
-      int i1=pc[i]*nbcomp;
-      int i2=i*nbcomp;
-      for (int j = 0; j < nbcomp; j++)
+      std::size_t i1=pc[i]*nbcomp;
+      std::size_t i2=i*nbcomp;
+      for (std::size_t j = 0; j < nbcomp; j++)
         {
           if (p1[i1+j]==p2[i2+j]) nbequal++;
           //cout<<" "<<p1[i1+j]<<"="<<p2[i2+j];
         }
     }
-  CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal);
+  CPPUNIT_ASSERT_EQUAL((int)(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();
@@ -1266,17 +1263,18 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
 
   std::vector<const MEDCouplingUMesh *> meshes;
-  std::vector<DataArrayInt *> corr;
+  std::vector<DataArrayIdType *> corr;
   meshes.push_back(cellMesh);
   refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9);
   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<MEDCouplingField> field1Tmp=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+  MCAuto<MEDCouplingField> field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6);
+  MCAuto<MEDCouplingFieldDouble> field1(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field1Tmp)),field2(MEDCoupling::DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(field2Tmp));
 
-  int nbcells=corr[1]->getNumberOfTuples();
+  mcIdType nbcells=corr[1]->getNumberOfTuples();
   CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells);
   //use corr to test equality of field
   DataArrayDouble* f1=field1->getArray();
@@ -1291,26 +1289,24 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG
     }
   int nbequal=0;
   int nbptgauss=8;
-  int nbcomp=field1->getNumberOfComponents();
+  std::size_t nbcomp=field1->getNumberOfComponents();
   double* p1=f1->getPointer();
   double* p2=f2->getPointer();
-  int* pc=corr[1]->getPointer();
+  mcIdType* pc=corr[1]->getPointer();
   for (int i = 0; i < nbcells; i++)
     {
-      int i1=pc[i]*nbcomp*nbptgauss;
-      int i2=i*nbcomp*nbptgauss;
-      for (int j = 0; j < nbcomp*nbptgauss; j++)
+      std::size_t i1=pc[i]*nbcomp*nbptgauss;
+      std::size_t i2=i*nbcomp*nbptgauss;
+      for (std::size_t j = 0; j < nbcomp*nbptgauss; j++)
         {
           if (p1[i1+j]==p2[i2+j]) nbequal++;
           //cout<<" "<<p1[i1+j]<<"="<<p2[i2+j];
         }
     }
-  CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal);
+  CPPUNIT_ASSERT_EQUAL((int)(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();
@@ -1340,7 +1336,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   int nbFam1, nbFam2, nbc;
   {
     const int nbX = 20, nbY = 15;
-    vector<int> conn;
+    vector<mcIdType> conn;
     vector<double> coor;
     for (int j=0; j<=nbY; j++)
       for (int i=0; i<=nbX; i++)
@@ -1362,30 +1358,30 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
     MEDCouplingUMesh *mesh=MEDCouplingUMesh::New();
     mesh->setMeshDimension(2);
 
-    nbc=conn.size()/4; //nb of cells
+    nbc=(int)conn.size()/4; //nb of cells
     mesh->allocateCells(nbc);
-    int* pConn = &conn[0];
+    mcIdType* pConn = &conn[0];
     for(int i=0; i<nbc; i++, pConn+=4)
       mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn);
     mesh->finishInsertingCells();
 
-    int nbv=coor.size()/2; //nb of vertices
+    int nbv=(int)coor.size()/2; //nb of vertices
     DataArrayDouble *myCoords=DataArrayDouble::New();
-    myCoords->useArray( &coor[0], /*ownership=*/false, CPP_DEALLOC, nbv, 2 );
+    myCoords->useArray( &coor[0], /*ownership=*/false, DeallocType::CPP_DEALLOC, nbv, 2 );
     mesh->setCoords(myCoords);
     mesh->setName("FacesIn2D");
     myCoords->decrRef();
-    mesh->checkCoherency();
+    mesh->checkConsistencyLight();
 
     // groups of cells
-    DataArrayInt* cellsFam=DataArrayInt::New();
+    DataArrayIdType* cellsFam=DataArrayIdType::New();
     cellsFam->alloc(nbc,1);
     nbFam1 = nbc/3, nbFam2 = nbc/2;
     int iE = 0;
     for ( int i = 0; i < nbFam1; ++i ) cellsFam->getPointer()[ iE++ ] = idFam1;
     for ( int i = 0; i < nbFam2; ++i ) cellsFam->getPointer()[ iE++ ] = idFam2;
     for (            ; iE < nbc;     ) cellsFam->getPointer()[ iE++ ] = 0;
-    map<string,int> theFamilies;
+    map<string,mcIdType> theFamilies;
     theFamilies["FAMILLE_ZERO"]=0;
     theFamilies["Family1"     ]=idFam1;
     theFamilies["Family2"     ]=idFam2;
@@ -1415,7 +1411,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   ParallelTopology* aPT = (ParallelTopology*) collection.getTopology();
   aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector());
 
-  std::auto_ptr< Topology > new_topo;
+  std::unique_ptr< Topology > new_topo;
 #if defined(MED_ENABLE_METIS) || defined(MED_ENABLE_PARMETIS)
   new_topo.reset( collection.createPartition(ndomains,Graph::METIS) );
 #endif
@@ -1430,13 +1426,13 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
 
   const char xmlName[] = "tmp_testCreateBoundaryFaces2D";
   {
-    MyGlobals::_Creates_Boundary_Faces = true;
+    MyGlobals::_Create_Boundary_Faces = true;
     MeshCollection new_collection(collection,new_topo.get());
 
     CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes());
     CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes());
     CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells());
-    CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces());
+    CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces());
     CPPUNIT_ASSERT      (new_collection.getNbOfLocalFaces() > 0 );
 
     MyGlobals::_General_Informations.clear();
@@ -1447,14 +1443,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   // Check that "groups and family handling is NOT bugged"
 
   MeshCollection new_collection(std::string(xmlName)+".xml");
-  std::map< int, int > famId2nb; // count total nb of cells in divided families
-  std::map< int, int >::iterator id2nn;
+  std::map< mcIdType, int > famId2nb; // count total nb of cells in divided families
+  std::map< mcIdType, int >::iterator id2nn;
   {
-    const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getCellFamilyIds();
+    const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getCellFamilyIds();
     for ( size_t i = 0; i < famIdsVec.size(); ++i )
       {
-        MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
-        for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
+        MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
+        for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
           {
             id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
             id2nn->second++;
@@ -1472,11 +1468,11 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
   // Check that "creates boundary faces option is handled"
 
   famId2nb.clear();
-  const std::vector<MEDCoupling::DataArrayInt*>& famIdsVec = new_collection.getFaceFamilyIds();
+  const std::vector<MEDCoupling::DataArrayIdType*>& famIdsVec = new_collection.getFaceFamilyIds();
   for ( size_t i = 0; i < famIdsVec.size(); ++i )
     {
-      MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i];
-      for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
+      MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i];
+      for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j )
         {
           id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first;
           id2nn->second++;
@@ -1487,9 +1483,9 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D()
 
   // for each "JOINT_n_p_..." group there must be "JOINT_p_n_..." group
   // of the same size
-  std::map<std::string,int>& famName2id = new_collection.getFamilyInfo();
-  std::map<std::string,int>::iterator na2id = famName2id.begin(), na2id2;
-  std::set< int > okFamIds;
+  std::map<std::string,mcIdType>& famName2id = new_collection.getFamilyInfo();
+  std::map<std::string,mcIdType>::iterator na2id = famName2id.begin(), na2id2;
+  std::set< mcIdType > okFamIds;
   okFamIds.insert(0);
   for ( ; na2id != famName2id.end(); ++na2id )
     {