From 573e0c9587b3841b6fa36f1e4c6872d8685b1a9e Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 24 Jan 2012 13:10:30 +0000 Subject: [PATCH] Warning hunting. --- src/MEDCoupling/MEDCouplingCMesh.cxx | 10 +- src/MEDCoupling/MEDCouplingDefinitionTime.cxx | 14 +- src/MEDCoupling/MEDCouplingExtrudedMesh.cxx | 18 +- src/MEDCoupling/MEDCouplingExtrudedMesh.hxx | 2 +- src/MEDCoupling/MEDCouplingField.cxx | 6 +- .../MEDCouplingFieldDiscretization.cxx | 42 ++-- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 18 +- src/MEDCoupling/MEDCouplingFieldDouble.hxx | 4 +- src/MEDCoupling/MEDCouplingFieldTemplate.cxx | 2 +- .../MEDCouplingGaussLocalization.cxx | 8 +- .../MEDCouplingGaussLocalization.hxx | 2 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 132 ++++++------- src/MEDCoupling/MEDCouplingMemArray.hxx | 22 +-- src/MEDCoupling/MEDCouplingMemArray.txx | 6 +- src/MEDCoupling/MEDCouplingMesh.cxx | 2 +- src/MEDCoupling/MEDCouplingMultiFields.cxx | 60 +++--- src/MEDCoupling/MEDCouplingNatureOfField.cxx | 2 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 10 +- src/MEDCoupling/MEDCouplingPointSet.hxx | 2 +- src/MEDCoupling/MEDCouplingPointSet.txx | 2 +- .../MEDCouplingTimeDiscretization.cxx | 2 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 184 +++++++++--------- src/MEDCoupling/MEDCouplingUMesh.hxx | 2 +- 23 files changed, 276 insertions(+), 276 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx index 6daf60045..85625493f 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -33,9 +33,9 @@ MEDCouplingCMesh::MEDCouplingCMesh():_x_array(0),_y_array(0),_z_array(0) { } -MEDCouplingCMesh::MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy):MEDCouplingMesh(other) +MEDCouplingCMesh::MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCopy):MEDCouplingMesh(other) { - if(deepCpy) + if(deepCopy) { if(other._x_array) _x_array=other._x_array->deepCpy(); @@ -521,7 +521,7 @@ std::vector MEDCouplingCMesh::getDistributionOfTypes() const throw(INTERP_K */ DataArrayInt *MEDCouplingCMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const throw(INTERP_KERNEL::Exception) { - int sz=code.size(); + std::size_t sz=code.size(); if(sz!=0 && sz!=3) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkTypeConsistencyAndContig : code should be of size 2 exactly !"); if(code[0]==INTERP_KERNEL::NORM_ERROR) @@ -696,7 +696,7 @@ int MEDCouplingCMesh::getCellContainingPoint(const double *pos, double eps) cons int nbOfNodes=getCoordsAt(i)->getNbOfElems(); double ref=pos[i]; const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater(),ref)); - int w2=std::distance(d,w); + int w2=(int)std::distance(d,w); if(w2& meshId ids.push_back(id); if(ids.empty()) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : No matching slice for such time !"); - int sz=ids.size(); + std::size_t sz=ids.size(); if(sz>2) throw INTERP_KERNEL::Exception("MEDCouplingDefinitionTime::getIdsOnTime : Too many slices match this time !"); // @@ -520,7 +520,7 @@ void MEDCouplingDefinitionTime::getIdsOnTime(double tm, std::vector& meshId arrIds.resize(sz); arrIdsInField.resize(sz); fieldIds.resize(sz); - for(int i=0;igetIdsOnTime(tm,_eps,meshIds[i],arrIds[i],arrIdsInField[i],fieldIds[i]); } @@ -557,7 +557,7 @@ void MEDCouplingDefinitionTime::appendRepr(std::ostream& stream) const void MEDCouplingDefinitionTime::getTinySerializationInformation(std::vector& tinyInfoI, std::vector& tinyInfoD) const { - int sz=_slices.size(); + int sz=(int)_slices.size(); tinyInfoD.resize(1); tinyInfoD[0]=_eps; tinyInfoI.resize(3*sz+2); @@ -569,12 +569,12 @@ void MEDCouplingDefinitionTime::getTinySerializationInformation(std::vector std::vector tmp2; tinyInfoI[i+2]=(int)_slices[i]->getTimeType(); _slices[i]->getTinySerializationInformation(tmp1,tmp2); - tinyInfoI[i+sz+2]=tmp1.size(); - tinyInfoI[i+2*sz+2]=tmp2.size(); + tinyInfoI[i+sz+2]=(int)tmp1.size(); + tinyInfoI[i+2*sz+2]=(int)tmp2.size(); coreData.insert(coreData.end(),tmp1.begin(),tmp1.end()); tinyInfoD.insert(tinyInfoD.end(),tmp2.begin(),tmp2.end()); } - tinyInfoI[1]=coreData.size(); + tinyInfoI[1]=(int)coreData.size(); tinyInfoI.insert(tinyInfoI.end(),coreData.begin(),coreData.end()); } diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index abd42cbec..d34898c83 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -100,9 +100,9 @@ MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh():_mesh2D(0),_mesh1D(0),_mesh3D { } -MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCpy):MEDCouplingMesh(other),_cell_2D_id(other._cell_2D_id) +MEDCouplingExtrudedMesh::MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCopy):MEDCouplingMesh(other),_cell_2D_id(other._cell_2D_id) { - if(deepCpy) + if(deepCopy) { _mesh2D=other._mesh2D->clone(true); _mesh1D=other._mesh1D->clone(true); @@ -206,7 +206,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingExtrudedMesh::getTypeOfCell(int cel if(where==ids+nbOf3DCells) throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !"); int nbOfCells2D=_mesh2D->getNumberOfCells(); - int locId=std::distance(ids,where)%nbOfCells2D; + int locId=((int)std::distance(ids,where))%nbOfCells2D; INTERP_KERNEL::NormalizedCellType tmp=_mesh2D->getTypeOfCell(locId); return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); } @@ -328,7 +328,7 @@ void MEDCouplingExtrudedMesh::getBoundingBox(double *bbox) const std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast(std::max)); } std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus()); - int id=std::max_element(tmp,tmp+3)-tmp; + int id=(int)std::distance(tmp,std::max_element(tmp,tmp+3)); bbox[0]=bbox1DMin[0]; bbox[1]=bbox1DMax[0]; bbox[2]=bbox1DMin[1]; bbox[3]=bbox1DMax[1]; bbox[4]=bbox1DMin[2]; bbox[5]=bbox1DMax[2]; @@ -526,7 +526,7 @@ void MEDCouplingExtrudedMesh::computeBaryCenterOfFace(const std::vector& no const double *coords=_mesh2D->getCoords()->getConstPointer(); for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) std::transform(zoneToUpdate,zoneToUpdate+3,coords+3*(*iter),zoneToUpdate,std::plus()); - std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(double)(1./nodalConnec.size()))); + std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(double)(1./(int)nodalConnec.size()))); } int MEDCouplingExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr) throw(INTERP_KERNEL::Exception) @@ -746,7 +746,7 @@ void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vectorgetNbOfElems()); littleStrings.push_back(getName()); littleStrings.push_back(getDescription()); @@ -754,7 +754,7 @@ void MEDCouplingExtrudedMesh::getTinySerializationInformation(std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - int sz=tinyInfo.size(); + std::size_t sz=tinyInfo.size(); int sz1=tinyInfo[sz-2]; std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); @@ -803,7 +803,7 @@ void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInf { setName(littleStrings[littleStrings.size()-2].c_str()); setDescription(littleStrings.back().c_str()); - int sz=tinyInfo.size(); + std::size_t sz=tinyInfo.size(); int sz1=tinyInfo[sz-2]; _cell_2D_id=tinyInfo[sz-3]; std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); @@ -836,7 +836,7 @@ void MEDCouplingExtrudedMesh::unserialization(const std::vector& tinyInf a1tmp->decrRef(); a2tmp->decrRef(); // _mesh3D_ids=DataArrayInt::New(); - int szIds=std::distance(a1Ptr,a1->getConstPointer()+a1->getNbOfElems()); + int szIds=(int)std::distance(a1Ptr,a1->getConstPointer()+a1->getNbOfElems()); _mesh3D_ids->alloc(szIds,1); std::copy(a1Ptr,a1Ptr+szIds,_mesh3D_ids->getPointer()); } diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index 8bf350930..01aedf9ea 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -97,7 +97,7 @@ namespace ParaMEDMEM const std::vector& littleStrings); private: MEDCouplingExtrudedMesh(const MEDCouplingUMesh *mesh3D, MEDCouplingUMesh *mesh2D, int cell2DId) throw(INTERP_KERNEL::Exception); - MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCpy); + MEDCouplingExtrudedMesh(const MEDCouplingExtrudedMesh& other, bool deepCopy); MEDCouplingExtrudedMesh(); void computeExtrusion(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception); void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingField.cxx b/src/MEDCoupling/MEDCouplingField.cxx index 67ef211c1..865d4e5b1 100644 --- a/src/MEDCoupling/MEDCouplingField.cxx +++ b/src/MEDCoupling/MEDCouplingField.cxx @@ -133,7 +133,7 @@ void MEDCouplingField::setMesh(const MEDCouplingMesh *mesh) if(mesh!=_mesh) { if(_mesh) - ((MEDCouplingMesh *)_mesh)->decrRef(); + _mesh->decrRef(); _mesh=mesh; if(_mesh) { @@ -266,7 +266,7 @@ const MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int l MEDCouplingField::~MEDCouplingField() { if(_mesh) - ((MEDCouplingMesh *)_mesh)->decrRef(); + _mesh->decrRef(); delete _type; } @@ -278,7 +278,7 @@ MEDCouplingField::MEDCouplingField(TypeOfField type):_nature(NoNature),_mesh(0), { } -MEDCouplingField::MEDCouplingField(const MEDCouplingField& other):_name(other._name),_desc(other._desc),_nature(other._nature), +MEDCouplingField::MEDCouplingField(const MEDCouplingField& other):RefCountObject(other),_name(other._name),_desc(other._desc),_nature(other._nature), _mesh(0),_type(other._type->clone()) { if(other._mesh) diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx index 8800898ea..971092aa0 100644 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -383,7 +383,7 @@ void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const DataArrayInt *&cellRest) { cellRest=DataArrayInt::New(); - cellRest->alloc(std::distance(partBg,partEnd),1); + cellRest->alloc((int)std::distance(partBg,partEnd),1); std::copy(partBg,partEnd,cellRest->getPointer()); } @@ -473,7 +473,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCou { MEDCouplingMesh *ret=mesh->buildPart(start,end); di=DataArrayInt::New(); - di->alloc(std::distance(start,end),1); + di->alloc((int)std::distance(start,end),1); int *pt=di->getPointer(); std::copy(start,end,pt); return ret; @@ -583,16 +583,16 @@ void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mes for(std::vector::const_iterator iter=conn.begin();iter!=conn.end();iter++) mesh->getCoordinatesOfNode(*iter,coo); int spaceDim=mesh->getSpaceDimension(); - int nbOfNodes=conn.size(); + std::size_t nbOfNodes=conn.size(); std::vector vec(nbOfNodes); - for(int i=0;i tmp=new double[nbOfNodes]; INTERP_KERNEL::barycentric_coords(vec,loc,tmp); int sz=arr->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp2=new double[sz]; std::fill(res,res+sz,0.); - for(int i=0;igetTuple(conn[i],(double *)tmp2); std::transform((double *)tmp2,((double *)tmp2)+sz,(double *)tmp2,std::bind2nd(std::multiplies(),tmp[i])); @@ -737,7 +737,7 @@ void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, _discr_per_cell=dpc; // if(check) - delete [] (int *)array; + delete [] const_cast(array); } void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *m) @@ -788,8 +788,8 @@ bool MEDCouplingFieldDiscretizationGauss::isEqual(const MEDCouplingFieldDiscreti return false; if(_loc.size()!=otherC->_loc.size()) return false; - int sz=_loc.size(); - for(int i=0;i_loc[i],eps)) return false; return true; @@ -804,8 +804,8 @@ bool MEDCouplingFieldDiscretizationGauss::isEqualWithoutConsideringStr(const MED return false; if(_loc.size()!=otherC->_loc.size()) return false; - int sz=_loc.size(); - for(int i=0;i_loc[i],eps)) return false; return true; @@ -876,7 +876,7 @@ void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplin (*it)->renumberInPlace(array2); delete [] array2; if(check) - delete [] (int*)array; + delete [] const_cast(array); } DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -907,7 +907,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValue INTERP_KERNEL::NormalizedCellType typ=cli.getType(); const std::vector& wg=cli.getWeights(); calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(), - &cli.getGaussCoords()[0],wg.size(),&cli.getRefCoords()[0], + &cli.getGaussCoords()[0],(int)wg.size(),&cli.getRefCoords()[0], INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes()); } int nbt=parts2[i]->getNumberOfTuples(); @@ -940,7 +940,7 @@ void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std if(_discr_per_cell) val=_discr_per_cell->getNumberOfTuples(); tinyInfo.push_back(val); - tinyInfo.push_back(_loc.size()); + tinyInfo.push_back((int)_loc.size()); if(_loc.empty()) tinyInfo.push_back(-1); else @@ -978,7 +978,7 @@ void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::ve int dim=tinyInfo[2]; int delta=-1; if(nbOfLoc>0) - delta=(tinyInfo.size()-3)/nbOfLoc; + delta=((int)tinyInfo.size()-3)/nbOfLoc; for(int i=0;i tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); @@ -1009,7 +1009,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da); for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) (*iter).checkCoherency(); - int nbOfDesc=_loc.size(); + int nbOfDesc=(int)_loc.size(); int nbOfCells=mesh->getNumberOfCells(); const int *dc=_discr_per_cell->getConstPointer(); for(int i=0;igetPointer(); @@ -1110,7 +1110,7 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDC throw INTERP_KERNEL::Exception("Size of [begin,end) must be equal or greater than 1 !"); INTERP_KERNEL::NormalizedCellType type=m->getTypeOfCell(*begin); MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg); - int id=_loc.size(); + int id=(int)_loc.size(); int *ptr=_discr_per_cell->getPointer(); for(const int *w=begin+1;w!=end;w++) { @@ -1146,7 +1146,7 @@ MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocal int MEDCouplingFieldDiscretizationGauss::getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception) { - return _loc.size(); + return (int)_loc.size(); } int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception) @@ -1319,7 +1319,7 @@ std::vector MEDCouplingFieldDiscretizationGauss::splitIntoSingle it=idsRemaining.begin(); ret.resize(ret.size()+1); DataArrayInt *part=DataArrayInt::New(); - part->alloc(ids.size(),1); + part->alloc((int)ids.size(),1); std::copy(ids.begin(),ids.end(),part->getPointer()); ret.back()=part; locIds.resize(locIds.size()+1); @@ -1404,7 +1404,7 @@ void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCoupl array3[0]=0; for(int i=1;igetTypeOfCell(std::distance(array,std::find(array,array+nbOfCells,i-1))); + INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell((int)std::distance(array,std::find(array,array+nbOfCells,i-1))); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); array3[i]=array3[i-1]+cm.getNumberOfNodes(); } @@ -1422,7 +1422,7 @@ void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCoupl (*it)->renumberInPlace(array2); delete [] array2; if(check) - delete [] (int*)array; + delete [] const_cast(array); } DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index d7355cd9c..2d74cf60c 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -92,9 +92,9 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::deepCpy() const return cloneWithMesh(true); } -MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const +MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const { - MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCpy); + MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCopy); MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),tdo,_type->clone()); ret->setMesh(getMesh()); ret->setName(getName()); @@ -443,8 +443,8 @@ MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *f { } -MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy):MEDCouplingField(other), - _time_discr(other._time_discr->performCpy(deepCpy)) +MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingField(other), + _time_discr(other._time_discr->performCpy(deepCopy)) { } @@ -832,7 +832,7 @@ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, dou std::vector res2; for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++) { - int sz=res2.size(); + int sz=(int)res2.size(); res2.resize(sz+(*iter)->getNumberOfComponents()); _type->getValueOn(*iter,_mesh,spaceLoc,&res2[sz]); } @@ -1090,7 +1090,7 @@ void MEDCouplingFieldDouble::getTinySerializationIntInformation(std::vector std::vector tinyInfo2; _type->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back(tinyInfo2.size()); + tinyInfo.push_back((int)tinyInfo2.size()); } /*! @@ -1104,7 +1104,7 @@ void MEDCouplingFieldDouble::getTinySerializationDbleInformation(std::vector tinyInfo2; _type->getTinySerializationDbleInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back(tinyInfo2.size()); + tinyInfo.push_back((int)tinyInfo2.size()); } /*! @@ -1140,7 +1140,7 @@ void MEDCouplingFieldDouble::finishUnserialization(const std::vector& tinyI _time_discr->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS); _nature=(NatureOfField)tinyInfoI[2]; _type->finishUnserialization(tmp2); - int nbOfElemS=tinyInfoS.size(); + int nbOfElemS=(int)tinyInfoS.size(); _name=tinyInfoS[nbOfElemS-3]; _desc=tinyInfoS[nbOfElemS-2]; setTimeUnit(tinyInfoS[nbOfElemS-1].c_str()); @@ -1177,7 +1177,7 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, renumberNodesWithoutMesh(nodeCor->getConstPointer()); nodeCor->decrRef(); } - setMesh((MEDCouplingMesh *)other); + setMesh(const_cast(other)); } /*! diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 909f32335..520d9942a 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -57,7 +57,7 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *deepCpy() const; MEDCouplingFieldDouble *clone(bool recDeepCpy) const; MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; - MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const; + MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const; TypeOfTimeDiscretization getTimeDiscretization() const; void checkCoherency() const throw(INTERP_KERNEL::Exception); void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception); @@ -182,7 +182,7 @@ namespace ParaMEDMEM private: MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td); MEDCouplingFieldDouble(const MEDCouplingFieldTemplate *ft, TypeOfTimeDiscretization td); - MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCpy); + MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy); MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type); ~MEDCouplingFieldDouble(); private: diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 77ecf4577..a72922c2b 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -81,7 +81,7 @@ void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector tinyInfo2; _type->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back(tinyInfo2.size()); + tinyInfo.push_back((int)tinyInfo2.size()); } void MEDCouplingFieldTemplate::getTinySerializationDbleInformation(std::vector& tinyInfo) const diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index ff0dc2d61..4adfeb235 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -64,7 +64,7 @@ int ParaMEDMEM::MEDCouplingGaussLocalization::getDimension() const { if(_weight.empty()) return -1; - return _gauss_coord.size()/_weight.size(); + return (int)_gauss_coord.size()/(int)_weight.size(); } int ParaMEDMEM::MEDCouplingGaussLocalization::getNumberOfPtsInRefCell() const @@ -72,7 +72,7 @@ int ParaMEDMEM::MEDCouplingGaussLocalization::getNumberOfPtsInRefCell() const int dim=getDimension(); if(dim==0) return -1; - return _ref_coord.size()/dim; + return (int)_ref_coord.size()/dim; } bool ParaMEDMEM::MEDCouplingGaussLocalization::isEqual(const MEDCouplingGaussLocalization& other, double eps) const @@ -205,8 +205,8 @@ int ParaMEDMEM::MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussP bool ParaMEDMEM::MEDCouplingGaussLocalization::AreAlmostEqual(const std::vector& v1, const std::vector& v2, double eps) { - int sz=v1.size(); - if(sz!=(int)v2.size()) + std::size_t sz=v1.size(); + if(sz!=v2.size()) return false; std::vector tmp(sz); std::transform(v1.begin(),v1.end(),v2.begin(),tmp.begin(),std::minus()); diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx index f853eba10..570bd4d56 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx @@ -36,7 +36,7 @@ namespace ParaMEDMEM MEDCouplingGaussLocalization(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) throw(INTERP_KERNEL::Exception); INTERP_KERNEL::NormalizedCellType getType() const { return _type; } - int getNumberOfGaussPt() const { return _weight.size(); } + int getNumberOfGaussPt() const { return (int)_weight.size(); } int getDimension() const; int getNumberOfPtsInRefCell() const; void checkCoherency() const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index a99f19069..1dab0f188 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -66,7 +66,7 @@ void DataArrayDouble::findCommonTuplesAlg(std::vector& bbox, } if(!commonNodes.empty()) { - cI.push_back(cI.back()+commonNodes.size()+1); + cI.push_back(cI.back()+(int)commonNodes.size()+1); c.push_back(i); c.insert(c.end(),commonNodes.begin(),commonNodes.end()); } @@ -91,31 +91,31 @@ void DataArray::copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL:: void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) throw(INTERP_KERNEL::Exception) { int nbOfCompoOth=other.getNumberOfComponents(); - int newNbOfCompo=compoIds.size(); - for(int i=0;i=nbOfCompoOth) { std::ostringstream oss; oss << "Specified component ids is to high (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompoOth << ")"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(int i=0;i& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception) { int nbOfCompo=getNumberOfComponents(); - int partOfCompoToSet=compoIds.size(); - if(partOfCompoToSet!=other.getNumberOfComponents()) + std::size_t partOfCompoToSet=compoIds.size(); + if((int)partOfCompoToSet!=other.getNumberOfComponents()) throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !"); - for(int i=0;i=nbOfCompo) { std::ostringstream oss; oss << "Specified component ids is to high (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(int i=0;ivmax) return false; return true; @@ -517,7 +517,7 @@ bool DataArrayDouble::isEqualWithoutConsideringStr(const DataArrayDouble& other, void DataArrayDouble::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception) { checkAllocated(); - _mem.reAlloc(_info_on_compo.size()*nbOfTuples); + _mem.reAlloc((int)(_info_on_compo.size())*nbOfTuples); _nb_of_tuples=nbOfTuples; declareAsNew(); } @@ -658,7 +658,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleId(const int *new2OldBg, const in { DataArrayDouble *ret=DataArrayDouble::New(); int nbComp=getNumberOfComponents(); - ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); + ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); double *pt=ret->getPointer(); const double *srcPt=getConstPointer(); @@ -677,7 +677,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); int nbComp=getNumberOfComponents(); int oldNbOfTuples=getNumberOfTuples(); - ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); + ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); double *pt=ret->getPointer(); const double *srcPt=getConstPointer(); @@ -694,18 +694,18 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons /*! * Idem than DataArrayInt::selectByTupleIdSafe except that the input array is not constructed explicitely. - * The convention is as python one. ['bg','end') with steps of 'step'. + * The convention is as python one. ['bg','end2') with steps of 'step'. * Returns a newly created array. */ -DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception) +DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception) { - if(end 0 !"); MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); int nbComp=getNumberOfComponents(); - int newNbOfTuples=(end-1-bg)/step+1; + int newNbOfTuples=(end2-1-bg)/step+1; ret->alloc(newNbOfTuples,nbComp); double *pt=ret->getPointer(); const double *srcPt=getConstPointer()+bg*nbComp; @@ -797,7 +797,7 @@ DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector& { checkAllocated(); MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); - int newNbOfCompo=compoIds.size(); + std::size_t newNbOfCompo=compoIds.size(); int oldNbOfCompo=getNumberOfComponents(); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) if((*it)<0 || (*it)>=oldNbOfCompo) @@ -806,12 +806,12 @@ DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector& throw INTERP_KERNEL::Exception(oss.str().c_str()); } int nbOfTuples=getNumberOfTuples(); - ret->alloc(nbOfTuples,newNbOfCompo); + ret->alloc(nbOfTuples,(int)newNbOfCompo); ret->copyPartOfStringInfoFrom(*this,compoIds); const double *oldc=getConstPointer(); double *nc=ret->getPointer(); for(int i=0;iincrRef(); return ret; @@ -897,7 +897,7 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI default: throw INTERP_KERNEL::Exception("Unexpected spacedim of coords. Must be 1, 2 or 3."); } - commIndex->alloc(cI.size(),1); + commIndex->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),commIndex->getPointer()); comm->alloc(cI.back(),1); std::copy(c.begin(),c.end(),comm->getPointer()); @@ -925,13 +925,13 @@ DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTuple void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds) throw(INTERP_KERNEL::Exception) { copyPartOfStringInfoFrom2(compoIds,*a); - int partOfCompoSz=compoIds.size(); + std::size_t partOfCompoSz=compoIds.size(); int nbOfCompo=getNumberOfComponents(); int nbOfTuples=getNumberOfTuples(); const double *ac=a->getConstPointer(); double *nc=getPointer(); for(int i=0;icheckNbOfElems(newNbOfTuples*newNbOfComp,msg); if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -1044,7 +1044,7 @@ void DataArrayDouble::setPartOfValues3(const DataArrayDouble *a, const int *bgTu int nbOfTuples=getNumberOfTuples(); DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value"); DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value"); - int newNbOfTuples=std::distance(bgTuples,endTuples); + int newNbOfTuples=(int)std::distance(bgTuples,endTuples); a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg); if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -1174,7 +1174,7 @@ double DataArrayDouble::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exc throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !"); const double *vals=getConstPointer(); const double *loc=std::max_element(vals,vals+nbOfTuples); - tupleId=std::distance(vals,loc); + tupleId=(int)std::distance(vals,loc); return *loc; } @@ -1206,7 +1206,7 @@ double DataArrayDouble::getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exc throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !"); const double *vals=getConstPointer(); const double *loc=std::min_element(vals,vals+nbOfTuples); - tupleId=std::distance(vals,loc); + tupleId=(int)std::distance(vals,loc); return *loc; } @@ -1600,7 +1600,7 @@ void DataArrayDouble::applyInv(double numerator) throw(INTERP_KERNEL::Exception) int nbOfElems=getNbOfElems(); for(int i=0;i::min()) { *ptr=numerator/(*ptr); } @@ -1849,7 +1849,7 @@ DataArrayInt *DataArrayDouble::getIdsInRange(double vmin, double vmax) const thr if(*cptr>=vmin && *cptr<=vmax) res.push_back(i); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(res.size(),1); + ret->alloc((int)res.size(),1); std::copy(res.begin(),res.end(),ret->getPointer()); return ret; } @@ -2466,7 +2466,7 @@ void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd { if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !"); - int nbElemsIn=std::distance(indArrBg,indArrEnd); + int nbElemsIn=(int)std::distance(indArrBg,indArrEnd); int nbOfTuples=getNumberOfTuples(); int *pt=getPointer(); for(int i=0;i rintstart; rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater of equal 2 - rintstart end(arrBg); + rintstart end2(arrBg); MEDCouplingAutoRefCountObjectPtr ret1=DataArrayInt::New(); MEDCouplingAutoRefCountObjectPtr ret2=DataArrayInt::New(); MEDCouplingAutoRefCountObjectPtr ret3=DataArrayInt::New(); @@ -2523,7 +2523,7 @@ void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd, std::set castsDetected; for(int i=0;i(), work[i])); + rintstart res=std::find_if(bg,end2,std::bind2nd(std::less_equal(), work[i])); std::size_t pos=std::distance(bg,res); std::size_t pos2=nbOfCast-pos; if(pos2 ret=DataArrayInt::New(); @@ -2809,7 +2809,7 @@ DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new { DataArrayInt *ret=DataArrayInt::New(); int nbComp=getNumberOfComponents(); - ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); + ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); int *pt=ret->getPointer(); const int *srcPt=getConstPointer(); @@ -2828,7 +2828,7 @@ DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); int nbComp=getNumberOfComponents(); int oldNbOfTuples=getNumberOfTuples(); - ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); + ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); int *pt=ret->getPointer(); const int *srcPt=getConstPointer(); @@ -2845,18 +2845,18 @@ DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int /*! * Idem than DataArrayInt::selectByTupleIdSafe except that the input array is not constructed explicitely. - * The convention is as python one. ['bg','end') with steps of 'step'. + * The convention is as python one. ['bg','end2') with steps of 'step'. * Returns a newly created array. */ -DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception) +DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception) { - if(end 0 !"); MEDCouplingAutoRefCountObjectPtr ret=DataArrayInt::New(); int nbComp=getNumberOfComponents(); - int newNbOfTuples=(end+1-bg)/step-1; + int newNbOfTuples=(end2+1-bg)/step-1; ret->alloc(newNbOfTuples,nbComp); int *pt=ret->getPointer(); const int *srcPt=getConstPointer()+bg*nbComp; @@ -2923,7 +2923,7 @@ void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, Data int *retIPtr=retI->getPointer(); *retIPtr=0; for(std::vector< std::vector >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++,retIPtr++) - retIPtr[1]=retIPtr[0]+(*it1).size(); + retIPtr[1]=retIPtr[0]+(int)((*it1).size()); if(nbOfTuples!=retI->getIJ(targetNb,0)) throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : big problem should never happen !"); ret->alloc(nbOfTuples,1); @@ -3053,8 +3053,8 @@ bool DataArrayInt::isUniform(int val) const throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); int nbOfTuples=getNumberOfTuples(); const int *w=getConstPointer(); - const int *end=w+nbOfTuples; - for(;w!=end;w++) + const int *end2=w+nbOfTuples; + for(;w!=end2;w++) if(*w!=val) return false; return true; @@ -3152,7 +3152,7 @@ DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue) void DataArrayInt::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception) { checkAllocated(); - _mem.reAlloc(_info_on_compo.size()*nbOfTuples); + _mem.reAlloc((int)_info_on_compo.size()*nbOfTuples); _nb_of_tuples=nbOfTuples; declareAsNew(); } @@ -3161,7 +3161,7 @@ DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector& compo { checkAllocated(); MEDCouplingAutoRefCountObjectPtr ret(DataArrayInt::New()); - int newNbOfCompo=compoIds.size(); + int newNbOfCompo=(int)compoIds.size(); int oldNbOfCompo=getNumberOfComponents(); for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) DataArray::CheckValueInRange(oldNbOfCompo,(*it),"keepSelectedComponents invalid requested component"); @@ -3211,13 +3211,13 @@ void DataArrayInt::meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exce void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vector& compoIds) throw(INTERP_KERNEL::Exception) { copyPartOfStringInfoFrom2(compoIds,*a); - int partOfCompoSz=compoIds.size(); + std::size_t partOfCompoSz=compoIds.size(); int nbOfCompo=getNumberOfComponents(); int nbOfTuples=getNumberOfTuples(); const int *ac=a->getConstPointer(); int *nc=getPointer(); for(int i=0;icheckNbOfElems(newNbOfTuples*newNbOfComp,msg); if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -3330,7 +3330,7 @@ void DataArrayInt::setPartOfValues3(const DataArrayInt *a, const int *bgTuples, int nbOfTuples=getNumberOfTuples(); DataArray::CheckValueInRange(nbComp,bgComp,"invalid begin component value"); DataArray::CheckClosingParInRange(nbComp,endComp,"invalid end component value"); - int newNbOfTuples=std::distance(bgTuples,endTuples); + int newNbOfTuples=(int)std::distance(bgTuples,endTuples); a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg); if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -3450,7 +3450,7 @@ DataArrayInt *DataArrayInt::getIdsEqual(int val) const throw(INTERP_KERNEL::Exce if(*cptr==val) res.push_back(i); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(res.size(),1); + ret->alloc((int)res.size(),1); std::copy(res.begin(),res.end(),ret->getPointer()); return ret; } @@ -3466,7 +3466,7 @@ DataArrayInt *DataArrayInt::getIdsNotEqual(int val) const throw(INTERP_KERNEL::E if(*cptr!=val) res.push_back(i); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(res.size(),1); + ret->alloc((int)res.size(),1); std::copy(res.begin(),res.end(),ret->getPointer()); return ret; } @@ -3483,9 +3483,9 @@ int DataArrayInt::changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::E throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !"); checkAllocated(); int *start=getPointer(); - int *end=start+getNbOfElems(); + int *end2=start+getNbOfElems(); int ret=0; - for(int *val=start;val!=end;val++) + for(int *val=start;val!=end2;val++) { if(*val==oldValue) { @@ -3508,7 +3508,7 @@ DataArrayInt *DataArrayInt::getIdsEqualList(const std::vector& vals) const if(vals2.find(*cptr)!=vals2.end()) res.push_back(i); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(res.size(),1); + ret->alloc((int)res.size(),1); std::copy(res.begin(),res.end(),ret->getPointer()); return ret; } @@ -3525,7 +3525,7 @@ DataArrayInt *DataArrayInt::getIdsNotEqualList(const std::vector& vals) con if(vals2.find(*cptr)==vals2.end()) res.push_back(i); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(res.size(),1); + ret->alloc((int)res.size(),1); std::copy(res.begin(),res.end(),ret->getPointer()); return ret; } @@ -3594,7 +3594,7 @@ int DataArrayInt::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !"); const int *vals=getConstPointer(); const int *loc=std::max_element(vals,vals+nbOfTuples); - tupleId=std::distance(vals,loc); + tupleId=(int)std::distance(vals,loc); return *loc; } @@ -3617,7 +3617,7 @@ int DataArrayInt::getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !"); const int *vals=getConstPointer(); const int *loc=std::min_element(vals,vals+nbOfTuples); - tupleId=std::distance(vals,loc); + tupleId=(int)std::distance(vals,loc); return *loc; } @@ -3843,7 +3843,7 @@ DataArrayInt *DataArrayInt::BuildUnion(const std::vector& r.insert(pt,pt+nbOfTuples); } DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(r.size(),1); + ret->alloc((int)r.size(),1); std::copy(r.begin(),r.end(),ret->getPointer()); return ret; } @@ -3878,7 +3878,7 @@ DataArrayInt *DataArrayInt::BuildIntersection(const std::vectoralloc(r.size(),1); + ret->alloc((int)r.size(),1); std::copy(r.begin(),r.end(),ret->getPointer()); return ret; } @@ -3896,7 +3896,7 @@ DataArrayInt *DataArrayInt::buildComplement(int nbOfElement) const throw(INTERP_ tmp[*w]=true; else throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : an element is not in valid range : [0,nbOfElement) !"); - int nbOfRetVal=std::count(tmp.begin(),tmp.end(),false); + int nbOfRetVal=(int)std::count(tmp.begin(),tmp.end(),false); DataArrayInt *ret=DataArrayInt::New(); ret->alloc(nbOfRetVal,1); int j=0; @@ -3924,7 +3924,7 @@ DataArrayInt *DataArrayInt::buildSubstraction(const DataArrayInt *other) const t std::vector r; std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector >(r)); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(r.size(),1); + ret->alloc((int)r.size(),1); std::copy(r.begin(),r.end(),ret->getPointer()); return ret; } @@ -4284,7 +4284,7 @@ void DataArrayInt::modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL:: int *DataArrayInt::CheckAndPreparePermutation(const int *start, const int *end) { - int sz=std::distance(start,end); + std::size_t sz=std::distance(start,end); int *ret=new int[sz]; int *work=new int[sz]; std::copy(start,end,work); @@ -4297,7 +4297,7 @@ int *DataArrayInt::CheckAndPreparePermutation(const int *start, const int *end) } int *iter2=ret; for(const int *iter=start;iter!=end;iter++,iter2++) - *iter2=std::distance(work,std::find(work,work+sz,*iter)); + *iter2=(int)std::distance(work,std::find(work,work+sz,*iter)); delete [] work; return ret; } diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 754d5ad08..1a68abc4e 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -102,9 +102,9 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT int getNumberOfComponents() const { return _info_on_compo.size(); } + MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); } MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _nb_of_tuples; } - MEDCOUPLING_EXPORT int getNbOfElems() const { return _info_on_compo.size()*_nb_of_tuples; } + MEDCOUPLING_EXPORT int getNbOfElems() const { return ((int)_info_on_compo.size())*_nb_of_tuples; } MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void checkNbOfElems(int nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception); @@ -169,7 +169,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT DataArrayDouble *renumberAndReduce(const int *old2New, int newNbOfTuple) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception); @@ -185,11 +185,11 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void setPartOfValuesSimple3(double a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } - MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } + MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); } + MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; } MEDCOUPLING_EXPORT double back() const throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); } - MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; } + MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); } + MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; } MEDCOUPLING_EXPORT double *getPointer() { return _mem.getPointer(); } MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet); MEDCOUPLING_EXPORT const double *getConstPointer() const { return _mem.getConstPointer(); } @@ -363,11 +363,11 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayInt *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void setPartOfValuesSimple3(int a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } - MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } + MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); } + MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; } MEDCOUPLING_EXPORT int back() const throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); } - MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; } + MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); } + MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; } MEDCOUPLING_EXPORT int *getPointer() { return _mem.getPointer(); } MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet); MEDCOUPLING_EXPORT const int *getConstPointer() const { return _mem.getConstPointer(); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index 32f66aad0..8bdccd5fd 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -61,7 +61,7 @@ namespace ParaMEDMEM _nb_of_elem=nbOfElem; destroy(); if(ownership) - _pointer.setInternal((T *)array); + _pointer.setInternal(const_cast(array)); else _pointer.setExternal(array); _ownership=ownership; @@ -239,7 +239,7 @@ namespace ParaMEDMEM T *pointer=new T[newNbOfElements]; std::copy(_pointer.getConstPointer(),_pointer.getConstPointer()+std::min(_nb_of_elem,newNbOfElements),pointer); if(_ownership) - destroyPointer((T *)_pointer.getConstPointer(),_dealloc); + destroyPointer(const_cast(_pointer.getConstPointer()),_dealloc);//Do not use getPointer because in case of _external _pointer.setInternal(pointer); _nb_of_elem=newNbOfElements; _ownership=true; @@ -272,7 +272,7 @@ namespace ParaMEDMEM void MemArray::destroy() { if(_ownership) - destroyPointer((T *)_pointer.getConstPointer(),_dealloc); + destroyPointer(const_cast(_pointer.getConstPointer()),_dealloc);//Do not use getPointer because in case of _external _pointer.null(); _ownership=false; } diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx index f1e56e168..84c4e7a65 100644 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -139,7 +139,7 @@ DataArrayInt *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const int *partB crest.push_back(i); } DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(crest.size(),1); + ret->alloc((int)crest.size(),1); std::copy(crest.begin(),crest.end(),ret->getPointer()); return ret; } diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index a9dc65f76..c15e41404 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -164,7 +164,7 @@ std::vector MEDCouplingMultiFields::getFields() int MEDCouplingMultiFields::getNumberOfFields() const { - return _fs.size(); + return (int)_fs.size(); } const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldAtPos(int id) const throw(INTERP_KERNEL::Exception) @@ -214,14 +214,14 @@ std::vector MEDCouplingMultiFields::getDifferentMeshes(std::v m=(*it)->getMesh(); if(m) { - std::vector::iterator it=std::find(ms.begin(),ms.end(),m); - if(it==ms.end()) + std::vector::iterator it2=std::find(ms.begin(),ms.end(),m); + if(it2==ms.end()) { ms.push_back(const_cast(m)); - refs[id]=ms.size()-1; + refs[id]=(int)ms.size()-1; } else - refs[id]=std::distance(ms.begin(),it); + refs[id]=(int)std::distance(ms.begin(),it2); } else refs[id]=-1; @@ -264,10 +264,10 @@ std::vector MEDCouplingMultiFields::getDifferentArrays(std::v if(it3==ret.end()) { ret.push_back(*it2); - refs[id][id2]=ret.size()-1; + refs[id][id2]=(int)ret.size()-1; } else - refs[id][id2]=std::distance(ret.begin(),it3); + refs[id][id2]=(int)std::distance(ret.begin(),it3); } else refs[id][id2]=-1; @@ -307,21 +307,21 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const std::vector refs; std::vector< std::vector > refs2; std::vector ms=other.getDifferentMeshes(refs); - int msLgh=ms.size(); + std::size_t msLgh=ms.size(); std::vector< MEDCouplingAutoRefCountObjectPtr > ms2(msLgh); - for(int i=0;ideepCpy(); std::vector das=other.getDifferentArrays(refs2); - int dasLgth=das.size(); + std::size_t dasLgth=das.size(); std::vector< MEDCouplingAutoRefCountObjectPtr > das2(dasLgth); - for(int i=0;ideepCpy(); - for(int i=0;idecrRef(); if(refs[i]!=-1) _fs[i]->setMesh(ms2[refs[i]]); - int nbOfArr=refs2[i].size(); + std::size_t nbOfArr=refs2[i].size(); std::vector tmp2(nbOfArr); - for(int j=0;j& t { std::vector refs; std::vector ms=getDifferentMeshes(refs); - nbOfDiffMeshes=ms.size(); + nbOfDiffMeshes=(int)ms.size(); std::vector< std::vector > refs2; std::vector fs=getDifferentArrays(refs2); - nbOfDiffArr=fs.size(); + nbOfDiffArr=(int)fs.size(); // - int sz=refs.size();//==_fs.size() + std::size_t sz=refs.size();//==_fs.size() int sz2=0; - for(int i=0;i doubleDaInd(sz); std::vector timeDiscrInt; tinyInfo.resize(sz2+5*sz+3); - tinyInfo[0]=sz; + tinyInfo[0]=(int)sz; tinyInfo[1]=sz2; - for(int i=0;i tmp; std::vector tmp2; _fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tmp); _fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tmp2); - tinyInfo[3*sz+3+i]=tmp.size(); - tinyInfo[4*sz+3+i]=tmp2.size(); + tinyInfo[3*sz+3+i]=(int)tmp.size(); + tinyInfo[4*sz+3+i]=(int)tmp2.size(); tinyInfo2.insert(tinyInfo2.end(),tmp.begin(),tmp.end()); timeDiscrInt.insert(timeDiscrInt.end(),tmp2.begin(),tmp2.end()); } - int sz3=timeDiscrInt.size(); + int sz3=(int)timeDiscrInt.size(); tinyInfo[2]=sz3; // - for(int i=0;igetTimeDiscretization(); int k=0; - for(int i=0;i::const_iterator it=refs2[i].begin();it!=refs2[i].end();it++,k++) tinyInfo[5*sz+k+3]=*it; tinyInfo.insert(tinyInfo.end(),timeDiscrInt.begin(),timeDiscrInt.end());//tinyInfo has lgth==sz3+sz2+5*sz+3 diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.cxx b/src/MEDCoupling/MEDCouplingNatureOfField.cxx index 368e826e9..b057c3f17 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.cxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.cxx @@ -37,7 +37,7 @@ namespace ParaMEDMEM const int *pos=std::find(POS_OF_NATUREOFFIELD,POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES,(int)nat); if(pos==POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES) throw INTERP_KERNEL::Exception("MEDCouplingNatureOfField::getRepr : Unrecognized nature of field !"); - int pos2=std::distance(POS_OF_NATUREOFFIELD,pos); + std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos); return REPR_OF_NATUREOFFIELD[pos2]; } } diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index ffc3c2a6a..a27ed5c3a 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -38,10 +38,10 @@ MEDCouplingPointSet::MEDCouplingPointSet():_coords(0) { } -MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCpy):MEDCouplingMesh(other),_coords(0) +MEDCouplingPointSet::MEDCouplingPointSet(const MEDCouplingPointSet& other, bool deepCopy):MEDCouplingMesh(other),_coords(0) { if(other._coords) - _coords=other._coords->performCpy(deepCpy); + _coords=other._coords->performCpy(deepCopy); } MEDCouplingPointSet::~MEDCouplingPointSet() @@ -825,7 +825,7 @@ void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *end if(spaceDim==3) { std::vector cpy(res); - int nbNodes=endConn-startConn; + int nbNodes=(int)std::distance(startConn,endConn); INTERP_KERNEL::PlanarIntersector::projection(&res[0],&cpy[0],nbNodes,nbNodes,1.e-12,0.,0.,true); res.resize(2*nbNodes); for(int i=0;i& res, bool isQuad) { - int nbOfNodes=res.size()/2; + std::size_t nbOfNodes=res.size()/2; std::vector nodes(nbOfNodes); - for(int i=0;i::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) if(INTERP_KERNEL::distance2(pos+SPACEDIM*i,coordsPtr+SPACEDIM*(*it))& vals, double *res) const { double alpha=(_end_time-time)/(_end_time-_start_time); - int nbComp=vals.size()/2; + std::size_t nbComp=vals.size()/2; std::transform(vals.begin(),vals.begin()+nbComp,res,std::bind2nd(std::multiplies(),alpha)); std::vector tmp(nbComp); std::transform(vals.begin()+nbComp,vals.end(),tmp.begin(),std::bind2nd(std::multiplies(),1-alpha)); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 00adbbf7c..4c8c9001f 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -613,7 +613,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt { meshDM1Conn.insert(meshDM1Conn.end(),tmp,tmp+nbOfNodesSon); meshDM1ConnIndex.push_back(meshDM1ConnIndex.back()+nbOfNodesSon); - int cellDM1Id=meshDM1Type.size(); + int cellDM1Id=(int)meshDM1Type.size(); meshDM1Type.push_back((int)cmsId); for(unsigned k=0;ksetCoords(getCoords()); - int nbOfCellsInConstituent=meshDM1Type.size(); + int nbOfCellsInConstituent=(int)meshDM1Type.size(); ret->allocateCells(nbOfCellsInConstituent); revDescIndx->alloc(nbOfCellsInConstituent+1,1); int *tmp3=revDescIndx->getPointer(); tmp3[0]=0; for(int ii=0;iiinsertNextCell((INTERP_KERNEL::NormalizedCellType)meshDM1Type[ii],meshDM1ConnIndex[ii+1]-meshDM1ConnIndex[ii],&meshDM1Conn[meshDM1ConnIndex[ii]]); - tmp3[ii+1]=tmp3[ii]+revDescMeshConnB[ii].size(); + tmp3[ii+1]=tmp3[ii]+((int)revDescMeshConnB[ii].size()); } ret->finishInsertingCells(); revDesc->alloc(tmp3[nbOfCellsInConstituent],1); @@ -653,7 +653,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt descIndx->alloc(nbOfCells+1,1); tmp3=descIndx->getPointer(); tmp3[0]=0; for(int jj=0;jjalloc(tmp3[nbOfCells],1); tmp3=desc->getPointer(); for(std::vector< std::vector >::const_iterator iter3=descMeshConnB.begin();iter3!=descMeshConnB.end();iter3++) @@ -723,14 +723,14 @@ void MEDCouplingUMesh::convertToPolyTypes(const std::vector& cellIdsToConve work+=offset; *work++=-1; } - unsigned newLgth=work-tmp-1; - unsigned delta=newLgth-lgthOld; + std::size_t newLgth=std::distance(tmp,work)-1; + std::size_t delta=newLgth-lgthOld; std::transform(connIndex+(*iter)+1,connIndex+connIndexLgth,connIndex+(*iter)+1,std::bind2nd(std::plus(),delta)); connNew.insert(connNew.begin()+posP1,tmp+lgthOld,tmp+newLgth); std::copy(tmp,tmp+lgthOld,connNew.begin()+pos+1); delete [] tmp; } - _nodal_connec->alloc(connNew.size(),1); + _nodal_connec->alloc((int)connNew.size(),1); int *newConnPtr=_nodal_connec->getPointer(); std::copy(connNew.begin(),connNew.end(),newConnPtr); } @@ -786,13 +786,13 @@ void MEDCouplingUMesh::convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron BUT it has NOT exactly 1 face !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int n2=std::distance(c+ci[i]+1,c+ci[i+1]); + std::size_t n2=std::distance(c+ci[i]+1,c+ci[i+1]); if(n2%2!=0) { std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron with 1 face but there is a mismatch of number of nodes in face should be even !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int n1=n2/2; + int n1=(int)(n2/2); newci[i+1]=7*n1+2+newci[i];//6*n1 (nodal length) + n1+2 (number of faces) - 1 (number of '-1' separator is equal to number of faces -1) + 1 (for cell type) } else @@ -806,10 +806,10 @@ void MEDCouplingUMesh::convertExtrudedPolyhedra() throw(INTERP_KERNEL::Exception INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[i]]; if(type==INTERP_KERNEL::NORM_POLYHED) { - int n1=std::distance(c+ci[i]+1,c+ci[i+1])/2; + std::size_t n1=std::distance(c+ci[i]+1,c+ci[i+1])/2; newc=std::copy(c+ci[i],c+ci[i]+n1+1,newc); *newc++=-1; - for(int j=0;j=0) traducer[conn[j]]=1; - nbrOfNodesInUse=std::count(traducer,traducer+nbOfNodes,1); + nbrOfNodesInUse=(int)std::count(traducer,traducer+nbOfNodes,1); std::transform(traducer,traducer+nbOfNodes,traducer,MEDCouplingAccVisit()); return ret; } @@ -987,10 +987,10 @@ bool MEDCouplingUMesh::areCellsFrom2MeshEqual(const MEDCouplingUMesh *other, int std::vector c1,c2; getNodeIdsOfCell(cellId,c1); other->getNodeIdsOfCell(cellId,c2); - int sz=c1.size(); - if(sz!=(int)c2.size()) + std::size_t sz=c1.size(); + if(sz!=c2.size()) return false; - for(int i=0;i n1,n2; getCoordinatesOfNode(c1[0],n1); @@ -1086,7 +1086,7 @@ void MEDCouplingUMesh::findCommonCellsBase(int compType, std::vector& res, if(areCellsEqualInPool(candidates,compType,res)) { int pos=resI.back(); - resI.push_back(res.size()); + resI.push_back((int)res.size()); for(std::vector::const_iterator it=res.begin()+pos;it!=res.end();it++) isFetched[*it]=true; } @@ -1135,10 +1135,10 @@ DataArrayInt *MEDCouplingUMesh::zipConnectivityTraducer(int compType) throw(INTE ret->alloc(nbOfCells,1); int *retPtr=ret->getPointer(); std::fill(retPtr,retPtr+nbOfCells,0); - const int nbOfTupleSmCells=commonCellsI.size()-1; + const std::size_t nbOfTupleSmCells=commonCellsI.size()-1; int id=-1; std::vector cellsToKeep; - for(int i=0;i::const_iterator it=commonCells.begin()+commonCellsI[i];it!=commonCells.begin()+commonCellsI[i+1];it++) retPtr[*it]=id; @@ -1280,7 +1280,7 @@ MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelf(const int *begin, const if(begin[0]!=0) throw INTERP_KERNEL::Exception("-1D mesh has only one cell : 0 !"); incrRef(); - return (MEDCouplingUMesh *)this; + return const_cast(this); } } @@ -1289,7 +1289,7 @@ DataArrayInt *MEDCouplingUMesh::getCellIdsFullyIncludedInNodeIds(const int *part std::vector cellIdsKept; fillCellIdsToKeepFromNodeIds(partBg,partEnd,true,cellIdsKept); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(cellIdsKept.size(),1); + ret->alloc((int)cellIdsKept.size(),1); std::copy(cellIdsKept.begin(),cellIdsKept.end(),ret->getPointer()); return ret; } @@ -1315,7 +1315,7 @@ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int { std::set connOfCell(conn+connIndex[i]+1,conn+connIndex[i+1]); connOfCell.erase(-1);//polyhedron separator - int refLgth=std::min(connOfCell.size(),fastFinder.size()); + int refLgth=(int)std::min(connOfCell.size(),fastFinder.size()); std::set locMerge; std::insert_iterator< std::set > it(locMerge,locMerge.begin()); std::set_intersection(connOfCell.begin(),connOfCell.end(),fastFinder.begin(),fastFinder.end(),it); @@ -1332,7 +1332,7 @@ DataArrayInt *MEDCouplingUMesh::getCellIdsLyingOnNodes(const int *begin, const i std::vector cellIdsKept; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(cellIdsKept.size(),1); + ret->alloc((int)cellIdsKept.size(),1); std::copy(cellIdsKept.begin(),cellIdsKept.end(),ret->getPointer()); ret->setName(getName()); return ret; @@ -1429,7 +1429,7 @@ DataArrayInt *MEDCouplingUMesh::findCellsIdsOnBoundary() const throw(INTERP_KERN revDesc->decrRef(); // DataArrayInt *ret2=DataArrayInt::New(); - ret2->alloc(ret.size(),1); + ret2->alloc((int)ret.size(),1); std::copy(ret.begin(),ret.end(),ret2->getPointer()); ret2->setName("BoundaryCells"); return ret2; @@ -1565,7 +1565,7 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) throw(INT newCI[0]=loc; for(int i=0;idecrRef(); newConnI->decrRef(); if(check) - delete [] (int *)array; + delete [] const_cast(array); } /*! @@ -1873,7 +1873,7 @@ int MEDCouplingUMesh::getNumberOfNodesInCell(int cellId) const if(pt[ptI[cellId]]!=INTERP_KERNEL::NORM_POLYHED) return ptI[cellId+1]-ptI[cellId]-1; else - return std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to(),-1)); + return (int)std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to(),-1)); } /*! @@ -1908,14 +1908,14 @@ void MEDCouplingUMesh::setConnectivity(DataArrayInt *conn, DataArrayInt *connInd * Copy constructor. If 'deepCpy' is false 'this' is a shallow copy of other. * If 'deeCpy' is true all arrays (coordinates and connectivities) are deeply copied. */ -MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy):MEDCouplingPointSet(other,deepCpy),_iterator(-1),_mesh_dim(other._mesh_dim), - _nodal_connec(0),_nodal_connec_index(0), +MEDCouplingUMesh::MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCopy):MEDCouplingPointSet(other,deepCopy),_iterator(-1),_mesh_dim(other._mesh_dim), + _nodal_connec(0),_nodal_connec_index(0), _types(other._types) { if(other._nodal_connec) - _nodal_connec=other._nodal_connec->performCpy(deepCpy); + _nodal_connec=other._nodal_connec->performCpy(deepCopy); if(other._nodal_connec_index) - _nodal_connec_index=other._nodal_connec_index->performCpy(deepCpy); + _nodal_connec_index=other._nodal_connec_index->performCpy(deepCopy); } MEDCouplingUMesh::~MEDCouplingUMesh() @@ -2077,7 +2077,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin MEDCouplingUMesh *ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - int nbOfElemsRet=end-begin; + std::size_t nbOfElemsRet=std::distance(begin,end); int *connIndexRet=new int[nbOfElemsRet+1]; connIndexRet[0]=0; const int *conn=_nodal_connec->getConstPointer(); @@ -2096,15 +2096,15 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin DataArrayInt *connRetArr=DataArrayInt::New(); connRetArr->useArray(connRet,true,CPP_DEALLOC,connIndexRet[nbOfElemsRet],1); DataArrayInt *connIndexRetArr=DataArrayInt::New(); - connIndexRetArr->useArray(connIndexRet,true,CPP_DEALLOC,nbOfElemsRet+1,1); + connIndexRetArr->useArray(connIndexRet,true,CPP_DEALLOC,(int)nbOfElemsRet+1,1); ret->setConnectivity(connRetArr,connIndexRetArr,false); ret->_types=types; connRetArr->decrRef(); connIndexRetArr->decrRef(); ret->copyTinyInfoFrom(this); std::string name(getName()); - int sz=strlen(PART_OF_NAME); - if((int)name.length()>=sz) + std::size_t sz=strlen(PART_OF_NAME); + if(name.length()>=sz) name=name.substr(0,sz); if(name!=PART_OF_NAME) { @@ -2170,7 +2170,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be { std::string name="PartMeasureOfMesh_"; name+=getName(); - int nbelem=std::distance(begin,end); + int nbelem=(int)std::distance(begin,end); DataArrayDouble* array=DataArrayDouble::New(); array->setName(name.c_str()); array->alloc(nbelem,1); @@ -2300,9 +2300,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); DataArrayDouble *array=DataArrayDouble::New(); - int nbelems=std::distance(begin,end); + std::size_t nbelems=std::distance(begin,end); int nbComp=getMeshDimension()+1; - array->alloc(nbelems,nbComp); + array->alloc((int)nbelems,nbComp); double *vals=array->getPointer(); const int *connI=_nodal_connec_index->getConstPointer(); const int *conn=_nodal_connec->getConstPointer(); @@ -2324,7 +2324,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be } else { - for(int i=0;ialloc(newc.size()*nbOf1DCells,1); + newConn->alloc((int)(newc.size())*nbOf1DCells,1); int *newConnPtr=newConn->getPointer(); int deltaPerLev=isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev; newConnIPtr=newConnI->getPointer(); @@ -3025,7 +3025,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNode std::transform(newConnIPtr+1,newConnIPtr+1+nbOf2DCells,newConnIPtr+1+iz*nbOf2DCells,std::bind2nd(std::plus(),newConnIPtr[iz*nbOf2DCells])); for(std::vector::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++) { - int icell=iter-newc.begin(); + int icell=(int)(iter-newc.begin()); if(std::find(newConnIPtr,newConnIPtr+nbOf2DCells,icell)==newConnIPtr+nbOf2DCells) { if(*iter!=-1) @@ -3762,7 +3762,7 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const throw(INTERP_K types.insert(typ); ret[3*i]=typ; const int *work2=std::find_if(work+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,typ)); - ret[3*i+1]=std::distance(work,work2); + ret[3*i+1]=(int)std::distance(work,work2); work=work2; } return ret; @@ -3788,7 +3788,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< { if(code.empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !"); - int sz=code.size(); + std::size_t sz=code.size(); std::size_t n=sz/3; if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !"); @@ -3822,13 +3822,13 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< for(std::vector::const_iterator it=types.begin();it!=types.end();it++,kk++) { i=std::find_if(i,connI+nbOfCells,ParaMEDMEMImpl::ConnReader2(conn,(int)(*it))); - int offset=std::distance(connI,i); + int offset=(int)std::distance(connI,i); if(code[3*kk+2]==-1) { const int *j=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)(*it))); - int pos2=std::distance(i,j); - for(int k=0;kincrRef(); idsInPflPerType[i]=locDa; } - int sz=idsPerType2.size(); + std::size_t sz=idsPerType2.size(); idsPerType.resize(sz); - for(int i=0;iincrRef(); @@ -3942,10 +3942,10 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 DataArrayInt *ret=0; if(!ret1->areCellsIncludedIn(nM1LevMesh,2,ret)) { - int tmp; - ret->getMaxValue(tmp); + int tmp2; + ret->getMaxValue(tmp2); ret->decrRef(); - std::ostringstream oss; oss << "MEDCouplingUMesh::emulateMEDMEMBDC : input N-1 mesh present a cell not in descending mesh ... Id of cell is " << tmp << " !"; + std::ostringstream oss; oss << "MEDCouplingUMesh::emulateMEDMEMBDC : input N-1 mesh present a cell not in descending mesh ... Id of cell is " << tmp2 << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } nM1LevMeshIds=ret; @@ -4011,7 +4011,7 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No for(const int *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; - int pos=std::distance(orderBg,std::find(orderBg,orderEnd,curType)); + int pos=(int)std::distance(orderBg,std::find(orderBg,orderEnd,curType)); if(pos<=lastPos) return false; lastPos=pos; @@ -4034,7 +4034,7 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma MEDCouplingAutoRefCountObjectPtr tmpa=DataArrayInt::New(); MEDCouplingAutoRefCountObjectPtr tmpb=DataArrayInt::New(); tmpa->alloc(nbOfCells,1); - tmpb->alloc(std::distance(orderBg,orderEnd),1); + tmpb->alloc((int)std::distance(orderBg,orderEnd),1); tmpb->fillWithZero(); int *tmp=tmpa->getPointer(); int *tmp2=tmpb->getPointer(); @@ -4043,7 +4043,7 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma const INTERP_KERNEL::NormalizedCellType *where=std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]); if(where!=orderEnd) { - int pos=std::distance(orderBg,where); + int pos=(int)std::distance(orderBg,where); tmp2[pos]++; tmp[std::distance(connI,i)]=pos; } @@ -4128,9 +4128,9 @@ std::vector MEDCouplingUMesh::splitByType() const for(const int *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; - int beginCellId=std::distance(connI,i); + int beginCellId=(int)std::distance(connI,i); i=std::find_if(i+1,connI+nbOfCells,ParaMEDMEMImpl::ConnReader(conn,(int)curType)); - int endCellId=std::distance(connI,i); + int endCellId=(int)std::distance(connI,i); int sz=endCellId-beginCellId; int *cells=new int[sz]; for(int j=0;jalloc(r.size(),1); + ret->alloc((int)r.size(),1); std::copy(r.begin(),r.end(),ret->getPointer()); return ret; } @@ -4288,7 +4288,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, c { DataArrayDouble *ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfTuple=std::distance(begin,end); + int nbOfTuple=(int)std::distance(begin,end); ret->alloc(nbOfTuple,spaceDim); double *ptToFill=ret->getPointer(); double *tmp=new double[spaceDim]; @@ -4490,13 +4490,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetNodalConnectivity()->getConstPointer(); const int *index=(*iter)->getNodalConnectivityIndex()->getConstPointer(); int nbOfCells=(*iter)->getNumberOfCells(); - int meshLgth=(*iter)->getMeshLength(); - nodalPtr=std::copy(nod,nod+meshLgth,nodalPtr); + int meshLgth2=(*iter)->getMeshLength(); + nodalPtr=std::copy(nod,nod+meshLgth2,nodalPtr); if(iter!=meshes.begin()) nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus(),offset)); else nodalIndexPtr=std::copy(index,index+nbOfCells+1,nodalIndexPtr); - offset+=meshLgth; + offset+=meshLgth2; } MEDCouplingUMesh *ret=MEDCouplingUMesh::New(); ret->setName("merge"); @@ -4526,10 +4526,10 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vectorzipConnectivityTraducer(compType); corr.resize(meshes.size()); - int nbOfMeshes=meshes.size(); + std::size_t nbOfMeshes=meshes.size(); int offset=0; const int *o2nPtr=o2n->getConstPointer(); - for(int i=0;igetNumberOfCells(); @@ -4612,8 +4612,8 @@ void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, std::reverse_iterator rConnBg(connEnd); std::reverse_iterator rConnEnd(connBg+1); std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus(),deltaz)); - int nbOfRadFaces=std::distance(connBg+1,connEnd); - for(int i=0;i > edges; - int nbOfFaces=std::count(begin,end,-1)+1; + std::size_t nbOfFaces=std::count(begin,end,-1)+1; const int *bgFace=begin; - for(int i=0;i p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); if(std::find(edges.begin(),edges.end(),p1)!=edges.end()) @@ -4665,7 +4665,7 @@ bool MEDCouplingUMesh::IsPolyhedronWellOriented(const int *begin, const int *end } bgFace=endFace+1; } - return INTERP_KERNEL::calculateVolumeForPolyh2(begin,std::distance(begin,end),coords)>-EPS_FOR_POLYH_ORIENTATION; + return INTERP_KERNEL::calculateVolumeForPolyh2(begin,(int)std::distance(begin,end),coords)>-EPS_FOR_POLYH_ORIENTATION; } /*! @@ -4675,24 +4675,24 @@ bool MEDCouplingUMesh::IsPolyhedronWellOriented(const int *begin, const int *end void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords) throw(INTERP_KERNEL::Exception) { std::vector > edges; - int nbOfFaces=std::count(begin,end,-1)+1; + std::size_t nbOfFaces=std::count(begin,end,-1)+1; int *bgFace=begin; std::vector isPerm(nbOfFaces); - for(int i=0;i p1(bgFace[l],bgFace[(l+1)%nbOfEdgesInFace]); edges.push_back(p1); } int *bgFace2=endFace+1; - for(int k=i+1;k p2(bgFace2[j],bgFace2[(j+1)%nbOfEdgesInFace2]); if(std::find(edges.begin(),edges.end(),p2)!=edges.end()) @@ -4710,13 +4710,13 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c } bgFace=endFace+1; } - if(INTERP_KERNEL::calculateVolumeForPolyh2(begin,std::distance(begin,end),coords)<-EPS_FOR_POLYH_ORIENTATION) + if(INTERP_KERNEL::calculateVolumeForPolyh2(begin,(int)std::distance(begin,end),coords)<-EPS_FOR_POLYH_ORIENTATION) {//not lucky ! The first face was not correctly oriented : reorient all faces... bgFace=begin; - for(int i=0;i tmp(nbOfEdgesInFace-1); std::copy(bgFace+1,endFace,tmp.rbegin()); std::copy(tmp.begin(),tmp.end(),bgFace+1); @@ -4810,16 +4810,16 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 /* outputs -> */cr,crI,cNb1,cNb2); // MEDCouplingAutoRefCountObjectPtr addCooDa=DataArrayDouble::New(); - addCooDa->alloc(addCoo.size()/2,2); + addCooDa->alloc((int)(addCoo.size())/2,2); std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer()); std::vector coordss(3); coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; MEDCouplingAutoRefCountObjectPtr coo=DataArrayDouble::Aggregate(coordss); MEDCouplingAutoRefCountObjectPtr ret=MEDCouplingUMesh::New("Intersect2D",2); - MEDCouplingAutoRefCountObjectPtr conn=DataArrayInt::New(); conn->alloc(cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); - MEDCouplingAutoRefCountObjectPtr connI=DataArrayInt::New(); connI->alloc(crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); - MEDCouplingAutoRefCountObjectPtr c1=DataArrayInt::New(); c1->alloc(cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); cellNb1=c1; - MEDCouplingAutoRefCountObjectPtr c2=DataArrayInt::New(); c2->alloc(cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); cellNb2=c2; + MEDCouplingAutoRefCountObjectPtr conn=DataArrayInt::New(); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); + MEDCouplingAutoRefCountObjectPtr connI=DataArrayInt::New(); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); + MEDCouplingAutoRefCountObjectPtr c1=DataArrayInt::New(); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); cellNb1=c1; + MEDCouplingAutoRefCountObjectPtr c2=DataArrayInt::New(); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); cellNb2=c2; ret->setConnectivity(conn,connI,true); ret->setCoords(coo); ret->incrRef(); c1->incrRef(); c2->incrRef(); desc1->decrRef(); descIndx1->decrRef(); desc2->decrRef(); descIndx2->decrRef(); @@ -5074,7 +5074,7 @@ MEDCouplingUMeshCellEntry *MEDCouplingUMeshCellByTypeIterator::nextt() if(_cell_id<_nb_cell) { INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]]; - int nbOfElems=std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,ParaMEDMEMImpl::ConnReader(c,type))); + int nbOfElems=(int)std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,ParaMEDMEMImpl::ConnReader(c,type))); int startId=_cell_id; _cell_id+=nbOfElems; return new MEDCouplingUMeshCellEntry(_mesh,type,_cell,startId,_cell_id); diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index a8ec97fb6..e5ed8196a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -187,7 +187,7 @@ namespace ParaMEDMEM /// @endcond private: MEDCouplingUMesh(); - MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy); + MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCopy); ~MEDCouplingUMesh(); void checkFullyDefined() const throw(INTERP_KERNEL::Exception); void checkConnectivityFullyDefined() const throw(INTERP_KERNEL::Exception); -- 2.39.2