From 325b22fcfccbdeb47aead09f366bd202ba9f8869 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 1 Jun 2017 23:27:40 +0200 Subject: [PATCH] Warnings help a lot. --- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 18 ++--- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 4 +- .../MEDCouplingFieldDiscretization.cxx | 50 +++++++------ src/MEDCoupling/MEDCouplingFieldDouble.cxx | 4 +- .../MEDCouplingMappedExtrudedMesh.cxx | 2 +- .../MEDCouplingMappedExtrudedMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 72 +++++++++---------- src/MEDCoupling/MEDCouplingMemArray.txx | 30 ++++---- src/MEDCoupling/MEDCouplingMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 2 +- src/MEDCoupling/MEDCouplingStructuredMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 29 ++++---- src/MEDCoupling/MEDCouplingUMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 2 +- .../MEDCouplingUMesh_intersection.cxx | 30 ++++---- 15 files changed, 122 insertions(+), 129 deletions(-) diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 83871ddad..07c562a79 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -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& conn) const +void MEDCoupling1SGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const { int sz=getNumberOfNodesPerCell(); conn.resize(sz); - if(cellId>=0 && cellIdbegin()+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& conn) const +void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const { - int nbOfCells(getNumberOfCells());//performs checks - if(cellId>=0 && cellIdgetIJ(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) diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx index 12855d1bd..d2f73c1b8 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.hxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.hxx @@ -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& conn) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& 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& conn) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index eb719663d..fac00497f 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -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 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 tmp=new double[nbOfCompo]; - for (int i=0;i(),volPtr[i])); std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus()); @@ -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;iisAllocated() || 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 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=0 && *startgetNumberOfTuples()) { 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 offset=getOffsetArr(mesh); MCAuto 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 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 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 arrNoI=arr->toNoInterlace(); srcWork2=arrNoI->getConstPointer(); - for(int i=0;i meshC2((MEDCouplingUMesh *)meshC->deepCopy()); - int oldNbOfCells=meshC2->getNumberOfCells(); + std::size_t oldNbOfCells(meshC2->getNumberOfCells()); MCAuto arr=meshC2->zipConnectivityTraducer(compType); if(meshC2->getNumberOfCells()!=oldNbOfCells) { diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index b897b57b7..54c860cc4 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -335,7 +335,7 @@ std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNE return ret*_mesh1D->getNumberOfCells(); } -void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(int cellId, std::vector& conn) const +void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const { int nbOfCells2D(_mesh2D->getNumberOfCells()); int nbOfNodes2D(_mesh2D->getNumberOfNodes()); diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx index 2965c82a8..a3025954c 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -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& conn) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 658d78727..91bef5038 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -572,7 +572,7 @@ void DataArray::setInfoAndChangeNbOfCompo(const std::vector& 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 bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); - for(int i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); - for(int i=0;i 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;ibegin(),*a2Ptr(a2->begin()); + for(std::size_t i=0;igetNumberOfTuples(); + 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;ibegin()),*a2Ptr(a2->begin()); + for(std::size_t i=0;igetNumberOfComponents()); 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 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;igetPointer()); + const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin()); + std::size_t nbElem(nbOfTuple*nbOfComp); + for(std::size_t i=0;icopyStringInfoFrom(*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 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;igetPointer()); + const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin()); + std::size_t nbElem(nbOfTuple*nbOfComp); + for(std::size_t i=0;icopyStringInfoFrom(*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 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 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& a if(a.empty()) throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input list must be NON EMPTY !"); std::vector::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) diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index f29026054..86dc8a297 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -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 *directRet(const_cast *>(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 nbc(a.size()); std::vector pts(a.size()); nbc[0]=(*it)->getNumberOfComponents(); @@ -3031,8 +3031,8 @@ struct NotInRange typename Traits::ArrayType *ret(Traits::ArrayType::New()); ret->alloc(nbOfTuples,totalNbOfComp); T *retPtr(ret->getPointer()); - for(int i=0;icheckAllocated(); 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;icheckAllocated(); 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 mm; - for(int i=0;i mm; + for(std::size_t i=0;igetPointer()); - for(int i=0;i::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 m; - for(mcIdType i=0;i::const_iterator it(m.find(*pt)); if(it!=m.end()) diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index 531e3add8..32bd86391 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -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 getAllGeoTypes() const = 0; - MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(int cellId, std::vector& conn) const = 0; + MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(int nodeId, std::vector& coo) const = 0; MEDCOUPLING_EXPORT virtual std::string simpleRepr() const = 0; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index 0fb0b18ad..5cbe73d8e 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -140,7 +140,7 @@ DataArrayInt *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() cons return computeNbOfNodesPerCell(); } -void MEDCouplingStructuredMesh::getNodeIdsOfCell(int cellId, std::vector& conn) const +void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const { int meshDim=getMeshDimension(); int tmpCell[3],tmpNode[3]; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx index 42b9e5540..72857d6c8 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx @@ -42,7 +42,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector 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& conn) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& 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; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index f1ab4e1a7..8848ab8c2 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -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=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& conn) const +void MEDCouplingUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& 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::clipSingle3DCellByPlane(const double std::vector > 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 f=buildDirectionVectorField(); const double *fPtr=f->getArray()->getConstPointer(); double tmp[3]; - for(int i=0;igetNumberOfTuples()==(int)arrOut.size()) + if(arr->getNumberOfTuples()==arrOut.size()) return false; arr->alloc((int)arrOut.size(),1); std::copy(arrOut.begin(),arrOut.end(),arr->getPointer()); diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 36b95b9b6..37c7ffa99 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -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& conn) const; + MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; MEDCOUPLING_EXPORT std::string cppRepr() const; diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx index 574688826..10c085840 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -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); diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index 7a6fa9159..0af597a3d 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -865,7 +865,7 @@ public: VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); std::size_t size() const { return _pool.size(); } int getPositionOf(double eps, const MEDCouplingUMesh *mesh) const; - void setMeshAt(int pos, const MCAuto& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); + void setMeshAt(std::size_t pos, const MCAuto& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); const std::vector& getConnOf(int pos) const { return get(pos)._edges; } const std::vector< MCAuto >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; } MCAuto 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& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs) +void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs) { get(pos);//to check pos bool isFast(pos==0 && _pool.size()==1); @@ -912,7 +912,7 @@ void VectorOfCellInfo::setMeshAt(int pos, const MCAuto& mesh, _edge_info.push_back(EdgeInfo(istart,iend,pos,edgePtrs[0].back())); // std::vector pool(_pool.size()-1+sz); - for(int i=0;i 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;igetNumberOfCells();i++) + for(std::size_t i=0;igetNumberOfCells();i++) ret2->pushBackSilent(*it); } // @@ -2151,11 +2151,12 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) const double * normalsP = normals->getConstPointer(); // Sort faces by decreasing surface: - vector> S; - for(int i=0;i < surfs->getNumberOfTuples();i++){ + vector< pair > S; + for(std::size_t i=0;i < surfs->getNumberOfTuples();i++) + { pair p = make_pair(surfs->begin()[i], i); S.push_back(p); - } + } sort(S.rbegin(),S.rend()); // reverse sort vector hit(nDescCell); fill(hit.begin(), hit.end(), false); @@ -2188,9 +2189,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto 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> S; - for(int i=0;i < lens->getNumberOfTuples();i++){ + for(std::size_t i=0;i < lens->getNumberOfTuples();i++) + { pair p = make_pair(lens->getIJ(i, 0), i); S.push_back(p); - } + } sort(S.rbegin(),S.rend()); // reverse sort vector hit(nDesc2Cell); @@ -2371,9 +2373,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto 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 idx(DataArrayInt::New()); idx->alloc(1); idx->fillWithValue(0); MCAuto 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; -- 2.39.2