From: Eugeny MALTCHIKOV Date: Thu, 17 Oct 2019 13:44:35 +0000 (+0300) Subject: Eliminating Wsign-compare warnings in medcouplingcpp X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=146ade1f8a37888735f3f479c9d1e8bb1ac77bda;p=tools%2Fmedcoupling.git Eliminating Wsign-compare warnings in medcouplingcpp --- diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx old mode 100644 new mode 100755 index dd396fd65..743948d7a --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -940,7 +940,7 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna if (edge[i]==max_cross) max_cross_list.push_back(zero_cross[i]+1) ; - double center((signature.size()/2.0)); + double center(static_cast(signature.size())/2.0); for (unsigned int i=0;igetNumberOfComponents()<1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !"); - if(_coords->getNumberOfTuples()!=(int)nbOfNodes) + if(_coords->getNumberOfTuples()!=nbOfNodes) { 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()); @@ -240,7 +240,7 @@ void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vectorgetNumberOfComponents()); - if(nodeId>=0 && nodeId<_coords->getNumberOfTuples()) + if(nodeId>=0 && nodeId<(ToIdType(_coords->getNumberOfTuples()))) coo.insert(coo.end(),_coords->begin()+nodeId*nbOfCompo,_coords->begin()+(nodeId+1)*nbOfCompo); else { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::getCoordinatesOfNode : nodeId has to be in [0," << _coords->getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx old mode 100644 new mode 100755 index 811015bce..525987d3c --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -2875,7 +2875,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const Da if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !"); mcIdType nbOfRows=ToIdType(getNumberOfMeshPlaces(mesh)); - if(arr->getNumberOfTuples()!=nbOfRows) + if(ToIdType(arr->getNumberOfTuples())!=nbOfRows) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array does not have correct number of tuples ! Excepted " << nbOfRows << " having " << arr->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -3112,7 +3112,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA mcIdType spaceDimension=ToIdType(arr->getNumberOfComponents()); delta=spaceDimension+1; mcIdType szOfMatrix=ToIdType(arr->getNumberOfTuples()); - if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) + if(szOfMatrix*szOfMatrix!=ToIdType(matr->getNumberOfTuples())) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); MCAuto ret=DataArrayDouble::New(); ret->alloc((szOfMatrix+delta)*(szOfMatrix+delta),1); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx old mode 100644 new mode 100755 index 85632075d..506b04fe2 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -2943,7 +2943,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh); } int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes()); - for(mcIdType j=0;j elt(vorCellsForCurDisc->clone(false)); MCAuto coo4(ptsInReal->selectByTupleIdSafeSlice(j*nbPtsPerCell,(j+1)*nbPtsPerCell,1)); diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx old mode 100644 new mode 100755 index 9c51ac09c..0a2f2c33f --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -287,13 +287,14 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the parameters 1 or 3 are NULL or not allocated !"); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -417,13 +418,14 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples in coarse DataArray having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -433,7 +435,7 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); mcIdType nbTuplesFine(ToIdType(fineDA->getNumberOfTuples())),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) + if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -546,13 +548,14 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !"); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -652,13 +655,14 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -668,7 +672,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) + if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -744,13 +748,14 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the parameters 1 or 3 are NULL or not allocated !"); std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); mcIdType nbCompo=ToIdType(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + if(ToIdType(coarseDA->getNumberOfComponents())!=nbCompo) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the number of components of fine DA and coarse one mismatches !"); - if(meshDim!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); - if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) + if(ToIdType(coarseDA->getNumberOfTuples())!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -760,7 +765,7 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); mcIdType nbTuplesFine=ToIdType(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); - if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) + if(ToIdType(fineDA->getNumberOfTuples())!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx old mode 100644 new mode 100755 index 1709952d7..de0de88d4 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -177,7 +177,7 @@ DataArrayDouble *DenseMatrix::MatVecMult(const DenseMatrix *mat, const DataArray vec->checkAllocated(); if(vec->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : input vector must have only one component !"); - if(vec->getNumberOfTuples()!=mat->getNumberOfCols()) + if(ToIdType(vec->getNumberOfTuples())!=mat->getNumberOfCols()) throw INTERP_KERNEL::Exception("DenseMatrix::MatVecMult : Number of columns of this must be equal to number of tuples of vec !"); MCAuto ret(DataArrayDouble::New()); ret->alloc(mat->getNumberOfRows(),1); INTERP_KERNEL::matrixProduct(mat->getData()->begin(),mat->getNumberOfRows(),mat->getNumberOfCols(),vec->begin(),ToIdType(vec->getNumberOfTuples()),1,ret->getPointer()); diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx old mode 100644 new mode 100755 index d79fe7c2e..77d6320fc --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1067,7 +1067,7 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, MCAuto ids=DataArrayInt::ConvertIndexArrayToO2N(ToIdType(a->getNumberOfTuples()),c->begin(),ci->begin(),ci->end(),newNbOfTuples); MCAuto ret1=ids->selectByTupleIdSafeSlice(ToIdType(getNumberOfTuples()),ToIdType(a->getNumberOfTuples()),1); tupleIds=ret1.retn(); - return newNbOfTuples==getNumberOfTuples(); + return newNbOfTuples==ToIdType(getNumberOfTuples()); } /*! @@ -4482,7 +4482,7 @@ DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tup { mcIdType nbOfCompoExp=ToIdType(std::distance(tupleBg,tupleEnd)); checkAllocated(); - if(getNumberOfComponents()!=nbOfCompoExp) + if(ToIdType(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()); diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx old mode 100644 new mode 100755 index 59481f8ad..7fae25881 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -664,7 +664,7 @@ namespace MEDCoupling T DataArrayTemplate::getIJSafe(int tupleId, int compoId) const { checkAllocated(); - if(tupleId<0 || tupleId>=getNumberOfTuples()) + if(tupleId<0 || tupleId>=ToIdType(getNumberOfTuples())) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -1331,7 +1331,7 @@ namespace MEDCoupling checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - mcIdType newNbOfCompo=ToIdType(compoIds.size()); + std::size_t newNbOfCompo=ToIdType(compoIds.size()); mcIdType oldNbOfCompo=ToIdType(getNumberOfComponents()); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) if((*it)<0 || (*it)>=oldNbOfCompo) @@ -3196,14 +3196,14 @@ struct NotInRange this->checkAllocated(); other->checkAllocated(); mcIdType nbOfTuples=ToIdType((this->getNumberOfTuples())); - if(nbOfTuples!=other->getNumberOfTuples()) + if(nbOfTuples!=ToIdType(other->getNumberOfTuples())) throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !"); mcIdType nbOfComp1=ToIdType(this->getNumberOfComponents()); mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents()); T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T)); T *w=newArr; const T *inp1(this->begin()),*inp2(other->begin()); - for(std::size_t i=0;igetNumberOfTuples()); other.checkAllocated(); - if(nbTuple!=other.getNumberOfTuples()) + if(nbTuple!=ToIdType(other.getNumberOfTuples())) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !"); MCAuto ret(DataArrayIdType::New()); ret->alloc(nbTuple,1); @@ -3619,7 +3619,7 @@ struct NotInRange mm[ToIdType(pt[i])]=i; pt=other.begin(); mcIdType *retToFill(ret->getPointer()); - for(std::size_t i=0;i::const_iterator it=mm.find(ToIdType(pt[i])); if(it==mm.end()) @@ -3651,7 +3651,7 @@ struct NotInRange if(this->getNumberOfComponents()!=1 || partOfThis.getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : this and input array must be one component array !"); this->checkAllocated(); partOfThis.checkAllocated(); - std::size_t thisNbTuples(this->getNumberOfTuples()),nbTuples(partOfThis.getNumberOfTuples()); + mcIdType thisNbTuples=ToIdType(this->getNumberOfTuples()),nbTuples=ToIdType(partOfThis.getNumberOfTuples()); const T *thisPt(this->begin()),*pt(partOfThis.begin()); MCAuto ret(DataArrayIdType::New()); ret->alloc(nbTuples,1); @@ -3659,9 +3659,9 @@ struct NotInRange std::map m; for(mcIdType i=0;i::const_iterator it(m.find(ToIdType(*pt))); if(it!=m.end()) @@ -3806,7 +3806,7 @@ struct NotInRange delta=nbOfElems/8; T ret0(0); const T *pt(this->begin()); - for(std::size_t i=0;i1) { oss2 << "("; - for(int j=0;jcheckAllocated(); mcIdType nbOfTuples=ToIdType(getNumberOfTuples()); - if(nbOfTuples!=other->getNumberOfTuples()) + if(nbOfTuples!=ToIdType(other->getNumberOfTuples())) throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !"); mcIdType nbOfComp1=ToIdType(getNumberOfComponents()); mcIdType nbOfComp2=ToIdType(other->getNumberOfComponents()); @@ -510,12 +510,12 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - mcIdType nbOfTuples=ToIdType((*it)->getNumberOfTuples()); + std::size_t nbOfTuples=(*it)->getNumberOfTuples(); std::vector nbc(a.size()); std::vector pts(a.size()); nbc[0]=ToIdType((*it)->getNumberOfComponents()); pts[0]=(*it++)->getConstPointer(); - for(int i=1;it!=a.end();it++,i++) + for(std::size_t i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !"); @@ -526,7 +526,7 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar(); ret->alloc(nbOfTuples,totalNbOfComp); char *retPtr=ret->getPointer(); - for(int i=0;i(this)); ret->incrRef(); diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx index 919ae7b34..9a9bd6325 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx @@ -22,6 +22,7 @@ #define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__ #include "NormalizedUnstructuredMesh.hxx" +#include "MCType.hxx" namespace MEDCoupling { diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index 550f06fda..7ca18cb07 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -48,7 +48,7 @@ void MEDCouplingNormalizedUnstructuredMesh::getBoundingBox(dou } const MEDCoupling::DataArrayDouble *array=_mesh->getCoords(); const double *ptr=array->getConstPointer(); - mcIdType nbOfPts=ToIdType(array->getNbOfElems())/SPACEDIM; + MEDCoupling::mcIdType nbOfPts=MEDCoupling::ToIdType(array->getNbOfElems())/SPACEDIM; for(int j=0;j::getNumberOfNodesOfE template int MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const { - return ToIdType(_mesh->getNumberOfCells()); + return MEDCoupling::ToIdType(_mesh->getNumberOfCells()); } template @@ -129,8 +129,8 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast(_mesh)); if(m1) { - mcIdType nbOfCell=ToIdType(m1->getNumberOfCells()); - mcIdType initialConnSize=ToIdType(m1->getNodalConnectivity()->getNbOfElems()); + MEDCoupling::mcIdType nbOfCell=MEDCoupling::ToIdType(m1->getNumberOfCells()); + MEDCoupling::mcIdType initialConnSize=MEDCoupling::ToIdType(m1->getNodalConnectivity()->getNbOfElems()); _conn_for_interp=new int[initialConnSize-nbOfCell]; _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; @@ -152,7 +152,7 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast(_mesh)); if(m2) { - mcIdType nbOfCell=ToIdType(m2->getNumberOfCells()); + MEDCoupling::mcIdType nbOfCell=MEDCoupling::ToIdType(m2->getNumberOfCells()); _conn_index_for_interp=new int[nbOfCell+1]; const int *conni(m2->getNodalConnectivityIndex()->begin()); std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp); @@ -163,7 +163,7 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast(_mesh)); if(m3) { - mcIdType nbOfCell=ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); + MEDCoupling::mcIdType nbOfCell=MEDCoupling::ToIdType(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; int *work(_conn_index_for_interp); for(int i=0;i(this)); ret->incrRef(); @@ -1436,7 +1436,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int // da=m->zipConnectivityTraducer(cellCompPol); mcIdType nbCells=ToIdType(getNumberOfCells()); - if (nbCells != other->getNumberOfCells()) + if (nbCells != ToIdType(other->getNumberOfCells())) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); mcIdType dan=ToIdType(da->getNumberOfTuples()); if (dan) diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx old mode 100644 new mode 100755 index 3fd214af7..645ed8b69 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx @@ -449,7 +449,7 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const std::deque< std::set > valuesByIdx; int* vP(_values->getPointer()); int* iP(_index->getPointer()); - std::size_t nt ( _index->getNbOfElems() ); + mcIdType nt = ToIdType(_index->getNbOfElems()); for (int ii = 0; ii < nt-1; ii++) valuesByIdx.push_back(std::set(vP+iP[ii], vP+iP[ii+1])); diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx old mode 100644 new mode 100755 index ec6803b32..b9e75be70 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -1709,7 +1709,7 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input array of double is NULL or not allocated!"); if(st.size()!=partCompactFormat.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input arrays must have the same size !"); - if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st)) + if(ToIdType(fieldOfDbl->getNumberOfTuples())!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !"); std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(ToIdType(fieldOfDbl->getNumberOfComponents())); @@ -1978,7 +1978,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const dims[i]=part[i].second-part[i].first; } int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),nbCompo(ToIdType(da->getNumberOfComponents())); - if(da->getNumberOfTuples()!=nbOfTuplesExp) + if(ToIdType(da->getNumberOfTuples())!=nbOfTuplesExp) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::MultiplyPartOf : invalid nb of tuples ! Expected " << nbOfTuplesExp << " having " << da->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx old mode 100644 new mode 100755 index 2e35b2891..0f2d3f486 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -6295,7 +6295,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons MCAuto m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); std::vector m1ssmfinal(m1ssm.size()); - for(mcIdType i=0;igetIJ(i,0)]=m1ssm[i]; MCAuto ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal); szOfCellGrpOfSameType=ret1->renumber(renum->begin()); diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx old mode 100644 new mode 100755 index 9a950d436..510b75556 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -1796,14 +1796,14 @@ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, con int spaceDim(getSpaceDimension()); double *coords(getCoords()->getPointer()); auto nbNodes(getNumberOfNodes()); - auto nbCells(getNumberOfCells()); + std::size_t nbCells(getNumberOfCells()); std::vector fastFinder(nbNodes,false); for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++) if(*work>=0 && *work cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); const int *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); - for(auto cellId=0;cellId MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool i if(isZip) { skinOfRes->zipCoords(); - if(skinOfRes->getNumberOfCells()!=skinOfRes->getNumberOfNodes()) + if(ToIdType(skinOfRes->getNumberOfCells())!=skinOfRes->getNumberOfNodes()) throw INTERP_KERNEL::Exception("MergeVorCells : result of merge looks bad !"); } MCAuto d(skinOfRes->orderConsecutiveCells1D()); @@ -223,7 +223,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAutoallocateCells(); std::vector conn; int jj(0); - for(int i=0;igetNumberOfTuples()-1;i++,jj++) + for(int i=0;igetNumberOfTuples())-1;i++,jj++) { if(jj!=0) conn.push_back(-1); @@ -241,7 +241,7 @@ MCAuto MergeVorCells3D(const std::vector< MCAuto tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true)); const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin()); - for(int i=0;igetNumberOfTuples();i++,jj++) + for(std::size_t i=0;igetNumberOfTuples();i++,jj++) { if(jj!=0) conn.push_back(-1); @@ -440,7 +440,7 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end()); } const double *cPtr(newCoords->begin()); - for(int j=0;jgetNumberOfTuples();j++,cPtr+=2) + for(std::size_t j=0;jgetNumberOfTuples();j++,cPtr+=2) { std::set zeCandidates; { @@ -510,7 +510,7 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * if(polygsToIterOn.size()<1) throw INTERP_KERNEL::Exception("Voronoize3D : presence of a point outside the given cell !"); std::vector< MCAuto > newVorCells; - for(int poly=0;polygetNumberOfCells();poly++) + for(int poly=0;polygetNumberOfCells());poly++) { const double *seed(pts+3*poly); MCAuto tile(l0[poly]);