Salome HOME
Warnings help a lot.
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 1 Jun 2017 21:27:40 +0000 (23:27 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 1 Jun 2017 21:27:40 +0000 (23:27 +0200)
15 files changed:
src/MEDCoupling/MEDCoupling1GTUMesh.cxx
src/MEDCoupling/MEDCoupling1GTUMesh.hxx
src/MEDCoupling/MEDCouplingFieldDiscretization.cxx
src/MEDCoupling/MEDCouplingFieldDouble.cxx
src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.txx
src/MEDCoupling/MEDCouplingMesh.hxx
src/MEDCoupling/MEDCouplingStructuredMesh.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling/MEDCouplingUMesh_internal.cxx
src/MEDCoupling/MEDCouplingUMesh_intersection.cxx

index 83871ddad78461f8b39a421d4d53e3adbb12bbba..07c562a79afa1f894536836676bcaf0aa64e7808 100644 (file)
@@ -121,7 +121,7 @@ std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::Normali
  */
 INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(std::size_t cellId) const
 {
-  if(cellId>=0 && cellId<getNumberOfCells())
+  if(cellId<getNumberOfCells())
     return getCellModelEnum();
   std::ostringstream oss; oss << "MEDCoupling1GTUMesh::getTypeOfCell : Requesting type of cell #" << cellId << " but it should be in [0," << getNumberOfCells() << ") !";
   throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -758,11 +758,11 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const
   return ret.retn();
 }
 
-void MEDCoupling1SGTUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCoupling1SGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
   int sz=getNumberOfNodesPerCell();
   conn.resize(sz);
-  if(cellId>=0 && cellId<getNumberOfCells())
+  if(cellId<getNumberOfCells())
     std::copy(_conn->begin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin());
   else
     {
@@ -2536,10 +2536,10 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeEffectiveNbOfNodesPerCell() const
   return ret.retn();
 }
 
-void MEDCoupling1DGTUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
-  int nbOfCells(getNumberOfCells());//performs checks
-  if(cellId>=0 && cellId<nbOfCells)
+  std::size_t nbOfCells(getNumberOfCells());//performs checks
+  if(cellId<nbOfCells)
     {
       int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
       int nbOfNodes=stp-strt;
@@ -3306,12 +3306,12 @@ void MEDCoupling1DGTUMesh::allocateCells(int nbOfCells)
  */
 void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd)
 {
-  int sz=(int)std::distance(nodalConnOfCellBg,nodalConnOfCellEnd);
+  std::size_t sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd));
   DataArrayInt *c(_conn),*c2(_conn_indx);
   if(c && c2)
     {
       int pos=c2->back();
-      if(pos==c->getNumberOfTuples())
+      if(pos==(int)c->getNumberOfTuples())
         {
           c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd);
           c2->pushBackSilent(pos+sz);
@@ -3428,7 +3428,7 @@ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalC
 bool MEDCoupling1DGTUMesh::isPacked() const
 {
   checkConsistencyLight();
-  return _conn_indx->front()==0 && _conn_indx->back()==_conn->getNumberOfTuples();
+  return _conn_indx->front()==0 && _conn_indx->back()==(int)_conn->getNumberOfTuples();
 }
 
 MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(const MEDCoupling1DGTUMesh *mesh1, const MEDCoupling1DGTUMesh *mesh2)
index 12855d1bd457675e30bb984b26df73bb4322f509..d2f73c1b81c36662ce1abfe3aaa9f60b0b50f991 100644 (file)
@@ -113,7 +113,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
     MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
-    MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
+    MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
     MEDCOUPLING_EXPORT std::string advancedRepr() const;
     MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
@@ -209,7 +209,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const;
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
     MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
-    MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
+    MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
     MEDCOUPLING_EXPORT std::string advancedRepr() const;
     MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
index eb719663d447f7c47800cf24995d01f5449306ac..fac00497ff63995ed20e7b66bd93b0480a1c9120 100644 (file)
@@ -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 "MEDCouplingFieldDiscretization.hxx"
 #include "MEDCouplingCMesh.hxx"
@@ -288,8 +288,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const
   if(!arr)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::integral : input array is NULL !");
   MCAuto<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
-  int nbOfCompo=arr->getNumberOfComponents();
-  int nbOfElems=getNumberOfTuples(mesh);
+  std::size_t nbOfCompo(arr->getNumberOfComponents()),nbOfElems(getNumberOfTuples(mesh));
   if(nbOfElems!=arr->getNumberOfTuples())
     {
       std::ostringstream oss; oss << "MEDCouplingFieldDiscretization::integral : field is not correct ! number of tuples in array is " << arr->getNumberOfTuples();
@@ -297,10 +296,9 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   std::fill(res,res+nbOfCompo,0.);
-  const double *arrPtr=arr->getConstPointer();
-  const double *volPtr=vol->getArray()->getConstPointer();
+  const double *arrPtr(arr->begin()),*volPtr(vol->getArray()->begin());
   INTERP_KERNEL::AutoPtr<double> tmp=new double[nbOfCompo];
-  for (int i=0;i<nbOfElems;i++)
+  for(std::size_t i=0;i<nbOfElems;i++)
     {
       std::transform(arrPtr+i*nbOfCompo,arrPtr+(i+1)*nbOfCompo,(double *)tmp,std::bind2nd(std::multiplies<double>(),volPtr[i]));
       std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus<double>());
@@ -555,7 +553,7 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(con
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
           const DataArrayInt *ids(idsPerType[pos]);
-          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
             {
               std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -799,7 +797,7 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCod
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
           const DataArrayInt *ids(idsPerType[pos]);
-          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
             {
               std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -862,7 +860,7 @@ void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCoupl
 {
   if(!mesh || !da)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::checkCoherencyBetween : NULL input mesh or DataArray !");
-  if(mesh->getNumberOfNodes()!=da->getNumberOfTuples())
+  if(mesh->getNumberOfNodes()!=(int)da->getNumberOfTuples())
     {
       std::ostringstream message;
       message << "Field on nodes invalid because there are " << mesh->getNumberOfNodes();
@@ -1143,7 +1141,7 @@ void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCoupl
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !");
   if(!mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh or DataArray !");
-  int nbOfTuples=_discr_per_cell->getNumberOfTuples();
+  std::size_t nbOfTuples(_discr_per_cell->getNumberOfTuples());
   if(nbOfTuples!=mesh->getNumberOfCells())
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has a discretization per cell but it's not matching the underlying mesh !");
 }
@@ -1395,7 +1393,7 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !");
   int nbOfSplit=(int)idsPerType.size();
   int nbOfTypes=(int)code.size()/3;
-  int ret=0;
+  std::size_t ret(0);
   for(int i=0;i<nbOfTypes;i++)
     {
       int nbOfEltInChunk=code[3*i+1];
@@ -1410,7 +1408,7 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
           const DataArrayInt *ids(idsPerType[pos]);
-          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
             {
               std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -1462,16 +1460,16 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplin
 {
   if(!mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !");
-  int nbOfTuples=mesh->getNumberOfCells();
+  std::size_t nbOfTuples(mesh->getNumberOfCells());
   MCAuto<DataArrayInt> ret=DataArrayInt::New();
   ret->alloc(nbOfTuples+1,1);
-  int *retPtr=ret->getPointer();
-  const int *start=_discr_per_cell->getConstPointer();
+  int *retPtr(ret->getPointer());
+  const int *start(_discr_per_cell->begin());
   if(_discr_per_cell->getNumberOfTuples()!=nbOfTuples)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : mismatch between the mesh and the discretization ids array length !");
   int maxPossible=(int)_loc.size();
   retPtr[0]=0;
-  for(int i=0;i<nbOfTuples;i++,start++)
+  for(std::size_t i=0;i<nbOfTuples;i++,start++)
     {
       if(*start>=0 && *start<maxPossible)
         retPtr[i+1]=retPtr[i]+_loc[*start].getNumberOfGaussPt();
@@ -1679,7 +1677,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
-  int nbOfTuples(getNumberOfTuples(mesh));
+  std::size_t nbOfTuples(getNumberOfTuples(mesh));
   if(nbOfTuples!=da->getNumberOfTuples())
     {
       std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !";
@@ -1701,7 +1699,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con
   _discr_per_cell->checkAllocated();
   if(_discr_per_cell->getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but with nb of components different from 1 !");
-  if(_discr_per_cell->getNumberOfTuples()!=(int)vol->getNumberOfTuples())
+  if(_discr_per_cell->getNumberOfTuples()!=vol->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but mismatch between nb of cells of mesh and size of spatial disr array !");
   MCAuto<DataArrayInt> offset=getOffsetArr(mesh);
   MCAuto<DataArrayDouble> arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1);
@@ -1820,7 +1818,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCe
   if(!mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : null mesh !");
   MCAuto<DataArrayInt> nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer
-  int nbOfCells=mesh->getNumberOfCells();
+  std::size_t nbOfCells(mesh->getNumberOfCells());
   if(_discr_per_cell->getNumberOfTuples()!=nbOfCells)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeTupleIdsToSelectFromCellIds : mismatch of nb of tuples of cell ids array and number of cells !");
   nbOfNodesPerCell->computeOffsetsFull();
@@ -2165,7 +2163,7 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCod
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
           const DataArrayInt *ids(idsPerType[pos]);
-          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
+          if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0)
             {
               std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -2586,7 +2584,7 @@ double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh
 
 void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const
 {
-  int nbOfTuples=getNumberOfTuples(mesh);
+  std::size_t nbOfTuples(getNumberOfTuples(mesh));
   if(nbOfTuples!=da->getNumberOfTuples())
     {
       std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !";
@@ -2796,7 +2794,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const Da
 {
   if(!arr || !arr->isAllocated())
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !");
-  int nbOfRows(getNumberOfMeshPlaces(mesh));
+  std::size_t nbOfRows(getNumberOfMeshPlaces(mesh));
   if(arr->getNumberOfTuples()!=nbOfRows)
     {
       std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !";
@@ -3026,9 +3024,9 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const
  */
 DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const
 {
-  int spaceDimension=arr->getNumberOfComponents();
+  std::size_t spaceDimension(arr->getNumberOfComponents());
   delta=spaceDimension+1;
-  int szOfMatrix=arr->getNumberOfTuples();
+  std::size_t szOfMatrix(arr->getNumberOfTuples());
   if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size");
   MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
@@ -3036,7 +3034,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA
   const double *srcWork=matr->getConstPointer();
   const double *srcWork2=arr->getConstPointer();
   double *destWork=ret->getPointer();
-  for(int i=0;i<szOfMatrix;i++)
+  for(std::size_t i=0;i<szOfMatrix;i++)
     {
       destWork=std::copy(srcWork,srcWork+szOfMatrix,destWork);
       srcWork+=szOfMatrix;
@@ -3048,7 +3046,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA
   std::fill(destWork,destWork+spaceDimension+1,0.); destWork+=spaceDimension+1;
   MCAuto<DataArrayDouble> arrNoI=arr->toNoInterlace();
   srcWork2=arrNoI->getConstPointer();
-  for(int i=0;i<spaceDimension;i++)
+  for(std::size_t i=0;i<spaceDimension;i++)
     {
       destWork=std::copy(srcWork2,srcWork2+szOfMatrix,destWork);
       srcWork2+=szOfMatrix;
index 49bb8d44275b3c334b6e4c1ccb0b1c8d15498919..c4a301a166d35da6297ef74de75e45e51552dd01 100644 (file)
@@ -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 "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingFieldTemplate.hxx"
@@ -1852,7 +1852,7 @@ bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals)
   if(_type.isNull())
     throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !");
   MCAuto<MEDCouplingUMesh> meshC2((MEDCouplingUMesh *)meshC->deepCopy());
-  int oldNbOfCells=meshC2->getNumberOfCells();
+  std::size_t oldNbOfCells(meshC2->getNumberOfCells());
   MCAuto<DataArrayInt> arr=meshC2->zipConnectivityTraducer(compType);
   if(meshC2->getNumberOfCells()!=oldNbOfCells)
     {
index b897b57b754b058d34e0238484ea469d13894a1e..54c860cc42682093dee56cb75e0f456e4d232e59 100644 (file)
@@ -335,7 +335,7 @@ std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNE
   return ret*_mesh1D->getNumberOfCells();
 }
 
-void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
   int nbOfCells2D(_mesh2D->getNumberOfCells());
   int nbOfNodes2D(_mesh2D->getNumberOfNodes());
index 2965c82a83d0f72967af9bf497011e9e99a2c6f5..a3025954cebc36140046efab4475f41653e07cfc 100644 (file)
@@ -64,7 +64,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const;
     MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const;
     MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
-    MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
+    MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
     MEDCOUPLING_EXPORT std::string advancedRepr() const;
index 658d78727d407f86abcfbc2ce3509f7e987c12b3..91bef50389f19b4805a8f2d441ed511c2dd2aa22 100644 (file)
@@ -572,7 +572,7 @@ void DataArray::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info)
 
 void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const
 {
-  if(getNumberOfTuples()!=nbOfTuples)
+  if((int)getNumberOfTuples()!=nbOfTuples)
     {
       std::ostringstream oss; oss << msg << " : mismatch number of tuples : expected " <<  nbOfTuples << " having " << getNumberOfTuples() << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -1267,21 +1267,21 @@ DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble
     case 3:
       {
         BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
-        for(int i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
+        for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
           *retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
         break;
       }
     case 2:
       {
         BBTree<2,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
-        for(int i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
+        for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
           *retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
         break;
       }
     case 1:
       {
         BBTree<1,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps);
-        for(int i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
+        for(std::size_t i=0;i<nbOfTuples;i++,retPtr++,thisBBPtr+=nbOfComp)
           *retPtr=bbt.getNbOfIntersectingElems(thisBBPtr);
         break;
       }
@@ -2041,7 +2041,7 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor
     throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : input coords are NULL !");
   MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
   checkAllocated(); coords->checkAllocated();
-  int nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
+  std::size_t nbOfComp(getNumberOfComponents()),nbTuples(getNumberOfTuples());
   if(nbOfComp!=3)
     throw INTERP_KERNEL::Exception("DataArrayDouble::fromCartToCylGiven : must be an array with exactly 3 components !");
   if(coords->getNumberOfComponents()!=3)
@@ -3148,15 +3148,14 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray
   std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array Dot !");
-  int nbOfTuple=a1->getNumberOfTuples();
+  std::size_t nbOfTuple(a1->getNumberOfTuples());
   if(nbOfTuple!=a2->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Dot !");
   DataArrayDouble *ret=DataArrayDouble::New();
   ret->alloc(nbOfTuple,1);
   double *retPtr=ret->getPointer();
-  const double *a1Ptr=a1->getConstPointer();
-  const double *a2Ptr=a2->getConstPointer();
-  for(int i=0;i<nbOfTuple;i++)
+  const double *a1Ptr=a1->begin(),*a2Ptr(a2->begin());
+  for(std::size_t i=0;i<nbOfTuple;i++)
     {
       double sum=0.;
       for(std::size_t j=0;j<nbOfComp;j++)
@@ -3194,15 +3193,14 @@ DataArrayDouble *DataArrayDouble::CrossProduct(const DataArrayDouble *a1, const
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array crossProduct !");
   if(nbOfComp!=3)
     throw INTERP_KERNEL::Exception("Nb of components must be equal to 3 for array crossProduct !");
-  int nbOfTuple=a1->getNumberOfTuples();
+  std::size_t nbOfTuple(a1->getNumberOfTuples());
   if(nbOfTuple!=a2->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array crossProduct !");
   DataArrayDouble *ret=DataArrayDouble::New();
   ret->alloc(nbOfTuple,3);
   double *retPtr=ret->getPointer();
-  const double *a1Ptr=a1->getConstPointer();
-  const double *a2Ptr=a2->getConstPointer();
-  for(int i=0;i<nbOfTuple;i++)
+  const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin());
+  for(std::size_t i=0;i<nbOfTuple;i++)
     {
       retPtr[3*i]=a1Ptr[3*i+1]*a2Ptr[3*i+2]-a1Ptr[3*i+2]*a2Ptr[3*i+1];
       retPtr[3*i+1]=a1Ptr[3*i+2]*a2Ptr[3*i]-a1Ptr[3*i]*a2Ptr[3*i+2];
@@ -3232,19 +3230,18 @@ DataArrayDouble *DataArrayDouble::Max(const DataArrayDouble *a1, const DataArray
   std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array Max !");
-  int nbOfTuple=a1->getNumberOfTuples();
+  std::size_t nbOfTuple(a1->getNumberOfTuples());
   if(nbOfTuple!=a2->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array Max !");
-  DataArrayDouble *ret=DataArrayDouble::New();
+  MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
   ret->alloc(nbOfTuple,nbOfComp);
-  double *retPtr=ret->getPointer();
-  const double *a1Ptr=a1->getConstPointer();
-  const double *a2Ptr=a2->getConstPointer();
-  int nbElem=nbOfTuple*nbOfComp;
-  for(int i=0;i<nbElem;i++)
+  double *retPtr(ret->getPointer());
+  const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin());
+  std::size_t nbElem(nbOfTuple*nbOfComp);
+  for(std::size_t i=0;i<nbElem;i++)
     retPtr[i]=std::max(a1Ptr[i],a2Ptr[i]);
   ret->copyStringInfoFrom(*a1);
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -3267,19 +3264,18 @@ DataArrayDouble *DataArrayDouble::Min(const DataArrayDouble *a1, const DataArray
   std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array min !");
-  int nbOfTuple=a1->getNumberOfTuples();
+  std::size_t nbOfTuple(a1->getNumberOfTuples());
   if(nbOfTuple!=a2->getNumberOfTuples())
     throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array min !");
-  DataArrayDouble *ret=DataArrayDouble::New();
+  MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
   ret->alloc(nbOfTuple,nbOfComp);
-  double *retPtr=ret->getPointer();
-  const double *a1Ptr=a1->getConstPointer();
-  const double *a2Ptr=a2->getConstPointer();
-  int nbElem=nbOfTuple*nbOfComp;
-  for(int i=0;i<nbElem;i++)
+  double *retPtr(ret->getPointer());
+  const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin());
+  std::size_t nbElem(nbOfTuple*nbOfComp);
+  for(std::size_t i=0;i<nbElem;i++)
     retPtr[i]=std::min(a1Ptr[i],a2Ptr[i]);
   ret->copyStringInfoFrom(*a1);
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -4526,7 +4522,7 @@ bool DataArrayInt::hasUniqueValues() const
   checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !");
-  int nbOfTuples(getNumberOfTuples());
+  std::size_t nbOfTuples(getNumberOfTuples());
   std::set<int> s(begin(),end());  // in C++11, should use unordered_set (O(1) complexity)
   if (s.size() != nbOfTuples)
     return false;
@@ -4635,7 +4631,7 @@ DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tup
 {
   std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd));
   checkAllocated();
-  if(getNumberOfComponents()!=(int)nbOfCompoExp)
+  if(getNumberOfComponents()!=nbOfCompoExp)
     {
       std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -5010,17 +5006,16 @@ DataArrayInt *DataArrayInt::Aggregate(const DataArrayInt *a1, const DataArrayInt
 {
   if(!a1 || !a2)
     throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input DataArrayInt instance is NULL !");
-  int nbOfComp=a1->getNumberOfComponents();
+  std::size_t nbOfComp(a1->getNumberOfComponents());
   if(nbOfComp!=a2->getNumberOfComponents())
     throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !");
-  int nbOfTuple1=a1->getNumberOfTuples();
-  int nbOfTuple2=a2->getNumberOfTuples();
-  DataArrayInt *ret=DataArrayInt::New();
+  std::size_t nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples());
+  MCAuto<DataArrayInt> ret(DataArrayInt::New());
   ret->alloc(nbOfTuple1+nbOfTuple2-offsetA2,nbOfComp);
-  int *pt=std::copy(a1->getConstPointer(),a1->getConstPointer()+nbOfTuple1*nbOfComp,ret->getPointer());
+  int *pt=std::copy(a1->begin(),a1->end(),ret->getPointer());
   std::copy(a2->getConstPointer()+offsetA2*nbOfComp,a2->getConstPointer()+nbOfTuple2*nbOfComp,pt);
   ret->copyStringInfoFrom(*a1);
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -5047,8 +5042,7 @@ DataArrayInt *DataArrayInt::Aggregate(const std::vector<const DataArrayInt *>& a
   if(a.empty())
     throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input list must be NON EMPTY !");
   std::vector<const DataArrayInt *>::const_iterator it=a.begin();
-  int nbOfComp=(*it)->getNumberOfComponents();
-  int nbt=(*it++)->getNumberOfTuples();
+  std::size_t nbOfComp((*it)->getNumberOfComponents()),nbt((*it++)->getNumberOfTuples());
   for(int i=1;it!=a.end();it++,i++)
     {
       if((*it)->getNumberOfComponents()!=nbOfComp)
index f290260540768fbad3a194ab7868672492232d93..86dc8a297a987ea75725bbaabd2b98af5efdfbb7 100644 (file)
@@ -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)
 
 #ifndef __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__
 #define __PARAMEDMEM_MEDCOUPLINGMEMARRAY_TXX__
@@ -1132,7 +1132,7 @@ namespace MEDCoupling
       {
         int a,b,c;
         spd->getSlice(a,b,c);
-        if(a==0 && b==getNumberOfTuples() && c==1)
+        if(a==0 && b==(int)getNumberOfTuples() && c==1)
           {
             DataArrayTemplate<T> *directRet(const_cast<DataArrayTemplate<T> *>(this));
             directRet->incrRef();
@@ -3015,7 +3015,7 @@ struct NotInRange
     for(it=a.begin();it!=a.end();it++)
       (*it)->checkAllocated();
     it=a.begin();
-    int nbOfTuples((*it)->getNumberOfTuples());
+    std::size_t nbOfTuples((*it)->getNumberOfTuples());
     std::vector<int> nbc(a.size());
     std::vector<const T *> pts(a.size());
     nbc[0]=(*it)->getNumberOfComponents();
@@ -3031,8 +3031,8 @@ struct NotInRange
     typename Traits<T>::ArrayType *ret(Traits<T>::ArrayType::New());
     ret->alloc(nbOfTuples,totalNbOfComp);
     T *retPtr(ret->getPointer());
-    for(int i=0;i<nbOfTuples;i++)
-      for(int j=0;j<(int)a.size();j++)
+    for(std::size_t i=0;i<nbOfTuples;i++)
+      for(std::size_t j=0;j<a.size();j++)
         {
           retPtr=std::copy(pts[j],pts[j]+nbc[j],retPtr);
           pts[j]+=nbc[j];
@@ -3105,14 +3105,14 @@ struct NotInRange
   {
     this->checkAllocated();
     other->checkAllocated();
-    int nbOfTuples(this->getNumberOfTuples());
+    std::size_t nbOfTuples(this->getNumberOfTuples());
     if(nbOfTuples!=other->getNumberOfTuples())
       throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !");
     int nbOfComp1(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents());
     T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T));
     T *w=newArr;
     const T *inp1(this->begin()),*inp2(other->begin());
-    for(int i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
+    for(std::size_t i=0;i<nbOfTuples;i++,inp1+=nbOfComp1,inp2+=nbOfComp2)
       {
         w=std::copy(inp1,inp1+nbOfComp1,w);
         w=std::copy(inp2,inp2+nbOfComp2,w);
@@ -3481,7 +3481,7 @@ struct NotInRange
     this->checkAllocated();
     if(this->getNumberOfComponents()!=1 || other.getNumberOfComponents()!=1)
       throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' have to have exactly ONE component !");
-    int nbTuple(this->getNumberOfTuples());
+    std::size_t nbTuple(this->getNumberOfTuples());
     other.checkAllocated();
     if(nbTuple!=other.getNumberOfTuples())
       throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !");
@@ -3489,12 +3489,12 @@ struct NotInRange
     ret->alloc(nbTuple,1);
     ret->fillWithValue(-1);
     const T *pt(this->begin());
-    std::map<int,int> mm;
-    for(int i=0;i<nbTuple;i++)
-      mm[pt[i]]=i;
+    std::map<int,mcIdType> mm;
+    for(std::size_t i=0;i<nbTuple;i++)
+      mm[pt[i]]=(mcIdType)i;
     pt=other.begin();
     mcIdType *retToFill(ret->getPointer());
-    for(int i=0;i<nbTuple;i++)
+    for(std::size_t i=0;i<nbTuple;i++)
       {
         std::map<int,int>::const_iterator it=mm.find(pt[i]);
         if(it==mm.end())
@@ -3532,11 +3532,11 @@ struct NotInRange
     ret->alloc(nbTuples,1);
     T *retPt(ret->getPointer());
     std::map<int,mcIdType> m;
-    for(mcIdType i=0;i<thisNbTuples;i++,thisPt++)
-      m[*thisPt]=i;
+    for(std::size_t i=0;i<thisNbTuples;i++,thisPt++)
+      m[*thisPt]=(mcIdType)i;
     if(m.size()!=thisNbTuples)
       throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : some elements appears more than once !");
-    for(mcIdType i=0;i<nbTuples;i++,retPt++,pt++)
+    for(std::size_t i=0;i<nbTuples;i++,retPt++,pt++)
       {
         std::map<int,mcIdType>::const_iterator it(m.find(*pt));
         if(it!=m.end())
index 531e3add85e8749fbfa8ab57109a3d8a7e5152e6..32bd863917cbb98cf0aeb75ef8b2cef9f1b9d2be 100644 (file)
@@ -100,7 +100,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT virtual std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
     MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const = 0;
     MEDCOUPLING_EXPORT virtual std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
-    MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const = 0;
+    MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const = 0;
     MEDCOUPLING_EXPORT virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
     MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
     MEDCOUPLING_EXPORT virtual std::string simpleRepr() const = 0;
index 0fb0b18adab65ba2a933a96230d780316d17f3c9..5cbe73d8e526f492a34b1f59024577b20e44e776 100644 (file)
@@ -140,7 +140,7 @@ DataArrayInt *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() cons
   return computeNbOfNodesPerCell();
 }
 
-void MEDCouplingStructuredMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
   int meshDim=getMeshDimension();
   int tmpCell[3],tmpNode[3];
index 42b9e55403b83a949cd192230d62e1fb61ddd34f..72857d6c8eff8011b55a53d5d30de16f203d1900 100644 (file)
@@ -42,7 +42,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT std::vector<int> getLocationFromNodeId(int nodeId) const;
     MEDCOUPLING_EXPORT static void GetPosFromId(int eltId, int meshDim, const int *split, int *res);
     MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim);
-    MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
+    MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingMesh *other);
     MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
index f1ab4e1a7779cf6115be9f9fc5e2fbe793609698..8848ab8c26ff7a0a004117090f432ade57c1f24d 100644 (file)
@@ -1984,19 +1984,19 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE
       oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !";
       throw INTERP_KERNEL::Exception(oss.str());
     }
-  int nbOfCellsToModify=(int)std::distance(cellIdsBg,cellIdsEnd);
+  std::size_t nbOfCellsToModify(std::distance(cellIdsBg,cellIdsEnd));
   if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells())
     {
       std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : cells ids length (" <<  nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
       throw INTERP_KERNEL::Exception(oss.str());
     }
-  int nbOfCells=getNumberOfCells();
-  bool easyAssign=true;
-  const int *connI=_nodal_connec_index->getConstPointer();
-  const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer();
+  std::size_t nbOfCells(getNumberOfCells());
+  bool easyAssign(true);
+  const int *connI(_nodal_connec_index->begin());
+  const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin();
   for(const int *it=cellIdsBg;it!=cellIdsEnd && easyAssign;it++,connIOther++)
     {
-      if(*it>=0 && *it<nbOfCells)
+      if(*it>=0 && *it<(int)nbOfCells)
         {
           easyAssign=(connIOther[1]-connIOther[0])==(connI[*it+1]-connI[*it]);
         }
@@ -2034,7 +2034,7 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const
       throw INTERP_KERNEL::Exception(oss.str());
     }
   int nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : ");
-  if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells())
+  if(nbOfCellsToModify!=(int)otherOnSameCoordsThanThis.getNumberOfCells())
     {
       std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" <<  nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !";
       throw INTERP_KERNEL::Exception(oss.str());
@@ -2390,7 +2390,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On
       // Connex zone without the crack (to compute the next seed really)
       int dnu;
       DAInt connexCheck = MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(&seed, &seed+1, neighInit00,neighIInit00, -1, dnu);
-      int cnt = 0;
+      std::size_t cnt(0);
       for (int * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++)
         hitCells->setIJ(*ptr,0,1);
       // Connex zone WITH the crack (to identify cells lying on either part of the crack)
@@ -2778,7 +2778,7 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::Direc
 INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(std::size_t cellId) const
 {
   const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
-  if(cellId>=0 && cellId<_nodal_connec_index->getNbOfElems()-1)
+  if(cellId<_nodal_connec_index->getNbOfElems()-1)
     return (INTERP_KERNEL::NormalizedCellType) pt[ptI[cellId]];
   else
     {
@@ -2839,10 +2839,9 @@ std::size_t MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::Normalized
  *         cleared before the appending.
  *  \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ).
  */
-void MEDCouplingUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
+void MEDCouplingUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const
 {
-  const int *ptI=_nodal_connec_index->getConstPointer();
-  const int *pt=_nodal_connec->getConstPointer();
+  const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin());
   for(const int *w=pt+ptI[cellId]+1;w!=pt+ptI[cellId+1];w++)
     if(*w>=0)
       conn.push_back(*w);
@@ -3713,7 +3712,7 @@ MCAuto<MEDCouplingUMesh> MEDCouplingUMesh::clipSingle3DCellByPlane(const double
   std::vector<std::vector<int> > res;
   buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res);
   std::size_t sz(res.size());
-  if((int)res.size()==mDesc1->getNumberOfCells() && sameNbNodes)
+  if(res.size()==mDesc1->getNumberOfCells() && sameNbNodes)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !");
   for(std::size_t i=0;i<sz;i++)
     {
@@ -3879,7 +3878,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps,
   MCAuto<MEDCouplingFieldDouble> f=buildDirectionVectorField();
   const double *fPtr=f->getArray()->getConstPointer();
   double tmp[3];
-  for(int i=0;i<getNumberOfCells();i++)
+  for(std::size_t i=0;i<getNumberOfCells();i++)
     {
       const double *tmp1=fPtr+3*i;
       tmp[0]=tmp1[1]*v[2]-tmp1[2]*v[1];
@@ -7727,7 +7726,7 @@ bool MEDCouplingUMesh::RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, cons
       previousArrI=*arrIPtr;
       *arrIPtr=(int)arrOut.size();
     }
-  if(arr->getNumberOfTuples()==(int)arrOut.size())
+  if(arr->getNumberOfTuples()==arrOut.size())
     return false;
   arr->alloc((int)arrOut.size(),1);
   std::copy(arrOut.begin(),arrOut.end(),arr->getPointer());
index 36b95b9b6308b4c961c13d65d7fb3a8dec9064d8..37c7ffa998d628d6ec8e1d18be2d07d4fbc3b00d 100644 (file)
@@ -74,7 +74,7 @@ namespace MEDCoupling
     MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const;
     MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
-    MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
+    MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
     MEDCOUPLING_EXPORT std::string advancedRepr() const;
     MEDCOUPLING_EXPORT std::string cppRepr() const;
index 5746888267c49ac5e8a9b8c8c5ca88bbb0af1104..10c0858400c273f6f5907d74884e262e7bf4bbbd 100644 (file)
@@ -395,7 +395,7 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps)
           newConnIPtr[1]=newConnIPtr[0]+3;
         }
     }
-  if(addCoo.empty() && ((int)newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed
+  if(addCoo.empty() && newConn.size()==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed
     return ;
   _types=types;
   DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index);
index 7a6fa91598e72e4f8da729350f81f5fc2865cb96..0af597a3d36afbc272d3f96d620a077cbefe5cbe 100644 (file)
@@ -865,7 +865,7 @@ public:
   VectorOfCellInfo(const std::vector<int>& edges, const std::vector< MCAuto<INTERP_KERNEL::Edge> >& edgesPtr);
   std::size_t size() const { return _pool.size(); }
   int getPositionOf(double eps, const MEDCouplingUMesh *mesh) const;
-  void setMeshAt(int pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs);
+  void setMeshAt(std::size_t pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs);
   const std::vector<int>& getConnOf(int pos) const { return get(pos)._edges; }
   const std::vector< MCAuto<INTERP_KERNEL::Edge> >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; }
   MCAuto<MEDCouplingUMesh> getZeMesh() const { return _ze_mesh; }
@@ -900,7 +900,7 @@ int VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) co
   return zeMesh->getCellContainingPoint(barys->begin(),eps);
 }
 
-void VectorOfCellInfo::setMeshAt(int pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs)
+void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto<MEDCouplingUMesh>& mesh, int istart, int iend, const MCAuto<MEDCouplingUMesh>& mesh1DInCase, const std::vector< std::vector<int> >& edges, const std::vector< std::vector< MCAuto<INTERP_KERNEL::Edge> > >& edgePtrs)
 {
   get(pos);//to check pos
   bool isFast(pos==0 && _pool.size()==1);
@@ -912,7 +912,7 @@ void VectorOfCellInfo::setMeshAt(int pos, const MCAuto<MEDCouplingUMesh>& mesh,
     _edge_info.push_back(EdgeInfo(istart,iend,pos,edgePtrs[0].back()));
   //
   std::vector<CellInfo> pool(_pool.size()-1+sz);
-  for(int i=0;i<pos;i++)
+  for(std::size_t i=0;i<pos;i++)
     pool[i]=_pool[i];
   for(std::size_t j=0;j<sz;j++)
     pool[pos+j]=CellInfo(edges[j],edgePtrs[j]);
@@ -1775,7 +1775,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D,
       MCAuto<MEDCouplingUMesh> splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3));
       ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true);
       outMesh2DSplit.push_back(splitOfOneCell);
-      for(int i=0;i<splitOfOneCell->getNumberOfCells();i++)
+      for(std::size_t i=0;i<splitOfOneCell->getNumberOfCells();i++)
         ret2->pushBackSilent(*it);
     }
   //
@@ -2151,11 +2151,12 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
     const double * normalsP = normals->getConstPointer();
 
     // Sort faces by decreasing surface:
-    vector<pair<double,int>> S;
-    for(int i=0;i < surfs->getNumberOfTuples();i++){
+    vector< pair<double,int> > S;
+    for(std::size_t i=0;i < surfs->getNumberOfTuples();i++)
+      {
         pair<double,int> p = make_pair(surfs->begin()[i], i);
         S.push_back(p);
-    }
+      }
     sort(S.rbegin(),S.rend()); // reverse sort
     vector<bool> hit(nDescCell);
     fill(hit.begin(), hit.end(), false);
@@ -2188,9 +2189,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
         MCAuto<MEDCouplingUMesh> mPartCand(mDesc->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), false)); // false=zipCoords is called
         double * cooPartRef(mPartRef->_coords->getPointer());
         double * cooPartCand(mPartCand->_coords->getPointer());
-        for (int ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
+        for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
           rotation.transform_vector(cooPartRef+SPACEDIM*ii);
-        for (int ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
+        for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
           rotation.transform_vector(cooPartCand+SPACEDIM*ii);
 
         // Localize faces in 2D thanks to barycenters
@@ -2318,10 +2319,11 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
 
     // Sort edges by decreasing length:
     vector<pair<double,int>> S;
-    for(int i=0;i < lens->getNumberOfTuples();i++){
+    for(std::size_t i=0;i < lens->getNumberOfTuples();i++)
+      {
         pair<double,int> p = make_pair(lens->getIJ(i, 0), i);
         S.push_back(p);
-    }
+      }
     sort(S.rbegin(),S.rend()); // reverse sort
 
     vector<bool> hit(nDesc2Cell);
@@ -2371,9 +2373,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
         MCAuto<DataArrayInt>  nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1);
         double * cooPartRef(mPartRef->_coords->getPointer());
         double * cooPartCand(mPartCand->_coords->getPointer());
-        for (int ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
+        for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++)
           rotation.transform_vector(cooPartRef+SPACEDIM*ii);
-        for (int ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
+        for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++)
           rotation.transform_vector(cooPartCand+SPACEDIM*ii);
 
 
@@ -2431,7 +2433,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps)
     MCAuto<DataArrayInt> idx(DataArrayInt::New());       idx->alloc(1);                         idx->fillWithValue(0);
     MCAuto<DataArrayInt> vals(DataArrayInt::New());      vals->alloc(0);
     newConn->set3(superIdx, idx, vals);
-    for(int ii = 0; ii < getNumberOfCells(); ii++)
+    for(std::size_t ii = 0; ii < getNumberOfCells(); ii++)
       for (int jj=descIP[ii]; jj < descIP[ii+1]; jj++)
         {
           int sz, faceIdx = abs(descP[jj])-1;