Salome HOME
Fix clang compilation (template instanciations) + clang warnings
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingCurveLinearMesh.cxx
old mode 100644 (file)
new mode 100755 (executable)
index a5158de..c265d7e
@@ -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
@@ -16,7 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
 
 #include "MEDCouplingCurveLinearMesh.hxx"
 #include "MEDCouplingPointSet.hxx"
 #include <sstream>
 #include <numeric>
 
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
 
 MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh():_coords(0),_structure(0)
 {
 }
 
-MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCopy):MEDCouplingStructuredMesh(other,deepCopy),_structure(other._structure)
+MEDCouplingCurveLinearMesh::MEDCouplingCurveLinearMesh(const MEDCouplingCurveLinearMesh& other, bool deepCpy):MEDCouplingStructuredMesh(other,deepCpy),_structure(other._structure)
 {
-  if(deepCopy)
+  if(deepCpy)
     {
       if((const DataArrayDouble *)other._coords)
-        _coords=other._coords->deepCpy();
+        _coords=other._coords->deepCopy();
     }
   else
     _coords=other._coords;
@@ -64,7 +64,7 @@ MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const std::string& m
   return ret;
 }
 
-MEDCouplingMesh *MEDCouplingCurveLinearMesh::deepCpy() const
+MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::deepCopy() const
 {
   return clone(true);
 }
@@ -83,15 +83,14 @@ void MEDCouplingCurveLinearMesh::updateTime() const
 std::size_t MEDCouplingCurveLinearMesh::getHeapMemorySizeWithoutChildren() const
 {
   std::size_t ret(MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren());
-  ret+=_structure.capacity()*sizeof(int);
+  ret+=_structure.capacity()*sizeof(mcIdType);
   return ret;
 }
 
-std::vector<const BigMemoryObject *> MEDCouplingCurveLinearMesh::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDCouplingCurveLinearMesh::getDirectChildrenWithNull() const
 {
   std::vector<const BigMemoryObject *> ret;
-  if((const DataArrayDouble *)_coords)
-    ret.push_back((const DataArrayDouble *)_coords);
+  ret.push_back((const DataArrayDouble *)_coords);
   return ret;
 }
 
@@ -160,70 +159,66 @@ bool MEDCouplingCurveLinearMesh::isEqualWithoutConsideringStr(const MEDCouplingM
 }
 
 void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
-                                                      DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const
+                                                      DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const
 {
   if(!isEqualWithoutConsideringStr(other,prec))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalWith : Meshes are not the same !");
 }
 
 /*!
- * Nothing is done here (except to check that the other is a ParaMEDMEM::MEDCouplingCurveLinearMesh instance too).
- * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingCurveLinearMesh, \a this and \a other are the same !
+ * Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingCurveLinearMesh instance too).
+ * The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingCurveLinearMesh, \a this and \a other are the same !
  */
 void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
-                                                                 DataArrayInt *&cellCor) const
+                                                                 DataArrayIdType *&cellCor) const
 {
   if(!isEqualWithoutConsideringStr(other,prec))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
 }
 
-void MEDCouplingCurveLinearMesh::checkCoherency() const
+void MEDCouplingCurveLinearMesh::checkConsistencyLight() const
 {
-  std::size_t sz=_structure.size(),i=0,nbOfNodes=1;
+  std::size_t sz=_structure.size(),i=0;
+  mcIdType nbOfNodes=1;
   if(sz<1)
-    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : structure should have a lgth of size 1 at least !");
-  for(std::vector<int>::const_iterator it=_structure.begin();it!=_structure.end();it++,i++)
+    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : structure should have a lgth of size 1 at least !");
+  for(std::vector<mcIdType>::const_iterator it=_structure.begin();it!=_structure.end();it++,i++)
     {
       if((*it)<1)
-        { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkCoherency : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
+        { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : At pos #" << i << " of structure value is " << *it << "should be >= 1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
       nbOfNodes*=*it;
     }
   if(!((const DataArrayDouble *)_coords))
-    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : the array is not set !");
+    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not set !");
   if(!_coords->isAllocated())
-    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : the array is not allocated !");
+    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !");
   if(_coords->getNumberOfComponents()<1)
-    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkCoherency : the array should have >= 1 components !");
-  if(_coords->getNumberOfTuples()!=(int)nbOfNodes)
+    throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !");
+  if(_coords->getNumberOfTuples()!=nbOfNodes)
     {
-      std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkCoherency : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !";
+      std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
 }
 
-void MEDCouplingCurveLinearMesh::checkCoherency1(double eps) const
+void MEDCouplingCurveLinearMesh::checkConsistency(double eps) const
 {
-  checkCoherency();
+  checkConsistencyLight();
 }
 
-void MEDCouplingCurveLinearMesh::checkCoherency2(double eps) const
+mcIdType MEDCouplingCurveLinearMesh::getNumberOfCells() const
 {
-  checkCoherency1(eps);
-}
-
-int MEDCouplingCurveLinearMesh::getNumberOfCells() const
-{
-  checkCoherency();
+  checkConsistencyLight();
   return MEDCouplingStructuredMesh::getNumberOfCells();
 }
 
-int MEDCouplingCurveLinearMesh::getNumberOfNodes() const
+mcIdType MEDCouplingCurveLinearMesh::getNumberOfNodes() const
 {
-  checkCoherency();
+  checkConsistencyLight();
   return MEDCouplingStructuredMesh::getNumberOfNodes();
 }
 
-void MEDCouplingCurveLinearMesh::getNodeGridStructure(int *res) const
+void MEDCouplingCurveLinearMesh::getNodeGridStructure(mcIdType *res) const
 {
   std::copy(_structure.begin(),_structure.end(),res);
 }
@@ -238,14 +233,14 @@ int MEDCouplingCurveLinearMesh::getSpaceDimension() const
 {
   if(!((const DataArrayDouble *)_coords))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getSpaceDimension : no array set ! impossible to deduce a space dimension !");
-  return _coords->getNumberOfComponents();
+  return int(_coords->getNumberOfComponents());
 }
 
-void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
+void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector<double>& coo) const
 {
   if(!((const DataArrayDouble *)_coords))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !");
-  int nbOfCompo=_coords->getNumberOfComponents();
+  std::size_t nbOfCompo=_coords->getNumberOfComponents();
   if(nodeId>=0 && nodeId<_coords->getNumberOfTuples())
     coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo);
   else
@@ -261,7 +256,7 @@ std::string MEDCouplingCurveLinearMesh::simpleRepr() const
   double tt=getTime(tmpp1,tmpp2);
   ret << "Time attached to the mesh [unit] : " << tt << " [" << getTimeUnit() << "]\n";
   ret << "Iteration : " << tmpp1  << " Order : " << tmpp2 << "\n";
-  ret << "The nodal stucture of curve linear mesh is : [";
+  ret << "The nodal structure of curve linear mesh is : [";
   std::copy(_structure.begin(),_structure.end(),std::ostream_iterator<int>(ret,",")); ret << "]\n";
   ret << "The coords array is this : ";
   if((const DataArrayDouble *)_coords)
@@ -276,6 +271,11 @@ std::string MEDCouplingCurveLinearMesh::advancedRepr() const
   return simpleRepr();
 }
 
+const DataArrayDouble *MEDCouplingCurveLinearMesh::getDirectAccessOfCoordsArrIfInStructure() const
+{
+  return _coords;
+}
+
 DataArrayDouble *MEDCouplingCurveLinearMesh::getCoords()
 {
   return _coords;
@@ -297,7 +297,7 @@ void MEDCouplingCurveLinearMesh::setCoords(const DataArrayDouble *coords)
     }
 }
 
-void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, const int *gridStructEnd)
+void MEDCouplingCurveLinearMesh::setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd)
 {
   std::size_t sz=std::distance(gridStructBg,gridStructEnd);
   if(sz>=1 && sz<=3)
@@ -312,30 +312,30 @@ void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, c
     }
 }
 
-std::vector<int> MEDCouplingCurveLinearMesh::getNodeGridStructure() const
+std::vector<mcIdType> MEDCouplingCurveLinearMesh::getNodeGridStructure() const
 {
   return _structure;
 }
 
-MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
+MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair<mcIdType,mcIdType> >& cellPart) const
 {
-  checkCoherency();
+  checkConsistencyLight();
   int dim(getSpaceDimension());
-  std::vector<int> dims(getMeshDimension());
-  if(dim!=(int)cellPart.size())
+  std::vector<mcIdType> dims(getMeshDimension());
+  if(dim!=ToIdType(cellPart.size()))
     {
       std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-  std::vector< std::pair<int,int> > nodePartFormat(cellPart);
-  for(std::vector< std::pair<int,int> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
+  std::vector< std::pair<mcIdType,mcIdType> > nodePartFormat(cellPart);
+  for(std::vector< std::pair<mcIdType,mcIdType> >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++)
     (*it).second++;
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCpy()));
+  MCAuto<DataArrayIdType> tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat));
+  MCAuto<MEDCouplingCurveLinearMesh> ret(dynamic_cast<MEDCouplingCurveLinearMesh *>(deepCopy()));
   const DataArrayDouble *coo(ret->getCoords());
   if(coo)
     {
-      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end()));
+      MCAuto<DataArrayDouble> coo2(coo->selectByTupleIdSafe(tmp1->begin(),tmp1->end()));
       ret->setCoords(coo2);
     }
   for(int i=0;i<dim;i++)
@@ -357,10 +357,10 @@ void MEDCouplingCurveLinearMesh::getBoundingBox(double *bbox) const
 
 MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) const
 {
-  checkCoherency();
+  checkConsistencyLight();
   int meshDim=getMeshDimension();
   std::string name="MeasureOfMesh_"; name+=getName();
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+  MCAuto<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   field->setName(name); field->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(this)); field->synchronizeTimeWithMesh();
   switch(meshDim)
   {
@@ -376,14 +376,15 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs)
 }
 
 /*!
- * \param [in,out] f field feeded with good values.
+ * \param [in] isAbs whether to compute signed or absolute values
+ * \param [in,out] field field fed with good values.
  * \sa MEDCouplingCurveLinearMesh::getMeasureField
  */
 void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const
 {
-  int nbnodes=getNumberOfNodes();
+  mcIdType nbnodes=getNumberOfNodes();
   int spaceDim=getSpaceDimension();
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
+  MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
   if(nbnodes==0)
     { arr->alloc(0,1); return; }
   if(spaceDim==1)
@@ -395,63 +396,65 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling
     }
   else
     {
-      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=DataArrayDouble::New(); tmp->alloc(nbnodes-1,spaceDim);
+      MCAuto<DataArrayDouble> tmp=DataArrayDouble::New(); tmp->alloc(nbnodes-1,spaceDim);
       std::transform(_coords->begin()+spaceDim,_coords->end(),_coords->begin(),tmp->getPointer(),std::minus<double>());
-      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=tmp->magnitude(); field->setArray(tmp2);
+      MCAuto<DataArrayDouble> tmp2=tmp->magnitude(); field->setArray(tmp2);
     }
 }
 
 /*!
- * \param [in,out] f field feeded with good values.
+ * \param [in] isAbs whether to compute signed or absolute values
+ * \param [in,out] field field fed with good values.
  * \sa MEDCouplingCurveLinearMesh::getMeasureField
  */
 void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const
 {
-  int nbcells=getNumberOfCells();
+  mcIdType nbcells=getNumberOfCells();
   int spaceDim=getSpaceDimension();
   if(spaceDim!=2 && spaceDim!=3)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
+  MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
   arr->alloc(nbcells,1);
   double *pt=arr->getPointer();
   const double *coords=_coords->begin();
-  int nX=_structure[0]-1;
-  int conn[4];
-  for(int i=0;i<nbcells;i++,pt++)
+  mcIdType nX=_structure[0]-1;
+  mcIdType conn[4];
+  for(mcIdType i=0;i<nbcells;i++,pt++)
     {
-      int cy=i/nX,cx=i-cy*nX;
+      mcIdType cy=i/nX,cx=i-cy*nX;
       conn[0]=cy*(nX+1)+cx; conn[1]=(cy+1)*(nX+1)+cx; conn[2]=(cy+1)*(nX+1)+1+cx; conn[3]=cy*(nX+1)+cx+1;
-      *pt=INTERP_KERNEL::computeVolSurfOfCell2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim);
+      *pt=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim);
     }
   if(isAbs)
     arr->abs();
 }
 
 /*!
- * \param [in,out] f field feeded with good values.
+ * \param [in] isAbs whether to compute signed or absolute values
+ * \param [in,out] field field fed with good values.
  * \sa MEDCouplingCurveLinearMesh::getMeasureField
  */
 void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCouplingFieldDouble *field) const
 {
-  int nbcells=getNumberOfCells();
+  mcIdType nbcells=getNumberOfCells();
   int spaceDim=getSpaceDimension();
   if(spaceDim!=3)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
+  MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); field->setArray(arr);
   arr->alloc(nbcells,1);
   double *pt=arr->getPointer();
   const double *coords=_coords->begin();
-  int nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
-  int nY1=_structure[0]*_structure[1];
-  int conn[8];
-  for(int i=0;i<nbcells;i++,pt++)
+  mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
+  mcIdType nY1=_structure[0]*_structure[1];
+  mcIdType conn[8];
+  for(mcIdType i=0;i<nbcells;i++,pt++)
     {
-      int cz=i/nY;
-      int cy=(i-cz*nY)/nX;
-      int cx=(i-cz*nY)-nX*cy;
+      mcIdType cz=i/nY;
+      mcIdType cy=(i-cz*nY)/nX;
+      mcIdType cx=(i-cz*nY)-nX*cy;
       conn[0]=cz*nY1+cy*(nX+1)+cx; conn[1]=cz*nY1+(cy+1)*(nX+1)+cx; conn[2]=cz*nY1+(cy+1)*(nX+1)+1+cx; conn[3]=cz*nY1+cy*(nX+1)+cx+1;
       conn[4]=(cz+1)*nY1+cy*(nX+1)+cx; conn[5]=(cz+1)*nY1+(cy+1)*(nX+1)+cx; conn[6]=(cz+1)*nY1+(cy+1)*(nX+1)+1+cx; conn[7]=(cz+1)*nY1+cy*(nX+1)+cx+1;
-      *pt=INTERP_KERNEL::computeVolSurfOfCell2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3);
+      *pt=INTERP_KERNEL::computeVolSurfOfCell2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3);
     }
   if(isAbs)
     arr->abs();
@@ -471,10 +474,10 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::buildOrthogonalField() const
     throw INTERP_KERNEL::Exception("Expected a cmesh with meshDim == 2 !");
   MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
   DataArrayDouble *array=DataArrayDouble::New();
-  int nbOfCells=getNumberOfCells();
+  mcIdType nbOfCells=getNumberOfCells();
   array->alloc(nbOfCells,3);
   double *vals=array->getPointer();
-  for(int i=0;i<nbOfCells;i++)
+  for(mcIdType i=0;i<nbOfCells;i++)
     { vals[3*i]=0.; vals[3*i+1]=0.; vals[3*i+2]=1.; }
   ret->setArray(array);
   array->decrRef();
@@ -484,7 +487,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::buildOrthogonalField() const
 
 /// @cond INTERNAL
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
   template<const int SPACEDIMM>
   class DummyClsMCL
@@ -492,31 +495,31 @@ namespace ParaMEDMEM
   public:
     static const int MY_SPACEDIM=SPACEDIMM;
     static const int MY_MESHDIM=8;
-    typedef int MyConnType;
+    typedef mcIdType MyConnType;
     static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
     // begin
     // useless, but for windows compilation ...
     const double* getCoordinatesPtr() const { return 0; }
-    const int* getConnectivityPtr() const { return 0; }
-    const int* getConnectivityIndexPtr() const { return 0; }
-    INTERP_KERNEL::NormalizedCellType getTypeOfElement(int) const { return (INTERP_KERNEL::NormalizedCellType)0; }
+    const mcIdType* getConnectivityPtr() const { return 0; }
+    const mcIdType* getConnectivityIndexPtr() const { return 0; }
+    INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType) const { return (INTERP_KERNEL::NormalizedCellType)0; }
     // end
   };
 }
 
 /// @endcond
 
-int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const
+mcIdType MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const
 {
-  checkCoherency();
+  checkConsistencyLight();
   int spaceDim=getSpaceDimension();
   const double *coords=_coords->getConstPointer();
-  int nodeId=-1;
+  mcIdType nodeId=-1;
   _coords->distanceToTuple(pos,pos+spaceDim,nodeId);
   if(nodeId<0)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : internal problem 1 !");
-  int conn[8];
-  int nbOfNodes=getNumberOfNodes();
+  mcIdType conn[8];
+  mcIdType nbOfNodes=getNumberOfNodes();
   if(nbOfNodes==1)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : No cells in this !");
   switch(getMeshDimension())
@@ -537,10 +540,11 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double
                 return nodeId;
             }
         }
+      break;
     case 2:
       if(spaceDim==2)
         {
-          int ny=nodeId/_structure[0],nx=nodeId-ny*_structure[0];
+          mcIdType ny=nodeId/_structure[0],nx=nodeId-ny*_structure[0];
           if(nx>0 && ny>0)
             {
               conn[0]=nx-1+_structure[0]*(ny-1); conn[1]=nx-1+_structure[0]*ny; conn[2]=nx+_structure[0]*ny; conn[3]=nx+_structure[0]*(ny-1);
@@ -566,12 +570,13 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double
                 return nx+ny*_structure[0];
             }
         }
+      break;
     case 3:
       {
         if(spaceDim==3)
           {
-            int nY=_structure[0]*_structure[1];
-            int nz=nodeId/_structure[1]; int ny=(nodeId-nz*nY)/_structure[0]; int nx=(nodeId-nz*nY)-_structure[0]*ny;
+            mcIdType nY=_structure[0]*_structure[1];
+            mcIdType nz=nodeId/_structure[1]; mcIdType ny=(nodeId-nz*nY)/_structure[0]; mcIdType nx=(nodeId-nz*nY)-_structure[0]*ny;
             if(nx>0 && ny>0 && nz>0)
               {
                 conn[0]=nx-1+_structure[0]*(ny-1)+nY*(nz-1); conn[1]=nx-1+_structure[2]*ny+nY*(nz-1); conn[2]=nx+_structure[2]*ny+nY*(nz-1); conn[3]=nx+_structure[0]*(ny-1)+nY*(nz-1);
@@ -630,9 +635,17 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double
               }
           }
       }
+      break;
     default:
       throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : mesh dimension managed are 1, 2 or 3 !");
   }
+  return 0;
+}
+
+void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const
+{
+  mcIdType ret(getCellContainingPoint(pos,eps));
+  elts.push_back(ret);
 }
 
 void MEDCouplingCurveLinearMesh::rotate(const double *center, const double *vector, double angle)
@@ -640,12 +653,12 @@ void MEDCouplingCurveLinearMesh::rotate(const double *center, const double *vect
   if(!((DataArrayDouble *)_coords))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !");
   int spaceDim=getSpaceDimension();
-  int nbNodes=_coords->getNumberOfTuples();
+  mcIdType nbNodes(_coords->getNumberOfTuples());
   double *coords=_coords->getPointer();
   if(spaceDim==3)
-    MEDCouplingPointSet::Rotate3DAlg(center,vector,angle,nbNodes,coords);
+    DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords);
   else if(spaceDim==2)
-    MEDCouplingPointSet::Rotate2DAlg(center,angle,nbNodes,coords);
+    DataArrayDouble::Rotate2DAlg(center,angle,nbNodes,coords,coords);
   else
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : invalid space dim for rotation must be 2 or 3");
   _coords->declareAsNew();
@@ -659,9 +672,9 @@ void MEDCouplingCurveLinearMesh::translate(const double *vector)
   if(!((DataArrayDouble *)_coords))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : no coordinates set !");
   double *coords=_coords->getPointer();
-  int nbNodes=getNumberOfNodes();
+  mcIdType nbNodes=getNumberOfNodes();
   int dim=getSpaceDimension();
-  for(int i=0; i<nbNodes; i++)
+  for(mcIdType i=0; i<nbNodes; i++)
     for(int idim=0; idim<dim;idim++)
       coords[i*dim+idim]+=vector[idim];
   _coords->declareAsNew();
@@ -675,9 +688,9 @@ void MEDCouplingCurveLinearMesh::scale(const double *point, double factor)
   if(!((DataArrayDouble *)_coords))
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !");
   double *coords=_coords->getPointer();
-  int nbNodes=_coords->getNumberOfTuples();
-  int dim=_coords->getNumberOfComponents();
-  for(int i=0;i<nbNodes;i++)
+  mcIdType nbNodes(_coords->getNumberOfTuples());
+  std::size_t dim(_coords->getNumberOfComponents());
+  for(mcIdType i=0;i<nbNodes;i++)
     {
       std::transform(coords+i*dim,coords+(i+1)*dim,point,coords+i*dim,std::minus<double>());
       std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies<double>(),factor));
@@ -700,13 +713,13 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::getCoordinatesAndOwner() const
   return ret;
 }
 
-DataArrayDouble *MEDCouplingCurveLinearMesh::getBarycenterAndOwner() const
+DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const
 {
-  checkCoherency();
-  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
+  checkConsistencyLight();
+  MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
   int spaceDim=getSpaceDimension();
   int meshDim=getMeshDimension();
-  int nbOfCells=getNumberOfCells();
+  mcIdType nbOfCells=getNumberOfCells();
   ret->alloc(nbOfCells,spaceDim);
   ret->copyStringInfoFrom(*getCoords());
   switch(meshDim)
@@ -718,67 +731,67 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::getBarycenterAndOwner() const
     case 1:
       { getBarycenterAndOwnerMeshDim1(ret); return ret.retn(); }
     default:
-      throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwner : mesh dimension must be in [1,2,3] !");
+      throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::computeCellCenterOfMass : mesh dimension must be in [1,2,3] !");
   }
 }
 
 DataArrayDouble *MEDCouplingCurveLinearMesh::computeIsoBarycenterOfNodesPerCell() const
 {
-  return MEDCouplingCurveLinearMesh::getBarycenterAndOwner();
+  return MEDCouplingCurveLinearMesh::computeCellCenterOfMass();
 }
 
 /*!
- * \param [in,out] bary Barycenter array feeded with good values.
- * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner
+ * \param [in,out] bary Barycenter array fed with good values.
+ * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass
  */
 void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const
 {
-  int nbOfCells=getNumberOfCells();
+  mcIdType nbOfCells=getNumberOfCells();
   double *ptToFill=bary->getPointer();
   const double *coor=_coords->getConstPointer();
   if(getSpaceDimension()!=3)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3 : with meshDim 3 only space dimension 3 is possible !");
-  int nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
-  int nY1=_structure[0]*_structure[1];
-  int conn[8];
-  for(int i=0;i<nbOfCells;i++)
+  mcIdType nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1);
+  mcIdType nY1=_structure[0]*_structure[1];
+  mcIdType conn[8];
+  for(mcIdType i=0;i<nbOfCells;i++)
     {
-      int cz=i/nY;
-      int cy=(i-cz*nY)/nX;
-      int cx=(i-cz*nY)-nX*cy;
+      mcIdType cz=i/nY;
+      mcIdType cy=(i-cz*nY)/nX;
+      mcIdType cx=(i-cz*nY)-nX*cy;
       conn[0]=cz*nY1+cy*(nX+1)+cx+1; conn[1]=cz*nY1+cy*(nX+1)+cx; conn[2]=cz*nY1+(cy+1)*(nX+1)+cx; conn[3]=cz*nY1+(cy+1)*(nX+1)+1+cx;
       conn[4]=(cz+1)*nY1+cy*(nX+1)+cx+1; conn[5]=(cz+1)*nY1+cy*(nX+1)+cx; conn[6]=(cz+1)*nY1+(cy+1)*(nX+1)+cx; conn[7]=(cz+1)*nY1+(cy+1)*(nX+1)+1+cx;
-      INTERP_KERNEL::computeBarycenter2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill);
+      INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill);
       ptToFill+=3;
     }
 }
 
 /*!
- * \param [in,out] bary Barycenter array feeded with good values.
- * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner
+ * \param [in,out] bary Barycenter array fed with good values.
+ * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass
  */
 void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const
 {
-  int nbcells=getNumberOfCells();
+  mcIdType nbcells=getNumberOfCells();
   int spaceDim=getSpaceDimension();
   double *ptToFill=bary->getPointer();
   const double *coor=_coords->getConstPointer();
   if(spaceDim!=2 && spaceDim!=3)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2 : with meshDim 2 only space dimension 2 and 3 are possible !");
-  int nX=_structure[0]-1;
-  int conn[4];
-  for(int i=0;i<nbcells;i++)
+  mcIdType nX=_structure[0]-1;
+  mcIdType conn[4];
+  for(mcIdType i=0;i<nbcells;i++)
     {
-      int cy=i/nX,cx=i-cy*nX;
+      mcIdType cy=i/nX,cx=i-cy*nX;
       conn[0]=cy*(nX+1)+cx; conn[1]=(cy+1)*(nX+1)+cx; conn[2]=(cy+1)*(nX+1)+1+cx; conn[3]=cy*(nX+1)+cx+1;
-      INTERP_KERNEL::computeBarycenter2<int,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill);
+      INTERP_KERNEL::computeBarycenter2<mcIdType,INTERP_KERNEL::ALL_C_MODE>(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill);
       ptToFill+=spaceDim;
     }
 }
 
 /*!
- * \param [in,out] bary Barycenter array feeded with good values.
- * \sa MEDCouplingCurveLinearMesh::getBarycenterAndOwner
+ * \param [in,out] bary Barycenter array fed with good values.
+ * \sa MEDCouplingCurveLinearMesh::computeCellCenterOfMass
  */
 void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble *bary) const
 {
@@ -787,12 +800,12 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble *
   std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind2nd(std::multiplies<double>(),0.5));
 }
 
-void MEDCouplingCurveLinearMesh::renumberCells(const int *old2NewBg, bool check)
+void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType *old2NewBg, bool check)
 {
-  throw INTERP_KERNEL::Exception("Functionnality of renumbering cell not available for CurveLinear Mesh !");
+  throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CurveLinear Mesh !");
 }
 
-void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const
+void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const
 {
   int it,order;
   double time=getTime(it,order);
@@ -810,10 +823,10 @@ void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector<dou
   //
   tinyInfo.push_back(it);
   tinyInfo.push_back(order);
-  tinyInfo.push_back((int)_structure.size());
-  for(std::vector<int>::const_iterator itt=_structure.begin();itt!=_structure.end();itt++)
+  tinyInfo.push_back(ToIdType(_structure.size()));
+  for(std::vector<mcIdType>::const_iterator itt=_structure.begin();itt!=_structure.end();itt++)
     tinyInfo.push_back(*itt);
-  std::vector<int> tinyInfo2;
+  std::vector<mcIdType> tinyInfo2;
   if((const DataArrayDouble *)_coords)
     _coords->getTinySerializationIntInformation(tinyInfo2);
   tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
@@ -821,21 +834,21 @@ void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector<dou
   tinyInfoD.push_back(time);
 }
 
-void MEDCouplingCurveLinearMesh::resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
+void MEDCouplingCurveLinearMesh::resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const
 {
   a1->alloc(tinyInfo[2],1);
-  std::vector<int> tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end());
+  std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end());
   a2->resizeForUnserialization(tinyInfo2);
 }
 
-void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
+void MEDCouplingCurveLinearMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const
 {
-  a1=DataArrayInt::New();
-  a1->alloc((int)_structure.size(),1);
-  int *ptr=a1->getPointer();
-  for(std::vector<int>::const_iterator it=_structure.begin();it!=_structure.end();it++,ptr++)
+  a1=DataArrayIdType::New();
+  a1->alloc(_structure.size(),1);
+  mcIdType *ptr=a1->getPointer();
+  for(std::vector<mcIdType>::const_iterator it=_structure.begin();it!=_structure.end();it++,ptr++)
     *ptr=(*it);
-  int sz=0;
+  mcIdType sz=0;
   if((const DataArrayDouble *)_coords)
     if(_coords->isAllocated())
       sz=_coords->getNbOfElems();
@@ -845,21 +858,21 @@ void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&
     std::copy(_coords->begin(),_coords->end(),a2->getPointer());
 }
 
-void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
+void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2,
                                                  const std::vector<std::string>& littleStrings)
 {
   setName(littleStrings[0]);
   setDescription(littleStrings[1]);
   setTimeUnit(littleStrings[2]);
-  setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]);
-  int sz=tinyInfo[2];
+  setTime(tinyInfoD[0],FromIdType<int>(tinyInfo[0]),FromIdType<int>(tinyInfo[1]));
+  mcIdType sz=tinyInfo[2];
   _structure.resize(sz);
-  for(int i=0;i<sz;i++)
+  for(mcIdType i=0;i<sz;i++)
     _structure[i]=tinyInfo[3+i];
-  if((int)tinyInfo.size()>sz+3)
+  if(ToIdType(tinyInfo.size())>sz+3)
     {
       _coords=DataArrayDouble::New();
-      std::vector<int> tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end());
+      std::vector<mcIdType> tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end());
       _coords->resizeForUnserialization(tinyInfo2);
       std::copy(a2->begin(),a2->end(),_coords->getPointer());
       std::vector<std::string> littleStrings2(littleStrings.begin()+3,littleStrings.end());
@@ -870,11 +883,11 @@ void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tiny
 void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
 {
   std::ostringstream extent;
-  int meshDim=(int)_structure.size();
-  if(meshDim<=0 || meshDim>3)
+  std::size_t meshDim=_structure.size();
+  if(meshDim==0 || meshDim>3)
     throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::writeVTKLL : meshDim invalid ! must be in [1,2,3] !");
-  for(int i=0;i<3;i++)
-    { int val=i<meshDim?_structure[i]-1:0; extent << "0 " <<  val << " "; }
+  for(std::size_t i=0;i<3;i++)
+    { mcIdType val=i<meshDim?_structure[i]-1:0; extent << "0 " <<  val << " "; }
   ofs << "  <" << getVTKDataSetType() << " WholeExtent=\"" << extent.str() << "\">\n";
   ofs << "    <Piece Extent=\"" << extent.str() << "\">\n";
   ofs << "      <PointData>\n" << pointData << std::endl;
@@ -886,7 +899,7 @@ void MEDCouplingCurveLinearMesh::writeVTKLL(std::ostream& ofs, const std::string
     _coords->writeVTK(ofs,8,"Points",byteData);
   else
     {
-      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
+      MCAuto<DataArrayDouble> coo=_coords->changeNbOfComponents(3,0.);
       coo->writeVTK(ofs,8,"Points",byteData);
     }
   ofs << "      </Points>\n";
@@ -898,11 +911,12 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const
 {
   stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\".";
   stream << " Nodal structure : [";
-  for(std::size_t i=0;i<_structure.size();i++)
+  std::size_t s_size=_structure.size();
+  for(std::size_t i=0;i<s_size;i++)
     {
-      char tmp='X'+i;
+      char tmp=(char)((int)('X')+i);
       stream << " " << tmp << "=" << _structure[i];
-      if(i!=_structure.size()-1)
+      if(i!=s_size-1)
         stream << ", ";
     }
   stream << " ].";
@@ -911,13 +925,26 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const
     { stream << std::endl << "No coordinates set !"; return ; }
   if(!coo->isAllocated())
     { stream << std::endl << "Coordinates set but not allocated !"; return ; }
-  int nbOfCompo=coo->getNumberOfComponents();
-  if(nbOfCompo!=(int)_structure.size())
+  std::size_t nbOfCompo(coo->getNumberOfComponents());
+  std::size_t nbOfCompoExp(-1);
+  try
+    {
+      nbOfCompoExp=getSpaceDimension();
+    }
+  catch(INTERP_KERNEL::Exception&)
+    {
+    }
+  if(nbOfCompo!=nbOfCompoExp)
     { stream << std::endl << "Coordinates set and allocated but mismatch number of components !"; return ; }
   stream << std::endl << "Coordinates ( number of tuples = " << coo->getNumberOfTuples() << " ) : ";
   coo->reprQuickOverviewData(stream,200);
 }
 
+std::string MEDCouplingCurveLinearMesh::getVTKFileExtension() const
+{
+  return std::string("vts");
+}
+
 std::string MEDCouplingCurveLinearMesh::getVTKDataSetType() const
 {
   return std::string("StructuredGrid");