From bc8e998bbf5abc5ca703a434cf02e7b8741820b0 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 11 Dec 2019 15:24:29 +0300 Subject: [PATCH] LOT5,6: int->mcIdType in MEDLoader,MEDPartitioner,RENUMBER with MPI activated --- src/MEDLoader/CMakeLists.txt | 4 + src/MEDLoader/MEDFileBlowStrEltUp.cxx | 21 +- src/MEDLoader/MEDFileEquivalence.cxx | 8 +- src/MEDLoader/MEDFileField.cxx | 16 +- src/MEDLoader/MEDFileField1TS.cxx | 40 +-- src/MEDLoader/MEDFileFieldGlobs.cxx | 36 +-- src/MEDLoader/MEDFileFieldInternal.cxx | 162 +++++------ src/MEDLoader/MEDFileFieldInternal.hxx | 26 +- src/MEDLoader/MEDFileFieldMultiTS.cxx | 34 +-- src/MEDLoader/MEDFileFieldOverView.cxx | 78 ++--- src/MEDLoader/MEDFileJoint.cxx | 14 +- src/MEDLoader/MEDFileMesh.cxx | 76 ++--- src/MEDLoader/MEDFileMeshElt.cxx | 116 ++++---- src/MEDLoader/MEDFileMeshElt.hxx | 18 +- src/MEDLoader/MEDFileMeshLL.cxx | 44 +-- src/MEDLoader/MEDFileMeshLL.hxx | 4 +- src/MEDLoader/MEDFileMeshSupport.cxx | 2 +- src/MEDLoader/MEDFileMeshSupport.hxx | 2 +- src/MEDLoader/MEDFileStructureElement.cxx | 11 +- src/MEDLoader/MEDFileStructureElement.hxx | 2 +- src/MEDLoader/MEDFileUtilities.cxx | 3 +- src/MEDLoader/MEDLoader.cxx | 6 +- src/MEDLoader/MEDLoaderBase.cxx | 4 +- src/MEDLoader/MEDLoaderBase.hxx | 2 +- src/MEDLoader/SauvMedConvertor.cxx | 152 +++++----- src/MEDLoader/SauvMedConvertor.hxx | 12 +- src/MEDLoader/SauvReader.cxx | 10 +- src/MEDLoader/SauvWriter.cxx | 76 ++--- src/MEDLoader/SauvWriter.hxx | 2 +- src/MEDLoader/Swig/MEDLoader.i | 77 +++-- src/MEDLoader/Swig/MEDLoaderCommon.i | 104 +++---- src/MEDLoader/Swig/MEDLoaderTest3.py | 30 +- src/MEDLoader/Swig/MEDLoaderTypemaps.i | 75 ++--- src/MEDPartitioner/CMakeLists.txt | 4 + .../MEDPARTITIONER_ConnectZone.cxx | 42 +-- .../MEDPARTITIONER_ConnectZone.hxx | 26 +- src/MEDPartitioner/MEDPARTITIONER_Graph.cxx | 2 +- .../MEDPARTITIONER_JointFinder.cxx | 38 +-- .../MEDPARTITIONER_JointFinder.hxx | 9 +- .../MEDPARTITIONER_MeshCollection.cxx | 266 +++++++++--------- .../MEDPARTITIONER_MeshCollection.hxx | 18 +- .../MEDPARTITIONER_MeshCollectionDriver.cxx | 6 +- ...RTITIONER_MeshCollectionMedAsciiDriver.cxx | 22 +- ...PARTITIONER_MeshCollectionMedXmlDriver.cxx | 2 +- .../MEDPARTITIONER_PTScotchGraph.cxx | 16 +- .../MEDPARTITIONER_ParMetisGraph.cxx | 17 +- .../MEDPARTITIONER_ParaDomainSelector.cxx | 131 +++++---- .../MEDPARTITIONER_ParaDomainSelector.hxx | 31 +- .../MEDPARTITIONER_ParallelTopology.cxx | 191 ++++++------- .../MEDPARTITIONER_ParallelTopology.hxx | 110 ++++---- .../MEDPARTITIONER_ScotchGraph.cxx | 2 +- .../MEDPARTITIONER_Topology.hxx | 69 ++--- .../MEDPARTITIONER_UserGraph.cxx | 2 +- .../MEDPARTITIONER_UserGraph.hxx | 2 +- src/MEDPartitioner/MEDPARTITIONER_Utils.cxx | 53 ++-- src/MEDPartitioner/MEDPARTITIONER_Utils.hxx | 39 +-- .../MEDPARTITIONER_UtilsPara.cxx | 49 ++-- .../Test/MEDPARTITIONERTest.cxx | 96 +++---- src/MEDPartitioner_Swig/CMakeLists.txt | 4 + src/ParaMEDLoader/CMakeLists.txt | 4 + src/ParaMEDLoader/ParaMEDFileMesh.cxx | 4 +- src/ParaMEDLoader/ParaMEDLoader.cxx | 4 +- src/ParaMEDMEM/BlockTopology.cxx | 110 ++++---- src/ParaMEDMEM/BlockTopology.hxx | 20 +- src/ParaMEDMEM/CMakeLists.txt | 4 + src/ParaMEDMEM/CommInterface.hxx | 3 + src/ParaMEDMEM/ComponentTopology.hxx | 2 +- src/ParaMEDMEM/DisjointDEC.cxx | 14 +- src/ParaMEDMEM/ElementLocator.cxx | 208 +++++++------- src/ParaMEDMEM/ElementLocator.hxx | 24 +- src/ParaMEDMEM/ExplicitCoincidentDEC.cxx | 60 ++-- src/ParaMEDMEM/ExplicitMapping.cxx | 22 +- src/ParaMEDMEM/ExplicitMapping.hxx | 16 +- src/ParaMEDMEM/ExplicitTopology.cxx | 28 +- src/ParaMEDMEM/ExplicitTopology.hxx | 32 +-- src/ParaMEDMEM/InterpKernelDEC.cxx | 4 +- src/ParaMEDMEM/InterpolationMatrix.cxx | 204 +++++++------- src/ParaMEDMEM/InterpolationMatrix.hxx | 36 +-- src/ParaMEDMEM/MPIAccess.cxx | 16 +- src/ParaMEDMEM/MPIAccess.hxx | 7 +- src/ParaMEDMEM/MPIAccessDEC.cxx | 24 +- src/ParaMEDMEM/MPIProcessorGroup.cxx | 2 +- src/ParaMEDMEM/MxN_Mapping.cxx | 22 +- src/ParaMEDMEM/MxN_Mapping.hxx | 8 +- src/ParaMEDMEM/OverlapDEC.cxx | 10 +- src/ParaMEDMEM/OverlapElementLocator.cxx | 58 ++-- src/ParaMEDMEM/OverlapElementLocator.hxx | 10 +- src/ParaMEDMEM/OverlapInterpolationMatrix.cxx | 16 +- src/ParaMEDMEM/OverlapInterpolationMatrix.hxx | 10 +- src/ParaMEDMEM/OverlapMapping.cxx | 209 +++++++------- src/ParaMEDMEM/OverlapMapping.hxx | 32 +-- src/ParaMEDMEM/ParaFIELD.cxx | 6 +- src/ParaMEDMEM/ParaFIELD.hxx | 5 +- src/ParaMEDMEM/ParaIdType.hxx | 31 ++ src/ParaMEDMEM/ParaMESH.cxx | 20 +- src/ParaMEDMEM/ParaMESH.hxx | 28 +- src/ParaMEDMEM/ProcessorGroup.hxx | 2 +- src/ParaMEDMEM/StructuredCoincidentDEC.cxx | 58 ++-- src/ParaMEDMEM/Topology.hxx | 6 +- src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx | 2 +- src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx | 2 +- .../ParaMEDMEMTest_BlockTopology.cxx | 12 +- .../ParaMEDMEMTest_FabienAPI.cxx | 8 +- .../ParaMEDMEMTest_Gauthier1.cxx | 16 +- src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx | 5 +- .../ParaMEDMEMTest_InterpKernelDEC.cxx | 58 ++-- .../ParaMEDMEMTest_OverlapDEC.cxx | 16 +- ...ParaMEDMEMTest_StructuredCoincidentDEC.cxx | 2 +- .../test_MPI_Access_ISend_IRecv_Length_1.cxx | 4 +- src/ParaMEDMEM_Swig/CMakeLists.txt | 7 + src/ParaMEDMEM_Swig/ParaMEDMEM.i | 71 ++++- src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i | 18 +- src/RENUMBER/CMakeLists.txt | 4 + src/RENUMBER/renumbering.cxx | 10 +- src/RENUMBER_Swig/CMakeLists.txt | 4 + src/RENUMBER_Swig/MEDRenumber.i | 168 +++++++---- 116 files changed, 2305 insertions(+), 1995 deletions(-) create mode 100644 src/ParaMEDMEM/ParaIdType.hxx diff --git a/src/MEDLoader/CMakeLists.txt b/src/MEDLoader/CMakeLists.txt index c5150e7d3..41cbe3ec7 100644 --- a/src/MEDLoader/CMakeLists.txt +++ b/src/MEDLoader/CMakeLists.txt @@ -20,6 +20,10 @@ ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${XDR_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + IF(MEDCOUPLING_ENABLE_PYTHON) ADD_SUBDIRECTORY(Swig) ENDIF(MEDCOUPLING_ENABLE_PYTHON) diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index 89524bb7d..2ca90a99a 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -101,7 +101,6 @@ MCAuto MEDFileBlowStrEltUp::dealWithMEDBALLInMesh(const M conn->checkAllocated(); if(conn->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : excepted to be single compo !"); - int nbCells(conn->getNumberOfTuples()); MCAuto connOut(coo->selectByTupleIdSafe(conn->begin(),conn->end())); MCAuto mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut)); mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR)); @@ -426,9 +425,9 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali // MCAuto dir(geoMesh->buildDirectionVectorField()); MCAuto rot(dir->getArray()->fromCartToSpher()); - int nbCompo(ptsForLoc->getNumberOfComponents()); + std::size_t nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); - int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); { const int TAB[3]={2,0,1}; std::vector v(TAB,TAB+3); @@ -449,7 +448,7 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali for(int l=0;l p2(p->deepCopy()); - for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k); arrs[j*nbg+l]=p2; } @@ -463,7 +462,7 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize { MCAuto ptsForLoc; MCAuto geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); - int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); MCConstAuto zeThickness; if(!pfl.empty()) { @@ -477,11 +476,11 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize MCAuto ortho(geoMesh->buildOrthogonalField()); orthoArr.takeRef(ortho->getArray()); } - int nbCompo(orthoArr->getNumberOfComponents()); + mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents())); MCAuto secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo)); secPts->rearrange(nbCompo); std::vector< MCAuto > arrs(nbCells*nbg); - for(int j=0;jgetIJ(j,0)),eccentricity(zeThickness->getIJ(j,1)); MCAuto fact(DataArrayDouble::New()),fact2(DataArrayDouble::New()); fact->alloc(1,nbCompo); fact2->alloc(1,nbCompo); @@ -509,7 +508,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, static const char MSG1[]="BuildMeshPipeSEG3 : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !"; MCAuto ptsForLoc; MCAuto geoMesh(BuildMeshCommon(INTERP_KERNEL::NORM_SEG3,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); - int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); MCConstAuto zeAngle,zeScale; if(!pfl.empty()) { @@ -531,7 +530,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, dir=geoMesh2->buildDirectionVectorField(); } MCAuto rot(dir->getArray()->fromCartToSpher()); - int nbCompo(ptsForLoc->getNumberOfComponents()); + std::size_t nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); { const int TAB[3]={2,0,1}; @@ -541,7 +540,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; double AX1[3]; AX1[2]=0.; std::vector< MCAuto > arrs(nbCells*nbg); - for(int j=0;j p(secPts->deepCopy()); @@ -566,7 +565,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, MCAuto p3(p->deepCopy()); DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,zeAngle->getIJ(j,l),nbSecPts,p3->begin(),p3->getPointer()); MCAuto p2(p3->deepCopy()); - for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k); arrs[j*nbg+l]=p2; } diff --git a/src/MEDLoader/MEDFileEquivalence.cxx b/src/MEDLoader/MEDFileEquivalence.cxx index 25d599a93..ef9ab57db 100644 --- a/src/MEDLoader/MEDFileEquivalence.cxx +++ b/src/MEDLoader/MEDFileEquivalence.cxx @@ -281,7 +281,7 @@ MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::s int MEDFileEquivalences::size() const { - return _equ.size(); + return (int)_equ.size(); } std::vector MEDFileEquivalences::getEquivalenceNames() const @@ -512,7 +512,7 @@ void MEDFileEquivalenceData::writeAdvanced(med_idt fid, med_entity_type medtype, MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy()); MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy()); MCAuto da2(da->deepCopy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); - MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,da2->getNumberOfTuples(),da2->begin())); + MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin())); } std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const @@ -662,7 +662,7 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) return ; MEDFileEquivalences::CheckDataArray(da); MEDFileMesh *mm(getMesh()); - int totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); + mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); // MCAuto tmp(da->deepCopy()); tmp->rearrange(1); int maxv,minv; @@ -678,7 +678,7 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) std::vector compS(1,0); for(std::vector::const_iterator it=gts.begin();it!=gts.end();it++) { - endId=startId+mm->getNumberOfCellsWithType(*it); + endId=startId+(int)mm->getNumberOfCellsWithType(*it); MCAuto da0(da->keepSelectedComponents(compS)); MCAuto ids(da0->findIdsInRange(startId,endId)); MCAuto da1(da->selectByTupleIdSafe(ids->begin(),ids->end())); diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 8ac073010..5ab6fbf03 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -169,7 +169,7 @@ std::vector< std::pair > MEDFileFields::getCommonIterations(bool& areTh int MEDFileFields::getNumberOfFields() const { - return _fields.size(); + return (int)_fields.size(); } std::vector MEDFileFields::getFieldsNames() const @@ -515,7 +515,7 @@ void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds) void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) { static const char msg[]="MEDFileFields::destroyFieldsAtPos2"; - int nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg)); + mcIdType nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg)); std::vector b(_fields.size(),true); int k=bg; for(int i=0;i& mat, const MCAuto& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { } + PFLData(const MCAuto& mat, const MCAuto& pfl, mcIdType nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { } std::string getPflName() const { if(_pfl.isNull()) { return std::string(); } else { return _pfl->getName(); } } - int getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; } + mcIdType getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; } MCAuto getProfile() const { return _pfl; } MCAuto getMatrix() const { return _matrix; } private: MCAuto _matrix; MCAuto _pfl; - int _add_pts_in_pfl; + mcIdType _add_pts_in_pfl; }; class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor @@ -640,7 +640,7 @@ public: // void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); private: - void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes); + void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes); private: const MEDFileUMesh *_lin; const MEDFileUMesh *_quad; @@ -723,7 +723,7 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl()); } -void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes) +void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes) { pmtd->incrementNbOfVals(deltaNbNodes); } @@ -1110,7 +1110,7 @@ int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const { std::string tmp(fieldName); std::vector poss; - for(std::size_t i=0;i<_fields.size();i++) + for(unsigned int i=0;i<_fields.size();i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]); if(f) diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index b0d2f08e3..aada9c550 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -135,9 +135,9 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi const DataArray *arr(getUndergroundDataArray()); if(!arr) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !"); - int nbOfCompo=arr->getNumberOfComponents(); + std::size_t nbOfCompo=arr->getNumberOfComponents(); std::vector< MCAuto > ret(nbOfCompo); - for(int i=0;i v(1,i); @@ -468,9 +468,9 @@ void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCe MEDFileFieldPerMeshPerTypePerDisc *disc(fpm->getLeafGivenTypeAndLocId(ct,0)); if(disc->getType()!=tof) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : error !"); - int s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples()); + mcIdType s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples()); DataArray *arr(getUndergroundDataArray()); - int nt2(arr->getNumberOfTuples()),delta((e-s)-nt); + mcIdType nt2(arr->getNumberOfTuples()),delta((e-s)-nt); if(delta<0) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : internal error !"); MCAuto arr0(arr->selectByTupleIdSafeSlice(0,s,1)),arr1(arr->selectByTupleIdSafeSlice(s,e,1)),arr2(arr->selectByTupleIdSafeSlice(e,nt2,1)); @@ -551,10 +551,10 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe if((*it)->getMeshName()==tmp) return i; } - int sz=_field_per_mesh.size(); + std::size_t sz=_field_per_mesh.size(); _field_per_mesh.resize(sz+1); _field_per_mesh[sz]=MEDFileFieldPerMesh::New(this,mesh); - return sz; + return (int)sz; } bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, @@ -681,7 +681,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(mcIdType newLgth, const std::v newArr->alloc(newLgth,getNumberOfComponents()); if(oldArr) newArr->copyStringInfoFrom(*oldArr); - int pos=0; + mcIdType pos=0; for(std::vector< std::pair >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++) { if((*it).second<(*it).first) @@ -1335,14 +1335,14 @@ std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingM if(!mesh) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !"); std::set geoTypes=mesh->getAllGeoTypes(); - int nbOfTypes=geoTypes.size(); + std::size_t nbOfTypes=geoTypes.size(); std::vector code(3*nbOfTypes); MCAuto arr1=DataArrayIdType::New(); arr1->alloc(nbOfTypes,1); mcIdType *arrPtr=arr1->getPointer(); std::set::const_iterator it=geoTypes.begin(); - for(int i=0;i arr2=arr1->checkAndPreparePermutation(); const mcIdType *arrPtr2=arr2->getConstPointer(); int i=0; @@ -1409,14 +1409,14 @@ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFiel if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); std::vector< std::vector< std::pair > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); - int nbOfRet=ret0.size(); + std::size_t nbOfRet=ret0.size(); std::vector< std::vector > ret(nbOfRet); - for(int i=0;i >& p=ret0[i]; - int nbOfRet1=p.size(); + std::size_t nbOfRet1=p.size(); ret[i].resize(nbOfRet1); - for(int j=0;jselectByTupleIdSafeSlice(p[j].first,p[j].second,1); ret[i][j]=tmp; @@ -1438,7 +1438,7 @@ MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const const DataArrayDouble *arr(_arr); if(arr) { - MCAuto arr2(arr->convertToIntArr()); + MCAuto arr2(arr->convertToIntArr()); ret->setArray(arr2); } return ret.retn(); @@ -2082,7 +2082,7 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTE MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); std::string oldPflName=disc->getProfile(); std::vector vv=getPflsReallyUsedMulti(); - int nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName); + std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldPflName); if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1)) { disc->setProfile(newPflName); @@ -2120,7 +2120,7 @@ void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_K MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); std::string oldLocName=disc->getLocalization(); std::vector vv=getLocsReallyUsedMulti(); - int nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName); + std::size_t nbOfOcc=std::count(vv.begin(),vv.end(),oldLocName); if(forceRenameOnGlob || (!existsLoc(newLocName) && nbOfOcc==1)) { disc->setLocalization(newLocName); @@ -2209,10 +2209,10 @@ void MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss() void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const { - int nbComp(getNumberOfComponents()); + std::size_t nbComp(getNumberOfComponents()); INTERP_KERNEL::AutoPtr comp(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE)); INTERP_KERNEL::AutoPtr unit(MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE)); - for(int i=0;iwriteLL(fid,*this,*contentNotNullBase()); } diff --git a/src/MEDLoader/MEDFileFieldGlobs.cxx b/src/MEDLoader/MEDFileFieldGlobs.cxx index 87890d36e..2302cf551 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.cxx +++ b/src/MEDLoader/MEDFileFieldGlobs.cxx @@ -71,18 +71,18 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i) void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const { - int nbOfPfls=_pfls.size(); - for(int i=0;i cpy=DataArrayMedInt::Copy((const DataArrayIdType*)_pfls[i]); cpy->applyLin(1,1,0); INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy()); - MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer())); + MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,ToMedInt(_pfls[i]->getNumberOfTuples()),cpy->getConstPointer())); } // - int nbOfLocs=_locs.size(); - for(int i=0;iwriteLL(fid); } @@ -98,7 +98,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) } else { - int id=std::distance(pfls.begin(),it2); + std::size_t id=std::distance(pfls.begin(),it2); if(!(*it)->isEqual(*_pfls[id])) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; @@ -116,7 +116,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) } else { - int id=std::distance(locs.begin(),it2); + std::size_t id=std::distance(locs.begin(),it2); if(!(*it)->isEqual(*_locs[id],eps)) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; @@ -141,15 +141,15 @@ void MEDFileFieldGlobs::checkGlobsLocsPartCoherency(const std::vector profiles=real.getPflsReallyUsed(); - int sz=profiles.size(); + std::size_t sz=profiles.size(); _pfls.resize(sz); - for(int i=0;i locs=real.getLocsReallyUsed(); sz=locs.size(); _locs.resize(sz); - for(int i=0;igetName() << "\", "; throw INTERP_KERNEL::Exception(oss.str()); } - return std::distance(_locs.begin(),it); + return (int)std::distance(_locs.begin(),it); } int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const @@ -408,7 +408,7 @@ int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const oss << "\"" << (*it)->getName() << "\", "; throw INTERP_KERNEL::Exception(oss.str()); } - return std::distance(_pfls.begin(),it); + return (int)std::distance(_pfls.begin(),it); } /*! @@ -501,18 +501,18 @@ void MEDFileFieldGlobs::killStructureElementsInGlobs() std::vector MEDFileFieldGlobs::getPfls() const { - int sz=_pfls.size(); + std::size_t sz=_pfls.size(); std::vector ret(sz); - for(int i=0;igetName(); return ret; } std::vector MEDFileFieldGlobs::getLocs() const { - int sz=_locs.size(); + std::size_t sz=_locs.size(); std::vector ret(sz); - for(int i=0;igetName(); return ret; } @@ -533,7 +533,7 @@ bool MEDFileFieldGlobs::existsLoc(const std::string& locName) const std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { - std::map > m; + std::map > m; int i=0; for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { @@ -544,7 +544,7 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const } } std::vector< std::vector > ret; - for(std::map >::const_iterator it2=m.begin();it2!=m.end();it2++) + for(std::map >::const_iterator it2=m.begin();it2!=m.end();it2++) { if((*it2).second.size()>1) { diff --git a/src/MEDLoader/MEDFileFieldInternal.cxx b/src/MEDLoader/MEDFileFieldInternal.cxx index bea5faeb0..55384dd90 100644 --- a/src/MEDLoader/MEDFileFieldInternal.cxx +++ b/src/MEDLoader/MEDFileFieldInternal.cxx @@ -180,7 +180,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::Norm const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _dim=cm.getDimension(); _nb_node_per_cell=cm.getNumberOfNodes(); - _nb_gauss_pt=_w.size(); + _nb_gauss_pt=(int)_w.size(); } @@ -265,11 +265,11 @@ std::string MEDFileFieldLoc::repr() const oss << "\n - Dimension : " << _dim << "\n - Number of gauss points : "; oss << _nb_gauss_pt << "\n - Number of nodes in cell : " << _nb_node_per_cell; oss << "\n - Ref coords are : "; - int sz=_ref_coo.size(); + std::size_t sz=_ref_coo.size(); if(sz%_dim==0) { - int nbOfTuples=sz/_dim; - for(int i=0;igetDiscretization()); - const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(_loc_id)); + const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(FromIdType(_loc_id))); const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !"); const DataArrayIdType *dai(disc2->getArrayOfDiscIds()); MCAuto dai2(disc2->getOffsetArr(field->getMesh())); const mcIdType *dai2Ptr(dai2->getConstPointer()); - int nbi(gsLoc.getWeights().size()); + mcIdType nbi(ToIdType(gsLoc.getWeights().size())); MCAuto da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1)); MCAuto da3(da2->findIdsEqual(_loc_id)); const mcIdType *da3Ptr(da3->getConstPointer()); @@ -433,7 +433,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, mcId if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); const DataArrayIdType *da1=disc2->getArrayOfDiscIds(); - const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id); + const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(FromIdType(_loc_id)); MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); MCAuto da3=da2->findIdsEqual(_loc_id); MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); @@ -491,12 +491,12 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start start=_end; } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd) { return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,profileIt,pd); } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId) { return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,locId,std::string()); } @@ -583,17 +583,17 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !"); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); int profilesize,nbi; - int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { mcIdType start,stop,step; spd->getSlice(start,stop,step); - int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile")); + mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile")); med_filter filter=MED_FILTER_INIT; MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/start+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(start+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter)); MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,startFeedingPtr)); MEDfilterClose(&filter); @@ -604,17 +604,17 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const { dpd->checkConsistencyLight(); MCAuto myIds(dpd->toDAI()); - int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); + mcIdType a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!! myIds->applyLin(1,-a); - int nbOfEltsToLoad(b-a+1); + mcIdType nbOfEltsToLoad(b-a+1); med_filter filter=MED_FILTER_INIT; {//TODO : manage int32 ! MCAuto tmp(DataArrayDouble::New()); tmp->alloc(nbOfEltsToLoad,nbOfCompo); MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(a+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter)); MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast(tmp->getPointer()))); MCAuto feeder(DataArrayDouble::New()); @@ -643,13 +643,13 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_i med_geometry_type mgeoti; med_entity_type menti; _father->entriesForMEDfile(type,mgeoti,menti); - int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal==0 && type==ON_CELLS) {//eheh maybe there's a surprise :) - int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal1==0) { - int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,ToMedInt(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); if(zeNVal2!=0) zeNVal=zeNVal2; } @@ -709,7 +709,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !"; throw INTERP_KERNEL::Exception(oss.str()); } - int nbOfCompo(arr->getNumberOfComponents()); + int nbOfCompo((int)arr->getNumberOfComponents()); DataArrayDouble *arrD(dynamic_cast(arr)); if(arrD) { @@ -717,10 +717,10 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } - DataArrayIdType *arrI(dynamic_cast(arr)); + DataArrayInt32 *arrI(dynamic_cast(arr)); if(arrI) { - mcIdType *startFeeding(arrI->getPointer()+_start*nbOfCompo); + int *startFeeding(arrI->getPointer()+_start*nbOfCompo); goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } @@ -913,7 +913,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN if(!arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !"); const DataArrayDouble *arrD(dynamic_cast(arr)); - const DataArrayIdType *arrI(dynamic_cast(arr)); + const DataArrayInt32 *arrI(dynamic_cast(arr)); const DataArrayFloat *arrF(dynamic_cast(arr)); const unsigned char *locToWrite=0; if(arrD) @@ -925,7 +925,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN else throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 FLOAT32 and INT32 !"); MEDFILESAFECALLERWR0(MEDfieldValueWithProfileWr,(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti, - MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval, + MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,ToMedInt(_nval), locToWrite)); } @@ -945,7 +945,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pa */ mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const { - _loc_id=offset; + _loc_id=FromIdType(offset); std::ostringstream oss; std::size_t nbOfType=codeOfMesh.size()/3; int found=-1; @@ -999,7 +999,7 @@ mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillTupleIds(mcIdType *ptToFill) con return _end-_start; } -int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, int locId) +int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, mcIdType locId) { switch(type) { @@ -1008,7 +1008,7 @@ int MEDFileFieldPerMeshPerTypePerDisc::ConvertType(TypeOfField type, int locId) case ON_GAUSS_NE: return -1; case ON_GAUSS_PT: - return locId; + return FromIdType(locId); default: throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::ConvertType : not managed type of field !"); } @@ -1065,7 +1065,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st int id=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { - int startOfEltIdOfChunk=(*it)->_start; + mcIdType startOfEltIdOfChunk=(*it)->_start; MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); @@ -1085,7 +1085,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st // MCAuto arrPart=arr->subArray(offset,offset+szTuples); arrPart->renumberInPlace(renumTupleIds->begin()); - arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1); + arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,ToIdType(arrPart->getNumberOfComponents()),1); bool ret=false; const mcIdType *idIt=diffVals->begin(); std::list li(entriesOnSameDisc.begin(),entriesOnSameDisc.end()); @@ -1123,7 +1123,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const st * \return a newly allocated chunk */ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt, - bool isPfl, int nbi, mcIdType offset, + bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting) @@ -1267,9 +1267,9 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c if(type!=ON_GAUSS_PT) { int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - int sz=_field_pm_pt_pd.size(); + std::size_t sz=_field_pm_pt_pd.size(); bool found=false; - for(int j=0;jgetLocId()==locIdToFind) { @@ -1288,19 +1288,19 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c else { std::vector ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells); - mcIdType sz2=ret2.size(); + std::size_t sz2=ret2.size(); std::vector ret3(sz2); mcIdType k=0; - for(mcIdType i=0;igetLocId()==locIdToFind) { - _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); + _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType(locIdToFind)); ret3[k++]=j; found=true; } @@ -1308,7 +1308,7 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c if(!found) { _field_pm_pt_pd.resize(sz+1); - _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); + _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType(locIdToFind)); ret3[k++]=sz; } } @@ -1339,9 +1339,9 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c if(type!=ON_GAUSS_PT) { int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - mcIdType sz=_field_pm_pt_pd.size(); + std::size_t sz=_field_pm_pt_pd.size(); bool found=false; - for(mcIdType j=0;jgetLocId()==locIdToFind) { @@ -1360,12 +1360,12 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(c else { std::vector ret2=addNewEntryIfNecessaryGauss(field,subCells); - mcIdType sz2=ret2.size(); + std::size_t sz2=ret2.size(); std::vector ret3(sz2); mcIdType k=0; - for(mcIdType i=0;i >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const { - mcIdType sz=_field_pm_pt_pd.size(); + std::size_t sz=_field_pm_pt_pd.size(); dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz); - for(mcIdType i=0;igetCoarseData(types[i],dads[i],pfls[i],locs[i]); } @@ -1582,14 +1582,14 @@ void MEDFileFieldPerMeshPerTypeCommon::changeLocsRefsNamesGen(const std::vector< (*it1)->changeLocsRefsNamesGen(mapOfModif); } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) { if(_field_pm_pt_pd.empty()) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !"; throw INTERP_KERNEL::Exception(oss.str()); } - if(locId>=0 && locId<(int)_field_pm_pt_pd.size()) + if(locId>=0 && locId(0); } -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) const { if(_field_pm_pt_pd.empty()) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !"; throw INTERP_KERNEL::Exception(oss.str()); } - if(locId>=0 && locId<(int)_field_pm_pt_pd.size()) + if(locId>=0 && locId& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { std::size_t nbOfTypes=code.size()/3; - int offset=0; + mcIdType offset=0; for(std::size_t i=0;icopyOptionsFrom(*this); _field_pm_pt[i]->writeLL(fid,nasc); @@ -2113,10 +2113,10 @@ void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set& types std::vector< std::vector< std::pair > > MEDFileFieldPerMesh::getFieldSplitedByType(std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector > & locs) const { - int sz=_field_pm_pt.size(); + std::size_t sz=_field_pm_pt.size(); std::vector< std::vector > > ret(sz); types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz); - for(int i=0;igetGeoType(); _field_pm_pt[i]->fillFieldSplitedByType(ret[i],typesF[i],pfls[i],locs[i]); @@ -2285,19 +2285,19 @@ const std::vector& MEDFileFieldPerMesh::getInfo() const void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& pfls, const std::vector& locs, std::vector& code, std::vector& notNullPfls) { int notNullPflsSz=0; - int nbOfArrs=geoTypes.size(); - for(int i=0;i geoTypes3(geoTypes.begin(),geoTypes.end()); - int nbOfDiffGeoTypes=geoTypes3.size(); + std::size_t nbOfDiffGeoTypes=geoTypes3.size(); code.resize(3*nbOfDiffGeoTypes); notNullPfls.resize(notNullPflsSz); notNullPflsSz=0; - int j=0; - for(int i=0;i notNullTmp; if(pfls[j]) @@ -2332,9 +2332,9 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T */ mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs) { - int sz=dads.size(); - int ret=0; - for(int i=0;i(arr0));//tony if(!arr0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !"); - int sz=0; + mcIdType sz=0; if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !"); for(std::vector< std::pair,std::pair > >::const_iterator it=entries.begin();it!=entries.end();it++) @@ -2481,7 +2481,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam //////////////////// MCAuto explicitIdsOldInMesh=DataArrayIdType::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after mcIdType *workI2=explicitIdsOldInMesh->getPointer(); - int sz1=0,sz2=0,sid=1; + mcIdType sz1=0,sz2=0,sid=1; std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept); // std::vector tupleIdOfStartOfNewChuncksV(entriesKeptML.size()); for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++) @@ -2656,7 +2656,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t { if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !"); - int nb=code[1]; + mcIdType nb=code[1]; if(code[2]==-1) { if(nb!=mesh->getNumberOfNodes()) @@ -2703,7 +2703,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c { if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !"); - int nb=code[1]; + mcIdType nb=code[1]; if(code[2]==-1) { if(nb!=mesh->getNumberOfNodes()) @@ -2746,7 +2746,7 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { @@ -2764,7 +2764,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId throw INTERP_KERNEL::Exception(oss.str()); } -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const { for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { @@ -2813,12 +2813,12 @@ MCAuto MEDFileFieldPerMeshPerTypePerDisc::Agg throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles !"); std::vector >::const_iterator it1(pms.begin()); std::vector< std::pair >::const_iterator it2(filteredDTS.begin()); - int zeStart(start),nval(0); + mcIdType zeStart(start),nval(0); for(;it1!=pms.end();it1++,it2++) { if((*it1).first!=(*it2).first) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles 2 !"); - int s1((*it1).second->getStart()),e1((*it1).second->getEnd()); + mcIdType s1((*it1).second->getStart()),e1((*it1).second->getEnd()); extractInfo.push_back(std::pair >((*it1).first,std::pair(s1,e1))); start+=e1-s1; nval+=((*it1).second)->getNumberOfVals(); @@ -2856,7 +2856,7 @@ MCAuto MEDFileFieldPerMesh::Aggregate(mcIdType &start, cons int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type) { int i=0; - int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); + std::size_t pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it2=_field_pm_pt.begin(); for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++,i++) { @@ -2865,14 +2865,14 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp return i; else { - int pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType)); + std::size_t pos2=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,curType)); if(pos>pos2) it2=it+1; } } - int ret=std::distance(_field_pm_pt.begin(),it2); + std::size_t ret=std::distance(_field_pm_pt.begin(),it2); _field_pm_pt.insert(it2,MEDFileFieldPerMeshPerType::New(this,type)); - return ret; + return (int)ret; } /*! @@ -2892,13 +2892,13 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const da->setName(""); if(type==ON_GAUSS_PT) { - int offset=0; - int nbOfArrs=dads.size(); - for(int i=0;i > dads2(1,dads[i]); const std::vector locs2(1,locs[i]); const std::vector geoTypes2(1,INTERP_KERNEL::NORM_ERROR); - int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); + mcIdType nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); MCAuto di=DataArrayIdType::New(); di->alloc(nbOfElems,1); di->iota(offset); diff --git a/src/MEDLoader/MEDFileFieldInternal.hxx b/src/MEDLoader/MEDFileFieldInternal.hxx index 04217f36e..bb2e318df 100644 --- a/src/MEDLoader/MEDFileFieldInternal.hxx +++ b/src/MEDLoader/MEDFileFieldInternal.hxx @@ -132,8 +132,8 @@ namespace MEDCoupling class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable { public: - static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd); - static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId); + static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); + static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId); static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; @@ -170,8 +170,8 @@ namespace MEDCoupling void setProfile(const std::string& newPflName); std::string getLocalization() const; void setLocalization(const std::string& newLocName); - int getLocId() const { return _loc_id; } - void setLocId(int newId) const { _loc_id=newId; } + mcIdType getLocId() const { return _loc_id; } + void setLocId(mcIdType newId) const { _loc_id=newId; } void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; } void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); @@ -180,13 +180,13 @@ namespace MEDCoupling void fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const; mcIdType fillEltIdsFromCode(mcIdType offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const; mcIdType fillTupleIds(mcIdType *ptToFill) const; - static int ConvertType(TypeOfField type, int locId); + static int ConvertType(TypeOfField type, mcIdType locId); static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries); static bool RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, const DataArrayIdType *explicitIdsInMesh, const std::vector& newCode, MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto >& result); static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt, - bool isPfl, int nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, + bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting); static MCAuto Aggregate(mcIdType &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo); MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { } @@ -207,11 +207,11 @@ namespace MEDCoupling std::string _profile; std::string _localization; //! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT - mutable int _loc_id; + mutable mcIdType _loc_id; mutable mcIdType _profile_it; MCAuto _pd; public: - mutable int _tmp_work1; + mutable mcIdType _tmp_work1; }; class MEDFileFieldVisitor; @@ -250,9 +250,9 @@ namespace MEDCoupling std::vector getLocsReallyUsedMulti() const; void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); - MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId); - const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const; - int getNumberOfLoc() const { return _field_pm_pt_pd.size(); } + MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId); + const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId) const; + int getNumberOfLoc() const { return (int)_field_pm_pt_pd.size(); } int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const; void fillValues(mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const; void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); @@ -382,8 +382,8 @@ namespace MEDCoupling MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; void getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId); - const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const; + MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId); + const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const; static MCAuto Aggregate(mcIdType &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo); private: int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type); diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 5d7975a83..7a1cc9bad 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -134,11 +134,11 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2"; - int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); + mcIdType nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); MCAuto ret=createNew(); ret->setInfo(_infos); - int sz=(int)_time_steps.size(); - int j=bg; + std::size_t sz=_time_steps.size(); + std::size_t j=bg; for(int i=0;i=0 && j >& timeSteps) const { - mcIdType id=0; + int id=0; MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { @@ -183,7 +183,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::part MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { - mcIdType id=0; + int id=0; MCAuto ids=DataArrayInt::New(); ids->alloc(0,1); for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,id++) { @@ -532,10 +532,10 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWri throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !"); checkThatNbOfCompoOfTSMatchThis(); std::vector infos(getInfo()); - int nbComp=infos.size(); + std::size_t nbComp=infos.size(); INTERP_KERNEL::AutoPtr comp=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE); INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(nbComp*MED_SNAME_SIZE); - for(int i=0;iwriteLL(fid,opts,*this); } @@ -583,7 +583,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays() int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const { - return _time_steps.size(); + return (int)_time_steps.size(); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() @@ -625,13 +625,13 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step) { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2"; - int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); + mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); if(nbOfEntriesToKill==0) return ; std::size_t sz=_time_steps.size(); std::vector b(sz,true); int j=bg; - for(int i=0;i > newTS; for(std::size_t i=0;i > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const { - int lgth=_time_steps.size(); + std::size_t lgth=_time_steps.size(); std::vector< std::pair > ret(lgth); - for(int i=0;ifillIteration(ret[i]); return ret; } @@ -830,9 +830,9 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::ve std::vector< std::vector > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const { - int lgth=_time_steps.size(); + std::size_t lgth=_time_steps.size(); std::vector< std::vector > ret(lgth); - for(int i=0;ifillTypesOfFieldAvailable(ret[i]); return ret; } diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 69bf68c12..79545ebf8 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -242,7 +242,7 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst if(sz!=_geo_types.size()) return false; mcIdType strt(0); - for(std::size_t i=0;i > retSafe(sz); std::vector< const DataArrayIdType *> ret(sz); - int start(0); + mcIdType start(0); for(std::size_t i=0;i tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); @@ -327,11 +327,11 @@ void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy=false; std::vector< MCAuto > retSafe(sz); std::vector< const DataArrayIdType *> ret(sz); - int start(0); + mcIdType start(0); for(std::size_t i=0;i tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); @@ -523,7 +523,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& std::vector< const DataArray *> arr(s.size()); std::vector< MCAuto > arrSafe(s.size()); int iii(0); - int nc(vals->getNumberOfComponents()); + mcIdType nc(ToIdType(vals->getNumberOfComponents())); std::vector compInfo(vals->getInfoOnComponents()); for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++) { @@ -629,7 +629,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& */ void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { - int nbOfVertices(verticesToAdd->getNumberOfTuples()); + mcIdType nbOfVertices(verticesToAdd->getNumberOfTuples()); std::size_t sz(_pfls.size()); _pfls.resize(sz+1); _geo_types.resize(sz+1,INTERP_KERNEL::NORM_POINT1); @@ -943,7 +943,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * if(!tmp) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !"); MCAuto a(const_cast(tmp)); tmp->incrRef(); - int szBCE(0),szD(0),szF(0); + mcIdType szBCE(0),szD(0),szF(0); bool isPolyh(false); int iii(0); for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) @@ -959,7 +959,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * else { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } // - int curNbCells(cur->getNumberOfCells()); + mcIdType curNbCells(cur->getNumberOfCells()); szBCE+=curNbCells; if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells; @@ -977,7 +977,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * MCAuto e(DataArrayIdType::New()),f(DataArrayIdType::New()); mcIdType *ePtr(0),*fPtr(0); if(isPolyh) { e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); } - int k(0); + mcIdType k(0); iii=0; for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { @@ -990,7 +990,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * else { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } // - int curNbCells(cur->getNumberOfCells()); + mcIdType curNbCells(cur->getNumberOfCells()); int gt((int)cur->getCellModelEnum()); if(gt<0 || gt>=PARAMEDMEM_2_VTKTYPE_LGTH) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : invalid geometric type !"); @@ -1007,8 +1007,8 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA27) { - int nnpc(scur->getNumberOfNodesPerCell()); - for(int i=0;igetNumberOfNodesPerCell()); + for(mcIdType i=0;i& coords, coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end())); return ; } - int sz(coords->getNumberOfTuples()); + mcIdType sz(coords->getNumberOfTuples()); std::vector b(sz,false); const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); while(work!=endW) { - int nb(*work++); - for(int i=0;i=0 && *work& coords, work=polyhedNodalConnVTK->begin(); endW=polyhedNodalConnVTK->end(); while(work!=endW) { - int nb(*work++); - for(int i=0;i=0 && *work& coords, } } } - int szExp(std::count(b.begin(),b.end(),true)); - if(szExp!=nr->getNumberOfTuples()) + std::size_t szExp(std::count(b.begin(),b.end(),true)); + if(ToIdType(szExp)!=nr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !"); // Go renumbering ! MCAuto o2n(DataArrayIdType::New()); o2n->alloc(sz,1); @@ -1149,8 +1149,8 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); while(work2!=endW2) { - int nb(*work2++); - for(int i=0;i& coords, work2=polyhedNodalConnVTK->getPointer(); endW2=polyhedNodalConnVTK->getPointer()+polyhedNodalConnVTK->getNumberOfTuples(); while(work2!=endW2) { - int nb(*work2++); - for(int i=0;i& coords, void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { - int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1 + mcIdType nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1 MEDMeshMultiLev::appendVertices(verticesToAdd,nr); MCAuto elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1)); elt->allocateCells(nbOfCells); - for(int i=0;igetIJ(i,0)); elt->insertNextCell(&pt,&pt+1); @@ -1306,7 +1306,7 @@ void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNode return ; std::vector ngs(getNodeGridStructure()); MCAuto conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); - MCAuto m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size()))); + MCAuto m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension((int)ngs.size()))); m->setNodalConnectivity(conn); const DataArrayIdType *pfl(_pfls[0]); if(pfl) @@ -1423,7 +1423,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const else { MCAuto m(MEDCouplingCMesh::New()); - for(std::size_t i=0;isetCoordsAt(i,_coords[i]); MCAuto m2(m->build1SGTUnstructured()); MCAuto m3=dynamic_cast(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); @@ -1650,9 +1650,9 @@ int MEDFileField1TSStructItem2::getNbOfIntegrationPts(const MEDFileFieldGlobsRea if(_loc.empty()) { if(getPflName().empty()) - return (_start_end.second-_start_end.first)/_nb_of_entity; + return (int)((_start_end.second-_start_end.first)/_nb_of_entity); else - return (_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples(); + return (int)((_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples()); } else { @@ -2431,7 +2431,7 @@ bool MEDFileFastCellSupportComparator::isDataSetSupportEqualToThePreviousOne(int int MEDFileFastCellSupportComparator::getNumberOfTS() const { - return _f1ts_cmps.size(); + return (int)_f1ts_cmps.size(); } std::vector MEDFileFastCellSupportComparator::getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index 0981456c6..1dd96e42c 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -109,7 +109,7 @@ void MEDFileJointCorrespondence::write(const std::string& fileName, int mode, co MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileJointCorrespondence : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); + MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); if (( !_is_nodal ) && ( _loc_geo_type == INTERP_KERNEL::NORM_ERROR || @@ -136,7 +136,7 @@ void MEDFileJointCorrespondence::writeLL(med_idt fid, const std::string& localMe order, iteration, MED_NODE, MED_NONE, MED_NODE, MED_NONE, - _correspondence->getNbOfElems()/2, + ToMedInt(_correspondence->getNbOfElems()/2), ToMedIntArray(_correspondence)->getConstPointer())); } else @@ -145,7 +145,7 @@ void MEDFileJointCorrespondence::writeLL(med_idt fid, const std::string& localMe order, iteration, MED_CELL, typmai3[ _loc_geo_type ], MED_CELL, typmai3[ _rem_geo_type ], - _correspondence->getNbOfElems()/2, + ToMedInt(_correspondence->getNbOfElems()/2), ToMedIntArray(_correspondence)->getConstPointer())); } } @@ -305,7 +305,7 @@ void MEDFileJointOneStep::write(const std::string& fileName, int mode, const std med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileJointOneStep : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); + MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); if ( _correspondences.empty() ) throw INTERP_KERNEL::Exception("MEDFileJointOneStep::write : no correspondences defined !"); writeLL(fid, localMeshName, jointName); @@ -329,7 +329,7 @@ void MEDFileJointOneStep::pushCorrespondence(MEDFileJointCorrespondence* corresp int MEDFileJointOneStep::getNumberOfCorrespondences() const { - return _correspondences.size(); + return (int)_correspondences.size(); } /** Return a borrowed reference (caller is not responsible) */ @@ -516,7 +516,7 @@ void MEDFileJoint::pushStep(MEDFileJointOneStep* step) int MEDFileJoint::getNumberOfSteps() const { - return _joint.size(); + return (int)_joint.size(); } /** Return a borrowed reference (caller is not responsible) */ @@ -655,7 +655,7 @@ std::string MEDFileJoints::getMeshName() const int MEDFileJoints::getNumberOfJoints() const { - return _joints.size(); + return (int)_joints.size(); } /** Return a borrowed reference (caller is not responsible) */ diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 34c072714..f57a5c2c7 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -839,7 +839,7 @@ void MEDFileMesh::rearrangeFamilies() removeFamiliesReferedByNoGroups(); // std::vector levels(getNonEmptyLevelsExt()); - std::set idsRefed; + std::set idsRefed; for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { idsRefed.insert((*it).second); @@ -863,7 +863,7 @@ void MEDFileMesh::rearrangeFamilies() if(!fams) continue; std::vector v(fams->getNumberOfTuples(),false); - for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) + for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) fams->switchOnTupleEqualTo(*pt,v); MCAuto unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v)); if(!unfetchedIds->empty()) @@ -1735,7 +1735,7 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() std::vector levs=getNonEmptyLevelsExt(); std::set allFamIds; mcIdType maxId=getMaxFamilyId()+1; - std::map > famIdsToRenum; + std::map > famIdsToRenum; for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { const DataArrayIdType *fam=getFamilyFieldAtLevel(*it); @@ -1753,7 +1753,7 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() if(famIdsToRenum.empty()) return true; MCAuto allIds=getAllFamiliesIdsReferenced(); - for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) + for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) { DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); mcIdType *famIdsToChange=fam->getPointer(); @@ -2154,7 +2154,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector fam; std::vector< std::vector > fidsOfGroups; if(!renum) @@ -2266,7 +2266,7 @@ std::string MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std:: //attempt #2 if(len>=1) { - for(std::size_t i=1;i<30;i++) + for(char i=1;i<30;i++) { std::string tmp1(nameTry.at(0),i); tmp1+=nameTry; @@ -2430,7 +2430,7 @@ MEDFileUMesh *MEDFileUMesh::New(const MEDCouplingMappedExtrudedMesh *mem) m2D->setCoords(m3D->getCoords()); ret->setMeshAtLevel(0,m3D); ret->setMeshAtLevel(-1,m2D); - ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits::max()-mem->get2DCellIdForExtrusion()); + ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits::max()-mem->get2DCellIdForExtrusion()); return ret.retn(); } @@ -3021,7 +3021,7 @@ void MEDFileUMesh::writeMeshLL(med_idt fid) const INTERP_KERNEL::AutoPtr desc=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str); MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str); - int spaceDim=coo?coo->getNumberOfComponents():0; + int spaceDim=(int)(coo?coo->getNumberOfComponents():0); int mdim(0); if(!_ms.empty()) mdim=getMeshDimension(); @@ -3262,7 +3262,7 @@ int MEDFileUMesh::getSpaceDimension() const const DataArrayDouble *coo=_coords; if(!coo) throw INTERP_KERNEL::Exception(" MEDFileUMesh::getSpaceDimension : no coords set !"); - return coo->getNumberOfComponents(); + return (int)coo->getNumberOfComponents(); } /*! @@ -3948,7 +3948,7 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords) if(coords==(DataArrayDouble *)_coords) return ; coords->checkAllocated(); - int nbOfTuples(coords->getNumberOfTuples()); + mcIdType nbOfTuples(coords->getNumberOfTuples()); _coords.takeRef(coords); _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfTuples,1); @@ -3969,7 +3969,7 @@ void MEDFileUMesh::setCoordsForced(DataArrayDouble *coords) if(coords==(DataArrayDouble *)_coords) return ; coords->checkAllocated(); - int nbOfTuples(coords->getNumberOfTuples()); + mcIdType nbOfTuples(coords->getNumberOfTuples()); if(_coords.isNull()) { _coords=coords; @@ -3977,7 +3977,7 @@ void MEDFileUMesh::setCoordsForced(DataArrayDouble *coords) } else { - int oldNbTuples(_coords->getNumberOfTuples()); + mcIdType oldNbTuples(_coords->getNumberOfTuples()); if(oldNbTuples!=nbOfTuples) throw INTERP_KERNEL::Exception("MEDFileUMesh::setCoordsForced : number of tuples is not the same -> invoke setCoords instead !"); _coords=coords; @@ -4012,12 +4012,12 @@ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) void MEDFileUMesh::optimizeFamilies() { std::vector levs=getNonEmptyLevelsExt(); - std::set allFamsIds; + std::set allFamsIds; for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it); MCAuto ids=ffield->getDifferentValues(); - std::set res; + std::set res; std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin())); allFamsIds=res; } @@ -4949,7 +4949,7 @@ MEDCouplingMappedExtrudedMesh *MEDFileUMesh::convertToExtrudedMesh() const MCAuto m3D(getMeshAtLevel(0)),m2D(getMeshAtLevel(-1)); if(m3D.isNull() || m2D.isNull()) throw INTERP_KERNEL::Exception("MEDFileUMesh::convertToExtrudedMesh : this must be defined both at level 0 and level -1 !"); - mcIdType zeId(std::numeric_limits::max()-getFamilyId(GetSpeStr4ExtMesh())); + mcIdType zeId(std::numeric_limits::max()-getFamilyId(GetSpeStr4ExtMesh())); MCAuto ret(MEDCouplingMappedExtrudedMesh::New(m3D,m2D,zeId)); return ret.retn(); } @@ -4959,7 +4959,7 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector layer0; + std::vector layer0; layer0.push_back(getAxisType());//0 i layer0.push_back(_order); //1 i layer0.push_back(_iteration);//2 i @@ -4969,7 +4969,7 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vectorgetInfoOnComponent(i)); - layer0.push_back((int)_families.size());//4 i <- key info aa layer#0 + layer0.push_back(ToIdType(_families.size()));//4 i <- key info aa layer#0 for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { tinyStr.push_back((*it).first); @@ -4978,7 +4978,7 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++) { - layer0.push_back((int)(*it0).second.size()); + layer0.push_back(ToIdType((*it0).second.size())); tinyStr.push_back((*it0).first); for(std::vector::const_iterator it1=((*it0).second).begin();it1!=((*it0).second).end();it1++) tinyStr.push_back(*it1); @@ -4994,7 +4994,7 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector tmp0; pd->serialize(tmp0,bigArraysI); - tinyInt.push_back(tmp0.size()); + tinyInt.push_back(ToIdType(tmp0.size())); tinyInt.insert(tinyInt.end(),tmp0.begin(),tmp0.end()); } // @@ -5008,9 +5008,9 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vectorserialize(layer1,bigArraysI); } // put layers all together. - tinyInt.push_back(layer0.size()); + tinyInt.push_back(ToIdType(layer0.size())); tinyInt.insert(tinyInt.end(),layer0.begin(),layer0.end()); - tinyInt.push_back(layer1.size()); + tinyInt.push_back(ToIdType(layer1.size())); tinyInt.insert(tinyInt.end(),layer1.begin(),layer1.end()); } @@ -5029,9 +5029,9 @@ void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector(layer0.back()); layer0.pop_back(); + _iteration=FromIdType(layer0.back()); layer0.pop_back(); + mcIdType spaceDim(layer0.back()); layer0.pop_back(); _time=tinyDouble.back(); tinyDouble.pop_back(); _name=tinyStr.back(); tinyStr.pop_back(); _desc_name=tinyStr.back(); tinyStr.pop_back(); @@ -5106,7 +5106,7 @@ void MEDFileUMesh::addNodeGroup(const DataArrayIdType *ids) const DataArrayDouble *coords(_coords); if(!coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::addNodeGroup : no coords set !"); - int nbOfNodes(coords->getNumberOfTuples()); + mcIdType nbOfNodes(coords->getNumberOfTuples()); if(_fam_coords.isNull()) { _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); } // @@ -6546,7 +6546,7 @@ void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem } const DataArrayIdType *arr(globs->getProfile(st[0].getPflName())); const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before - mcIdType sz(nodesFetched.size()); + mcIdType sz(ToIdType(nodesFetched.size())); for(const mcIdType *work=arr->begin();work!=arr->end();work++) { std::vector conn; @@ -6667,17 +6667,17 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1)); // if((const DataArrayIdType *)_fam_cells) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),ToMedIntArray(_fam_cells)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_fam_cells->getNumberOfTuples()),ToMedIntArray(_fam_cells)->getConstPointer())); if((const DataArrayIdType *)_fam_faces) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),ToMedIntArray(_fam_faces)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_fam_faces->getNumberOfTuples()),ToMedIntArray(_fam_faces)->getConstPointer())); if((const DataArrayIdType *)_fam_nodes) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),ToMedIntArray(_fam_nodes)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_fam_nodes->getNumberOfTuples()),ToMedIntArray(_fam_nodes)->getConstPointer())); if((const DataArrayIdType *)_num_cells) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),ToMedIntArray(_num_cells)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_num_cells->getNumberOfTuples()),ToMedIntArray(_num_cells)->getConstPointer())); if((const DataArrayIdType *)_num_faces) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),ToMedIntArray(_num_faces)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_num_faces->getNumberOfTuples()),ToMedIntArray(_num_faces)->getConstPointer())); if((const DataArrayIdType *)_num_nodes) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),ToMedIntArray(_num_nodes)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_num_nodes->getNumberOfTuples()),ToMedIntArray(_num_nodes)->getConstPointer())); if((const DataArrayAsciiChar *)_names_cells) { if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -6686,7 +6686,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_names_cells->getNumberOfTuples()),_names_cells->getConstPointer())); } if((const DataArrayAsciiChar *)_names_faces) { @@ -6696,7 +6696,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma oss << " ! The array has " << _names_faces->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_names_faces->getNumberOfTuples(),_names_faces->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_names_faces->getNumberOfTuples()),_names_faces->getConstPointer())); } if((const DataArrayAsciiChar *)_names_nodes) { @@ -6706,7 +6706,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_names_nodes->getNumberOfTuples()),_names_nodes->getConstPointer())); } // MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str); @@ -7004,7 +7004,7 @@ void MEDFileCMesh::writeMeshLL(med_idt fid) const for(int i=0;igetCoordsAt(i); - MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,ToMedInt(da->getNumberOfTuples()),da->getConstPointer())); } // std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); @@ -7236,7 +7236,7 @@ void MEDFileCurveLinearMesh::writeMeshLL(med_idt fid) const std::vector nodeGridSt=_clmesh->getNodeGridStructure(); MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,ToMedIntArray(nodeGridSt)->getConstPointer())); - MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin())); + MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin())); // std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); MEDFileStructuredMesh::writeStructuredLL(fid,meshName); @@ -7502,7 +7502,7 @@ void MEDFileMeshes::writeLL(med_idt fid) const int MEDFileMeshes::getNumberOfMeshes() const { - return _meshes.size(); + return (int)_meshes.size(); } MEDFileMeshesIterator *MEDFileMeshes::iterator() diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index 5f682cfda..96982a4b1 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -40,7 +40,7 @@ MEDFileUMeshPerTypeCommon *MEDFileUMeshPerTypeCommon::New() return new MEDFileUMeshPerTypeCommon; } -void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt, +void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; @@ -105,7 +105,7 @@ MEDFileUMeshPerType *MEDFileUMeshPerType::New(med_idt fid, const char *mName, in return new MEDFileUMeshPerType(fid,mName,dt,it,mdim,geoElt,geoElt2,whichEntity,mrs); } -MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs) +MEDFileUMeshPerType *MEDFileUMeshPerType::NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs) { int geoElt2i((int)geoElt2); if(geoElt2i<0 || geoElt2i>=34) @@ -134,11 +134,11 @@ std::vector MEDFileUMeshPerType::getDirectChildrenWithN bool MEDFileUMeshPerType::isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity) { static const med_entity_type entities[3]={MED_CELL,MED_DESCENDING_FACE,MED_DESCENDING_EDGE}; - int nbOfElt=0; + mcIdType nbOfElt=0; for(int i=0;i<3;i++) { med_bool changement,transformation; - int tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); if(tmp>nbOfElt) { nbOfElt=tmp; @@ -163,7 +163,7 @@ MEDFileUMeshPerType::MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); if(!cm.isDynamic()) { @@ -180,10 +180,10 @@ MEDFileUMeshPerType::MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, } void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs) + med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); _pd=PartDefinition::New(strt,end,step); if(!cm.isDynamic()) @@ -194,63 +194,64 @@ void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int i throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPart : not implemented yet for the dynamic type !"); } -void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, +void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, med_entity_type entity, MEDFileMeshReadSelector *mrs) { _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); MCAuto conn(DataArrayMedInt::New()); - int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); + mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*curNbOfElem,1); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer())); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); mc->setNodalConnectivity(FromMedIntArray(conn)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, + med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs) { if(strt<0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : start pos is negative !"); if(end>curNbOfElem) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : end is after the authorized range !"); - int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType")); + mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType")); _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); MCAuto conn(DataArrayMedInt::New()); - int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); + mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/nbOfNodesPerCell, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/ToMedInt(nbOfNodesPerCell), MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer())); MEDfilterClose(&filter); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); mc->setNodalConnectivity(FromMedIntArray(conn)); loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; _fam=0; - int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart")); + mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart")); if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellFamilyFieldReading()) { - _fam=DataArrayIdType::New(); - _fam->alloc(nbOfEltsToLoad,1); + MCAuto miFam(DataArrayMedInt::New()); + miFam->alloc(nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); - if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,_fam->getPointer())!=0) - _fam->fillWithZero(); + if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,miFam->getPointer())!=0) + miFam->fillWithZero(); + _fam=FromMedIntArray(miFam); MEDfilterClose(&filter); } } @@ -259,15 +260,16 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam { if(!mrs || mrs->isCellNumFieldReading()) { - _num=DataArrayIdType::New(); - _num->alloc(nbOfEltsToLoad,1); + MCAuto miNum(DataArrayMedInt::New()); + miNum->alloc(nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); - if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,_num->getPointer())!=0) - _num->fillWithZero(); + if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,miNum->getPointer())!=0) + miNum->fillWithZero(); + _num=FromMedIntArray(miNum); MEDfilterClose(&filter); } } @@ -279,9 +281,9 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam _names=DataArrayAsciiChar::New(); _names->alloc(nbOfEltsToLoad+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NAME,dt,it,entity,geoElt,&filter,_names->getPointer())!=0) _names=0; @@ -292,37 +294,37 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam } } -void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt, +void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - med_int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1); _m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG); MCAuto mc(DynamicCast(_m)); MCAuto conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New()); conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1); MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer())); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); - std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus(),-1)); mc->setNodalConnectivity(FromMedIntArray(conn),FromMedIntArray(connI)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt, +void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)); - int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1); + mcIdType curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1); _m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED); MCAuto mc(DynamicCastSafe(_m)); - INTERP_KERNEL::AutoPtr index=new int[curNbOfElem+1]; - INTERP_KERNEL::AutoPtr indexFace=new int[indexFaceLgth]; - INTERP_KERNEL::AutoPtr locConn=new int[connFaceLgth]; + INTERP_KERNEL::AutoPtr index=new med_int[curNbOfElem+1]; + INTERP_KERNEL::AutoPtr indexFace=new med_int[indexFaceLgth]; + INTERP_KERNEL::AutoPtr locConn=new med_int[connFaceLgth]; MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn)); MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); - int arraySize=connFaceLgth; - for(int i=0;ialloc(arraySize,1); @@ -346,7 +348,7 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names) { - int nbOfCells=m->getNumberOfCells(); + mcIdType nbOfCells=m->getNumberOfCells(); if(nbOfCells<1) return ; int dt,it; @@ -360,8 +362,8 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); MCAuto arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())); - std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); - MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin())); + std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); + MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,ToMedInt(nbOfCells),arr->begin())); } else { @@ -371,15 +373,15 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG) { MCAuto arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())),arrI(DataArrayMedInt::Copy(m0->getNodalConnectivityIndex())); - std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); - std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); - MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin())); + std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); + std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); + MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,ToMedInt(nbOfCells+1),arrI->begin(),arr->begin())); } else { const mcIdType *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin()); mcIdType meshLgth=m0->getNodalConnectivityLength(); - mcIdType nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells; + mcIdType nbOfFaces=ToIdType(std::count(conn,conn+meshLgth,-1)+nbOfCells); INTERP_KERNEL::AutoPtr tab1=new med_int[nbOfCells+1]; med_int *w1=tab1; *w1=1; INTERP_KERNEL::AutoPtr tab2=new med_int[nbOfFaces+1]; @@ -393,8 +395,8 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, { const mcIdType *wend=std::find(w,conn+connI[i+1],-1); bt=std::transform(w,wend,bt,std::bind2nd(std::plus(),1)); - int nbOfNode=std::distance(w,wend); - w2[1]=w2[0]+nbOfNode; + std::size_t nbOfNode=std::distance(w,wend); + w2[1]=w2[0]+(med_int)nbOfNode; if(wend!=conn+connI[i+1]) w=wend+1; else @@ -403,13 +405,13 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, } w1[1]=w1[0]+nbOfFaces2; } - MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab)); + MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,ToMedInt(nbOfCells+1),tab1,ToMedInt(nbOfFaces+1),tab2,bigtab)); } } if(fam) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray(fam)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray(fam)->getConstPointer())); if(num) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray(num)->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray(num)->getConstPointer())); if(names) { if(names->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -418,6 +420,6 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, oss << " ! The array has " << names->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),names->getConstPointer())); } } diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index c81d55c67..b0417ae67 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -39,7 +39,7 @@ namespace MEDCoupling { public: static MEDFileUMeshPerTypeCommon *New(); - void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt, + void loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; @@ -56,7 +56,7 @@ namespace MEDCoupling { public: static MEDFileUMeshPerType *New(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType geoElt2, MEDFileMeshReadSelector *mrs); - static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs); + static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, mcIdType strt, mcIdType stp, mcIdType step, MEDFileMeshReadSelector *mrs); static bool isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; @@ -69,16 +69,16 @@ namespace MEDCoupling MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, med_entity_type entity, MEDFileMeshReadSelector *mrs); void loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs); - void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, + med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs); + void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, med_entity_type entity, MEDFileMeshReadSelector *mrs); - void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs); - void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt, + void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, + med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs); + void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType arraySize, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); - void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt, + void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, mcIdType connFaceLgth, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); - void loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); + void loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); private: MCAuto _m; MCAuto _pd; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index e5ad01db8..7ccfa9793 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -284,11 +284,11 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName return ; char nomfam[MED_NAME_SIZE+1]; med_int numfam; - mcIdType nfam=MEDnFamily(fid,meshName.c_str()); + med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector< std::pair > > > crudeFams(nfam); - for(mcIdType i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -299,7 +299,7 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName std::vector grps(ngro); for(int j=0;j > >(famName,std::pair >(numfam,grps)); + crudeFams[i]=std::pair > >(famName,std::pair >(numfam,grps)); } RenameFamiliesFromFileToMemInternal(crudeFams); for(std::vector< std::pair > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++) @@ -327,14 +327,14 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, RenameFamiliesFromMemToFileInternal(crudeFams); for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++) { - mcIdType ngro((*it).second.second.size()); + std::size_t ngro((*it).second.second.size()); INTERP_KERNEL::AutoPtr groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro); int i=0; for(std::vector::const_iterator it2=(*it).second.second.begin();it2!=(*it).second.second.end();it2++,i++) MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE,groName+i*MED_LNAME_SIZE,tooLongStrPol); INTERP_KERNEL::AutoPtr famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); - int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second.first,ngro,groName); + med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt((*it).second.first),ToMedInt(ngro),groName); ret++; } } @@ -557,8 +557,8 @@ void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) (*it1)->getMesh()->computeNodeIdsAlg(fetchedNodeIds); - mcIdType nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))); - mcIdType nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true))); + mcIdType nMin(ToIdType(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true)))); + mcIdType nMax(ToIdType(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true)))); nMax=nCoords-nMax; for(std::vector< std::vector< MCAuto > >::const_iterator it0=_per_type_mesh.begin();it0!=_per_type_mesh.end();it0++) for(std::vector< MCAuto >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) @@ -646,23 +646,23 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf _coords->setInfoOnComponent(i,infosOnComp[i]); } -void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax) +void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax) { med_bool changement,transformation; int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); _coords=DataArrayDouble::New(); - int nbNodesToLoad(nMax-nMin); + mcIdType nbNodesToLoad(nMax-nMin); _coords->alloc(nbNodesToLoad,spaceDim); med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT; MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/nMin+1,/*stride*/1,/*count*/1,/*blocksize*/nbNodesToLoad, + /*start*/ToMedInt(nMin+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbNodesToLoad), /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateAdvancedRd,(fid,mName.c_str(),dt,it,&filter,_coords->getPointer())); _part_coords=PartDefinition::New(nMin,nMax,1); MEDfilterClose(&filter); MEDfilterBlockOfEntityCr(fid,nCoords,1,1,MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE, - MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2); + MED_NO_PROFILE,ToMedInt(nMin+1),1,1,ToMedInt(nbNodesToLoad),0,&filter2); if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { MCAuto miFamCoord=DataArrayMedInt::New(); @@ -731,11 +731,11 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, { if(!coords) return ; - MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin())); + MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin())); if(famCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),ToMedIntArray(famCoords)->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(famCoords->getNumberOfTuples()),ToMedIntArray(famCoords)->begin())); if(numCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),ToMedIntArray(numCoords)->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(numCoords->getNumberOfTuples()),ToMedIntArray(numCoords)->begin())); if(nameCoords) { if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -744,10 +744,10 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(nameCoords->getNumberOfTuples()),nameCoords->begin())); } if(globalNumCoords) - MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),ToMedIntArray(globalNumCoords)->begin())); + MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,ToMedInt(globalNumCoords->getNumberOfTuples()),ToMedIntArray(globalNumCoords)->begin())); } bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const @@ -922,12 +922,12 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st const std::vector< MCAuto >& v=l2.getLev(id); if(v.empty()) return; - int sz=v.size(); + std::size_t sz=v.size(); std::vector ms(sz); std::vector fams(sz),nums(sz); std::vector names(sz); std::vector pds(sz); - for(int i=0;igetMesh()); MCAuto tmp2=l2.getCoords(); @@ -939,7 +939,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st _m_by_types.assignDefParts(pds); if(l2.isFamDefinedOnLev(id)) { - for(int i=0;igetFam(); if(sz!=1) _fam=DataArrayIdType::Aggregate(fams); @@ -951,7 +951,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st } if(l2.isNumDefinedOnLev(id)) { - for(int i=0;igetNum(); if(sz!=1) _num=DataArrayIdType::Aggregate(nums); @@ -964,7 +964,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st } if(l2.isNamesDefinedOnLev(id)) { - for(int i=0;igetNames(); _names=dynamic_cast(DataArrayChar::Aggregate(names)); } diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index 75bad8ff4..21cb9c494 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -123,8 +123,8 @@ namespace MEDCoupling void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); void loadCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it); - void loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax); - int getNumberOfLevels() const { return _per_type_mesh.size(); } + void loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax); + int getNumberOfLevels() const { return (int)_per_type_mesh.size(); } bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); } const std::vector< MCAuto >& getLev(int levId) const { return _per_type_mesh[levId]; } bool isFamDefinedOnLev(int levId) const; diff --git a/src/MEDLoader/MEDFileMeshSupport.cxx b/src/MEDLoader/MEDFileMeshSupport.cxx index c1fb5c051..0ac762bbf 100644 --- a/src/MEDLoader/MEDFileMeshSupport.cxx +++ b/src/MEDLoader/MEDFileMeshSupport.cxx @@ -120,7 +120,7 @@ const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& n throw INTERP_KERNEL::Exception(oss.str()); } -int MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const +mcIdType MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const { const MEDFileUMesh *sup(getSupMeshWithName(name)); switch(entity) diff --git a/src/MEDLoader/MEDFileMeshSupport.hxx b/src/MEDLoader/MEDFileMeshSupport.hxx index f3caabc16..00634fdb2 100644 --- a/src/MEDLoader/MEDFileMeshSupport.hxx +++ b/src/MEDLoader/MEDFileMeshSupport.hxx @@ -41,7 +41,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::vector getSupMeshNames() const; MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; - MEDLOADER_EXPORT int getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const; private: MEDFileMeshSupports(med_idt fid); MEDFileMeshSupports(); diff --git a/src/MEDLoader/MEDFileStructureElement.cxx b/src/MEDLoader/MEDFileStructureElement.cxx index b53ff049a..17a2cb736 100644 --- a/src/MEDLoader/MEDFileStructureElement.cxx +++ b/src/MEDLoader/MEDFileStructureElement.cxx @@ -63,8 +63,8 @@ MEDFileSEConstAtt::MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *fathe med_attribute_type constatttype; int nbCompo; med_entity_type met; - int pflSz; - MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&pflSz)); + med_int miPflSz; + MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz)); std::string name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE)); setName(name); setProfile(MEDLoaderBase::buildStringFromFortran(profilename,MED_NAME_SIZE)); @@ -72,6 +72,7 @@ MEDFileSEConstAtt::MEDFileSEConstAtt(med_idt fid, MEDFileStructureElement *fathe // _val=MEDFileStructureElement::BuildFrom(constatttype); nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,nbCompo); + mcIdType pflSz = miPflSz; if(pflSz==0 && getProfile().empty()) { switch(met) @@ -140,7 +141,7 @@ MEDFileSEVarAtt::MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, i INTERP_KERNEL::AutoPtr varattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_attribute_type varatttype; { - int pflSz; + //int pflSz; MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&_nb_compo)); } setName(MEDLoaderBase::buildStringFromFortran(varattname,MED_NAME_SIZE)); @@ -344,7 +345,7 @@ MEDFileStructureElements::~MEDFileStructureElements() int MEDFileStructureElements::getNumberOf() const { - return _elems.size(); + return (int)_elems.size(); } std::vector MEDFileStructureElements::getDynGTAvail() const @@ -371,7 +372,7 @@ const MEDFileStructureElement *MEDFileStructureElements::getWithGT(int idGT) con throw INTERP_KERNEL::Exception(oss.str()); } -int MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const +mcIdType MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const { if(seName=="MED_PARTICLE") return 1; diff --git a/src/MEDLoader/MEDFileStructureElement.hxx b/src/MEDLoader/MEDFileStructureElement.hxx index 5cfeee1ed..b31802b36 100644 --- a/src/MEDLoader/MEDFileStructureElement.hxx +++ b/src/MEDLoader/MEDFileStructureElement.hxx @@ -121,7 +121,7 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon MEDLOADER_EXPORT int getNumberOf() const; MEDLOADER_EXPORT std::vector getDynGTAvail() const; MEDLOADER_EXPORT const MEDFileStructureElement *getWithGT(int idGT) const; - MEDLOADER_EXPORT int getNumberOfNodesPerSE(const std::string& seName) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodesPerSE(const std::string& seName) const; MEDLOADER_EXPORT const MEDFileStructureElement *getSEWithName(const std::string& seName) const; MEDLOADER_EXPORT std::vector getVarAttsOf(const std::string& seName) const; MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const; diff --git a/src/MEDLoader/MEDFileUtilities.cxx b/src/MEDLoader/MEDFileUtilities.cxx index e05a25c80..750fb56db 100644 --- a/src/MEDLoader/MEDFileUtilities.cxx +++ b/src/MEDLoader/MEDFileUtilities.cxx @@ -22,6 +22,7 @@ #include "MEDFileSafeCaller.txx" #include "MEDLoaderBase.hxx" #include "MEDLoader.hxx" +#include "MEDFileBasis.hxx" #include "InterpKernelAutoPtr.hxx" @@ -185,7 +186,7 @@ void MEDCoupling::MEDFileWritableStandAlone::write(const std::string& fileName, med_access_mode medmod(MEDFileUtilities::TraduceWriteMode(mode)); MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod)); std::ostringstream oss; oss << "MEDFileWritableStandAlone : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); + MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); writeLL(fid); } diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 5a31d4e9e..7cd676ceb 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -209,7 +209,7 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st } med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) - { +{ if(meshName.empty()) { std::vector meshes=getMeshNamesFid(fid); @@ -231,8 +231,8 @@ med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, throw INTERP_KERNEL::Exception(os2.str().c_str()); } trueMeshName=meshName; - return iter-meshes.begin()+1; - } + return ToMedInt( iter-meshes.begin()+1 ); +} std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) { diff --git a/src/MEDLoader/MEDLoaderBase.cxx b/src/MEDLoader/MEDLoaderBase.cxx index b2f8fd78a..7fdbbae76 100644 --- a/src/MEDLoader/MEDLoaderBase.cxx +++ b/src/MEDLoader/MEDLoaderBase.cxx @@ -45,7 +45,7 @@ int MEDLoaderBase::getStatusOfFile(const std::string& fileName) return EXIST_RW; } -char *MEDLoaderBase::buildEmptyString(int lgth) +char *MEDLoaderBase::buildEmptyString(std::size_t lgth) { char *ret=new char[lgth+1]; std::fill(ret,ret+lgth,' '); @@ -177,7 +177,7 @@ void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int be return ; } } - int n(strlen(src)); + std::size_t n(strlen(src)); std::fill(dest,dest+maxLgth,' '); strncpy(dest,src,n); } diff --git a/src/MEDLoader/MEDLoaderBase.hxx b/src/MEDLoader/MEDLoaderBase.hxx index 0b6ea093f..bc11fe228 100644 --- a/src/MEDLoader/MEDLoaderBase.hxx +++ b/src/MEDLoader/MEDLoaderBase.hxx @@ -30,7 +30,7 @@ class MEDLOADER_EXPORT MEDLoaderBase { public: static int getStatusOfFile(const std::string& fileName); - static char *buildEmptyString(int lgth); + static char *buildEmptyString(std::size_t lgth); static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName); static std::string getPathSep(); static std::string joinPath(const std::string& dirName, const std::string& baseName); diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index e8dc1e0ff..ad9e35118 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -262,7 +262,7 @@ namespace // define default GAUSS points TInt GetNbRef() const { return myNbRef; } - TCoordSlice GetCoord(TInt theRefId) { return &myRefCoord[0] + theRefId * myDim; } + TCoordSlice GetCoord(std::size_t theRefId) { return &myRefCoord[0] + theRefId * myDim; } }; //--------------------------------------------------------------- /*! @@ -291,7 +291,7 @@ namespace // define default GAUSS points TGaussDef(const int geomType, const int nbPoints, const int variant=1); int dim() const { return SauvUtilities::getDimension( NormalizedCellType( myType )); } - int nbPoints() const { return myWeights.capacity(); } + std::size_t nbPoints() const { return myWeights.capacity(); } private: void add(const double x, const double weight); @@ -669,8 +669,8 @@ namespace // define default GAUSS points THexa20a::THexa20a(TInt theDim, TInt theNbRef): TShapeFun(theDim,theNbRef) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; @@ -701,8 +701,8 @@ namespace // define default GAUSS points THexa27a::THexa27a(): THexa20a(3,27) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 20: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break; @@ -738,8 +738,8 @@ namespace // define default GAUSS points THexa20b::THexa20b(TInt theDim, TInt theNbRef): TShapeFun(theDim,theNbRef) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; @@ -770,8 +770,8 @@ namespace // define default GAUSS points TPenta6a::TPenta6a(): TShapeFun(3,6) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -787,8 +787,8 @@ namespace // define default GAUSS points TPenta6b::TPenta6b(): TShapeFun(3,6) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -804,8 +804,8 @@ namespace // define default GAUSS points TPenta15a::TPenta15a(): TShapeFun(3,15) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -831,8 +831,8 @@ namespace // define default GAUSS points TPenta15b::TPenta15b(): TShapeFun(3,15) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -858,8 +858,8 @@ namespace // define default GAUSS points TPyra5a::TPyra5a(): TShapeFun(3,5) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -874,8 +874,8 @@ namespace // define default GAUSS points TPyra5b::TPyra5b(): TShapeFun(3,5) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -890,8 +890,8 @@ namespace // define default GAUSS points TPyra13a::TPyra13a(): TShapeFun(3,13) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -915,8 +915,8 @@ namespace // define default GAUSS points TPyra13b::TPyra13b(): TShapeFun(3,13) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -1510,7 +1510,7 @@ Cell::Cell(const Cell& ma) SauvUtilities::Link Cell::link(int i) const { - int i2 = ( i + 1 ) % _nodes.size(); + std::size_t i2 = ( i + 1 ) % _nodes.size(); if ( _reverse ) return std::make_pair( _nodes[i2]->_number, _nodes[i]->_number ); else @@ -1588,9 +1588,9 @@ std::ostream& SauvUtilities::operator<< (std::ostream& os, const SauvUtilities:: */ //================================================================================ -int Group::size() const +mcIdType Group::size() const { - int sizze = 0; + std::size_t sizze = 0; if ( !_relocTable.empty() ) sizze = _relocTable.size(); else if ( _medGroup ) @@ -1600,7 +1600,7 @@ int Group::size() const else for ( size_t i = 0; i < _groups.size(); ++i ) sizze += _groups[i]->size(); - return sizze; + return ToIdType( sizze ); } //================================================================================ @@ -1739,13 +1739,13 @@ bool ASCIIReader::getLine(char* & line) bool aResult = true; // Check the state of the buffer; // if there is too little left, read the next portion of data - int nBytesRest = _eptr - _ptr; + std::size_t nBytesRest = _eptr - _ptr; if (nBytesRest < GIBI_MaxOutputLen) { if (nBytesRest > 0) { // move the remaining portion to the buffer beginning - for ( int i = 0; i < nBytesRest; ++i ) + for ( std::size_t i = 0; i < nBytesRest; ++i ) _start[i] = _ptr[i]; //memcpy (_tmpBuf, _ptr, nBytesRest); //memcpy (_start, _tmpBuf, nBytesRest); @@ -1755,9 +1755,9 @@ bool ASCIIReader::getLine(char* & line) nBytesRest = 0; } _ptr = _start; - const int nBytesRead = ::read (_file, - &_start [nBytesRest], - GIBI_BufferSize - nBytesRest); + const std::size_t nBytesRead = ::read (_file, + &_start [nBytesRest], + GIBI_BufferSize - nBytesRest); nBytesRest += nBytesRead; _eptr = &_start [nBytesRest]; } @@ -1942,7 +1942,7 @@ int ASCIIReader::getInt() const float ASCIIReader::getFloat() const { - return getDouble(); + return (float)getDouble(); } //================================================================================ @@ -2327,7 +2327,7 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo // correct pointers to sub-groups for ( size_t j = 0; j < _groups[i]._groups.size(); ++j ) { - int iG = _groups[i]._groups[j] - &_groups[0]; + std::size_t iG = _groups[i]._groups[j] - &_groups[0]; newGroups[i]._groups[j] = & newGroups[ iG ]; } } @@ -2337,7 +2337,7 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo for ( size_t i = 0; i < groupsToFix->size(); ++i ) if ( (*groupsToFix)[i] ) { - int iG = (*groupsToFix)[i] - &_groups[0]; + std::size_t iG = (*groupsToFix)[i] - &_groups[0]; (*groupsToFix)[i] = & newGroups[ iG ]; } @@ -2351,12 +2351,12 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo for ( size_t j = 0; j < fields[i]->_sub.size(); ++j ) if ( fields[i]->_sub[j]._support ) { - int iG = fields[i]->_sub[j]._support - &_groups[0]; + std::size_t iG = fields[i]->_sub[j]._support - &_groups[0]; fields[i]->_sub[j]._support = & newGroups[ iG ]; } if ( fields[i]->_group ) { - int iG = fields[i]->_group - &_groups[0]; + std::size_t iG = fields[i]->_group - &_groups[0]; fields[i]->_group = & newGroups[ iG ]; } } @@ -2557,8 +2557,8 @@ void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) if (medName.find( fields[ifi]->_name + "." ) == 0 ) { std::vector& aSubDs = fields[ifi]->_sub; - int nbSub = aSubDs.size(); - for (int isu = 0; isu < nbSub; isu++) + std::size_t nbSub = aSubDs.size(); + for (std::size_t isu = 0; isu < nbSub; isu++) for (int ico = 0; ico < aSubDs[isu].nbComponents(); ico++) { if (aSubDs[isu].compName(ico) == gibiName) @@ -2837,7 +2837,7 @@ void IntermediateMED::orientFaces3D() for ( size_t j = 0; j < grp._cells.size(); ++j ) if ( faces.insert( grp._cells[j] ).second ) { - for ( size_t k = 0; k < grp._cells[j]->_nodes.size(); ++k ) + for ( unsigned int k = 0; k < grp._cells[j]->_nodes.size(); ++k ) linkFacesMap[ grp._cells[j]->link( k ) ].push_back( grp._cells[j] ); fgm.insert( std::make_pair( grp._cells[j], &grp )); } @@ -3089,7 +3089,7 @@ void IntermediateMED::numberElements() // check if re-numeration is needed (to try to keep elem oreder as in sauve file ) bool ok = true, renumEntity = false; CellsByDimIterator cellsIt( *this, dim ); - int prevNbElems = 0; + mcIdType prevNbElems = 0; while ( const std::set * typeCells = cellsIt.nextType() ) { TID minNumber = std::numeric_limits::max(), maxNumber = 0; @@ -3098,7 +3098,7 @@ void IntermediateMED::numberElements() if ( elemIt->_number < minNumber ) minNumber = elemIt->_number; if ( elemIt->_number > maxNumber ) maxNumber = elemIt->_number; } - TID typeSize = typeCells->size(); + mcIdType typeSize = ToIdType( typeCells->size() ); if ( typeSize != maxNumber - minNumber + 1 ) ok = false; if ( prevNbElems+1 != (int)minNumber ) @@ -3112,12 +3112,12 @@ void IntermediateMED::numberElements() if ( ok && renumEntity ) // each geom type was numerated separately { cellsIt.init( dim ); - prevNbElems = cellsIt.nextType()->size(); // no need to renumber the first type + prevNbElems = ToIdType( cellsIt.nextType()->size()); // no need to renumber the first type while ( const std::set * typeCells = cellsIt.nextType() ) { for ( elemIt = typeCells->begin(), elemEnd = typeCells->end(); elemIt!=elemEnd; ++elemIt) elemIt->_number += prevNbElems; - prevNbElems += typeCells->size(); + prevNbElems += ToIdType( typeCells->size() ); } } if ( !ok ) @@ -3142,7 +3142,7 @@ MEDCoupling::DataArrayDouble * IntermediateMED::getCoords() DataArrayDouble* coordArray = DataArrayDouble::New(); coordArray->alloc( _nbNodes, _spaceDim ); double * coordPrt = coordArray->getPointer(); - for ( int i = 0, nb = _points.size(); i < nb; ++i ) + for ( unsigned int i = 0; i < _points.size(); ++i ) { Node* n = getNode( i+1 ); if ( n->isUsed() ) @@ -3175,9 +3175,9 @@ void IntermediateMED::setConnectivity( MEDCoupling::MEDFileUMesh* mesh, { CellsByDimIterator dimCells( *this, dim ); - int nbOfCells = 0; + mcIdType nbOfCells = 0; while ( const std::set * cells = dimCells.nextType() ) - nbOfCells += cells->size(); + nbOfCells += ToIdType( cells->size() ); if ( nbOfCells == 0 ) continue; @@ -3188,27 +3188,27 @@ void IntermediateMED::setConnectivity( MEDCoupling::MEDFileUMesh* mesh, dimMesh->setMeshDimension( dim ); dimMesh->allocateCells( nbOfCells ); - int prevNbCells = 0; + mcIdType prevNbCells = 0; dimCells.init( dim ); while ( const std::set * cells = dimCells.nextType() ) { // fill connectivity array to take into account order of elements in the sauv file - const int nbCellNodes = cells->begin()->_nodes.size(); + const mcIdType nbCellNodes = ToIdType( cells->begin()->_nodes.size() ); std::vector< TID > connectivity( cells->size() * nbCellNodes ); TID * nodalConnOfCell; for ( elemIt = cells->begin(), elemEnd = cells->end(); elemIt != elemEnd; ++elemIt ) { const Cell& cell = *elemIt; - const int index = cell._number - 1 - prevNbCells; + const TID index = cell._number - 1 - prevNbCells; nodalConnOfCell = &connectivity[ index * nbCellNodes ]; if ( cell._reverse ) - for ( int i = nbCellNodes-1; i >= 0; --i ) + for ( mcIdType i = nbCellNodes-1; i >= 0; --i ) *nodalConnOfCell++ = cell._nodes[i]->_number - 1; else - for ( int i = 0; i < nbCellNodes; ++i ) + for ( mcIdType i = 0; i < nbCellNodes; ++i ) *nodalConnOfCell++ = cell._nodes[i]->_number - 1; } - prevNbCells += cells->size(); + prevNbCells += ToIdType( cells->size() ); // fill dimMesh TCellType cellType = dimCells.type(); @@ -3336,7 +3336,7 @@ bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const { int dim = getDim( grp ); - int nbElems = 0; + mcIdType nbElems = 0; if ( dim == 0 ) { nbElems = _nbNodes; @@ -3346,7 +3346,7 @@ bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const { CellsByDimIterator dimCells( *this, dim ); while ( const std::set * cells = dimCells.nextType() ) - nbElems += cells->size(); + nbElems += ToIdType( cells->size() ); int meshDim = 3; for ( ; meshDim > 0; --meshDim ) @@ -3378,10 +3378,10 @@ MEDCoupling::MEDFileFields * IntermediateMED::makeMEDFileFields(MEDCoupling::MED MEDFileFields* fields = MEDFileFields::New(); - for ( size_t i = 0; i < _nodeFields.size(); ++i ) + for ( unsigned int i = 0; i < _nodeFields.size(); ++i ) setFields( _nodeFields[i], fields, mesh, i+1, usedFieldNames ); - for ( size_t i = 0; i < _cellFields.size(); ++i ) + for ( unsigned int i = 0; i < _cellFields.size(); ++i ) setFields( _cellFields[i], fields, mesh, i+1, usedFieldNames ); return fields; @@ -3415,7 +3415,7 @@ void IntermediateMED::setFields( SauvUtilities::DoubleField* fld, std::cout << "Castem field #" << castemID << " <" << fld->_name << "> is incompatible with MED format, so we split it into several fields:" << std::endl; - for ( size_t iSub = 0; iSub < fld->_sub.size(); ) + for ( unsigned int iSub = 0; iSub < fld->_sub.size(); ) { // set field name if ( !uniteSubs || fld->_name.empty() ) @@ -3429,8 +3429,8 @@ void IntermediateMED::setFields( SauvUtilities::DoubleField* fld, double * valPtr = values->getPointer(); if ( uniteSubs ) { - int nbElems = fld->_group->size(); - for ( int elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); ) + mcIdType nbElems = fld->_group->size(); + for ( mcIdType elemShift = 0; elemShift < nbElems && iSub < fld->_sub.size(); ) elemShift += fld->setValues( valPtr, iSub++, elemShift ); setTS( fld, values, medFields, mesh ); } @@ -3660,7 +3660,7 @@ bool DoubleField::isMultiTimeStamps() const bool DoubleField::isMedCompatible(bool& sameNbGauss) const { - for ( size_t iSub = 0; iSub < _sub.size(); ++iSub ) + for ( unsigned int iSub = 0; iSub < _sub.size(); ++iSub ) { if ( !getSupport(iSub) || !getSupport(iSub)->_medGroup ) THROW_IK_EXCEPTION("SauvReader INTERNAL ERROR: NULL field support"); @@ -3741,9 +3741,9 @@ MEDCoupling::TypeOfTimeDiscretization DoubleField::getMedTimeDisc() const */ //================================================================================ -int DoubleField::getNbTuples( const int iSub ) const +mcIdType DoubleField::getNbTuples( const int iSub ) const { - int nb = 0; + mcIdType nb = 0; if ( hasCommonSupport() && !_group->_groups.empty() ) for ( size_t i = 0; i < _group->_groups.size(); ++i ) nb += _sub[i].nbGauss() * _sub[i]._support->size(); @@ -3758,7 +3758,7 @@ int DoubleField::getNbTuples( const int iSub ) const */ //================================================================================ -int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift ) const +mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType elemShift ) const { // find values for iSub int iComp = 0; @@ -3768,41 +3768,41 @@ int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift // Set values - const std::vector< unsigned >& relocTable = getSupport( iSub )->_relocTable; + const std::vector< mcIdType >& relocTable = getSupport( iSub )->_relocTable; - const int nbElems = _sub[iSub]._support->size(); + const mcIdType nbElems = _sub[iSub]._support->size(); const int nbGauss = _sub[iSub].nbGauss(); const int nbComponents = _sub[iSub].nbComponents(); const int nbValsByElem = nbComponents * nbGauss; // check nb values - int nbVals = 0; + mcIdType nbVals = 0; for ( iComp = 0; iComp < nbComponents; ++iComp ) - nbVals += compValues[iComp].size(); + nbVals += ToIdType( compValues[iComp].size() ); const bool isConstField = ( nbVals == nbComponents ); // one value per component (issue 22321) if ( !isConstField && nbVals != nbElems * nbValsByElem ) THROW_IK_EXCEPTION("SauvMedConvertor.cxx: support size mismatches field size"); // compute nb values in previous subs - int valsShift = 0; - for ( int iS = iSub-1, shift = elemShift; shift > 0; --iS) + mcIdType valsShift = 0; + for ( mcIdType iS = iSub-1, shift = elemShift; shift > 0; --iS) { - int nbE = _sub[iS]._support->size(); + mcIdType nbE = _sub[iS]._support->size(); shift -= nbE; valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss(); } if ( isConstField ) - for ( int iE = 0; iE < nbElems; ++iE ) + for ( mcIdType iE = 0; iE < nbElems; ++iE ) { - int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); + mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); for ( iComp = 0; iComp < nbComponents; ++iComp ) valPtr[ iMed + iComp ] = compValues[iComp][ 0 ]; } else - for ( int iE = 0; iE < nbElems; ++iE ) + for ( mcIdType iE = 0; iE < nbElems; ++iE ) { - int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); + mcIdType iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift ); for ( iComp = 0; iComp < nbComponents; ++iComp ) for ( int iG = 0; iG < nbGauss; ++iG ) valPtr[ iMed + iG * nbComponents + iComp ] = compValues[iComp][ iE * nbGauss + iG ]; diff --git a/src/MEDLoader/SauvMedConvertor.hxx b/src/MEDLoader/SauvMedConvertor.hxx index 5b09a1c84..9fc216225 100644 --- a/src/MEDLoader/SauvMedConvertor.hxx +++ b/src/MEDLoader/SauvMedConvertor.hxx @@ -104,10 +104,10 @@ namespace SauvUtilities (issue 0021311) */ MEDCoupling::DataArrayIdType* _medGroup; // result of conversion - std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup + std::vector< mcIdType > _relocTable; // for _cells[i] gives its index in _medGroup bool empty() const { return _cells.empty() && _groups.empty(); } - int size() const; + mcIdType size() const; Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {} }; @@ -126,7 +126,7 @@ namespace SauvUtilities void setData( int nb_comp, Group* supp ) { _support = supp; _comp_names.resize(nb_comp); _nb_gauss.resize(nb_comp,1); } - int nbComponents() const { return _comp_names.size(); } + int nbComponents() const { return (int)_comp_names.size(); } std::string & compName( int i_comp ) { return _comp_names[ i_comp ]; } bool isSameNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) == *std::min_element( _nb_gauss.begin(), _nb_gauss.end() ); } @@ -158,11 +158,11 @@ namespace SauvUtilities bool isMedCompatible(bool& sameNbGauss) const; MEDCoupling::TypeOfField getMedType( const int iSub=0 ) const; MEDCoupling::TypeOfTimeDiscretization getMedTimeDisc() const; - int getNbTuples( const int iSub=0 ) const; + mcIdType getNbTuples( const int iSub=0 ) const; int getNbValuesPerElement( const int iSub=0 ) const; int getNbGauss( const int iSub=0 ) const; const Group* getSupport( const int iSub=0 ) const; - int setValues( double * valPtr, const int iSub, const int elemShift=0 ) const; + mcIdType setValues( double * valPtr, const int iSub, const mcIdType elemShift=0 ) const; void splitSubWithDiffNbGauss(); //virtual void dump(std::ostream&) const; @@ -253,7 +253,7 @@ namespace SauvUtilities ~IntermediateMED(); Node* getNode( TID nID ) { return _points.getNode( nID ); } - int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); } + mcIdType getNbCellsOfType( TCellType type ) const { return ToIdType(_cellsByType[type].size()); } const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); } Group* addNewGroup(std::vector* groupsToFix=0); MEDCoupling::MEDFileData* convertInMEDFileDS(); diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index 30a62fecb..931d35255 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -735,10 +735,10 @@ void SauvReader::setFieldSupport(const vector& supports, while ( isSwapped ) { isSwapped = false; - for ( size_t i = 1; i < groups.size(); ++i ) + for ( std::size_t i = 1; i < groups.size(); ++i ) { - int nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size(); - int nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size(); + std::size_t nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size(); + std::size_t nbN2 = groups[i ]->empty() ? 0 : groups[i ]->_cells[0]->_nodes.size(); if ( nbN1 > nbN2 ) { isSwapped = isModified = true; @@ -1204,7 +1204,7 @@ void SauvReader::read_PILE_STRINGS (const int nbObjects, const int fixedLength = 71; while ((int)aWholeString.length() < stringLen) { - int remainLen = stringLen - aWholeString.length(); + int remainLen = (int)(stringLen - aWholeString.length()); int len; if ( remainLen > fixedLength ) { @@ -1226,7 +1226,7 @@ void SauvReader::read_PILE_STRINGS (const int nbObjects, while ((int)aWholeString.length() < stringLen) { getNextLine( line ); - int remainLen = stringLen - aWholeString.length(); + int remainLen = (int)(stringLen - aWholeString.length()); if ( remainLen > fixedLength ) { aWholeString += line + 1; diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 2d29f5401..fbdbe0bff 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -130,9 +130,9 @@ namespace if (!healedName.empty()) { string name = healedName; - int len = name.length(); - for (int i = 0; i < len; ++i) - name[i] = toupper(name[i]); + std::size_t len = name.length(); + for (std::size_t i = 0; i < len; ++i) + name[i] = (char)toupper(name[i]); bool doResave = false; // only for tracing @@ -316,7 +316,7 @@ int SauvWriter::SubMesh::nbTypes() const void SauvWriter::fillSubMeshes( int& nbSauvObjects, map& nameNbMap ) { // evaluate nb of _subs in order to avoid re-allocation of _subs - int nbSubs = 1; // for the very mesh + std::size_t nbSubs = 1; // for the very mesh nbSubs += _fileMesh->getFamilyInfo().size() + 4; // + 4 zero families (for each dimRelExt) nbSubs += _fileMesh->getGroupInfo().size(); nbSubs += evaluateNbProfileSubMeshes(); @@ -381,7 +381,7 @@ void SauvWriter::fillFamilySubMeshes() mcIdType curFamID = 0; SubMesh* curSubMesh = addSubMesh( "", dimRelExt ); // submesh of zero family _famIDs2Sub[0] = curSubMesh; - int sub0Index = _subs.size()-1; + std::size_t sub0Index = _subs.size()-1; const mcIdType * famID = famIds->begin(), * famIDEnd = famIds->end(); for ( mcIdType cellID = 0; famID < famIDEnd; ++famID, cellID++ ) @@ -407,7 +407,7 @@ void SauvWriter::fillFamilySubMeshes() else if ( dimRelExt == 0 ) { // make a submesh including all cells - if ( sub0Index == (int)(_subs.size()-1) ) + if ( sub0Index == _subs.size()-1 ) { _famIDs2Sub[0]->_name = _fileMesh->getName(); // there is the zero family only } @@ -416,7 +416,7 @@ void SauvWriter::fillFamilySubMeshes() curSubMesh = addSubMesh( _fileMesh->getName(), dimRelExt ); if ( _famIDs2Sub[0]->nbTypes() == 0 ) sub0Index++; // skip an empty zero family - for ( size_t i = sub0Index; i < _subs.size()-1; ++i ) + for ( std::size_t i = sub0Index; i < _subs.size()-1; ++i ) curSubMesh->_subs.push_back( & _subs[i] ); } } @@ -536,11 +536,11 @@ void SauvWriter::fillProfileSubMeshes() int SauvWriter::evaluateNbProfileSubMeshes() const { - int nb = 0; - for ( size_t i = 0; i < _nodeFields.size(); ++i ) + std::size_t nb = 0; + for ( std::size_t i = 0; i < _nodeFields.size(); ++i ) nb += 1 + _nodeFields[i]->getPflsReallyUsed().size(); - for ( size_t i = 0; i < _cellFields.size(); ++i ) + for ( std::size_t i = 0; i < _cellFields.size(); ++i ) { nb += _cellFields[i]->getPflsReallyUsed().size(); @@ -554,7 +554,7 @@ int SauvWriter::evaluateNbProfileSubMeshes() const nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time } - return nb; + return (int)nb; } //================================================================================ @@ -565,14 +565,14 @@ int SauvWriter::evaluateNbProfileSubMeshes() const void SauvWriter::makeProfileIDs( SubMesh* sm, INTERP_KERNEL::NormalizedCellType type, - const DataArrayIdType* profile ) + const DataArrayIdType* profile ) { MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt); const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh ); if ( sm->_dimRelExt == 1 ) type = INTERP_KERNEL::NORM_POINT1; - vector< int >& ids = sm->_cellIDsByType[ type ]; + vector< mcIdType >& ids = sm->_cellIDsByType[ type ]; if ( sm->_dimRelExt == 1 || !uMesh ) { @@ -585,7 +585,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, { ids.resize( sm->_dimRelExt == 1 ? mesh->getNumberOfNodes() : mesh->getNumberOfCells() ); for ( size_t i = 0; i < ids.size(); ++i ) - ids[i]=i; + ids[i] = ToIdType( i ); } } else @@ -612,7 +612,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, } else // mesh includes only one type { - int nbE = code[1]; + mcIdType nbE = code[1]; for ( ids.resize( nbE ); nbE; --nbE ) ids[ nbE-1 ] = nbE-1; } @@ -727,7 +727,7 @@ void SauvWriter::writeSubMeshes() TFieldCounter fcount( *_sauvFile, 10 ); // 10 integers per line - for ( size_t iSub = 0; iSub < _subs.size(); ++iSub ) + for ( unsigned int iSub = 0; iSub < _subs.size(); ++iSub ) { SubMesh& sm = _subs[iSub]; if ( sm._nbSauvObjects < 1 ) continue; @@ -753,7 +753,7 @@ void SauvWriter::writeSubMeshes() for ( int iType=0; iType < sm.cellIDsByTypeSize(); ++iType ) { - const vector& cellIDs = sm._cellIDsByType[iType]; + const vector& cellIDs = sm._cellIDsByType[iType]; if ( cellIDs.empty() ) continue; INTERP_KERNEL::NormalizedCellType @@ -762,7 +762,7 @@ void SauvWriter::writeSubMeshes() cell = INTERP_KERNEL::CellModel::GetCellModel( cellType ); int castemType = SauvUtilities::med2gibiGeom( cellType ); unsigned nbElemNodes = cell.getNumberOfNodes(); - unsigned nbElems = cellIDs.size(); + std::size_t nbElems = cellIDs.size(); *_sauvFile << setw(8) << castemType << zeroI8 @@ -772,14 +772,14 @@ void SauvWriter::writeSubMeshes() // write color of each element // * 8000 FORMAT(10I8) - for ( size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8; + for ( std::size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8; fcount.stop(); // write connectivity // gibi IDs are in FORTRAN mode while MEDCoupling IDs are in C mode if ( sm._dimRelExt == 1 ) // nodes { - for ( size_t i = 0; i < nbElems; ++i, fcount++ ) + for ( std::size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << setw(8) << ( cellIDs[i] + 1 ); } else @@ -788,7 +788,7 @@ void SauvWriter::writeSubMeshes() const int * toMedConn = getGibi2MedQuadraticInterlace( cellType ); vector< mcIdType > cellConn( nbElemNodes ), transformedConn( nbElemNodes ); - for ( size_t i = 0; i < nbElems; ++i ) + for ( std::size_t i = 0; i < nbElems; ++i ) { cellConn.clear(); umesh->getNodeIdsOfCell( cellIDs[i], cellConn ); @@ -850,13 +850,13 @@ void SauvWriter::writeNodes() // write the index connecting nodes with their coordinates - const int nbNodes = umesh->getNumberOfNodes(); + const mcIdType nbNodes = umesh->getNumberOfNodes(); *_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl << " PILE NUMERO 32NBRE OBJETS NOMMES 0NBRE OBJETS" << setw(8) << nbNodes << endl; *_sauvFile << setw(8) << nbNodes << endl; // TFieldCounter fcount( *_sauvFile, 10 );// * 8000 FORMAT(10I8) - for ( int i = 0; i < nbNodes; ++i, fcount++ ) + for ( mcIdType i = 0; i < nbNodes; ++i, fcount++ ) *_sauvFile << setw(8) << i + 1; fcount.stop(); @@ -865,8 +865,8 @@ void SauvWriter::writeNodes() *_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl; *_sauvFile << " PILE NUMERO 33NBRE OBJETS NOMMES 0NBRE OBJETS 1" << endl; // - const int dim = umesh->getSpaceDimension(); - const int nbValues = nbNodes * ( dim + 1 ); + const int dim = umesh->getSpaceDimension(); + const mcIdType nbValues = nbNodes * ( dim + 1 ); *_sauvFile << setw(8) << nbValues << endl; // * 8003 FORMAT(1P,3E22.14) @@ -923,7 +923,7 @@ void SauvWriter::writeLongNames() *_sauvFile << endl; string theWholeString; // concatenated long names - vector theOffsets; + vector theOffsets; int iStr = 1; TFieldCounter fcount (*_sauvFile, 10); @@ -976,7 +976,7 @@ void SauvWriter::writeLongNames() // Write the STRING pile // ---------------------- - const int nbNames = theOffsets.size(); + const std::size_t nbNames = theOffsets.size(); *_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl << " PILE NUMERO 27NBRE OBJETS NOMMES" << zeroI8 << "NBRE OBJETS" << setw(8) << nbNames << endl << setw(8) << theWholeString.length() << setw(8) << nbNames << endl; @@ -987,7 +987,7 @@ void SauvWriter::writeLongNames() *_sauvFile << setw(72) << theWholeString.substr(aPos, fixedLength) << endl; // write the offsets - for ( size_t i = 0; i < theOffsets.size(); ++i, fcount++ ) + for ( std::size_t i = 0; i < theOffsets.size(); ++i, fcount++ ) *_sauvFile << setw(8) << theOffsets[i]; } @@ -1004,7 +1004,7 @@ void SauvWriter::writeFieldNames( const bool isNodal, flds = isNodal ? _nodeFields : _cellFields; map nameNbMap; - for ( size_t iF = 0; iF < flds.size(); ++iF ) + for ( unsigned int iF = 0; iF < flds.size(); ++iF ) { string name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 ); nameGIBItoMED aMEDName; @@ -1089,9 +1089,9 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) // (1) write nb subcomponents, nb components(total) vector< pair > iters = _nodeFields[iF]->getIterations(); const vector& compInfo = _nodeFields[iF]->getInfo(); - const int nbSub = iters.size(); - const int nbComp = compInfo.size(); - const int totalNbComp = nbSub * nbComp; + const std::size_t nbSub = iters.size(); + const std::size_t nbComp = compInfo.size(); + const std::size_t totalNbComp = nbSub * nbComp; *_sauvFile << setw(8) << nbSub << setw(8) << totalNbComp << setw(8) << -1 // IFOUR @@ -1120,7 +1120,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) << pfls[0][0] << "|"); vals[0] = -pfl2Sub->second->_id; vals[1] = (valsVec[0][0].second-valsVec[0][0].first); - vals[2] = compInfo.size(); + vals[2] = ToIdType( compInfo.size() ); for ( size_t i = 0; i < vals.size(); ++i, fcount++ ) *_sauvFile << setw(8) << vals[i]; } @@ -1206,10 +1206,10 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) // (10) 1.00000000000000E+02 1.00000000000000E+02 1.00000000000000E+02 // (10) ... - for ( size_t iF = 0; iF < _cellFields.size(); ++iF ) + for ( unsigned int iF = 0; iF < _cellFields.size(); ++iF ) { // count nb of sub-components - int iSub, nbSub = 0; + std::size_t iSub, nbSub = 0; vector< pair > iters = _cellFields[iF]->getIterations(); for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { @@ -1235,9 +1235,9 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) *_sauvFile << setw(72) << " " << endl; // (3) support, nb components - vector vals(9, 0); + vector vals(9, 0); const vector& compInfo = _cellFields[iF]->getInfo(); - vals[2] = compInfo.size(); + vals[2] = ToIdType( compInfo.size() ); fcount.init(10); for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { @@ -1320,7 +1320,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) const vector& compInfo = _cellFields[iF]->getInfo(); // (6) component addresses - int iComp = 0, nbComp = compInfo.size(); + std::size_t iComp = 0, nbComp = compInfo.size(); for ( fcount.init(10); iComp < nbComp; ++iComp, fcount++ ) *_sauvFile << setw(8) << 777; // a good number fcount.stop(); diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index 27f4b3baa..3bdb3d3a7 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -62,7 +62,7 @@ namespace MEDCoupling */ struct SubMesh { - std::vector _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ]; + std::vector _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ]; std::vector _subs; std::string _name; int _id; diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index 1438d85dd..9d74a0635 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -65,24 +65,42 @@ def MEDCouplingDataArrayFloatImul(self,*args): def MEDCouplingDataArrayFloatIdiv(self,*args): import _MEDLoader return _MEDLoader.DataArrayFloat____idiv___(self, self, *args) -def MEDCouplingDataArrayIntIadd(self,*args): +def MEDCouplingDataArrayInt32Iadd(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____iadd___(self, self, *args) -def MEDCouplingDataArrayIntIsub(self,*args): + return _MEDLoader.DataArrayInt32____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32Isub(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____isub___(self, self, *args) -def MEDCouplingDataArrayIntImul(self,*args): + return _MEDLoader.DataArrayInt32____isub___(self, self, *args) +def MEDCouplingDataArrayInt32Imul(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____imul___(self, self, *args) -def MEDCouplingDataArrayIntIdiv(self,*args): + return _MEDLoader.DataArrayInt32____imul___(self, self, *args) +def MEDCouplingDataArrayInt32Idiv(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____idiv___(self, self, *args) -def MEDCouplingDataArrayIntImod(self,*args): + return _MEDLoader.DataArrayInt32____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32Imod(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____imod___(self, self, *args) -def MEDCouplingDataArrayIntIpow(self,*args): + return _MEDLoader.DataArrayInt32____imod___(self, self, *args) +def MEDCouplingDataArrayInt32Ipow(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____ipow___(self, self, *args) + return _MEDLoader.DataArrayInt32____ipow___(self, self, *args) +def MEDCouplingDataArrayInt64Iadd(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64Isub(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____isub___(self, self, *args) +def MEDCouplingDataArrayInt64Imul(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____imul___(self, self, *args) +def MEDCouplingDataArrayInt64Idiv(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64Imod(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____imod___(self, self, *args) +def MEDCouplingDataArrayInt64Ipow(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____ipow___(self, self, *args) def MEDCouplingDataArrayDoubleTupleIadd(self,*args): import _MEDLoader return _MEDLoader.DataArrayDoubleTuple____iadd___(self, self, *args) @@ -95,21 +113,36 @@ def MEDCouplingDataArrayDoubleTupleImul(self,*args): def MEDCouplingDataArrayDoubleTupleIdiv(self,*args): import _MEDLoader return _MEDLoader.DataArrayDoubleTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleIadd(self,*args): +def MEDCouplingDataArrayInt32TupleIadd(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIsub(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImul(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIdiv(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImod(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____imod___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIadd(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____iadd___(self, self, *args) -def MEDCouplingDataArrayIntTupleIsub(self,*args): + return _MEDLoader.DataArrayInt64Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIsub(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____isub___(self, self, *args) -def MEDCouplingDataArrayIntTupleImul(self,*args): + return _MEDLoader.DataArrayInt64Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImul(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____imul___(self, self, *args) -def MEDCouplingDataArrayIntTupleIdiv(self,*args): + return _MEDLoader.DataArrayInt64Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIdiv(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleImod(self,*args): + return _MEDLoader.DataArrayInt64Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImod(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____imod___(self, self, *args) + return _MEDLoader.DataArrayInt64Tuple____imod___(self, self, *args) def MEDCouplingDenseMatrixIadd(self,*args): import _MEDLoader return _MEDLoader.DenseMatrix____iadd___(self, self, *args) diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index f21b93682..261efa111 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -565,9 +565,9 @@ namespace MEDCoupling PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName); - int size=v.size(); + std::size_t size=v.size(); PyObject *ret=PyList_New(size); - for(int i=0;i a0; @@ -2149,9 +2149,9 @@ namespace MEDCoupling std::vector< std::vector > pfls; std::vector< std::vector > locs; std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i >& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; @@ -2159,13 +2159,13 @@ namespace MEDCoupling const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j > pfls; std::vector< std::vector > locs; std::vector< std::vector > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; @@ -2300,9 +2300,9 @@ namespace MEDCoupling const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;jgetPosOfTimeStep(iter,order); } else @@ -2622,9 +2622,9 @@ namespace MEDCoupling std::vector< std::vector > pfls; std::vector< std::vector > locs; std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i >& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; @@ -2632,13 +2632,13 @@ namespace MEDCoupling const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j ret(sz); - for(int i=0;igetNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !"); - self->eraseTimeStepIds2(strt,stp,step); + self->eraseTimeStepIds2((int)strt,(int)stp,(int)step); } else { @@ -2728,10 +2728,10 @@ namespace MEDCoupling { if(elt0 && PyList_Check(elt0)) { - int sz=PyList_Size(elt0); + std::size_t sz=PyList_Size(elt0); MCAuto da=DataArrayInt32::New(); da->alloc(sz,1); int *pt=da->getPointer(); - for(int i=0;igetNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !"); - return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0); + return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0); } else return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0); @@ -2941,9 +2941,9 @@ namespace MEDCoupling std::vector< std::vector > pfls; std::vector< std::vector > locs; std::vector< std::vector > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; @@ -2951,9 +2951,9 @@ namespace MEDCoupling const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j da=DataArrayInt::New(); da->alloc(sz,1); int *pt=da->getPointer(); - for(int i=0;igetPosFromFieldName(convertPyObjectToStr(elt0,msg)); } @@ -3372,9 +3372,9 @@ namespace MEDCoupling { if(PyList_Check(elts)) { - int sz=PyList_Size(elts); + std::size_t sz=PyList_Size(elts); std::vector ret(sz); - for(int i=0;igetNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !"); - self->destroyFieldsAtPos2(strt,stp,step); + self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step); } else { @@ -3614,8 +3614,8 @@ namespace MEDCoupling PyObject *o1=PyTuple_GetItem(elt0,1); if(PyInt_Check(o0) && PyInt_Check(o1)) {//fmts(1,-1) - int iter=PyInt_AS_LONG(o0); - int order=PyInt_AS_LONG(o1); + int iter=(int)PyInt_AS_LONG(o0); + int order=(int)PyInt_AS_LONG(o1); return self->getPosOfTimeStep(iter,order); } else @@ -3645,9 +3645,9 @@ namespace MEDCoupling { if(PyList_Check(elts)) { - int sz=PyList_Size(elts); + std::size_t sz=PyList_Size(elts); std::vector ret(sz); - for(int i=0;i > convertTimePairIdsFromPy(PyObject *pyLi) std::vector > ret; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i p; - int size2=PyTuple_Size(o); + std::size_t size2=PyTuple_Size(o); if(size2!=2) throw INTERP_KERNEL::Exception("tuples in list must be of size 2 (dt,it) !"); PyObject *o0=PyTuple_GetItem(o,0); @@ -169,9 +169,9 @@ static void converPyListToVecString(PyObject *pyLi, std::vector& v) static const char msg2[]="Unrecognized python argument : expected a list of string or tuple of string or string !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); v.resize(size); - for(int i=0;i& v) } else if(PyTuple_Check(pyLi)) { - int size=PyTuple_Size(pyLi); + std::size_t size=PyTuple_Size(pyLi); v.resize(size); - for(int i=0;i& v) static PyObject *convertFieldDoubleVecToPy(const std::vector& li) { - int sz=li.size(); + std::size_t sz=li.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i >& vec) +template< class T > +PyObject *convertVecPairIntToPy(const std::vector< std::pair >& vec) { PyObject *ret(PyList_New(vec.size())); int rk=0; - for(std::vector< std::pair >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++) + for(typename std::vector< std::pair >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++) { PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); - PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); + PyTuple_SetItem(elt,1,PyInt_FromLong((*iter).second)); PyList_SetItem(ret,rk,elt); } return ret; @@ -221,9 +222,9 @@ PyObject *convertVecPairIntToPy(const std::vector< std::pair >& vec) PyObject *convertVecPairVecStToPy(const std::vector< std::pair, std::string > >& vec) { - int sz=(int)vec.size(); + std::size_t sz=vec.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i >& vec) { - int sz=(int)vec.size(); + std::size_t sz=vec.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i > convertVecPairStStFromPy(PyO const char *msg="convertVecPairStStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is one string and the 2nd one a string !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i p; - int size2=PyTuple_Size(o); + std::size_t size2=PyTuple_Size(o); if(size2!=2) throw INTERP_KERNEL::Exception(msg); PyObject *o0=PyTuple_GetItem(o,0); @@ -288,23 +289,23 @@ std::vector< std::pair, std::string > > convertVecPairV const char *msg="convertVecPairVecStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is a list of strings and the 2nd one a string !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i, std::string> p; - int size2=PyTuple_Size(o); + std::size_t size2=PyTuple_Size(o); if(size2!=2) throw INTERP_KERNEL::Exception(msg); PyObject *o0=PyTuple_GetItem(o,0); if(PyList_Check(o0)) { - int size3=PyList_Size(o0); + std::size_t size3=PyList_Size(o0); p.first.resize(size3); - for(int j=0;jgetPosOfTimeStep(iter,order); } else @@ -370,12 +371,12 @@ int MEDFileFieldsgetitemSingleTS__(const MEDFileFields *self, PyObject *obj) static const char msg[]="MEDFileFields::__getitem__ : only integer or string with fieldname supported !"; if(PyInt_Check(obj)) { - return InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfFields()); + return InterpreteNegativeInt(PyInt_AS_LONG(obj),self->getNumberOfFields()); } return self->getPosFromFieldName(convertPyObjectToStr(obj,msg)); } -void convertToMapIntDataArrayInt(PyObject *pyMap, std::map >& cppMap) +void convertToMapIntDataArrayInt(PyObject *pyMap, std::map >& cppMap) { if(!PyDict_Check(pyMap)) throw INTERP_KERNEL::Exception("convertToMapIntDataArrayInt : input is not a python map !"); @@ -386,16 +387,16 @@ void convertToMapIntDataArrayInt(PyObject *pyMap, std::map::TI,0|0)); if(!SWIG_IsOK(status)) { std::ostringstream oss; oss << "convertToMapIntDataArrayInt : values in map must be DataArrayInt !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - DataArrayInt *arg(reinterpret_cast(argp)); - MCAuto arg2(arg); + DataArrayIdType *arg(reinterpret_cast(argp)); + MCAuto arg2(arg); if(arg) arg->incrRef(); cppMap[k]=arg2; @@ -405,18 +406,18 @@ void convertToMapIntDataArrayInt(PyObject *pyMap, std::map PyObject *MEDFileField1TS_getFieldWithProfile(const typename MLFieldTraits::F1TSType *self, TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) { - DataArrayInt *ret1(NULL); + DataArrayIdType *ret1(NULL); typename MEDCoupling::Traits::ArrayType *ret0(self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1)); PyObject *ret(PyTuple_New(2)); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } template PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTraits::F1TSType *self) { - std::vector< std::pair,std::pair > > elt1Cpp; + std::vector< std::pair,std::pair > > elt1Cpp; typename MEDCoupling::Traits::ArrayType *elt0=self->getUndergroundDataArrayExt(elt1Cpp); if(elt0) elt0->incrRef(); @@ -431,8 +432,8 @@ PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTrait PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first)); PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second)); PyObject *elt3=PyTuple_New(2); - PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first)); - PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second)); + PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first)); + PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second)); PyTuple_SetItem(elt1,0,elt2); PyTuple_SetItem(elt1,1,elt3); PyList_SetItem(elt,i,elt1); diff --git a/src/MEDPartitioner/CMakeLists.txt b/src/MEDPartitioner/CMakeLists.txt index 9f27daa16..41eceb565 100644 --- a/src/MEDPartitioner/CMakeLists.txt +++ b/src/MEDPartitioner/CMakeLists.txt @@ -19,6 +19,10 @@ ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${LIBXML2_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${LIBXML2_INCLUDE_DIR} ${MEDFILE_INCLUDE_DIRS} diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx index 551bb0fa5..870fd4f0f 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -39,7 +39,7 @@ MEDPARTITIONER::ConnectZone::ConnectZone(): MEDPARTITIONER::ConnectZone::~ConnectZone() { - for(std::map < std::pair ,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++) + for(std::map < std::pair ,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++) { iter->second->decrRef(); } @@ -88,9 +88,9 @@ MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getDistantMesh() const return _distant_mesh; } -bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(int localEntity, int distantEntity) const +bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(mcIdType localEntity, mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for(map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) @@ -139,10 +139,10 @@ const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getFaceCorresp() co return _face_corresp; } -const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity, - int distantEntity) const +const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { @@ -152,10 +152,10 @@ const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEnti return 0; } -const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity, - int distantEntity) const +const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { @@ -165,10 +165,10 @@ const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEnti return 0; } -mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, - int distantEntity) const +mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { @@ -178,10 +178,10 @@ mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, return 0; } -mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity, - int distantEntity) const +mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { @@ -192,9 +192,9 @@ mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity, } const MEDCouplingSkyLineArray * -MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity) const +MEDPARTITIONER::ConnectZone::getEntityCorresp(mcIdType localEntity, mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { @@ -204,11 +204,11 @@ MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity return 0; } -std::vector< std::pair< int,int > > MEDPARTITIONER::ConnectZone::getEntities() const +std::vector< std::pair< mcIdType,mcIdType > > MEDPARTITIONER::ConnectZone::getEntities() const { - std::vector< std::pair< int,int > > types; + std::vector< std::pair< mcIdType,mcIdType > > types; - std::map, MEDCouplingSkyLineArray*>::const_iterator + std::map, MEDCouplingSkyLineArray*>::const_iterator iter = _entity_corresp.begin(); for ( ; iter != _entity_corresp.end(); iter++) { @@ -333,7 +333,7 @@ void MEDPARTITIONER::ConnectZone::setEntityCorresp(mcIdType localEntity, mcIdTyp MEDCouplingSkyLineArray *array) { MEDCouplingSkyLineArray * nullArray = 0; - std::map < std::pair , MEDCouplingSkyLineArray * >::iterator it; + std::map < std::pair , MEDCouplingSkyLineArray * >::iterator it; it = _entity_corresp.insert ( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first; if ( it->second != nullArray ) it->second->decrRef(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx index eaa9ca22c..6cf3eff68 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx @@ -52,7 +52,7 @@ namespace MEDPARTITIONER MEDCouplingUMesh *getLocalMesh() const ; MEDCouplingUMesh *getDistantMesh() const ; - bool isEntityCorrespPresent(int localEntity,int distantEntity) const; + bool isEntityCorrespPresent(mcIdType localEntity,mcIdType distantEntity) const; const mcIdType *getNodeCorrespIndex() const; const mcIdType *getNodeCorrespValue() const; mcIdType getNodeNumber() const; @@ -61,17 +61,17 @@ namespace MEDPARTITIONER const mcIdType *getFaceCorrespValue() const; mcIdType getFaceNumber() const; const MEDCouplingSkyLineArray * getFaceCorresp() const; - const mcIdType *getEntityCorrespIndex(int localEntity, - int distantEntity) const; - const mcIdType *getEntityCorrespValue(int localEntity, - int distantEntity) const; - mcIdType getEntityCorrespNumber(int localEntity, - int distantEntity) const; - mcIdType getEntityCorrespLength(int localEntity, - int distantEntity) const; - const MEDCouplingSkyLineArray * getEntityCorresp(int localEntity, - int distantEntity) const; - std::vector< std::pair< int,int > > getEntities() const; + const mcIdType *getEntityCorrespIndex(mcIdType localEntity, + mcIdType distantEntity) const; + const mcIdType *getEntityCorrespValue(mcIdType localEntity, + mcIdType distantEntity) const; + mcIdType getEntityCorrespNumber(mcIdType localEntity, + mcIdType distantEntity) const; + mcIdType getEntityCorrespLength(mcIdType localEntity, + mcIdType distantEntity) const; + const MEDCouplingSkyLineArray * getEntityCorresp(mcIdType localEntity, + mcIdType distantEntity) const; + std::vector< std::pair< mcIdType,mcIdType > > getEntities() const; void setName(const std::string& name) ; void setDescription(const std::string& description) ; @@ -100,7 +100,7 @@ namespace MEDPARTITIONER MCAuto _node_corresp; MCAuto _face_corresp; - std::map < std::pair , MEDCouplingSkyLineArray * > _entity_corresp; + std::map < std::pair , MEDCouplingSkyLineArray * > _entity_corresp; }; } # endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 09a9f3830..17df2fc01 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -50,7 +50,7 @@ namespace MEDPARTITIONER for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom ) domains.insert( *dom ); } - return domains.size(); + return (int)domains.size(); } const mcIdType *Graph::getPart() const diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx index 9e02fd968..36aa24052 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx @@ -50,9 +50,9 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() int nbproc=_domain_selector->nbProcs(); std::vector bbtree(nbdomain,(BBTreeOfDim*) 0); std::vector bbxi(nbdomain,(double*) 0); - std::vector rev(nbdomain,(MEDCoupling::DataArrayInt*) 0); - std::vector revIndx(nbdomain,(MEDCoupling::DataArrayInt*) 0); - int meshDim=-1; + std::vector rev(nbdomain,(MEDCoupling::DataArrayIdType*) 0); + std::vector revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) 0); + //int meshDim=-1; int spaceDim=-1; //init rev and revIndx and bbtree for my domain (of me:proc n) @@ -61,10 +61,10 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() if(!_domain_selector->isMyDomain(mydomain)) continue; const MEDCoupling::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain); - meshDim = myMesh->getMeshDimension(); + //meshDim = myMesh->getMeshDimension(); spaceDim= myMesh->getSpaceDimension(); - rev[mydomain] = MEDCoupling::DataArrayInt::New(); - revIndx[mydomain] = MEDCoupling::DataArrayInt::New(); + rev[mydomain] = MEDCoupling::DataArrayIdType::New(); + revIndx[mydomain] = MEDCoupling::DataArrayIdType::New(); myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]); double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()]; for (int i=0; igetNumberOfNodes()*spaceDim; i++) @@ -97,7 +97,7 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() SendDoubleVec(vec,targetProc); //retrieving target data for storage in commonDistantNodes array - std::vector localCorrespondency; + std::vector localCorrespondency; RecvIntVec(localCorrespondency, targetProc); for (std::size_t i=0; i recvVec; RecvDoubleVec(recvVec,sourceProc); - std::map commonNodes; // (local nodes, distant nodes) list - for (int inode=0; inode<(recvVec.size()/spaceDim); inode++) + std::map commonNodes; // (local nodes, distant nodes) list + for (mcIdType inode=0; inode inodes; + std::vector inodes; bbtree[itarget]->getIntersectingElems(bbox,inodes); delete [] bbox; @@ -131,16 +131,16 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() } } - std::vector nodeCellCorrespondency; - for (std::map::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) + std::vector nodeCellCorrespondency; + for (std::map::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) { _node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector - const int* revIndxPtr=revIndx[itarget]->getConstPointer(); - const int* revPtr=rev[itarget]->getConstPointer(); - for (int icell=revIndxPtr[iter->first]; icellfirst+1]; icell++) + const mcIdType* revIndxPtr=revIndx[itarget]->getConstPointer(); + const mcIdType* revPtr=rev[itarget]->getConstPointer(); + for (mcIdType icell=revIndxPtr[iter->first]; icellfirst+1]; icell++) { nodeCellCorrespondency.push_back(iter->second); // - int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); + mcIdType globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); nodeCellCorrespondency.push_back(globalCell); } } @@ -166,12 +166,12 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() std::cout << "proc " << _domain_selector->rank() << " : end JointFinder::findCommonDistantNodes" << std::endl; } -std::vector > >& MEDPARTITIONER::JointFinder::getDistantNodeCell() +std::vector > >& MEDPARTITIONER::JointFinder::getDistantNodeCell() { return _distant_node_cell; } -std::vector > > >& MEDPARTITIONER::JointFinder::getNodeNode() +std::vector > > >& MEDPARTITIONER::JointFinder::getNodeNode() { return _node_node; } @@ -200,7 +200,7 @@ void MEDPARTITIONER::JointFinder::print() { for (int itarget=0; itarget::iterator it; + std::multimap::iterator it; for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++) { std::cout << " nc" << _domain_selector->rank() << "|" << itarget << "|" << isource << "|" << (*it).first << "=" << (*it).second; diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx index a83d3449a..ed51e926c 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx @@ -21,6 +21,7 @@ #define __MEDPARTITIONER_JOINTFINDER_HXX__ #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include #include @@ -38,14 +39,14 @@ namespace MEDPARTITIONER ~JointFinder(); void findCommonDistantNodes(); void print(); - std::vector > >& getDistantNodeCell(); - std::vector > > >& getNodeNode(); + std::vector > >& getDistantNodeCell(); + std::vector > > >& getNodeNode(); private: const MeshCollection& _mesh_collection; const ParaDomainSelector *_domain_selector; const Topology *_topology; - std::vector > > _distant_node_cell; - std::vector > > > _node_node; + std::vector > > _distant_node_cell; + std::vector > > > _node_node; }; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 6977da292..bbaba7b05 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -175,7 +175,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection castAllFields(initialCollection,"cellFieldDouble"); if (_i_non_empty_mesh<0) { - for (size_t i=0; i<_mesh.size(); i++) + for (int i=0; iisMyDomain(iold)) { - int size=(initialCollection._mesh)[iold]->getNumberOfCells(); - std::vector globalids(size); + mcIdType size=(initialCollection._mesh)[iold]->getNumberOfCells(); + std::vector globalids(size); initialCollection.getTopology()->getCellList(iold, &globalids[0]); - std::vector ilocalnew(size); //local + std::vector ilocalnew(size); //local std::vector ipnew(size); //idomain old _topology->convertGlobalCellList(&globalids[0],size,&ilocalnew[0],&ipnew[0]); @@ -336,8 +336,8 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC // std::map >, int > nodeClassifier; MEDCoupling::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords(); double* coordsPtr=coords->getPointer(); - dim = coords->getNumberOfComponents(); - int nvertices=initialCollection.getMesh(iold)->getNumberOfNodes(); + dim = (int)coords->getNumberOfComponents(); + mcIdType nvertices=initialCollection.getMesh(iold)->getNumberOfNodes(); bbox=new double[nvertices*2*dim]; for (int i=0; igetNumberOfNodes();inode++) { double* coordsPtr=coords->getPointer()+inode*dim; - vector elems; + vector elems; tree->getElementsAroundPoint(coordsPtr,elems); if (elems.size()==0) continue; nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode))); @@ -378,7 +378,7 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC for (int inode=0; inode<_mesh[inew]->getNumberOfNodes();inode++) { double* coordsPtr=coords->getPointer()+inode*dim; - vector elems; + vector elems; tree->getElementsAroundPoint(coordsPtr,elems); if (elems.size()==0) continue; nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode))); @@ -394,16 +394,16 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC } -void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector& nodeIds) +void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector& nodeIds) { using std::vector; using MEDPARTITIONER::BBTreeOfDim; //if (!&meshOne || !&meshTwo) return; //empty or not existing double* bbox; BBTreeOfDim* tree = 0; - int nv1=meshOne.getNumberOfNodes(); + mcIdType nv1=meshOne.getNumberOfNodes(); MEDCoupling::DataArrayDouble* coords=meshOne.getCoords(); - int dim = coords->getNumberOfComponents(); + int dim = (int)coords->getNumberOfComponents(); bbox=new double[nv1*2*dim]; double* coordsPtr=coords->getPointer(); @@ -414,13 +414,13 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling } tree=new BBTreeOfDim( dim, bbox,0,0,nv1,1e-9); - int nv2=meshTwo.getNumberOfNodes(); + mcIdType nv2=meshTwo.getNumberOfNodes(); nodeIds.resize(nv2,-1); coords=meshTwo.getCoords(); for (int inode=0; inodegetPointer()+inode*dim; - vector elems; + vector elems; tree->getElementsAroundPoint(coordsPtr2,elems); if (elems.size()==0) continue; nodeIds[inode]=elems[0]; @@ -434,7 +434,7 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling faces at the interface are duplicated */ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialCollection, - const std::multimap, std::pair >& nodeMapping, + const std::multimap, std::pair >& nodeMapping, std::vector > >& new2oldIds) { //splitMeshes structure will contain the partition of @@ -489,12 +489,12 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle //initial face mesh known : in my domain if (meshesCastFrom[iold] != 0) { - for (int ielem=0; ielemgetNumberOfCells(); ielem++) + for (mcIdType ielem=0; ielemgetNumberOfCells(); ielem++) { vector nodes; meshesCastFrom[iold]->getNodeIdsOfCell(ielem,nodes); - map faces; + map faces; //analysis of element ielem //counters are set for the element @@ -502,10 +502,10 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle //are incremented for each target node //the face is considered as going to target domains if the counter of the domain //is equal to the number of nodes - for (int inode=0; inode<(int)nodes.size(); inode++) + for (std::size_t inode=0; inode,pair >::const_iterator MI; - int mynode=nodes[inode]; + typedef multimap,pair >::const_iterator MI; + mcIdType mynode=nodes[inode]; pair myRange = nodeMapping.equal_range(make_pair(iold,mynode)); for (MI iter=myRange.first; iter!=myRange.second; iter++) @@ -518,9 +518,9 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle } } - for (map::iterator iter=faces.begin(); iter!=faces.end(); iter++) + for (map::iterator iter=faces.begin(); iter!=faces.end(); iter++) { - if (iter->second==(int)nodes.size()) + if (iter->second==ToIdType(nodes.size())) //cvw eligible but may be have to be face of a cell of this->getMesh()[inew]? //it is not sure here... //done before writeMedfile on option?... see filterFaceOnCell() @@ -640,8 +640,8 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vector acceleratingStructures(ioldMax); std::vectorbbox(ioldMax); - for (int iold =0; iold< ioldMax; iold++) + for (unsigned int iold =0; iold< ioldMax; iold++) if (isParallelMode() && _domain_selector->isMyDomain(iold)) { MEDCoupling::DataArrayDouble* sourceCoords=meshesCastFrom[iold]->computeCellCenterOfMass(); @@ -659,9 +659,9 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold) && !_domain_selector->isMyDomain(inew)) @@ -669,8 +669,8 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorsendMesh(*meshesCastFrom[iold],_domain_selector->getProcessorID(inew)); //send vector - int size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1! - vectorsendIds; + mcIdType size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1! + vector sendIds; if (MyGlobals::_Verbose>400) std::cout<<"proc "<<_domain_selector->rank()<<" : castIntField SendIntVec size "<0) //no empty { @@ -688,7 +688,7 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold) && _domain_selector->isMyDomain(inew)) { //receive mesh - vector recvIds; + vector recvIds; MEDCoupling::MEDCouplingUMesh* recvMesh; _domain_selector->recvMesh(recvMesh,_domain_selector->getProcessorID(iold)); //receive vector @@ -701,16 +701,16 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold) && _domain_selector->isMyDomain(inew))) { remapIntField(inew,iold,*meshesCastFrom[iold],*meshesCastTo[inew],arrayFrom[iold]->getConstPointer(),nameArrayTo,acceleratingStructures[iold]); } } - for (int iold=0; ioldisMyDomain(iold)) { bbox[iold]->decrRef(); @@ -742,7 +742,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, const BBTreeOfDim* tree; bool cleantree=false; MEDCoupling::DataArrayDouble* sourceBBox=0; - int dim = targetCoords->getNumberOfComponents(); + int dim = (int)targetCoords->getNumberOfComponents(); if (myTree==0) { sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8); @@ -766,16 +766,16 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, toArray=_map_dataarray_int.find(cle)->second->getPointer(); } - std::map< int, int > isource2nb; // count coincident elements - std::map::iterator i2nb; + std::map< mcIdType, int > isource2nb; // count coincident elements + std::map< mcIdType, int>::iterator i2nb; - for (int itargetnode=0; itargetnode intersectingElems; + std::vector intersectingElems; tree->getElementsAroundPoint(tc+itargetnode*dim,intersectingElems); if (intersectingElems.size()!=0) { - int isourcenode=intersectingElems[0]; + mcIdType isourcenode=intersectingElems[0]; if ( intersectingElems.size() > 1 ) { i2nb = isource2nb.insert( std::make_pair( isourcenode, 0 )).first; @@ -810,21 +810,21 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec std::string nameTo="typeData=6"; //resume the type of field casted // send-recv operations - int ioldMax=initialCollection.getMesh().size(); - int inewMax=this->getMesh().size(); - int iFieldMax=initialCollection.getFieldDescriptions().size(); + std::size_t ioldMax=initialCollection.getMesh().size(); + std::size_t inewMax=this->getMesh().size(); + std::size_t iFieldMax=initialCollection.getFieldDescriptions().size(); if (MyGlobals::_Verbose>10) std::cout << "castAllFields with:\n" << ReprVectorOfString(initialCollection.getFieldDescriptions()) << std::endl; //see collection.prepareFieldDescriptions() - for (int ifield=0; ifieldisMyDomain(iold) && !_domain_selector->isMyDomain(inew)) @@ -849,9 +849,9 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec } #endif //local contributions and aggregation - for (int inew=0; inewisMyDomain(iold) && _domain_selector->isMyDomain(inew))) { MEDCoupling::DataArrayDouble* field=initialCollection.getField(descriptionField,iold); @@ -890,9 +890,9 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, std::string tag="inewFieldDouble="+IntToStr(inew); key=descriptionField+SerializeFromString(tag); - int fromArrayNbOfElem=fromArray->getNbOfElems(); - int fromArrayNbOfComp=fromArray->getNumberOfComponents(); - int fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss; + mcIdType fromArrayNbOfElem=fromArray->getNbOfElems(); + mcIdType fromArrayNbOfComp=ToIdType(fromArray->getNumberOfComponents()); + mcIdType fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss; if (MyGlobals::_Verbose>1000) { @@ -937,16 +937,16 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, mcIdType* pccI=ccI->getPointer(); double* pField=field->getPointer(); double* pFrom=fromArray->getPointer(); - int itarget, isource, delta=nbPtGauss*nbcomp; - for (int i=0; i=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell)) throw INTERP_KERNEL::Exception("Error field override"); - int ita=itarget*delta; - int iso=isource*delta; - for (int k=0; ksecond.first; - int node1 = nmIt1->second.second; + mcIdType node1 = nmIt1->second.second; for ( ; nmIt2 != nmEnd; ++nmIt2 ) { int dom2 = nmIt2->second.first; - int node2 = nmIt2->second.second; + mcIdType node2 = nmIt2->second.second; if ( dom1 != dom2 ) { nodeCorresp[ dom1 ][ dom2 ].push_back( node1 ); @@ -1121,7 +1121,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM czVec.push_back(cz); } - cz->setNodeCorresp( &corresp[0], corresp.size()/2 ); + cz->setNodeCorresp( &corresp[0], ToIdType( corresp.size()/2 )); } } @@ -1288,12 +1288,12 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() using MEDCoupling::DataArrayInt; std::vector& faceMeshes = getFaceMesh(); - int nbMeshes = faceMeshes.size(); + std::size_t nbMeshes = faceMeshes.size(); //preparing bounding box trees for accelerating search of coincident faces std::vector bbTrees(nbMeshes); std::vectorbbox (nbMeshes); - for (int inew = 0; inew < nbMeshes-1; inew++) + for (unsigned int inew = 0; inew < nbMeshes-1; inew++) if ( !isParallelMode() || _domain_selector->isMyDomain(inew) ) { DataArrayDouble* bcCoords = faceMeshes[inew]->computeCellCenterOfMass(); @@ -1305,9 +1305,9 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() } // loop on domains to find joint faces between them - for (int inew1 = 0; inew1 < nbMeshes; inew1++ ) + for (unsigned int inew1 = 0; inew1 < nbMeshes; inew1++ ) { - for (int inew2 = inew1+1; inew2 < nbMeshes; inew2++ ) + for (unsigned int inew2 = inew1+1; inew2 < nbMeshes; inew2++ ) { MEDCouplingUMesh* mesh1 = 0; MEDCouplingUMesh* mesh2 = 0; @@ -1338,22 +1338,22 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() if ( mesh2Here && !mesh2 ) mesh2 = faceMeshes[ inew2 ]; // find coincident faces - std::vector< int > faces1, faces2; + std::vector< mcIdType > faces1, faces2; if ( mesh1 && mesh2 ) { const DataArrayDouble* coords2 = mesh2->computeCellCenterOfMass(); - const double* c2 = coords2->getConstPointer(); - const int dim = coords2->getNumberOfComponents(); - const int nbFaces2 = mesh2->getNumberOfCells(); - const int nbFaces1 = mesh1->getNumberOfCells(); + const double* c2 = coords2->getConstPointer(); + const std::size_t dim = coords2->getNumberOfComponents(); + const mcIdType nbFaces2 = mesh2->getNumberOfCells(); + const mcIdType nbFaces1 = mesh1->getNumberOfCells(); - for (int i2 = 0; i2 < nbFaces2; i2++) + for (mcIdType i2 = 0; i2 < nbFaces2; i2++) { - std::vector coincFaces; + std::vector coincFaces; bbTrees[inew1]->getElementsAroundPoint( c2+i2*dim, coincFaces ); if (coincFaces.size()!=0) { - int i1 = coincFaces[0]; + mcIdType i1 = coincFaces[0]; // if ( coincFaces.size() > 1 ) // { // i2nb = isource2nb.insert( std::make_pair( i1 , 0 )).first; @@ -1399,7 +1399,7 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() // delete bounding box trees - for (int inew = 0; inew < nbMeshes-1; inew++) + for (unsigned int inew = 0; inew < nbMeshes-1; inew++) if (isParallelMode() && _domain_selector->isMyDomain(inew)) { bbox[inew]->decrRef(); @@ -1417,7 +1417,7 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() */ //================================================================================ -void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& faces, +void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< mcIdType >& faces, const int inew1, const int inew2, const bool is2nd ) @@ -1464,7 +1464,7 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& // remove faces from the familyID-the family if ( familyID != 0 && famIDs ) - for ( int i = 0; i < totalNbFaces; ++i ) + for ( mcIdType i = 0; i < totalNbFaces; ++i ) if ( famIDs[i] == familyID ) famIDs[i] = 0; @@ -1535,7 +1535,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename) throw INTERP_KERNEL::Exception("file does not comply with any recognized format"); } } - for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain ) + for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain ) if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 ) _i_non_empty_mesh = idomain; } @@ -1654,7 +1654,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para } } // find non-empty domain mesh - for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain ) + for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain ) if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 ) _i_non_empty_mesh = idomain; @@ -1733,18 +1733,18 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, cons MEDPARTITIONER::MeshCollection::~MeshCollection() { - for (int i=0; i<(int)_mesh.size();i++) + for (std::size_t i=0; i<_mesh.size();i++) if (_mesh[i]!=0) _mesh[i]->decrRef(); - for (int i=0; i<(int)_cell_family_ids.size();i++) + for (std::size_t i=0; i<_cell_family_ids.size();i++) if (_cell_family_ids[i]!=0) _cell_family_ids[i]->decrRef(); - for (int i=0; i<(int)_face_mesh.size();i++) + for (std::size_t i=0; i<_face_mesh.size();i++) if (_face_mesh[i]!=0) _face_mesh[i]->decrRef(); - for (int i=0; i<(int)_face_family_ids.size();i++) + for (std::size_t i=0; i<_face_family_ids.size();i++) if (_face_family_ids[i]!=0) _face_family_ids[i]->decrRef(); @@ -1830,9 +1830,9 @@ int MEDPARTITIONER::MeshCollection::getNbOfLocalMeshes() const return nb; } -int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const +mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const { - int nb=0; + mcIdType nb=0; for (size_t i=0; i<_mesh.size(); i++) { if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells(); @@ -1840,9 +1840,9 @@ int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const return nb; } -int MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const +mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const { - int nb=0; + mcIdType nb=0; for (size_t i=0; i<_face_mesh.size(); i++) { if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells(); @@ -1940,11 +1940,11 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup using std::make_pair; using std::pair; - std::multimap< int, int > node2cell; - std::map< pair, int > cell2cellcounter; - std::multimap cell2cell; + std::multimap< mcIdType, mcIdType > node2cell; + std::map< pair, mcIdType > cell2cellcounter; + std::multimap cell2cell; - std::vector > > commonDistantNodes; + std::vector > > commonDistantNodes; int nbdomain=_topology->nbDomain(); #ifdef HAVE_MPI if (isParallelMode()) @@ -1970,14 +1970,14 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New(); MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New(); - int nbNodes=_mesh[idomain]->getNumberOfNodes(); + mcIdType nbNodes=_mesh[idomain]->getNumberOfNodes(); _mesh[idomain]->getReverseNodalConnectivity(revConn,index); //problem saturation over 1 000 000 nodes for 1 proc if (MyGlobals::_Verbose>100) std::cout << "proc " << MyGlobals::_Rank << " : getReverseNodalConnectivity done on " << nbNodes << " nodes" << std::endl; mcIdType* index_ptr=index->getPointer(); mcIdType* revConnPtr=revConn->getPointer(); - for (int i=0; i::iterator it; + std::multimap::iterator it; int isource=idomain; int itarget=iother; for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin(); it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++) { - int globalNode=_topology->convertNodeToGlobal(idomain,(*it).first); - int globalCell=(*it).second; + mcIdType globalNode=_topology->convertNodeToGlobal(idomain,(*it).first); + mcIdType globalCell=(*it).second; node2cell.insert(make_pair(globalNode, globalCell)); } } @@ -2018,32 +2018,32 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup if (MyGlobals::_Verbose>50) std::cout<< "proc " << MyGlobals::_Rank << " : creating graph arcs on nbNodes " << _topology->nbNodes() << std::endl; - for (int inode=0;inode<_topology->nbNodes();inode++) + for (mcIdType inode=0;inode<_topology->nbNodes();inode++) { - typedef multimap::const_iterator MI; + typedef multimap::const_iterator MI; std::pair nodeRange=node2cell.equal_range(inode); for (MI cell1=nodeRange.first;cell1!=nodeRange.second;cell1++) for (MI cell2=nodeRange.first;cell2!=cell1;cell2++) { - int icell1=cell1->second; - int icell2=cell2->second; - if (icell1>icell2) {int tmp=icell1; icell1=icell2; icell2=tmp;} - std::map,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); + mcIdType icell1=cell1->second; + mcIdType icell2=cell2->second; + if (icell1>icell2) std::swap(icell1,icell2); + std::map,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1)); else (it->second)++; } } - // for (int icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes + // for (mcIdType icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes // { - // typedef multimap::const_iterator MI; + // typedef multimap::const_iterator MI; // std::pair nodeRange=cell2node.equal_range(icell1); // for (MI node1=nodeRange.first; node1!=nodeRange.second; node1++) //on nodes with icell // { // std::pair cellRange=node2cell.equal_range(node1->second); // for (MI cell2=cellRange.first; cell2!=cellRange.second; cell2++) //on one of these cell // { - // int icell2=cell2->second; - // std::map,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); + // mcIdType icell2=cell2->second; + // std::map,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); // if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1)); // else (it->second)++; // } @@ -2052,7 +2052,7 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup //converting the counter to a multimap structure - for (std::map,int>::const_iterator it=cell2cellcounter.begin(); + for (std::map,mcIdType>::const_iterator it=cell2cellcounter.begin(); it!=cell2cellcounter.end(); it++) if (it->second>=meshDim) @@ -2067,23 +2067,23 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup //filling up index and value to create skylinearray structure std::vector index,value; index.push_back(0); - int idep=0; + mcIdType idep=0; for (int idomain=0; idomainisMyDomain(idomain)) continue; - int nbCells=_mesh[idomain]->getNumberOfCells(); - for (int icell=0; icellgetNumberOfCells(); + for (mcIdType icell=0; icellconvertCellToGlobal(idomain,icell); - multimap::iterator it; - pair::iterator,multimap::iterator> ret; + mcIdType size=0; + mcIdType globalCell=_topology->convertCellToGlobal(idomain,icell); + multimap::iterator it; + pair::iterator,multimap::iterator> ret; ret=cell2cell.equal_range(globalCell); for (it=ret.first; it!=ret.second; ++it) { - int ival=(*it).second; //no adding one existing yet - for (int i=idep ; irank() << " : end MeshCollection::buildCellGraph " << index.size()-1 << " " << value.size() << std::endl; - int max=index.size()>15?15:index.size(); + std::size_t max=index.size()>15?15:index.size(); if (index.size()>1) { - for (int i=0; i domains; - for (int i=0; i<_topology->nbCells(); i++) + for (mcIdType i=0; i<_topology->nbCells(); i++) { domains.insert(partition[i]); } @@ -2232,7 +2232,7 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const //cellGraph is a shared pointer Topology *topology=0; - int nbdomain=domains.size(); + int nbdomain=(int)domains.size(); topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension()); // if (array!=0) delete array; delete cellGraph; @@ -2293,22 +2293,22 @@ void MEDPARTITIONER::MeshCollection::prepareFieldDescriptions() //to have unique valid fields names/pointers/descriptions for partitionning //filter _field_descriptions to be in all procs compliant and equal { - int nbfiles=MyGlobals::_File_Names.size(); //nb domains + std::size_t nbfiles=MyGlobals::_File_Names.size(); //nb domains if (nbfiles==0) { nbfiles=_topology->nbDomain(); } std::vector r2; //from allgatherv then vector(procs) of serialised vector(fields) of vector(description) data - for (int i=0; i<(int)_field_descriptions.size(); i++) + for (std::size_t i=0; i<_field_descriptions.size(); i++) { std::vector r1=DeserializeToVectorOfString(_field_descriptions[i]); - for (int ii=0; ii<(int)r1.size(); ii++) + for (std::size_t ii=0; ii& inodesFace, std::vector< mcIdType >& inodesCell) { - int ires=0; - int nbok=inodesFace.size(); - for (int i=0; i nodeIds; + std::vector nodeIds; getNodeIds(*mcel, *mfac, nodeIds); if (nodeIds.size()==0) continue; //one empty mesh nothing to do @@ -2386,7 +2386,7 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() bool ok; std::vector< mcIdType > inodesFace; mfac->getNodeIdsOfCell(iface, inodesFace); - int nbnodFace=inodesFace.size(); + mcIdType nbnodFace=ToIdType(inodesFace.size()); if ( nbnodFace != mfac->getNumberOfNodesInCell( iface )) continue; // invalid node ids //set inodesFace in mcel @@ -2395,14 +2395,14 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() nbok += (( inodesFace[i]=nodeIds[inodesFace[i]] ) >= 0 ); if ( nbok != nbnodFace ) continue; - int inod=inodesFace[0]; + mcIdType inod=inodesFace[0]; if (inod<0) { std::cout << "filterFaceOnCell problem 1" << std::endl; continue; } - int nbcell=revIndxC[inod+1]-revIndxC[inod]; - for (int j=0; j inodesCell; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx index 06e80d048..8d24d8a97 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx @@ -46,7 +46,7 @@ namespace MEDPARTITIONER class JointFinder; typedef enum{MedAscii, MedXml, Undefined} DriverType; - typedef std::multimap, std::pair > NodeMapping ; + typedef std::multimap, std::pair > NodeMapping ; typedef std::vector > NodeList; class MEDPARTITIONER_EXPORT MeshCollection @@ -82,14 +82,14 @@ namespace MEDPARTITIONER const std::string& ="", int* edgeweights=0, int* verticesweights=0); //creation of a user specified partition - Topology* createPartition(const mcIdType* partition); + Topology* createPartition(const int* partition); //getting mesh dimension int getMeshDimension() const; int getNbOfLocalMeshes() const; - int getNbOfGlobalMeshes() const { return _mesh.size(); } - int getNbOfLocalCells() const; - int getNbOfLocalFaces() const; + int getNbOfGlobalMeshes() const { return (int)_mesh.size(); } + mcIdType getNbOfLocalCells() const; + mcIdType getNbOfLocalFaces() const; //getting a reference to mesh vector std::vector& getMesh(); @@ -138,7 +138,7 @@ namespace MEDPARTITIONER //creates the node mapping between an old collection and the present one void createNodeMapping(MeshCollection& initialCollection, - std::multimap,std::pair >& nodeMapping); + std::multimap,std::pair >& nodeMapping); void castCellMeshes(MeshCollection& initialCollection, std::vector > >& new2oldIds, @@ -146,7 +146,7 @@ namespace MEDPARTITIONER //creates faces on the new collection void castFaceMeshes(MeshCollection& initialCollection, - const std::multimap, std::pair >& nodeMapping, + const std::multimap, std::pair >& nodeMapping, std::vector > >& new2oldIds); //constructing connect zones @@ -166,7 +166,7 @@ namespace MEDPARTITIONER void castAllFields(MeshCollection& initialCollection, std::string nameArrayTo); - void findCommonDistantNodes(std::vector > >& commonDistantNodes); + void findCommonDistantNodes(std::vector > >& commonDistantNodes); void remapIntField(int inew, int iold, @@ -181,7 +181,7 @@ namespace MEDPARTITIONER std::string nameArrayTo, std::string descriptionField); - void createJointGroup( const std::vector< int >& faces, + void createJointGroup( const std::vector< mcIdType >& faces, const int inew1, const int inew2, const bool is2nd ); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index 1f7c80041..2e6ec0e46 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -304,7 +304,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const j1st->pushCorrespondence( corr ); } - std::vector< std::pair< int,int > > types = cz->getEntities(); + std::vector< std::pair< mcIdType,mcIdType > > types = cz->getEntities(); INTERP_KERNEL::NormalizedCellType t1, t2; for ( size_t it = 0; it < types.size(); ++it ) { @@ -371,7 +371,7 @@ MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); if (nbc==da->getNumberOfComponents()) { - for (std::size_t i=0; isetInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"=")); } else @@ -429,7 +429,7 @@ MEDCoupling::MEDFileData* MeshCollectionDriver::getMEDFileData() meshes = MEDCoupling::MEDFileMeshes::New(); fields = MEDCoupling::MEDFileFields::New(); - for (size_t i=0; i<_collection->getMesh().size(); i++) + for (unsigned int i=0; i<_collection->getMesh().size(); i++) { MEDCoupling::MEDFileMesh* mfm = getMesh( i ); meshes->pushMesh(mfm); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx index 3da899e5f..0fd977b06 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx @@ -58,14 +58,14 @@ int MeshCollectionMedAsciiDriver::read(MEDCoupling::MEDFileData* filedata) readMEDFileData(filedata); std::vector cz; // to fill from filedata - std::vector cellglobal; - std::vector nodeglobal; - std::vector faceglobal; - int size = (_collection->getMesh()).size(); + std::vector cellglobal; + std::vector nodeglobal; + std::vector faceglobal; + std::size_t size = _collection->getMesh().size(); cellglobal.resize(size); nodeglobal.resize(size); faceglobal.resize(size); - for ( int idomain = 0; idomain < size; ++idomain ) + for ( unsigned int idomain = 0; idomain < size; ++idomain ) { cellglobal[idomain]=0; faceglobal[idomain]=0; @@ -90,9 +90,9 @@ int MeshCollectionMedAsciiDriver::read(MEDCoupling::MEDFileData* filedata) int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* domainSelector) { //distributed meshes - std::vector cellglobal; - std::vector nodeglobal; - std::vector faceglobal; + std::vector cellglobal; + std::vector nodeglobal; + std::vector faceglobal; int nbdomain; //reading ascii master file @@ -168,12 +168,12 @@ int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* */ void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const { - int nbdomains=_collection->getMesh().size(); + std::size_t nbdomains=_collection->getMesh().size(); std::vector filenames; filenames.resize(nbdomains); //loop on the domains - for (int idomain=0; idomaingetMesh().size() << " " << std::endl; - for (int idomain=0; idomaingetName() <<" "<< idomain+1 << " " << (_collection->getMesh())[idomain]->getName() << " localhost " << filenames[idomain] << " "<< std::endl; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx index ba130e9b5..79a472764 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx @@ -242,7 +242,7 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0); xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str()); - int nbdomains= _collection->getMesh().size(); + int nbdomains= _collection->getNbOfGlobalMeshes(); //loop on the domains std::string finalMeshName=""; diff --git a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx index 9a2399394..3d44cb216 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_PTScotchGraph.cxx @@ -52,10 +52,17 @@ void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Pa std::cout << "proc " << MyGlobals::_Rank << " : PTSCOTCHGraph::partGraph" << std::endl; //number of graph vertices - int n = _graph->getNumberOf(); + int n = FromIdType(_graph->getNumberOf()); //graph +#ifdef MEDCOUPLING_USE_64BIT_IDS + std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); + std::vector valueVec( _graph->getValues(), _graph->getValuesArray()->end() ); + int * xadj=indexVec.data(); + int * adjncy=valueVec.data(); +#else int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValues()); +#endif //ndomain int nparts=ndomain; @@ -104,13 +111,13 @@ void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Pa SCOTCH_stratExit(&scotch_strategy); SCOTCH_dgraphExit(&scotch_graph); - std::vector index(n+1); - std::vector value(n); + std::vector index(n+1); + std::vector value(n); index[0]=0; for (int i=0; igetNumberOf(); + int n=FromIdType(_graph->getNumberOf()); //graph +#ifdef MEDCOUPLING_USE_64BIT_IDS + std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); + std::vector valueVec( _graph->getValues(), _graph->getValuesArray()->end() ); + int * xadj=indexVec.data(); + int * adjncy=valueVec.data(); +#else int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValues()); ++#endif //constraints int * vwgt=_cell_weight; int * adjwgt=_edge_weight; @@ -110,8 +117,8 @@ void ParMETISGraph::partGraph(int ndomain, MPI_Comm *comm); */ - vector index(n+1); - vector value(n); + vector index(n+1); + vector value(n); index[0]=0; if (ran.size()>0 && MyGlobals::_Atomize==0) //there is randomize { @@ -120,7 +127,7 @@ void ParMETISGraph::partGraph(int ndomain, for (int i=0; i #include #ifdef HAVE_MPI + #include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + #endif /*! @@ -137,8 +147,8 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbOf(const std::vector nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes + int nb_domains=(int)domain_meshes.size(); + std::vector nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes for (int i=0; igetNumberOfNodes(); } // receive nb of elems from other procs - std::vector all_nb_elems; + std::vector all_nb_elems; if (MyGlobals::_World_Size==1) { all_nb_elems=nb_elems; @@ -155,12 +165,12 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbOf(const std::vector1"); #endif } - int total_nb_cells=0, total_nb_nodes=0; + mcIdType total_nb_cells=0, total_nb_nodes=0; for (int i=0; i10) std::cout << "totalNbCells " << total_nb_cells << " totalNbNodes " << total_nb_nodes << std::endl; - std::vector& cell_shift_by_domain=_cell_shift_by_domain; - std::vector& node_shift_by_domain=_node_shift_by_domain; - std::vector& face_shift_by_domain=_face_shift_by_domain; + std::vector& cell_shift_by_domain=_cell_shift_by_domain; + std::vector& node_shift_by_domain=_node_shift_by_domain; + std::vector& face_shift_by_domain=_face_shift_by_domain; - std::vector< int > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains); + std::vector< mcIdType > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains); ordered_nbs_cell.push_back(0); ordered_nbs_node.push_back(0); for (int iproc=0; iproc(& _nb_vert_of_procs[0]); + return const_cast(& _nb_vert_of_procs[0]); } /*! @@ -252,7 +262,7 @@ int *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const * gatherNbOf() must be called before. * Result added to local id on given domain gives id in the whole distributed mesh */ -int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const { evaluateMemory(); if (_cell_shift_by_domain.empty()) @@ -260,7 +270,7 @@ int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) cons return _cell_shift_by_domain[domainIndex]; } -int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const { evaluateMemory(); if (_node_shift_by_domain.empty()) @@ -274,7 +284,7 @@ int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) cons * gatherNbOf() must be called before. * Result added to global id on this processor gives id in the whole distributed mesh */ -int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const +mcIdType MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const { evaluateMemory(); if (_nb_vert_of_procs.empty()) @@ -298,20 +308,21 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe std::vector index_size_of_proc( nbProcs() ); // index sizes - 1 for ( std::size_t i = 1; i < _nb_vert_of_procs.size(); ++i ) - index_size_of_proc[i-1] = _nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]; + index_size_of_proc[i-1] = FromIdType(_nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]); - int index_size = 1 + _cell_shift_by_domain.back(); - int *graph_index = new int[ index_size ]; - const int *index = graph->getGraph()->getIndex(); - int *proc_index_displacement = const_cast( & _nb_vert_of_procs[0] ); + mcIdType index_size = 1 + _cell_shift_by_domain.back(); + mcIdType *graph_index = new mcIdType[ index_size ]; + const mcIdType *index = graph->getGraph()->getIndex(); + MCAuto< DataArrayInt > nb_vert_of_procs = FromIdTypeVec( _nb_vert_of_procs ); + int *proc_index_displacement = nb_vert_of_procs->getPointer(); MPI_Allgatherv((void*) (index+1), // send local index except first 0 (or 1) index_size_of_proc[_rank], // index size on this proc - MPI_INT, + MPI_ID_TYPE, (void*) graph_index, // receive indices & index_size_of_proc[0], // index size on each proc proc_index_displacement, // displacement of each proc index - MPI_INT, + MPI_ID_TYPE, MPI_COMM_WORLD); graph_index[0] = index[0]; // it is not overwritten thanks to proc_index_displacement[0]==1 @@ -320,7 +331,7 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe for ( int i = 0; i < nbProcs(); ++i ) { if ( index_size_of_proc[i] > 0 ) - value_size_of_proc[i] = graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]; + value_size_of_proc[i] = (int)(graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]); else value_size_of_proc[i] = 0; proc_value_displacement.push_back( proc_value_displacement.back() + value_size_of_proc[i] ); @@ -329,7 +340,7 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe // update graph_index for ( int i = 1; i < nbProcs(); ++i ) { - int shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0]; + mcIdType shift = graph_index[ proc_index_displacement[i]-1 ]-graph_index[0]; for ( int j = proc_index_displacement[i]; j < proc_index_displacement[i+1]; ++j ) graph_index[ j ] += shift; } @@ -338,33 +349,33 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe // Gather values // -------------- - int value_size = graph_index[ index_size-1 ] - graph_index[ 0 ]; - int *graph_value = new int[ value_size ]; - const int *value = graph->getGraph()->getValues(); + mcIdType value_size = graph_index[ index_size-1 ] - graph_index[ 0 ]; + mcIdType *graph_value = new mcIdType[ value_size ]; + const mcIdType *value = graph->getGraph()->getValues(); MPI_Allgatherv((void*) value, // send local value value_size_of_proc[_rank], // value size on this proc - MPI_INT, + MPI_ID_TYPE, (void*) graph_value, // receive values & value_size_of_proc[0], // value size on each proc & proc_value_displacement[0], // displacement of each proc value - MPI_INT, + MPI_ID_TYPE, MPI_COMM_WORLD); // ----------------- // Gather partition // ----------------- - int * partition = new int[ _cell_shift_by_domain.back() ]; - const int* part = graph->getPart(); + mcIdType * partition = new mcIdType[ _cell_shift_by_domain.back() ]; + const mcIdType* part = graph->getPart(); MPI_Allgatherv((void*) part, // send local partition index_size_of_proc[_rank], // index size on this proc - MPI_INT, + MPI_ID_TYPE, (void*)(partition-1), // -1 compensates proc_index_displacement[0]==1 & index_size_of_proc[0], // index size on each proc proc_index_displacement, // displacement of each proc index - MPI_INT, + MPI_ID_TYPE, MPI_COMM_WORLD); // ----------- @@ -389,7 +400,7 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe /*! * \brief Set nb of cell/cell pairs in a joint between domains */ -void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ) +void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( mcIdType nb_cell_pairs, int dist_domain, int loc_domain ) { // This method is needed for further computing global numbers of faces in joint. // Store if both domains are on this proc else on one of procs only @@ -410,7 +421,7 @@ void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int */ //================================================================================ -int MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const { evaluateMemory(); @@ -430,12 +441,12 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbCellPairs() _nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0); evaluateMemory(); - std::vector< int > send_buf = _nb_cell_pairs_by_joint; + std::vector< mcIdType > send_buf = _nb_cell_pairs_by_joint; #ifdef HAVE_MPI MPI_Allreduce((void*)&send_buf[0], (void*)&_nb_cell_pairs_by_joint[0], - _nb_cell_pairs_by_joint.size(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + (int)_nb_cell_pairs_by_joint.size(), + MPI_ID_TYPE, MPI_SUM, MPI_COMM_WORLD); #endif // check that the set nbs of cell pairs are correct, // namely that each joint is treated on one proc only @@ -450,14 +461,14 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbCellPairs() */ //================================================================================ -int MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const { // total_nb_faces includes faces existing before creation of joint faces // (got in gatherNbOf( MED_FACE )). evaluateMemory(); - int total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back(); - int id = total_nb_faces + 1; + mcIdType total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back(); + mcIdType id = total_nb_faces + 1; if ( _nb_cell_pairs_by_joint.empty() ) throw INTERP_KERNEL::Exception("gatherNbCellPairs() must be called before"); @@ -482,8 +493,8 @@ int *MEDPARTITIONER::ParaDomainSelector::exchangeSubentityIds( int loc_domain, i int dest = getProcessorID( dist_domain ); int tag = 2002 + jointId( loc_domain, dist_domain ); MPI_Status status; - MPI_Sendrecv((void*)&loc_ids_here[0], loc_ids_here.size(), MPI_INT, dest, tag, - (void*) loc_ids_dist, loc_ids_here.size(), MPI_INT, dest, tag, + MPI_Sendrecv((void*)&loc_ids_here[0], (int)loc_ids_here.size(), MPI_INT, dest, tag, + (void*) loc_ids_dist, (int)loc_ids_here.size(), MPI_INT, dest, tag, MPI_COMM_WORLD, &status); #endif evaluateMemory(); @@ -539,36 +550,36 @@ void MEDPARTITIONER::ParaDomainSelector::sendMesh(const MEDCoupling::MEDCoupling std::cout << "proc " << _rank << " : sendMesh '" << mesh.getName() << "' size " << mesh.getNumberOfCells() << " to " << target << std::endl; // First stage : sending sizes // ------------------------------ - std::vector tinyInfoLocal; + std::vector tinyInfoLocal; std::vector tinyInfoLocalS; std::vector tinyInfoLocalD; //Getting tiny info of local mesh to allow the distant proc to initialize and allocate //the transmitted mesh. mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); tinyInfoLocal.push_back(mesh.getNumberOfCells()); - int tinySize=tinyInfoLocal.size(); + int tinySize=(int)tinyInfoLocal.size(); MPI_Send(&tinySize, 1, MPI_INT, target, 1113, MPI_COMM_WORLD); - MPI_Send(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, target, 1112, MPI_COMM_WORLD); + MPI_Send(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, target, 1112, MPI_COMM_WORLD); if (mesh.getNumberOfCells()>0) //no sends if empty { - MEDCoupling::DataArrayInt *v1Local=0; + MEDCoupling::DataArrayIdType *v1Local=0; MEDCoupling::DataArrayDouble *v2Local=0; //serialization of local mesh to send data to distant proc. mesh.serialize(v1Local,v2Local); int nbLocalElems=0; - int* ptLocal=0; + mcIdType* ptLocal=0; if(v1Local) //if empty getNbOfElems() is 1! { - nbLocalElems=v1Local->getNbOfElems(); // if empty be 1! + nbLocalElems=FromIdType(v1Local->getNbOfElems()); // if empty be 1! ptLocal=v1Local->getPointer(); } - MPI_Send(ptLocal, nbLocalElems, MPI_INT, target, 1111, MPI_COMM_WORLD); + MPI_Send(ptLocal, nbLocalElems, MPI_ID_TYPE, target, 1111, MPI_COMM_WORLD); int nbLocalElems2=0; double *ptLocal2=0; if(v2Local) //if empty be 0! { - nbLocalElems2=v2Local->getNbOfElems(); + nbLocalElems2=FromIdType(v2Local->getNbOfElems()); ptLocal2=v2Local->getPointer(); } MPI_Send(ptLocal2, nbLocalElems2, MPI_DOUBLE, target, 1110, MPI_COMM_WORLD); @@ -590,7 +601,7 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* #else // First stage : exchanging sizes // ------------------------------ - std::vector tinyInfoDistant; + std::vector tinyInfoDistant; std::vector tinyInfoLocalS; std::vector tinyInfoDistantD(1); //Getting tiny info of local mesh to allow the distant proc to initialize and allocate @@ -601,12 +612,12 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* tinyInfoDistant.resize(tinyVecSize); std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0); - MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_INT,source,1112,MPI_COMM_WORLD, &status); + MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_ID_TYPE,source,1112,MPI_COMM_WORLD, &status); //there was tinyInfoLocal.push_back(mesh.getNumberOfCells()); - int NumberOfCells=tinyInfoDistant[tinyVecSize-1]; + mcIdType NumberOfCells=tinyInfoDistant[tinyVecSize-1]; if (NumberOfCells>0) { - MEDCoupling::DataArrayInt *v1Distant=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType *v1Distant=MEDCoupling::DataArrayIdType::New(); MEDCoupling::DataArrayDouble *v2Distant=MEDCoupling::DataArrayDouble::New(); //Building the right instance of copy of distant mesh. MEDCoupling::MEDCouplingPointSet *distant_mesh_tmp= @@ -617,18 +628,18 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); int nbDistElem=0; - int *ptDist=0; + mcIdType *ptDist=0; if(v1Distant) { - nbDistElem=v1Distant->getNbOfElems(); + nbDistElem=FromIdType(v1Distant->getNbOfElems()); ptDist=v1Distant->getPointer(); } - MPI_Recv(ptDist, nbDistElem, MPI_INT, source,1111, MPI_COMM_WORLD, &status); + MPI_Recv(ptDist, nbDistElem, MPI_ID_TYPE, source,1111, MPI_COMM_WORLD, &status); double *ptDist2=0; nbDistElem=0; if(v2Distant) { - nbDistElem=v2Distant->getNbOfElems(); + nbDistElem=FromIdType(v2Distant->getNbOfElems()); ptDist2=v2Distant->getPointer(); } MPI_Recv(ptDist2, nbDistElem, MPI_DOUBLE,source, 1110, MPI_COMM_WORLD, &status); @@ -662,7 +673,7 @@ int MEDPARTITIONER::ParaDomainSelector::evaluateMemory() const struct sysinfo si; int err = sysinfo( &si ); if ( !err ) - used_memory = (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; + used_memory = (int)(( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; #endif if ( used_memory > _max_memory ) _max_memory = used_memory; diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx index 9a371e498..ef94256a3 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx @@ -21,6 +21,7 @@ #define __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__ #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include #include @@ -59,35 +60,35 @@ namespace MEDPARTITIONER //identifier for a joint int jointId( int local_domain, int distant_domain ) const; - int getNbTotalCells() { return _cell_shift_by_domain.back(); } - int getNbTotalNodes() { return _node_shift_by_domain.back(); }; - int getNbTotalFaces() { return _face_shift_by_domain.back(); }; + mcIdType getNbTotalCells() { return _cell_shift_by_domain.back(); } + mcIdType getNbTotalNodes() { return _node_shift_by_domain.back(); }; + mcIdType getNbTotalFaces() { return _face_shift_by_domain.back(); }; //Collect nb of entities on procs void gatherNbOf(const std::vector& domain_meshes); //distribution of the graph vertices among the processors - int* getProcVtxdist() const; + mcIdType* getProcVtxdist() const; //nb of nodes on processors with lower rank - int getProcNodeShift() const; + mcIdType getProcNodeShift() const; //nb of cells in domains with lower index - int getDomainCellShift(int domainIndex) const; + mcIdType getDomainCellShift(int domainIndex) const; //nb of nodes in domains with lower index - int getDomainNodeShift(int domainIndex) const; + mcIdType getDomainNodeShift(int domainIndex) const; //Gather graphs from all processors into one std::unique_ptr gatherGraph(const Graph* graph) const; //Set nb of cell/cell pairs in a joint between domains - void setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ); + void setNbCellPairs( mcIdType nb_cell_pairs, int dist_domain, int loc_domain ); //Gather size of each proc/proc joint void gatherNbCellPairs(); //nb of cell/cell pairs in a joint between domains on different procs - int getNbCellPairs( int dist_domain, int loc_domain ) const; + mcIdType getNbCellPairs( int dist_domain, int loc_domain ) const; //get the first global id of sub-entity for the joint - int getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const; + mcIdType getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const; //Send-receive local ids of joint faces int* exchangeSubentityIds( int loc_domain, int dist_domain, const std::vector& loc_ids_here ) const; @@ -104,11 +105,11 @@ namespace MEDPARTITIONER int _world_size; //nb of processors int _nb_result_domains; //required nb of domains - std::vector< int > _nb_cell_pairs_by_joint; - std::vector< int > _nb_vert_of_procs; //graph vertices - std::vector< int > _cell_shift_by_domain; - std::vector< int > _node_shift_by_domain; - std::vector< int > _face_shift_by_domain; + std::vector< mcIdType > _nb_cell_pairs_by_joint; + std::vector< mcIdType > _nb_vert_of_procs; //graph vertices + std::vector< mcIdType > _cell_shift_by_domain; + std::vector< mcIdType > _node_shift_by_domain; + std::vector< mcIdType > _face_shift_by_domain; double _init_time; bool _mesure_memory; diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx index b2eb36df2..af874d658 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx @@ -28,6 +28,7 @@ #include "MEDCouplingSkyLineArray.hxx" #include "MEDCouplingUMesh.hxx" #include "InterpKernelHashMap.hxx" +#include "MCIdType.hxx" #include #include @@ -47,7 +48,7 @@ ParallelTopology::ParallelTopology():_nb_domain(0),_mesh_dimension(0) //constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later) ParallelTopology::ParallelTopology(const std::vector& meshes) { - _nb_domain=meshes.size(); + _nb_domain=(int)meshes.size(); _nb_cells.resize(_nb_domain); _nb_nodes.resize(_nb_domain); // _nb_faces.resize(_nb_domain); @@ -98,10 +99,10 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe for (int idomain=0; idomain<_nb_domain; idomain++) { _loc_to_glob[idomain].resize(_nb_cells[idomain]); - int domainCellShift=domainSelector->getDomainCellShift(idomain); - for (int i=0; i<_nb_cells[idomain]; i++) + mcIdType domainCellShift=domainSelector->getDomainCellShift(idomain); + for (mcIdType i=0; i<_nb_cells[idomain]; i++) { - int global=domainCellShift+i ; + mcIdType global=domainCellShift+i ; _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i))); _loc_to_glob[idomain][i]=global; if (MyGlobals::_Verbose>500) @@ -117,10 +118,10 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe for (int idomain=0; idomain<_nb_domain; idomain++) { _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); - int domainNodeShift=domainSelector->getDomainNodeShift(idomain); - for (int i=0; i<_nb_nodes[idomain]; i++) + mcIdType domainNodeShift=domainSelector->getDomainNodeShift(idomain); + for (mcIdType i=0; i<_nb_nodes[idomain]; i++) { - int global=domainNodeShift+i ; + mcIdType global=domainNodeShift+i ; _node_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i))); _node_loc_to_glob[idomain][i]=global; if (MyGlobals::_Verbose>500) @@ -142,14 +143,14 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe //constructing topology according to mesh collection ParallelTopology::ParallelTopology(const std::vector& meshes, const std::vector& cz, - std::vector& cellglobal, - std::vector& nodeglobal, - std::vector& faceglobal) + std::vector& cellglobal, + std::vector& nodeglobal, + std::vector& faceglobal) { - _nb_domain=meshes.size(); - int index_global=0; - int index_node_global=0; - int index_face_global=0; + _nb_domain=(int)meshes.size(); + mcIdType index_global=0; + mcIdType index_node_global=0; + mcIdType index_face_global=0; _nb_cells.resize(_nb_domain); _nb_nodes.resize(_nb_domain); @@ -177,9 +178,9 @@ ParallelTopology::ParallelTopology(const std::vectorgetNumberOfNodes()); - for (int i=0; igetNumberOfNodes(); i++) + for (mcIdType i=0; igetNumberOfNodes(); i++) { _node_glob_to_loc.insert(std::make_pair(i,std::make_pair(0,i))); _node_loc_to_glob[0][i]=i; @@ -216,7 +217,7 @@ ParallelTopology::ParallelTopology(const std::vectorgetNumberOfNodes(); - INTERP_KERNEL::HashMap > local2distant; + INTERP_KERNEL::HashMap > local2distant; _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); for (std::size_t icz=0; iczgetDistantDomainNumber(); for (mcIdType i=0; i< nb_node; i++) { - int local= node_corresp[i*2]; - int distant = node_corresp[i*2+1]; + mcIdType local= node_corresp[i*2]; + mcIdType distant = node_corresp[i*2+1]; local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant))); } } @@ -237,7 +238,7 @@ ParallelTopology::ParallelTopology(const std::vectorsecond).first; - int distant = (local2distant.find(inode)->second).second; - int global_number=_loc_to_glob[ip][distant]; + mcIdType distant = (local2distant.find(inode)->second).second; + mcIdType global_number=_loc_to_glob[ip][distant]; _node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode))); _node_loc_to_glob[idomain][inode]=global_number; } @@ -259,9 +260,9 @@ ParallelTopology::ParallelTopology(const std::vectornbDomain(); iold++) { - int ioldNbCell=oldTopology->getCellNumber(iold); + mcIdType ioldNbCell=oldTopology->getCellNumber(iold); //std::cout<<"proc "< globalids(ioldNbCell); + std::vector globalids(ioldNbCell); oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation - for (int icell=0; icell(part[icellProc]); _nb_cells[idomain]++; icellProc++; - int iGlobalCell=globalids[icell]; + mcIdType iGlobalCell=globalids[icell]; _loc_to_glob[idomain].push_back(iGlobalCell); _glob_to_loc.insert(std::make_pair(iGlobalCell, std::make_pair(idomain, _nb_cells[idomain]))); } @@ -336,17 +337,17 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d for ( mcIdType iGlob = 0; iGlob < nbCells; ++iGlob ) { - int iGlobDom = part[ iGlob ]; - for ( int i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ ) + int iGlobDom = FromIdType(part[ iGlob ]); + for ( mcIdType i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ ) { - int iGlobNear = value[ i ]; + mcIdType iGlobNear = value[ i ]; if ( iGlob > iGlobNear ) continue; // treat ( iGlob, iGlobNear ) pair once - int iGlobNearDom = part[ iGlobNear ]; + int iGlobNearDom = FromIdType(part[ iGlobNear ]); if ( iGlobDom != iGlobNearDom ) { - int iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt - int iLocNear = convertGlobalCell( iGlobNear ).second - 1; + mcIdType iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt + mcIdType iLocNear = convertGlobalCell( iGlobNear ).second - 1; cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLoc ); cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLocNear ); cellCorresp[ iGlobNearDom ][ iGlobDom ].push_back( iLocNear ); @@ -365,7 +366,7 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d cz->setName( "Connect Zone defined by MEDPARTITIONER" ); cz->setDistantDomainNumber( idomainNear ); cz->setLocalDomainNumber ( idomain ); - cz->setEntityCorresp( 0,0, &corresp[0], corresp.size()/2 ); + cz->setEntityCorresp( 0,0, &corresp[0], ToIdType( corresp.size()/2 )); _connect_zones.push_back( cz ); } } @@ -388,13 +389,13 @@ ParallelTopology::~ParallelTopology() * If a node in the list is represented on several domains, * only the first value is returned * */ -void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int* ip) +void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int* ip) { if (_node_glob_to_loc.empty()) throw INTERP_KERNEL::Exception("Node mapping has not yet been built"); - for (int i=0; i< nbnode; i++) + for (mcIdType i=0; i< nbnode; i++) { - std::pair local_node = _node_glob_to_loc.find(node_list[i])->second; + std::pair local_node = _node_glob_to_loc.find(node_list[i])->second; ip[i]=local_node.first; local[i]=local_node.second; } @@ -407,14 +408,14 @@ void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, i * only the value with domain ip is returned * * */ -void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int ip) +void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int ip) { if (_node_glob_to_loc.empty()) throw INTERP_KERNEL::Exception("Node mapping has not yet been built"); - for (int i=0; i< nbnode; i++) + for (mcIdType i=0; i< nbnode; i++) { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_node_glob_to_loc.equal_range(node_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -431,24 +432,24 @@ void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, i * If a node in the list is represented on several domains, * all the values are put in the array * */ -void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int nbnode, int*& local, int*& ip,int*& full_array, int& size) +void ParallelTopology::convertGlobalNodeListWithTwins(const mcIdType* node_list, mcIdType nbnode, mcIdType*& local, int*& ip,mcIdType*& full_array, mcIdType& size) { if (_node_glob_to_loc.empty()) throw INTERP_KERNEL::Exception("Node mapping has not yet been built"); size=0; - for (int i=0; i< nbnode; i++) + for (mcIdType i=0; i< nbnode; i++) { - int count= _node_glob_to_loc.count(node_list[i]); + mcIdType count= ToIdType( _node_glob_to_loc.count(node_list[i])); size+=count; } - int index=0; + mcIdType index=0; ip=new int[size]; - local=new int[size]; - full_array=new int[size]; - for (int i=0; i< nbnode; i++) + local=new mcIdType[size]; + full_array=new mcIdType[size]; + for (mcIdType i=0; i< nbnode; i++) { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_node_glob_to_loc.equal_range(node_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -467,22 +468,22 @@ void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int * If a face in the list is represented on several domains, * all the values are put in the array * */ -void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size) +void ParallelTopology::convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size) { size=0; - for (int i=0; i< nbface; i++) + for (mcIdType i=0; i< nbface; i++) { //int count = _face_glob_to_loc.count(face_list[i]); //if (count >1) MESSAGE_MED("face en doublon "< >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_face_glob_to_loc.equal_range(face_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -497,11 +498,11 @@ void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int //!converts a list of global cell numbers //!to a distributed array with local cell numbers -void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, int* local, int* ip) +void ParallelTopology::convertGlobalCellList(const mcIdType* cell_list, mcIdType nbcell, mcIdType* local, int* ip) { - for (int i=0; i >::const_iterator iter = _glob_to_loc.find(cell_list[i]); + INTERP_KERNEL::HashMap >::const_iterator iter = _glob_to_loc.find(cell_list[i]); if (iter == _glob_to_loc.end()) { std::cerr << "proc " << MyGlobals::_Rank << " : KO cell_list[" << i << "] : " << cell_list[i] << std::endl; @@ -518,11 +519,11 @@ void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, i /*!Converts a list of global face numbers * to a distributed array with local face numbers */ -void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int* ip) +void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int* ip) { - for (int i=0; i< nbface; i++) + for (mcIdType i=0; i< nbface; i++) { - INTERP_KERNEL::HashMap >::const_iterator iter = _face_glob_to_loc.find(face_list[i]); + INTERP_KERNEL::HashMap >::const_iterator iter = _face_glob_to_loc.find(face_list[i]); if (iter == _face_glob_to_loc.end()) { throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalFaceList : Face not found"); @@ -539,11 +540,11 @@ void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, i * only the value with domain ip is returned * */ -void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int ip) +void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int ip) { - for (int i=0; i< nbface; i++) + for (mcIdType i=0; i< nbface; i++) { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_face_glob_to_loc.equal_range(face_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -558,13 +559,13 @@ void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, i //replacing a table of global numbering with a table with local numberings // type_connectivity contains global connectivity for each type in input // type_connectivity contains local connectivity for each type in output -void ParallelTopology::convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain) +void ParallelTopology::convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain) { - for (int inode=0; inodegetNumberOf(); + int n = FromIdType(_graph->getNumberOf()); //graph #ifdef MEDCOUPLING_USE_64BIT_IDS std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx index 6197f4ed6..3a26a5e6b 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Topology.hxx @@ -21,6 +21,7 @@ #define __MEDPARTITIONER_TOPOLOGY_HXX__ #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include #include @@ -47,63 +48,63 @@ namespace MEDPARTITIONER /*! converts a list of global cell numbers * to a distributed array with local cell numbers */ - virtual void convertGlobalNodeList(const int *list, int nb, int *local, int*ip) = 0; - virtual void convertGlobalNodeList(const int *list, int nb, int *local, int ip) = 0; + virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int*ip) = 0; + virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int ip) = 0; //converts a list of global node numbers /*! to a distributed array with local cell numbers */ - virtual void convertGlobalCellList(const int*list , int nb, int *local, int*ip) = 0; + virtual void convertGlobalCellList(const mcIdType*list , mcIdType nb, mcIdType *local, int*ip) = 0; /*! converts a list of global face numbers * to a distributed array with local face numbers */ - virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0; - virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip) = 0; - virtual void convertGlobalFaceListWithTwins(const int *face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0; - virtual void convertGlobalNodeListWithTwins(const int *face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0; + virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int*ip) = 0; + virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int ip) = 0; + virtual void convertGlobalFaceListWithTwins(const mcIdType *face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0; + virtual void convertGlobalNodeListWithTwins(const mcIdType *face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0; /*! number of doamins */ virtual int nbDomain() const = 0; /*! number of cells */ - virtual int nbCells() const = 0; + virtual mcIdType nbCells() const = 0; /*! number of nodes */ - virtual int nbNodes() const = 0; + virtual mcIdType nbNodes() const = 0; /*! number of cells on a specific domain */ - virtual int nbCells(int idomain) const = 0; + virtual mcIdType nbCells(int idomain) const = 0; /*! converting node global numberings to local numberings */ - virtual void convertToLocal2ndVersion(int*,int,int) = 0; - virtual int convertNodeToGlobal(int ip,int icell) const = 0; - virtual int convertFaceToGlobal(int ip,int icell) const = 0; - virtual int convertCellToGlobal(int ip,int icell) const = 0; - virtual void convertNodeToGlobal(int ip,const int *local, int n, int *global) const = 0; - virtual void convertCellToGlobal(int ip,const int *local, int n, int *global) const = 0; - virtual void convertFaceToGlobal(int ip,const int *local, int n, int *global) const = 0; + virtual void convertToLocal2ndVersion(mcIdType*,mcIdType,int) = 0; + virtual mcIdType convertNodeToGlobal(int ip,mcIdType icell) const = 0; + virtual mcIdType convertFaceToGlobal(int ip,mcIdType icell) const = 0; + virtual mcIdType convertCellToGlobal(int ip,mcIdType icell) const = 0; + virtual void convertNodeToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0; + virtual void convertCellToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0; + virtual void convertFaceToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0; /*! retrieving number of nodes */ - virtual int getNodeNumber(int idomain) const = 0; - virtual int getNodeNumber() const = 0; + virtual mcIdType getNodeNumber(int idomain) const = 0; + virtual mcIdType getNodeNumber() const = 0; /*! retrieving list of nodes */ - virtual void getNodeList(int idomain, int *list) const = 0; - virtual std::vector & getFusedCellNumbers(int idomain) = 0; - virtual const std::vector & getFusedCellNumbers(int idomain) const = 0; - virtual std::vector & getFusedFaceNumbers(int idomain) = 0; - virtual const std::vector & getFusedFaceNumbers(int idomain) const = 0; + virtual void getNodeList(int idomain, mcIdType *list) const = 0; + virtual std::vector & getFusedCellNumbers(int idomain) = 0; + virtual const std::vector & getFusedCellNumbers(int idomain) const = 0; + virtual std::vector & getFusedFaceNumbers(int idomain) = 0; + virtual const std::vector & getFusedFaceNumbers(int idomain) const = 0; /*! retrieving number of nodes */ - virtual int getCellNumber(int idomain) const = 0; + virtual mcIdType getCellNumber(int idomain) const = 0; /*! retrieving list of nodes */ - virtual void getCellList(int idomain, int *list) const = 0; + virtual void getCellList(int idomain, mcIdType *list) const = 0; /*! retrieving number of faces */ - virtual int getFaceNumber(int idomain) const = 0; - virtual int getFaceNumber() const = 0; + virtual mcIdType getFaceNumber(int idomain) const = 0; + virtual mcIdType getFaceNumber() const = 0; /*! retrieving list of nodes */ - virtual void getFaceList(int idomain, int *list) const = 0; + virtual void getFaceList(int idomain, mcIdType *list) const = 0; /*! adding a face to the mapping */ - virtual void appendFace(int idomain, int ilocal, int iglobal) = 0; + virtual void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) = 0; /*! returns max global face number */ - virtual int getMaxGlobalFace() const = 0; + virtual mcIdType getMaxGlobalFace() const = 0; /*! converting a global cell number to a local representation */ - virtual std::pair convertGlobalCell(int iglobal) const = 0; + virtual std::pair convertGlobalCell(mcIdType iglobal) const = 0; /*! converting a global face number to a local representation */ - virtual int convertGlobalFace(int iglobal, int idomain) = 0; + virtual mcIdType convertGlobalFace(mcIdType iglobal, int idomain) = 0; /*! converting a global node number to a local representation */ - virtual int convertGlobalNode(int iglobal, int idomain) = 0; + virtual mcIdType convertGlobalNode(mcIdType iglobal, int idomain) = 0; /*! getting a reference to connect zones vector */ virtual std::vector& getCZ() = 0; }; diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx index cbc42f687..9098d93c7 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx @@ -32,7 +32,7 @@ using namespace MEDPARTITIONER; * (domain numbers range from 0 to ndomain-1 * \param n number of cells in the mesh */ -UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const mcIdType *partition, mcIdType n):Graph(array,0) +UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,0) { std::vector index(n+1),value(n); diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx index 3aa529c88..eef6a2e35 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.hxx @@ -30,7 +30,7 @@ namespace MEDPARTITIONER class MEDPARTITIONER_EXPORT UserGraph : public Graph { public: - UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const mcIdType*, mcIdType); + UserGraph(MEDCoupling::MEDCouplingSkyLineArray*, const int*, mcIdType); virtual ~UserGraph(); void partGraph(int, const std::string& options=std::string(""), ParaDomainSelector *sel=0); }; diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index a27804f9d..7b240cf35 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -131,16 +131,16 @@ void MEDPARTITIONER::RandomizeAdj(int* xadj, int* adjncy, std::vector& ran, std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl; return; } - int size=ran.size(); + std::size_t size=ran.size(); std::vector invran(size); - for (int i=0; i& v return oss.str(); } -std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map& mymap) +std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map& mymap) { if (mymap.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl; return oss.str(); } @@ -285,10 +285,10 @@ std::string MEDPARTITIONER::EraseTagSerialized(const std::string& fromStr, const * elements first and second of map give one elements in result vector of string * converting formatted the int second as firsts characters ending at first slash */ -std::vector MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map& mymap) +std::vector MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map& mymap) { std::vector res; - for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) { std::ostringstream oss; oss << (*i).second << "/" << (*i).first; @@ -300,9 +300,9 @@ std::vector MEDPARTITIONER::VectorizeFromMapOfStringInt(const std:: /* * if existing identicals (first,second) in vector no problem, else Exception */ -std::map MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector& vec) +std::map MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector& vec) { - std::map res; + std::map res; for (std::vector::const_iterator i=vec.begin(); i!=vec.end(); ++i) { std::size_t pos=0; @@ -310,11 +310,11 @@ std::map MEDPARTITIONER::DevectorizeToMapOfStringInt(const std: std::size_t found=(*i).find('/'); //first slash if ((found==std::string::npos) || (found<1)) throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected"); - int second; + mcIdType second; std::istringstream iss((*i).substr(pos,found)); iss >> second; std::string first=(*i).substr(pos+found+1,posmax-found); - std::map::iterator it=res.find(first); + std::map::iterator it=res.find(first); if (it!=res.end()) if ((*it).second!=second) throw INTERP_KERNEL::Exception("Error not the same map value"); @@ -539,9 +539,9 @@ std::vector MEDPARTITIONER::BrowseFieldDouble(const MEDCoupling::ME std::vector res; if (fd->getArray()) { - int nb=fd->getArray()->getNumberOfComponents(); - res.push_back("nbComponents="); res.back()+=IntToStr(nb); - for (int i=0; igetArray()->getNumberOfComponents(); + res.push_back("nbComponents="); res.back()+=IntToStr((int)nb); + for (unsigned int i=0; igetArray()->getInfoOnComponent(i); @@ -801,6 +801,15 @@ std::vector MEDPARTITIONER::GetInfosOfField(const char *fileName, c return res; } +MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > MEDPARTITIONER::FromIdTypeVec( const std::vector< mcIdType >& vec ) +{ + MEDCoupling::DataArrayInt32* array = MEDCoupling::DataArrayInt32::New(); + array->alloc( vec.size(), 1 ); + std::copy( vec.begin(), vec.end(), array->getPointer() ); + return array; +} + + /*! * quick almost human readable information on all fields on a mesh in a .med file */ @@ -830,27 +839,27 @@ MEDCoupling::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh() namespace MEDPARTITIONER { - BBTreeOfDim::BBTreeOfDim( int dim, + BBTreeOfDim::BBTreeOfDim( std::size_t dim, const double* bbs, - int* elems, + mcIdType* elems, int level, - int nbelems, + mcIdType nbelems, double epsilon) { switch ( dim ) { case 3: - _tree=new BBTree<3> (bbs,elems,level,nbelems,epsilon); + _tree=new BBTree<3,mcIdType> (bbs,elems,level,nbelems,epsilon); _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 3 >; _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 3 >; break; case 2: - _tree=new BBTree<2> (bbs,elems,level,nbelems,epsilon); + _tree=new BBTree<2,mcIdType> (bbs,elems,level,nbelems,epsilon); _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 2 >; _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 2 >; break; case 1: - _tree=new BBTree<1> (bbs,elems,level,nbelems,epsilon); + _tree=new BBTree<1,mcIdType> (bbs,elems,level,nbelems,epsilon); _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 1 >; _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >; break; @@ -866,13 +875,13 @@ namespace MEDPARTITIONER } void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr, - std::vector& elems ) const + std::vector& elems ) const { BBTreeOfDim* me = (BBTreeOfDim*) this; (me->*_PgetElementsAroundPoint) ( coordsPtr, elems ); } void BBTreeOfDim::getIntersectingElems(const double* bb, - std::vector& elems) const + std::vector& elems) const { BBTreeOfDim* me = (BBTreeOfDim*) this; (me->*_PgetIntersectingElems) ( bb, elems ); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx index 184098369..57de1814b 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx @@ -45,7 +45,7 @@ namespace MEDPARTITIONER MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector& vec); MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector& vec, const std::string separator); - MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map& mymap); + MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map& mymap); MEDPARTITIONER_EXPORT std::string ReprMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); MEDPARTITIONER_EXPORT std::string ReprFieldDescriptions(const std::vector& vec,const std::string separator); @@ -54,8 +54,8 @@ namespace MEDPARTITIONER MEDPARTITIONER_EXPORT std::vector DeserializeToVectorOfString(const std::string& str); MEDPARTITIONER_EXPORT std::string EraseTagSerialized(const std::string& fromStr, const std::string& tag); - MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringInt(const std::map& mymap); - MEDPARTITIONER_EXPORT std::map DevectorizeToMapOfStringInt(const std::vector& vec); + MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringInt(const std::map& mymap); + MEDPARTITIONER_EXPORT std::map DevectorizeToMapOfStringInt(const std::vector& vec); MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); MEDPARTITIONER_EXPORT std::map< std::string,std::vector > DevectorizeToMapOfStringVectorOfString(const std::vector& vec); @@ -75,8 +75,8 @@ namespace MEDPARTITIONER int& idomain, std::string& fileName, std::string& meshName, std::string& fieldName, int& typeField, int& DT, int& IT); MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description, - std::string& fieldName, int& typeField, int& entity, int& DT, int& IT); - + std::string& fieldName, int& typeField, int& entity, int& DT, int& IT); + MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector& v); MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector& v, const int nbComponents); MEDCoupling::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector& v); @@ -88,6 +88,9 @@ namespace MEDPARTITIONER std::vector BrowseAllFieldsOnMesh(const std::string& myfile, const std::string& mymesh, const int idomain); std::vector GetInfosOfField(const char *fileName, const char *meshName, const int idomain ); + MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > FromIdTypeVec( const std::vector< mcIdType >& vec ); + + #ifdef HAVE_MPI //not advised, interblocking, use sendAndReceive //void SendVectorOfString(const std::vector& vec, const int target); @@ -100,9 +103,9 @@ namespace MEDPARTITIONER std::vector *RecvDoubleVec(const int source); void RecvDoubleVec(std::vector& vec, const int source); - void SendIntVec(const std::vector& vec, const int target); + void SendIntVec(const std::vector& vec, const int target); std::vector* RecvIntVec(int source); - void RecvIntVec(std::vector& vec, const int source); + void RecvIntVec(std::vector& vec, const int source); void SendDataArrayInt(const MEDCoupling::DataArrayInt* da, const int target); MEDCoupling::DataArrayInt *RecvDataArrayInt(const int source); @@ -146,33 +149,33 @@ namespace MEDPARTITIONER { void * _tree; void (BBTreeOfDim::*_PgetElementsAroundPoint)( const double* coordsPtr, - std::vector& elems ) const; + std::vector& elems ) const; void (BBTreeOfDim::*_PgetIntersectingElems)( const double* bb, - std::vector& elems ) const; + std::vector& elems ) const; template< int dim> void _getElementsAroundPoint( const double* coordsPtr, - std::vector& elems ) const + std::vector& elems ) const { - ((BBTree*)_tree)->getElementsAroundPoint( coordsPtr, elems ); + ((BBTree*)_tree)->getElementsAroundPoint( coordsPtr, elems ); } template< int dim> void _getIntersectingElems(const double* bb, - std::vector& elems) const + std::vector& elems) const { - ((BBTree*)_tree)->getIntersectingElems( bb, elems ); + ((BBTree*)_tree)->getIntersectingElems( bb, elems ); } public: - BBTreeOfDim( int dim, + BBTreeOfDim( std::size_t dim, const double* bbs, - int* elems, + mcIdType* elems, int level, - int nbelems, + mcIdType nbelems, double epsilon=1e-12); ~BBTreeOfDim(); - void getElementsAroundPoint(const double* coordsPtr, std::vector& elems ) const; - void getIntersectingElems (const double* bb, std::vector& elems) const; + void getElementsAroundPoint(const double* coordsPtr, std::vector& elems ) const; + void getIntersectingElems (const double* bb, std::vector& elems) const; }; } #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx index fcd43eaad..f02318984 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx @@ -27,6 +27,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" #include "MCAuto.hxx" +#include "MEDCouplingMemArray.txx" #include "InterpKernelAutoPtr.hxx" #include @@ -36,7 +37,15 @@ #include #ifdef HAVE_MPI + #include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + #endif using namespace MEDPARTITIONER; @@ -54,9 +63,9 @@ std::vector MEDPARTITIONER::SendAndReceiveVectorOfString(const std: if (rank == source) { std::string str=SerializeFromVectorOfString(vec); - int size=str.length(); + int size=(int)str.length(); MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD ); - MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); + MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); } int recSize=0; @@ -83,7 +92,7 @@ std::vector MEDPARTITIONER::AllgathervVectorOfString(const std::vec std::string str=SerializeFromVectorOfString(vec); std::vector indexes(world_size); - int size=str.length(); + int size=(int)str.length(); MPI_Allgather(&size, 1, MPI_INT, &indexes[0], 1, MPI_INT, MPI_COMM_WORLD); @@ -92,7 +101,7 @@ std::vector MEDPARTITIONER::AllgathervVectorOfString(const std::vec for (int i=0; i MEDPARTITIONER::AllgathervVectorOfString(const std::vec void MEDPARTITIONER::SendDoubleVec(const std::vector& vec, const int target) { int tag = 111002; - int size=vec.size(); + int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl; #ifdef HAVE_MPI @@ -164,15 +173,15 @@ void MEDPARTITIONER::RecvDoubleVec(std::vector& vec, const int source) \param vec vector to be sent \param target processor id of the target */ -void MEDPARTITIONER::SendIntVec(const std::vector& vec, const int target) +void MEDPARTITIONER::SendIntVec(const std::vector& vec, const int target) { int tag = 111003; - int size=vec.size(); + int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl; #ifdef HAVE_MPI - MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD); - MPI_Send(const_cast(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD); + MPI_Send(&size, 1, MPI_ID_TYPE, target, tag, MPI_COMM_WORLD); + MPI_Send(const_cast(&vec[0]), size,MPI_ID_TYPE, target, tag+100, MPI_COMM_WORLD); #endif } @@ -197,7 +206,7 @@ std::vector *MEDPARTITIONER::RecvIntVec(const int source) return vec; } -void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) +void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) { int tag = 111003; int size; @@ -207,7 +216,7 @@ void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl; vec.resize(size); - MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD,&status); + MPI_Recv(&vec[0], size, MPI_ID_TYPE, source, tag+100, MPI_COMM_WORLD,&status); #endif } @@ -223,9 +232,9 @@ void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL"); int tag = 111004; int size[3]; - size[0]=da->getNbOfElems(); - size[1]=da->getNumberOfTuples(); - size[2]=da->getNumberOfComponents(); + size[0]=(int)da->getNbOfElems(); + size[1]=(int)da->getNumberOfTuples(); + size[2]=(int)da->getNumberOfComponents(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl; #ifdef HAVE_MPI @@ -271,9 +280,9 @@ void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL"); int tag = 111005; int size[3]; - size[0]=da->getNbOfElems(); - size[1]=da->getNumberOfTuples(); - size[2]=da->getNumberOfComponents(); + size[0]=(int)da->getNbOfElems(); + size[1]=(int)da->getNumberOfTuples(); + size[2]=(int)da->getNumberOfComponents(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl; #ifdef HAVE_MPI @@ -380,7 +389,7 @@ void MEDPARTITIONER::TestVectorOfStringMpi() void MEDPARTITIONER::TestMapOfStringIntMpi() { int rank=MyGlobals::_Rank; - std::map myMap; + std::map myMap; myMap["one"]=1; myMap["two"]=22; //a bug myMap["three"]=3; @@ -389,7 +398,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() if (rank==0) { std::vector v2=VectorizeFromMapOfStringInt(myMap); - std::map m3=DevectorizeToMapOfStringInt(v2); + std::map m3=DevectorizeToMapOfStringInt(v2); if (ReprMapOfStringInt(m3)!=ReprMapOfStringInt(myMap)) throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringInt"); } @@ -399,7 +408,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() { std::cout << "v2 is : a vector of size " << v2.size() << std::endl; std::cout << ReprVectorOfString(v2) << std::endl; - std::map m2=DevectorizeToMapOfStringInt(v2); + std::map m2=DevectorizeToMapOfStringInt(v2); std::cout << "m2 is : a map of size " << m2.size() << std::endl; std::cout << ReprMapOfStringInt(m2) << std::endl; } diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index f12bcb281..21a25cecb 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -213,10 +213,10 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(3); - mcIdType nbc=conn.size()/8; //nb of cells - mcIdType nbv=coor.size()/3; //nb of vertices - mesh->allocateCells(nbc); - for(mcIdType i=0; iallocateCells(ToIdType(nbc)); + for(std::size_t i=0; isetMeshDimension(2); - int nbc=conn.size()/4; //nb of cells - int nbv=coor.size()/3; //nb of vertices - mesh->allocateCells(nbc); - for(int i=0; iallocateCells(ToIdType(nbc)); + for(std::size_t i=0; isetMeshDimension(2); - int nbc=conn.size()/4; //nb of cells - int nbv=coor.size()/3; //nb of vertices - mesh->allocateCells(nbc); - for(int i=0; iallocateCells(ToIdType(nbc)); + for(std::size_t i=0; igetNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file? @@ -422,7 +422,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes() } MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0); - int nbOfNodes=mesh->getNumberOfNodes(); + mcIdType nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VectorFieldOnNodes"); f1->setDescription("DescriptionOfFieldOnNodes"); //not saved in file? @@ -594,10 +594,10 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int DataArrayDouble* coords=mesh->getCoords(); //int nbOfComp=coords->getNumberOfComponents(); //be 3D - int nbOfTuple=coords->getNumberOfTuples(); + mcIdType nbOfTuple=coords->getNumberOfTuples(); double* ptr=coords->getPointer(); double* ptrini=ptrInit; - for (int i=0; igetMesh()->getNumberOfCells(); - int nb=nbcell*nbptgauss; + mcIdType nbcell=f3->getMesh()->getNumberOfCells(); + mcIdType nb=nbcell*nbptgauss; int nbcomp=2; array->alloc(nb,nbcomp); double *ptr=array->getPointer(); @@ -805,8 +805,8 @@ void MEDPARTITIONERTest::testMeshCollectionSingle() CPPUNIT_ASSERT(collection.getName()=="testMesh"); CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfGlobalMeshes()); - CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk,collection.getNbOfLocalCells()); - CPPUNIT_ASSERT_EQUAL(_ni*_nj,collection.getNbOfLocalFaces()); + CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk),collection.getNbOfLocalCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj),collection.getNbOfLocalFaces()); } void MEDPARTITIONERTest::testMeshCollectionXml() @@ -821,8 +821,8 @@ void MEDPARTITIONERTest::testMeshCollectionXml() CPPUNIT_ASSERT(collection.getName()=="testMesh"); CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfGlobalMeshes()); - CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk*8,collection.getNbOfLocalCells()); - CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces()); + CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk*8),collection.getNbOfLocalCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces()); } @@ -1064,17 +1064,17 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); std::vectorcellMeshes=collection.getMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size()); - int nbcells=0; + mcIdType nbcells=0; for (std::size_t i = 0; i < cellMeshes.size(); i++) nbcells+=cellMeshes[i]->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); std::vectorfaceMeshes=collection.getFaceMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); - int nbfaces=0; + mcIdType nbfaces=0; for (std::size_t i=0; i < faceMeshes.size(); i++) nbfaces+=faceMeshes[i]->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL((int)faceMesh->getNumberOfCells(), nbfaces); + CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); //merge split meshes and test equality cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc @@ -1186,8 +1186,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC MCAuto field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1)); MCAuto field1(MEDCoupling::DynamicCast(field1Tmp)),field2(MEDCoupling::DynamicCast(field2Tmp)); - int nbcells=corr[1]->getNumberOfTuples(); - CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells); + mcIdType nbcells=corr[1]->getNumberOfTuples(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); @@ -1200,21 +1200,21 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC } int nbequal=0; - int nbcomp=field1->getNumberOfComponents(); + std::size_t nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - mcIdType i1=pc[i]*nbcomp; - int i2=i*nbcomp; - for (int j = 0; j < nbcomp; j++) + std::size_t i1=pc[i]*nbcomp; + std::size_t i2=i*nbcomp; + for (std::size_t j = 0; j < nbcomp; j++) { if (p1[i1+j]==p2[i2+j]) nbequal++; //cout<<" "<decrRef(); @@ -1274,8 +1274,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG MCAuto field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); MCAuto field1(MEDCoupling::DynamicCast(field1Tmp)),field2(MEDCoupling::DynamicCast(field2Tmp)); - int nbcells=corr[1]->getNumberOfTuples(); - CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells); + mcIdType nbcells=corr[1]->getNumberOfTuples(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); @@ -1289,21 +1289,21 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG } int nbequal=0; int nbptgauss=8; - int nbcomp=field1->getNumberOfComponents(); + std::size_t nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - mcIdType i1=pc[i]*nbcomp*nbptgauss; - int i2=i*nbcomp*nbptgauss; - for (int j = 0; j < nbcomp*nbptgauss; j++) + std::size_t i1=pc[i]*nbcomp*nbptgauss; + std::size_t i2=i*nbcomp*nbptgauss; + for (std::size_t j = 0; j < nbcomp*nbptgauss; j++) { if (p1[i1+j]==p2[i2+j]) nbequal++; //cout<<" "<decrRef(); @@ -1358,14 +1358,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); - nbc=conn.size()/4; //nb of cells + nbc=(int)conn.size()/4; //nb of cells mesh->allocateCells(nbc); mcIdType* pConn = &conn[0]; for(int i=0; iinsertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn); mesh->finishInsertingCells(); - int nbv=coor.size()/2; //nb of vertices + int nbv=(int)coor.size()/2; //nb of vertices DataArrayDouble *myCoords=DataArrayDouble::New(); myCoords->useArray( &coor[0], /*ownership=*/false, DeallocType::CPP_DEALLOC, nbv, 2 ); mesh->setCoords(myCoords); @@ -1432,7 +1432,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes()); CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells()); - CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces()); CPPUNIT_ASSERT (new_collection.getNbOfLocalFaces() > 0 ); MyGlobals::_General_Informations.clear(); @@ -1443,14 +1443,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // Check that "groups and family handling is NOT bugged" MeshCollection new_collection(std::string(xmlName)+".xml"); - std::map< int, int > famId2nb; // count total nb of cells in divided families - std::map< int, int >::iterator id2nn; + std::map< mcIdType, int > famId2nb; // count total nb of cells in divided families + std::map< mcIdType, int >::iterator id2nn; { const std::vector& famIdsVec = new_collection.getCellFamilyIds(); for ( size_t i = 0; i < famIdsVec.size(); ++i ) { MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i]; - for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) + for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) { id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first; id2nn->second++; @@ -1472,7 +1472,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() for ( size_t i = 0; i < famIdsVec.size(); ++i ) { MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i]; - for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) + for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) { id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first; id2nn->second++; @@ -1485,7 +1485,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // of the same size std::map& famName2id = new_collection.getFamilyInfo(); std::map::iterator na2id = famName2id.begin(), na2id2; - std::set< int > okFamIds; + std::set< mcIdType > okFamIds; okFamIds.insert(0); for ( ; na2id != famName2id.end(); ++na2id ) { diff --git a/src/MEDPartitioner_Swig/CMakeLists.txt b/src/MEDPartitioner_Swig/CMakeLists.txt index 0c39e70a7..82eaad115 100644 --- a/src/MEDPartitioner_Swig/CMakeLists.txt +++ b/src/MEDPartitioner_Swig/CMakeLists.txt @@ -21,6 +21,10 @@ INCLUDE(${SWIG_USE_FILE}) ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3") diff --git a/src/ParaMEDLoader/CMakeLists.txt b/src/ParaMEDLoader/CMakeLists.txt index 1bf934ecd..bd76a8332 100644 --- a/src/ParaMEDLoader/CMakeLists.txt +++ b/src/ParaMEDLoader/CMakeLists.txt @@ -24,6 +24,10 @@ IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) ADD_DEFINITIONS("-DHDF5_IS_PARALLEL") ENDIF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${MPI_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS} diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index dbf9c1103..7bfeade4c 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -91,12 +91,12 @@ MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts int meshDim, spaceDim, numberOfNodes; std::vector< std::vector< std::pair > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); std::vector types; - std::vector distrib; + std::vector distrib; for(std::vector< std::vector< std::pair > >::const_iterator it0=typesDistrib.begin();it0!=typesDistrib.end();it0++) for(std::vector< std::pair >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { types.push_back((*it1).first); - int tmp[3]; + mcIdType tmp[3]; DataArray::GetSlice(0,(*it1).second,1,iPart,nbOfParts,tmp[0],tmp[1]); tmp[2]=1; distrib.insert(distrib.end(),tmp,tmp+3); diff --git a/src/ParaMEDLoader/ParaMEDLoader.cxx b/src/ParaMEDLoader/ParaMEDLoader.cxx index 4c72d0be9..dbd238af1 100644 --- a/src/ParaMEDLoader/ParaMEDLoader.cxx +++ b/src/ParaMEDLoader/ParaMEDLoader.cxx @@ -56,11 +56,11 @@ void ParaMEDLoader::WriteParaMesh(const char *fileName, MEDCoupling::ParaMESH *m */ void ParaMEDLoader::WriteMasterFile(const char *fileName, const std::vector& fileNames, const char *meshName) { - int nbOfDom=fileNames.size(); + std::size_t nbOfDom=fileNames.size(); std::ofstream fs(fileName); fs << "#MED Fichier V 2.3" << " " << std::endl; fs << "#"<<" " << std::endl; fs << nbOfDom <<" " << std::endl; - for(int i=0;igetSpaceDimension()), _proc_group(&group), _owns_processor_group(false) { - vector axis_length(_dimension); + vector axis_length(_dimension); _nb_elems=1; for (int idim=0; idim <_dimension; idim++) { @@ -119,7 +119,7 @@ namespace MEDCoupling _proc_group=geom_topo.getProcGroup(); _local_array_indices=geom_topo._local_array_indices; vector comp_indices = *(comp_topo.getBlockIndices()); - _local_array_indices.push_back(comp_indices); + _local_array_indices.emplace_back( comp_indices.begin(), comp_indices.end() ); _nb_procs_per_dim=geom_topo._nb_procs_per_dim; _nb_procs_per_dim.push_back(comp_topo.nbBlocks()); _cycle_type=geom_topo._cycle_type; @@ -137,16 +137,16 @@ namespace MEDCoupling * to \a group will cause an MPI error, while calling from a subset * of \a group will result in a deadlock. */ - BlockTopology::BlockTopology(const ProcessorGroup& group, int nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false) + BlockTopology::BlockTopology(const ProcessorGroup& group, mcIdType nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false) { - int* nbelems_per_proc = new int[group.size()]; + mcIdType* nbelems_per_proc = new mcIdType[group.size()]; const MPIProcessorGroup* mpi_group=dynamic_cast(_proc_group); const MPI_Comm* comm=mpi_group->getComm(); - int nbtemp=nb_elem; - mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_INT, - nbelems_per_proc, 1, MPI_INT, + mcIdType nbtemp=nb_elem; + mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_ID_TYPE, + nbelems_per_proc, 1, MPI_ID_TYPE, *comm); - _nb_elems=0; + _nb_elems=0; //splitting along only dimension _local_array_indices.resize(1); @@ -174,22 +174,22 @@ namespace MEDCoupling } //!converts a pair to a global number - std::pair BlockTopology::globalToLocal(const int global) const + std::pair BlockTopology::globalToLocal(const mcIdType global) const { int subdomain_id=0; - int position=global; - int size=_nb_elems; - int size_procs=_proc_group->size(); - int increment=size; - vectoraxis_position(_dimension); - vectoraxis_offset(_dimension); + mcIdType position=global; + mcIdType size=_nb_elems; + std::size_t size_procs=_proc_group->size(); + mcIdType increment=size; + vectoraxis_position(_dimension); + vectoraxis_offset(_dimension); for (int idim=0; idim<_dimension; idim++) { - int axis_size=_local_array_indices[idim].size()-1; - int axis_nb_elem=_local_array_indices[idim][axis_size]; + std::size_t axis_size=_local_array_indices[idim].size()-1; + mcIdType axis_nb_elem=_local_array_indices[idim][axis_size]; increment=increment/axis_nb_elem; - int proc_increment = size_procs/(axis_size); - int axis_pos=position/increment; + int proc_increment = (int)(size_procs/axis_size); + mcIdType axis_pos=position/increment; position=position%increment; int iaxis=1; while (_local_array_indices[idim][iaxis]<=axis_pos) @@ -200,8 +200,8 @@ namespace MEDCoupling axis_position[idim]=axis_pos-_local_array_indices[idim][iaxis-1]; axis_offset[idim]=iaxis; } - int local=0; - int local_increment=1; + mcIdType local=0; + mcIdType local_increment=1; for (int idim=_dimension-1; idim>=0; idim--) { local+=axis_position[idim]*local_increment; @@ -211,26 +211,26 @@ namespace MEDCoupling } //!converts local number to a global number - int BlockTopology::localToGlobal(const pair local) const + mcIdType BlockTopology::localToGlobal(const pair local) const { - int subdomain_id=local.first; - int global=0; - int loc=local.second; - int increment=_nb_elems; - int proc_increment=_proc_group->size(); - int local_increment=getNbLocalElements(); + std::size_t subdomain_id=local.first; + mcIdType global=0; + mcIdType loc=local.second; + mcIdType increment=_nb_elems; + std::size_t proc_increment=_proc_group->size(); + mcIdType local_increment=getNbLocalElements(); for (int idim=0; idim < _dimension; idim++) { - int axis_size=_local_array_indices[idim].size()-1; - int axis_nb_elem=_local_array_indices[idim][axis_size]; + std::size_t axis_size=_local_array_indices[idim].size()-1; + mcIdType axis_nb_elem=_local_array_indices[idim][axis_size]; increment=axis_nb_elem==0?0:increment/axis_nb_elem; - proc_increment = proc_increment/(axis_size); - int proc_axis=subdomain_id/proc_increment; + proc_increment = proc_increment/axis_size; + std::size_t proc_axis=subdomain_id/proc_increment; subdomain_id=subdomain_id%proc_increment; - int local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis]; + mcIdType local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis]; local_increment = (local_axis_nb_elem==0)?0:(local_increment/local_axis_nb_elem); - int iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis]; + mcIdType iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis]; global+=increment*iaxis; loc = (local_increment==0)?0:(loc%local_increment); } @@ -238,18 +238,18 @@ namespace MEDCoupling } //Retrieves the local number of elements - int BlockTopology::getNbLocalElements()const + mcIdType BlockTopology::getNbLocalElements()const { int position=_proc_group->myRank(); - int nb_elem = 1; + mcIdType nb_elem = 1; int increment=1; for (int i=_dimension-1; i>=0; i--) { increment *=_nb_procs_per_dim[i]; int idim=position%increment; position=position/increment; - int imin=_local_array_indices[i][idim]; - int imax=_local_array_indices[i][idim+1]; + mcIdType imin=_local_array_indices[i][idim]; + mcIdType imax=_local_array_indices[i][idim+1]; nb_elem*=(imax-imin); } return nb_elem; @@ -260,16 +260,16 @@ namespace MEDCoupling * as a size and each pair contains min and max. Indices * range from min to max-1. */ - std::vector > BlockTopology::getLocalArrayMinMax() const + std::vector > BlockTopology::getLocalArrayMinMax() const { - vector > local_indices (_dimension); + vector > local_indices (_dimension); int myrank=_proc_group->myRank(); int increment=1; for (int i=_dimension-1; i>=0; i--) { increment *=_nb_procs_per_dim[i]; int idim=myrank%increment; - local_indices[i].first=_local_array_indices[i][idim]; + local_indices[i].first=(int)_local_array_indices[i][idim]; local_indices[i].second=_local_array_indices[i][idim+1]; cout << local_indices[i].first << " "<< local_indices[i].second< buffer; + vector buffer; buffer.push_back(_dimension); buffer.push_back(_nb_elems); @@ -288,13 +288,13 @@ namespace MEDCoupling { buffer.push_back(_nb_procs_per_dim[i]); buffer.push_back(_cycle_type[i]); - buffer.push_back(_local_array_indices[i].size()); - for (int j=0; j<(int)_local_array_indices[i].size(); j++) + buffer.push_back(ToIdType(_local_array_indices[i].size())); + for (std::size_t j=0; j<_local_array_indices[i].size(); j++) buffer.push_back(_local_array_indices[i][j]); } //serializing the comm group - int size_comm=_proc_group->size(); + mcIdType size_comm=_proc_group->size(); buffer.push_back(size_comm); MPIProcessorGroup world_group(_proc_group->getCommInterface()); for (int i=0; i procs; - int size_comm=*(ptr_serializer++); + mcIdType size_comm=*(ptr_serializer++); for (int i=0; i globalToLocal (const int) const ; - int localToGlobal (const std::pair) const; - std::vector > getLocalArrayMinMax() const ; + std::pair globalToLocal (const mcIdType) const ; + mcIdType localToGlobal (const std::pair) const; + std::vector > getLocalArrayMinMax() const ; int getDimension() const { return _dimension; } - void serialize(int* & serializer, int& size) const ; - void unserialize(const int* serializer, const CommInterface& comm_interface); + void serialize(mcIdType* & serializer, mcIdType& size) const ; + void unserialize(const mcIdType* serializer, const CommInterface& comm_interface); private: //dimension : 2 or 3 int _dimension; //proc array std::vector _nb_procs_per_dim; //stores the offsets vector - std::vector > _local_array_indices; + std::vector > _local_array_indices; //stores the cycle type (block or cyclic) std::vector _cycle_type; //Processor group const ProcessorGroup* _proc_group; //nb of elements - int _nb_elems; + mcIdType _nb_elems; bool _owns_processor_group; }; } diff --git a/src/ParaMEDMEM/CMakeLists.txt b/src/ParaMEDMEM/CMakeLists.txt index 98aa37d05..7324dd19d 100644 --- a/src/ParaMEDMEM/CMakeLists.txt +++ b/src/ParaMEDMEM/CMakeLists.txt @@ -20,6 +20,10 @@ ADD_DEFINITIONS(${MPI_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${MPI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/ParaMEDMEM/CommInterface.hxx b/src/ParaMEDMEM/CommInterface.hxx index c24c4fcfc..e76f22e6e 100644 --- a/src/ParaMEDMEM/CommInterface.hxx +++ b/src/ParaMEDMEM/CommInterface.hxx @@ -21,6 +21,9 @@ #define __COMMINTERFACE_HXX__ #include + +#include "ParaIdType.hxx" + namespace MEDCoupling { diff --git a/src/ParaMEDMEM/ComponentTopology.hxx b/src/ParaMEDMEM/ComponentTopology.hxx index 429bac236..90048bc17 100644 --- a/src/ParaMEDMEM/ComponentTopology.hxx +++ b/src/ParaMEDMEM/ComponentTopology.hxx @@ -51,7 +51,7 @@ namespace MEDCoupling //!returns the number of the first MED component on local processor int firstLocalComponent() const ; //!returns the number of blocks in the topology - int nbBlocks()const {return _component_array.size()-1;} + int nbBlocks()const {return (int)_component_array.size()-1;} //!returns the block structure const std::vector* getBlockIndices() const { return &_component_array; } const ProcessorGroup* getProcGroup()const { return _proc_group; } diff --git a/src/ParaMEDMEM/DisjointDEC.cxx b/src/ParaMEDMEM/DisjointDEC.cxx index 334af2106..48d90c5c4 100644 --- a/src/ParaMEDMEM/DisjointDEC.cxx +++ b/src/ParaMEDMEM/DisjointDEC.cxx @@ -133,9 +133,9 @@ namespace MEDCoupling const std::set& target_ids, const MPI_Comm& world_comm): _local_field(0), + _comm_interface(0), _owns_field(false), _owns_groups(true), - _comm_interface(0), _union_comm(MPI_COMM_NULL) { MEDCoupling::CommInterface comm; @@ -151,7 +151,7 @@ namespace MEDCoupling // Create a communicator on these procs MPI_Group union_group,world_group; comm.commGroup(world_comm,&world_group); - comm.groupIncl(world_group,union_ids.size(),union_ranks_world,&union_group); + comm.groupIncl(world_group,(int)union_ids.size(),union_ranks_world,&union_group); comm.commCreate(world_comm,union_group,&_union_comm); delete[] union_ranks_world; if (_union_comm==MPI_COMM_NULL) @@ -171,8 +171,8 @@ namespace MEDCoupling int* target_ranks_world=new int[target_ids.size()]; // ranks of targets in world_comm std::copy(target_ids.begin(), target_ids.end(),target_ranks_world); int* target_ranks_union=new int[target_ids.size()]; // ranks of targets in union_comm - MPI_Group_translate_ranks(world_group,source_ids.size(),source_ranks_world,union_group,source_ranks_union); - MPI_Group_translate_ranks(world_group,target_ids.size(),target_ranks_world,union_group,target_ranks_union); + MPI_Group_translate_ranks(world_group,(int)source_ids.size(),source_ranks_world,union_group,source_ranks_union); + MPI_Group_translate_ranks(world_group,(int)target_ids.size(),target_ranks_world,union_group,target_ranks_union); std::set source_ids_union; for (int i=0;i<(int)source_ids.size();i++) source_ids_union.insert(source_ranks_union[i]); @@ -237,7 +237,7 @@ namespace MEDCoupling std::set union_ids; // source and target ids in world_comm union_ids.insert(src->getProcIDs().begin(),src->getProcIDs().end()); union_ids.insert(tgt->getProcIDs().begin(),tgt->getProcIDs().end()); - if(union_ids.size()!=size) + if((int)union_ids.size()!=size) throw INTERP_KERNEL::Exception("DisjointDEC constructor: source_ids and target_ids do not form a partition of the communicator! Restrain the world communicator passed to MPIProcessorGroup ctor."); } @@ -331,7 +331,7 @@ namespace MEDCoupling void DisjointDEC::renormalizeTargetField(bool isWAbs) { if (_source_group->containsMyRank()) - for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) + for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) { double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); double source_norm = total_norm; @@ -340,7 +340,7 @@ namespace MEDCoupling } if (_target_group->containsMyRank()) { - for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) + for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) { double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); double source_norm=total_norm; diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 6f09ce2dc..753249170 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -81,14 +81,14 @@ namespace MEDCoupling */ void ElementLocator::exchangeMesh(int idistantrank, MEDCouplingPointSet*& distant_mesh, - int*& distant_ids) + mcIdType*& distant_ids) { int rank = _union_group->translateRank(&_distant_group,idistantrank); if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end()) return; - MCAuto elems; + MCAuto elems; #ifdef USE_DIRECTED_BB INTERP_KERNEL::DirectedBoundingBox dbb; double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim); @@ -99,7 +99,7 @@ namespace MEDCoupling elems=_local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment()); #endif - DataArrayInt *distant_ids_send; + DataArrayIdType *distant_ids_send; MEDCouplingPointSet *send_mesh = (MEDCouplingPointSet *)_local_para_field.getField()->buildSubMeshData(elems->begin(),elems->end(),distant_ids_send); _exchangeMesh(send_mesh, distant_mesh, idistantrank, distant_ids_send, distant_ids); distant_ids_send->decrRef(); @@ -227,15 +227,15 @@ namespace MEDCoupling void ElementLocator::_exchangeMesh( MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh, int iproc_distant, - const DataArrayInt* distant_ids_send, - int*& distant_ids_recv) + const DataArrayIdType* distant_ids_send, + mcIdType*& distant_ids_recv) { CommInterface comm_interface=_union_group->getCommInterface(); // First stage : exchanging sizes // ------------------------------ vector tinyInfoLocalD,tinyInfoDistantD(1);//not used for the moment - vector tinyInfoLocal,tinyInfoDistant; + vector tinyInfoLocal,tinyInfoDistant; vector tinyInfoLocalS; //Getting tiny info of local mesh to allow the distant proc to initialize and allocate //the transmitted mesh. @@ -252,12 +252,12 @@ namespace MEDCoupling int iprocdistant_in_union = group->translateRank(&_distant_group, iproc_distant); - comm_interface.sendRecv(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, iprocdistant_in_union, 1112, - &tinyInfoDistant[0], tinyInfoDistant.size(), MPI_INT,iprocdistant_in_union,1112, + comm_interface.sendRecv(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, iprocdistant_in_union, 1112, + &tinyInfoDistant[0], (int)tinyInfoDistant.size(), MPI_ID_TYPE,iprocdistant_in_union,1112, *comm, &status); - DataArrayInt *v1Local=0; + DataArrayIdType *v1Local=0; DataArrayDouble *v2Local=0; - DataArrayInt *v1Distant=DataArrayInt::New(); + DataArrayIdType *v1Distant=DataArrayIdType::New(); DataArrayDouble *v2Distant=DataArrayDouble::New(); //serialization of local mesh to send data to distant proc. local_mesh->serialize(v1Local,v2Local); @@ -265,10 +265,10 @@ namespace MEDCoupling MEDCouplingPointSet *distant_mesh_tmp=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]); std::vector unusedTinyDistantSts; distant_mesh_tmp->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); - int nbLocalElems=0; - int nbDistElem=0; - int *ptLocal=0; - int *ptDist=0; + mcIdType nbLocalElems=0; + mcIdType nbDistElem=0; + mcIdType *ptLocal=0; + mcIdType *ptDist=0; if(v1Local) { nbLocalElems=v1Local->getNbOfElems(); @@ -279,9 +279,9 @@ namespace MEDCoupling nbDistElem=v1Distant->getNbOfElems(); ptDist=v1Distant->getPointer(); } - comm_interface.sendRecv(ptLocal, nbLocalElems, MPI_INT, + comm_interface.sendRecv(ptLocal, (int)nbLocalElems, MPI_ID_TYPE, iprocdistant_in_union, 1111, - ptDist, nbDistElem, MPI_INT, + ptDist, (int)nbDistElem, MPI_ID_TYPE, iprocdistant_in_union,1111, *comm, &status); nbLocalElems=0; @@ -298,9 +298,9 @@ namespace MEDCoupling nbDistElem=v2Distant->getNbOfElems(); ptDist2=v2Distant->getPointer(); } - comm_interface.sendRecv(ptLocal2, nbLocalElems, MPI_DOUBLE, + comm_interface.sendRecv(ptLocal2, (int)nbLocalElems, MPI_DOUBLE, iprocdistant_in_union, 1112, - ptDist2, nbDistElem, MPI_DOUBLE, + ptDist2, (int)nbDistElem, MPI_DOUBLE, iprocdistant_in_union, 1112, *comm, &status); // @@ -308,10 +308,10 @@ namespace MEDCoupling //finish unserialization distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); // - distant_ids_recv=new int[tinyInfoDistant.back()]; - comm_interface.sendRecv(const_cast(reinterpret_cast(distant_ids_send->getConstPointer())),tinyInfoLocal.back(), MPI_INT, + distant_ids_recv=new mcIdType[tinyInfoDistant.back()]; + comm_interface.sendRecv(const_cast(reinterpret_cast(distant_ids_send->getConstPointer())),(int)tinyInfoLocal.back(), MPI_ID_TYPE, iprocdistant_in_union, 1113, - distant_ids_recv,tinyInfoDistant.back(), MPI_INT, + distant_ids_recv,(int)tinyInfoDistant.back(), MPI_ID_TYPE, iprocdistant_in_union,1113, *comm, &status); if(v1Local) @@ -344,17 +344,17 @@ namespace MEDCoupling /*! * connected with ElementLocator::recvFromWorkingSideL */ - void ElementLocator::sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds) + void ElementLocator::sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds) { int procId=0; CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& eltIds=distantLocEltIds[procId]; + const vector& eltIds=distantLocEltIds[procId]; const vector& valued=partialSumRelToDistantIds[procId]; - int lgth=eltIds.size(); + int lgth=(int)eltIds.size(); comm.send(&lgth,1,MPI_INT,*iter,1114,*_comm); - comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm); + comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1115,*_comm); comm.send(const_cast(reinterpret_cast(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm); } } @@ -370,30 +370,30 @@ namespace MEDCoupling for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { std::vector& vec=globalSumRelToDistantIds[procId]; - comm.recv(&vec[0],vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status); + comm.recv(&vec[0],(int)vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status); } } /*! * connected with ElementLocator::recvLocalIdsFromWorkingSideL */ - void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds) + void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds) { int procId=0; CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& eltIds=distantLocEltIds[procId]; - int lgth=eltIds.size(); + const vector& eltIds=distantLocEltIds[procId]; + int lgth=(int)eltIds.size(); comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm); - comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm); + comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1122,*_comm); } } /*! * connected with ElementLocator::sendGlobalIdsToWorkingSideL */ - void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds) + void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds) { int procId=0; CommInterface comm; @@ -401,17 +401,17 @@ namespace MEDCoupling globalIds.resize(_distant_proc_ids.size()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& vec=distantLocEltIds[procId]; - std::vector& global=globalIds[procId]; + const std::vector& vec=distantLocEltIds[procId]; + std::vector& global=globalIds[procId]; global.resize(vec.size()); - comm.recv(&global[0],vec.size(),MPI_INT,*iter,1123,*_comm,&status); + comm.recv(&global[0],(int)vec.size(),MPI_ID_TYPE,*iter,1123,*_comm,&status); } } /*! * connected with ElementLocator::sendCandidatesGlobalIdsToWorkingSideL */ - void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds) + void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds) { int procId=0; CommInterface comm; @@ -419,26 +419,26 @@ namespace MEDCoupling globalIds.resize(_distant_proc_ids.size()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - std::vector& global=globalIds[procId]; + std::vector& global=globalIds[procId]; int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1132,*_comm,&status); global.resize(lgth); - comm.recv(&global[0],lgth,MPI_INT,*iter,1133,*_comm,&status); + comm.recv(&global[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm,&status); } } /*! * connected with ElementLocator::recvSumFromWorkingSideL */ - void ElementLocator::sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum) + void ElementLocator::sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum) { int procId=0; CommInterface comm; - int lgth=distantGlobIds.size(); + int lgth=(int)distantGlobIds.size(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { comm.send(&lgth,1,MPI_INT,*iter,1124,*_comm); - comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1125,*_comm); comm.send(const_cast(reinterpret_cast(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm); } } @@ -446,35 +446,35 @@ namespace MEDCoupling /*! * connected with ElementLocator::recvCandidatesForAddElementsL */ - void ElementLocator::sendCandidatesForAddElementsW(const std::vector& distantGlobIds) + void ElementLocator::sendCandidatesForAddElementsW(const std::vector& distantGlobIds) { int procId=0; CommInterface comm; - int lgth=distantGlobIds.size(); + int lgth=(int)distantGlobIds.size(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { comm.send(const_cast(reinterpret_cast(&lgth)),1,MPI_INT,*iter,1128,*_comm); - comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1129,*_comm); } } /*! * connected with ElementLocator::sendAddElementsToWorkingSideL */ - void ElementLocator::recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd) + void ElementLocator::recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd) { int procId=0; CommInterface comm; MPI_Status status; - int lgth=_distant_proc_ids.size(); + int lgth=(int)_distant_proc_ids.size(); elementsToAdd.resize(lgth); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int locLgth; - std::vector& eltToFeed=elementsToAdd[procId]; + std::vector& eltToFeed=elementsToAdd[procId]; comm.recv(&locLgth,1,MPI_INT,*iter,1130,*_comm,&status); eltToFeed.resize(locLgth); - comm.recv(&eltToFeed[0],locLgth,MPI_INT,*iter,1131,*_comm,&status); + comm.recv(&eltToFeed[0],locLgth,MPI_ID_TYPE,*iter,1131,*_comm,&status); } } @@ -485,7 +485,7 @@ namespace MEDCoupling { CommInterface comm; int toSend; - DataArrayInt *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); + DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); if(isCumulative) { toSend=CUMULATIVE_POLICY; @@ -512,12 +512,12 @@ namespace MEDCoupling { int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1114,*_comm,&status); - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; ids.resize(lgth); vector values(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1115,*_comm,&status); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1115,*_comm,&status); comm.recv(&values[0],lgth,MPI_DOUBLE,*iter,1116,*_comm,&status); - for(int i=0;i::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector valsToSend(ids.size()); vector::iterator iter3=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++) + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++) *iter3=_values_added[*iter2]; - comm.send(&valsToSend[0],ids.size(),MPI_DOUBLE,*iter,1117,*_comm); + comm.send(&valsToSend[0],(int)ids.size(),MPI_DOUBLE,*iter,1117,*_comm); //ids.clear(); } //_ids_per_working_proc.clear(); @@ -554,10 +554,10 @@ namespace MEDCoupling for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int lgth; - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; comm.recv(&lgth,1,MPI_INT,*iter,1121,*_comm,&status); ids.resize(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1122,*_comm,&status); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1122,*_comm,&status); } } @@ -568,16 +568,16 @@ namespace MEDCoupling { int procId=0; CommInterface comm; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& ids=_ids_per_working_proc[procId]; - vector valsToSend(ids.size()); - vector::iterator iter1=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) + const vector& ids=_ids_per_working_proc[procId]; + vector valsToSend(ids.size()); + vector::iterator iter1=valsToSend.begin(); + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) *iter1=globalIdsC[*iter2]; - comm.send(&valsToSend[0],ids.size(),MPI_INT,*iter,1123,*_comm); + comm.send(&valsToSend[0],(int)ids.size(),MPI_ID_TYPE,*iter,1123,*_comm); } if(globalIds) globalIds->decrRef(); @@ -588,24 +588,24 @@ namespace MEDCoupling */ void ElementLocator::recvSumFromWorkingSideL() { - int procId=0; - int wProcSize=_distant_proc_ids.size(); + std::size_t procId=0; + std::size_t wProcSize=_distant_proc_ids.size(); CommInterface comm; _ids_per_working_proc.resize(wProcSize); _values_per_working_proc.resize(wProcSize); MPI_Status status; - std::map sums; + std::map sums; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1124,*_comm,&status); - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector& vals=_values_per_working_proc[procId]; ids.resize(lgth); vals.resize(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1125,*_comm,&status); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1125,*_comm,&status); comm.recv(&vals[0],lgth,MPI_DOUBLE,*iter,1126,*_comm,&status); - vector::const_iterator iter1=ids.begin(); + vector::const_iterator iter1=ids.begin(); vector::const_iterator iter2=vals.begin(); for(;iter1!=ids.end();iter1++,iter2++) sums[*iter1]+=*iter2; @@ -613,9 +613,9 @@ namespace MEDCoupling //assign sum to prepare sending to working side for(procId=0;procId& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector& vals=_values_per_working_proc[procId]; - vector::const_iterator iter1=ids.begin(); + vector::const_iterator iter1=ids.begin(); vector::iterator iter2=vals.begin(); for(;iter1!=ids.end();iter1++,iter2++) *iter2=sums[*iter1]; @@ -633,38 +633,38 @@ namespace MEDCoupling */ void ElementLocator::recvCandidatesForAddElementsL() { - int procId=0; - int wProcSize=_distant_proc_ids.size(); + std::size_t procId=0; + std::size_t wProcSize=_distant_proc_ids.size(); CommInterface comm; _ids_per_working_proc3.resize(wProcSize); MPI_Status status; std::map sums; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); - int nbElts=globalIds->getNumberOfTuples(); - std::set globalIdsS(globalIdsC,globalIdsC+nbElts); + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); + mcIdType nbElts=globalIds->getNumberOfTuples(); + std::set globalIdsS(globalIdsC,globalIdsC+nbElts); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& ids0=_ids_per_working_proc[procId]; - int lgth0=ids0.size(); - std::set elts0; - for(int i=0;i& ids0=_ids_per_working_proc[procId]; + std::size_t lgth0=ids0.size(); + std::set elts0; + for(std::size_t i=0;i ids(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1129,*_comm,&status); - set ids1(ids.begin(),ids.end()); + vector ids(lgth); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1129,*_comm,&status); + set ids1(ids.begin(),ids.end()); ids.clear(); set tmp5,tmp6; set_intersection(globalIdsS.begin(),globalIdsS.end(),ids1.begin(),ids1.end(),inserter(tmp5,tmp5.begin())); set_difference(tmp5.begin(),tmp5.end(),elts0.begin(),elts0.end(),inserter(tmp6,tmp6.begin())); - std::vector& ids2=_ids_per_working_proc3[procId]; + std::vector& ids2=_ids_per_working_proc3[procId]; ids2.resize(tmp6.size()); std::copy(tmp6.begin(),tmp6.end(),ids2.begin()); //global->local - for(std::vector::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++) - *iter2=std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC; + for(std::vector::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++) + *iter2=ToIdType(std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC); } if(globalIds) globalIds->decrRef(); @@ -679,10 +679,10 @@ namespace MEDCoupling CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& vals=_ids_per_working_proc3[procId]; - int size=vals.size(); + const std::vector& vals=_ids_per_working_proc3[procId]; + int size=(int)vals.size(); comm.send(const_cast(reinterpret_cast(&size)),1,MPI_INT,*iter,1130,*_comm); - comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_INT,*iter,1131,*_comm); + comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_ID_TYPE,*iter,1131,*_comm); } } @@ -694,25 +694,25 @@ namespace MEDCoupling { int procId=0; CommInterface comm; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); - MCAuto candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); - for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); + MCAuto candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); + for(mcIdType *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) (*iter1)=globalIdsC[*iter1]; - std::set candidatesS(candidates->begin(),candidates->end()); + std::set candidatesS(candidates->begin(),candidates->end()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& ids=_ids_per_working_proc[procId]; - vector valsToSend(ids.size()); - vector::iterator iter1=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) + const vector& ids=_ids_per_working_proc[procId]; + vector valsToSend(ids.size()); + vector::iterator iter1=valsToSend.begin(); + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) *iter1=globalIdsC[*iter2]; - std::set tmp2(valsToSend.begin(),valsToSend.end()); - std::vector tmp3; - set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector >(tmp3)); - int lgth=tmp3.size(); + std::set tmp2(valsToSend.begin(),valsToSend.end()); + std::vector tmp3; + set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector >(tmp3)); + int lgth=(int)tmp3.size(); comm.send(&lgth,1,MPI_INT,*iter,1132,*_comm); - comm.send(&tmp3[0],lgth,MPI_INT,*iter,1133,*_comm); + comm.send(&tmp3[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm); } if(globalIds) globalIds->decrRef(); diff --git a/src/ParaMEDMEM/ElementLocator.hxx b/src/ParaMEDMEM/ElementLocator.hxx index f5704949f..b5013f8e0 100644 --- a/src/ParaMEDMEM/ElementLocator.hxx +++ b/src/ParaMEDMEM/ElementLocator.hxx @@ -47,7 +47,7 @@ namespace MEDCoupling virtual ~ElementLocator(); void exchangeMesh(int idistantrank, MEDCouplingPointSet*& target_mesh, - int*& distant_ids); + mcIdType*& distant_ids); void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth); const std::vector& getDistantProcIds() const { return _distant_proc_ids; } const MPI_Comm *getCommunicator() const; @@ -56,15 +56,15 @@ namespace MEDCoupling bool isM1DCorr() const { return _is_m1d_corr; } //Working side methods void recvPolicyFromLazySideW(std::vector& policy); - void sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds); + void sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds); void recvSumFromLazySideW(std::vector< std::vector >& globalSumRelToDistantIds); - void sendCandidatesForAddElementsW(const std::vector& distantGlobIds); - void recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd); + void sendCandidatesForAddElementsW(const std::vector& distantGlobIds); + void recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd); // - void sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds); - void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds); - void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds); - void sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum); + void sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds); + void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds); + void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds); + void sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum); //Lazy side methods int sendPolicyToWorkingSideL(); void recvFromWorkingSideL(); @@ -81,8 +81,8 @@ namespace MEDCoupling void _computeBoundingBoxes(); bool _intersectsBoundingBox(int irank); void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh, - int iproc_distant, const DataArrayInt* distant_ids_send, - int*& distant_ids_recv); + int iproc_distant, const DataArrayIdType* distant_ids_send, + mcIdType*& distant_ids_recv); private: const ParaFIELD& _local_para_field ; MEDCouplingPointSet* _local_cell_mesh; @@ -99,8 +99,8 @@ namespace MEDCoupling const MPI_Comm *_comm; //Attributes only used by lazy side std::vector _values_added; - std::vector< std::vector > _ids_per_working_proc; - std::vector< std::vector > _ids_per_working_proc3; + std::vector< std::vector > _ids_per_working_proc; + std::vector< std::vector > _ids_per_working_proc3; std::vector< std::vector > _values_per_working_proc; public: static const int CUMULATIVE_POLICY=3; diff --git a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx index d0e0abed8..c7b62a879 100644 --- a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx +++ b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx @@ -145,16 +145,16 @@ namespace MEDCoupling vector* target_arrays=new vector[target_size]; - int nb_local = _toposource-> getNbLocalElements(); + mcIdType nb_local = _toposource-> getNbLocalElements(); - int union_size=group->size(); + std::size_t union_size=group->size(); _sendcounts=new int[union_size]; _senddispls=new int[union_size]; _recvcounts=new int[union_size]; _recvdispls=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _sendcounts[i]=0; _recvcounts[i]=0; @@ -177,7 +177,7 @@ namespace MEDCoupling int* counter=new int [target_size]; counter[0]=0; for (int i=1; igetField()->getArray()->getPointer(); @@ -205,21 +205,21 @@ namespace MEDCoupling return; MPIProcessorGroup* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface()); - vector < vector > source_arrays(_sourcegroup->size()); - int nb_local = _topotarget-> getNbLocalElements(); - for (int ielem=0; ielem< nb_local ; ielem++) + vector < vector > source_arrays(_sourcegroup->size()); + mcIdType nb_local = _topotarget-> getNbLocalElements(); + for (mcIdType ielem=0; ielem< nb_local ; ielem++) { - //pair source_local =_distant_elems[ielem]; - pair source_local=_explicit_mapping.getDistantNumbering(ielem); - source_arrays[source_local.first].push_back(source_local.second); + //pair source_local =_distant_elems[ielem]; + pair source_local=_explicit_mapping.getDistantNumbering(ielem); + source_arrays[source_local.first].push_back(source_local.second); } - int union_size=group->size(); + std::size_t union_size=group->size(); _recvcounts=new int[union_size]; _recvdispls=new int[union_size]; _sendcounts=new int[union_size]; _senddispls=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _sendcounts[i]=0; _recvcounts[i]=0; @@ -229,9 +229,9 @@ namespace MEDCoupling { //converts the rank in target to the rank in union communicator int unionrank=group->translateRank(_sourcegroup,iproc); - _recvcounts[unionrank]=source_arrays[iproc].size()*_topotarget->getNbComponents(); + _recvcounts[unionrank]=(int)(source_arrays[iproc].size()*_topotarget->getNbComponents()); } - for (int i=1; igetNbComponents()]; @@ -249,8 +249,8 @@ namespace MEDCoupling { MPI_Status status; - int* serializer=0; - int size; + mcIdType* serializer=0; + mcIdType size; MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); @@ -264,8 +264,8 @@ namespace MEDCoupling int itarget=iproc; if (!toposend->getProcGroup()->contains(itarget)) { - _comm_interface->send(&size,1,MPI_INT, itarget,tag+itarget,*(group->getComm())); - _comm_interface->send(serializer, size, MPI_INT, itarget, tag+itarget,*(group->getComm())); + _comm_interface->send(&size,1,MPI_ID_TYPE, itarget,tag+itarget,*(group->getComm())); + _comm_interface->send(serializer, (int)size, MPI_ID_TYPE, itarget, tag+itarget,*(group->getComm())); } } } @@ -278,19 +278,19 @@ namespace MEDCoupling int isource = iproc; if (!toporecv->getProcGroup()->contains(isource)) { - int nbelem; - _comm_interface->recv(&nbelem, 1, MPI_INT, isource, tag+myworldrank, *(group->getComm()), &status); - int* buffer = new int[nbelem]; - _comm_interface->recv(buffer, nbelem, MPI_INT, isource,tag+myworldrank, *(group->getComm()), &status); + mcIdType nbelem; + _comm_interface->recv(&nbelem, 1, MPI_ID_TYPE, isource, tag+myworldrank, *(group->getComm()), &status); + mcIdType* buffer = new mcIdType[nbelem]; + _comm_interface->recv(buffer, (int)nbelem, MPI_ID_TYPE, isource,tag+myworldrank, *(group->getComm()), &status); ExplicitTopology* topotemp=new ExplicitTopology(); topotemp->unserialize(buffer, *_comm_interface); delete[] buffer; - for (int ielem=0; ielemgetNbLocalElements(); ielem++) + for (mcIdType ielem=0; ielemgetNbLocalElements(); ielem++) { - int global = toporecv->localToGlobal(ielem); - int sendlocal=topotemp->globalToLocal(global); + mcIdType global = toporecv->localToGlobal(ielem); + mcIdType sendlocal=topotemp->globalToLocal(global); if (sendlocal!=-1) { size2[iproc]++; @@ -327,7 +327,7 @@ namespace MEDCoupling } _comm_interface->allToAll(nb_transfer_union, 1, MPI_INT, dummy_recv, 1, MPI_INT, MPI_COMM_WORLD); - int* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank()); + mcIdType* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank()); int* sendcounts= new int [world_size]; int* senddispls = new int [world_size]; @@ -347,7 +347,7 @@ namespace MEDCoupling recvcounts[i]=0; recvdispls[i]=0; } - _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_INT, dummyrecv, recvcounts, senddispls, MPI_INT, MPI_COMM_WORLD); + _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_ID_TYPE, dummyrecv, recvcounts, senddispls, MPI_ID_TYPE, MPI_COMM_WORLD); } //receiving in the source subdomains the mapping sent by targets @@ -367,7 +367,7 @@ namespace MEDCoupling int* targetranks = new int[ nbtarget]; for (int i=0; itranslateRank(_targetgroup,i); - int* mappingbuffer= new int [total_size*2]; + mcIdType* mappingbuffer= new mcIdType [total_size*2]; int* sendcounts= new int [world_size]; int* senddispls = new int [world_size]; int* recvcounts=new int[world_size]; @@ -387,7 +387,7 @@ namespace MEDCoupling sendcounts[i]=0; senddispls[i]=0; } - _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_INT, mappingbuffer, recvcounts, recvdispls, MPI_INT, MPI_COMM_WORLD); + _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_ID_TYPE, mappingbuffer, recvcounts, recvdispls, MPI_ID_TYPE, MPI_COMM_WORLD); _explicit_mapping.unserialize(world_size,nb_transfer_union,nbtarget, targetranks, mappingbuffer); } } @@ -402,7 +402,7 @@ namespace MEDCoupling _comm_interface->allToAllV(_sendbuffer, _sendcounts, _senddispls, MPI_DOUBLE, _recvbuffer, _recvcounts, _recvdispls, MPI_DOUBLE,MPI_COMM_WORLD); cout<<"end AllToAll"<getNbLocalElements(); + mcIdType nb_local = _topotarget->getNbLocalElements(); double* value=new double[nb_local*_topotarget->getNbComponents()]; vector counters(_sourcegroup->size()); diff --git a/src/ParaMEDMEM/ExplicitMapping.cxx b/src/ParaMEDMEM/ExplicitMapping.cxx index 7eff1780d..b82eaa7b5 100644 --- a/src/ParaMEDMEM/ExplicitMapping.cxx +++ b/src/ParaMEDMEM/ExplicitMapping.cxx @@ -35,12 +35,12 @@ namespace MEDCoupling if (_comm_buffer!=0) delete[] _comm_buffer; } - void ExplicitMapping::pushBackElem(std::pair idistant) + void ExplicitMapping::pushBackElem(std::pair idistant) { _mapping.push_back(idistant); } - void ExplicitMapping::setDistantElem(int ilocal, std::pair idistant) + void ExplicitMapping::setDistantElem(mcIdType ilocal, std::pair idistant) { _mapping[ilocal]=idistant; } @@ -49,15 +49,15 @@ namespace MEDCoupling { if (_distant_domains.empty()) { - for (std::vector >::const_iterator iter= _mapping.begin(); + for (std::vector >::const_iterator iter= _mapping.begin(); iter!=_mapping.end(); iter++) _distant_domains.insert(iter->first); } - return _distant_domains.size(); + return (int)_distant_domains.size(); } - std::pair ExplicitMapping::getDistantNumbering(int ielem)const + std::pair ExplicitMapping::getDistantNumbering(mcIdType ielem)const { return _mapping[ielem]; } @@ -77,17 +77,17 @@ namespace MEDCoupling return _numbers[i]; } - int* ExplicitMapping::serialize(int idproc) + mcIdType* ExplicitMapping::serialize(int idproc) { - _comm_buffer=new int[_mapping.size()*2]; - std::vector offsets(_distant_domains.size()); + _comm_buffer=new mcIdType[_mapping.size()*2]; + std::vector offsets(_distant_domains.size()); offsets[0]=0; for (int i=1; i<(int)_distant_domains.size();i++) offsets[i]=offsets[i-1]+_numbers[i-1]; for (int i=0; i<(int)_mapping.size(); i++) { - int offset= offsets[_mapping[i].first]; + mcIdType offset= offsets[_mapping[i].first]; _comm_buffer[offset*2]=idproc; _comm_buffer[offset*2+1]=_mapping[i].second; offsets[_mapping[i].first]++; @@ -95,7 +95,7 @@ namespace MEDCoupling return _comm_buffer; } - void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer) + void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer) { int total_size=0; for (int i=0; i< nbprocs; i++) @@ -109,7 +109,7 @@ namespace MEDCoupling { _mapping[indmap].first=i; _mapping[indmap].second=commbuffer[indmap*2+1]; - _buffer_index[indmap]=commbuffer[indmap*2+1]; + _buffer_index[indmap]=(int)commbuffer[indmap*2+1]; indmap++; } _numbers=new int [nbtarget]; diff --git a/src/ParaMEDMEM/ExplicitMapping.hxx b/src/ParaMEDMEM/ExplicitMapping.hxx index dcd69cf7e..95717ea31 100644 --- a/src/ParaMEDMEM/ExplicitMapping.hxx +++ b/src/ParaMEDMEM/ExplicitMapping.hxx @@ -20,6 +20,8 @@ #ifndef __EXPLICITMAPPING_HXX__ #define __EXPLICITMAPPING_HXX__ +#include "MCIdType.hxx" + #include #include #include @@ -37,24 +39,24 @@ namespace MEDCoupling ExplicitMapping(); ~ExplicitMapping(); - void pushBackElem(std::pair idistant); - void setDistantElem(int ilocal, std::pair idistant); + void pushBackElem(std::pair idistant); + void setDistantElem(mcIdType ilocal, std::pair idistant); int nbDistantDomains(); - std::pair getDistantNumbering(int ielem) const; + std::pair getDistantNumbering(mcIdType ielem) const; int getDistantDomain(int i); int getNbDistantElems(int i); - int* serialize(int idproc); - void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer); + mcIdType* serialize(int idproc); + void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer); int* getBufferIndex() const { return _buffer_index; } int* getCounts() const { return _send_counts; } private: - std::vector > _mapping; + std::vector > _mapping; std::set _distant_domains; int* _numbers; int* _domains; - int* _comm_buffer; + mcIdType* _comm_buffer; int* _buffer_index; int* _send_counts; diff --git a/src/ParaMEDMEM/ExplicitTopology.cxx b/src/ParaMEDMEM/ExplicitTopology.cxx index d6cf32c83..0d46627db 100644 --- a/src/ParaMEDMEM/ExplicitTopology.cxx +++ b/src/ParaMEDMEM/ExplicitTopology.cxx @@ -43,10 +43,10 @@ _proc_group(paramesh.getBlockTopology()->getProcGroup()), _nb_components(1) { _nb_elems=paramesh.getCellMesh()->getNumberOfCells(); - const int* global=paramesh.getGlobalNumberingCell(); - _loc2glob=new int[_nb_elems]; + const mcIdType* global=paramesh.getGlobalNumberingCell(); + _loc2glob=new mcIdType[_nb_elems]; - for (int i=0; i<_nb_elems; i++) + for (mcIdType i=0; i<_nb_elems; i++) { _loc2glob[i]=global[i]; _glob2loc[global[i]]=i; @@ -58,8 +58,8 @@ ExplicitTopology::ExplicitTopology(const ExplicitTopology& topo, int nb_componen _proc_group = topo._proc_group; _nb_elems = topo._nb_elems; _nb_components = nb_components; - _loc2glob=new int[_nb_elems]; - for (int i=0; i<_nb_elems; i++) + _loc2glob=new mcIdType[_nb_elems]; + for (mcIdType i=0; i<_nb_elems; i++) { _loc2glob[i]=topo._loc2glob[i]; } @@ -75,18 +75,18 @@ ExplicitTopology::~ExplicitTopology() /*! Serializes the data contained in the Explicit Topology * for communication purposes*/ -void ExplicitTopology::serialize(int* & serializer, int& size) const +void ExplicitTopology::serialize(mcIdType* & serializer, mcIdType& size) const { - vector buffer; + vector buffer; buffer.push_back(_nb_elems); - for (int i=0; i<_nb_elems; i++) + for (mcIdType i=0; i<_nb_elems; i++) { buffer.push_back(_loc2glob[i]); } - serializer=new int[buffer.size()]; - size= buffer.size(); + serializer=new mcIdType[buffer.size()]; + size=ToIdType(buffer.size()); copy(buffer.begin(), buffer.end(), serializer); } @@ -94,14 +94,14 @@ void ExplicitTopology::serialize(int* & serializer, int& size) const * after communication. Uses the same structure as the one used for serialize() * * */ -void ExplicitTopology::unserialize(const int* serializer,const CommInterface& comm_interface) +void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface) { - const int* ptr_serializer=serializer; + const mcIdType* ptr_serializer=serializer; cout << "unserialize..."< local) const { return localToGlobal(local.second); } - inline int localToGlobal(int) const; - inline int globalToLocal(int) const; - void serialize(int* & serializer, int& size) const ; - void unserialize(const int* serializer, const CommInterface& comm_interface); + mcIdType localToGlobal (const std::pair local) const { return localToGlobal(local.second); } + inline mcIdType localToGlobal(mcIdType) const; + inline mcIdType globalToLocal(mcIdType) const; + void serialize(mcIdType* & serializer, mcIdType& size) const ; + void unserialize(const mcIdType* serializer, const CommInterface& comm_interface); int getNbComponents() const { return _nb_components; } private: //Processor group const ProcessorGroup* _proc_group; //nb of elements - int _nb_elems; + mcIdType _nb_elems; //nb of components int _nb_components; //mapping local to global - int* _loc2glob; + mcIdType* _loc2glob; //mapping global to local - INTERP_KERNEL::HashMap _glob2loc; + INTERP_KERNEL::HashMap _glob2loc; }; //!converts a pair to a global number - inline int ExplicitTopology::globalToLocal(const int global) const + inline mcIdType ExplicitTopology::globalToLocal(const mcIdType global) const { - return (_glob2loc.find(global))->second;; + return (_glob2loc.find(global))->second; } //!converts local number to a global number - int ExplicitTopology::localToGlobal(int local) const + mcIdType ExplicitTopology::localToGlobal(mcIdType local) const { return _loc2glob[local]; } //!Retrieves the number of elements for a given topology - inline int ExplicitTopology::getNbElements() const + inline mcIdType ExplicitTopology::getNbElements() const { return _nb_elems; } //Retrieves the local number of elements - inline int ExplicitTopology::getNbLocalElements()const + inline mcIdType ExplicitTopology::getNbLocalElements()const { - return _glob2loc.size(); + return ToIdType(_glob2loc.size()); } } diff --git a/src/ParaMEDMEM/InterpKernelDEC.cxx b/src/ParaMEDMEM/InterpKernelDEC.cxx index 5d87ac873..93919747e 100644 --- a/src/ParaMEDMEM/InterpKernelDEC.cxx +++ b/src/ParaMEDMEM/InterpKernelDEC.cxx @@ -204,7 +204,7 @@ namespace MEDCoupling //transferring option from InterpKernelDEC to ElementLocator locator.copyOptions(*this); MEDCouplingPointSet* distant_mesh=0; - int* distant_ids=0; + mcIdType* distant_ids=0; std::string distantMeth; for (int i=0; i<_target_group->size(); i++) { @@ -235,7 +235,7 @@ namespace MEDCoupling //transferring option from InterpKernelDEC to ElementLocator locator.copyOptions(*this); MEDCouplingPointSet* distant_mesh=0; - int* distant_ids=0; + mcIdType* distant_ids=0; for (int i=0; i<_source_group->size(); i++) { // int idistant_proc = (i+_target_group->myRank())%_source_group->size(); diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index c3d813dd9..021e9ac6e 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -66,7 +66,7 @@ namespace MEDCoupling _source_group(source_group), _target_group(target_group) { - int nbelems = source_field->getField()->getNumberOfTuples(); + mcIdType nbelems = source_field->getField()->getNumberOfTuples(); _row_offsets.resize(nbelems+1); _coeffs.resize(nbelems); _target_volume.resize(nbelems); @@ -94,14 +94,14 @@ namespace MEDCoupling */ void InterpolationMatrix::addContribution ( MEDCouplingPointSet& distant_support, int iproc_distant, - const int* distant_elems, + const mcIdType* distant_elems, const std::string& srcMeth, const std::string& targetMeth) { std::string interpMethod(targetMeth); interpMethod+=srcMeth; //creating the interpolator structure - vector > surfaces; + vector > surfaces; //computation of the intersection volumes between source and target elements MEDCouplingUMesh *distant_supportC=dynamic_cast(&distant_support); MEDCouplingUMesh *source_supportC=dynamic_cast(_source_support); @@ -258,30 +258,30 @@ namespace MEDCoupling target_triangle_surf->decrRef(); } - void InterpolationMatrix::fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf) + void InterpolationMatrix::fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf) { //loop over the elements to build the interpolation //matrix structures - int source_size=values.size(); - for (int ielem=0; ielem < source_size; ielem++) + std::size_t source_size=values.size(); + for (std::size_t ielem=0; ielem < source_size; ielem++) { - _row_offsets[ielem+1] += values[ielem].size(); - for(map::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++) + _row_offsets[ielem+1] += ToIdType(values[ielem].size()); + for(map::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++) { - int localId; + mcIdType localId; if(distant_elems) localId=distant_elems[iter->first]; else localId=iter->first; //locating the (iproc, itriangle) pair in the list of columns - map,int >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId)); - int col_id; + map,mcIdType >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId)); + mcIdType col_id; if (iter2 == _col_offsets.end()) { //(iproc, itriangle) is not registered in the list //of distant elements - col_id =_col_offsets.size(); + col_id =ToIdType(_col_offsets.size()); _col_offsets.insert(make_pair(make_pair(iproc_distant,localId),col_id)); _mapping.addElementFromSource(iproc_distant,localId); } @@ -303,13 +303,13 @@ namespace MEDCoupling } } - void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const + void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const { data1.clear(); data2.clear(); - const std::vector >& sendingIds=_mapping.getSendingIds(); + const std::vector >& sendingIds=_mapping.getSendingIds(); std::set procsS; - for(std::vector >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++) + for(std::vector >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++) procsS.insert((*iter1).first); data1.resize(procsS.size()); data2.resize(procsS.size()); @@ -318,15 +318,15 @@ namespace MEDCoupling int id=0; for(std::set::const_iterator iter2=procsS.begin();iter2!=procsS.end();iter2++,id++) fastProcAcc[*iter2]=id; - int nbOfSrcElt=_coeffs.size(); - for(std::vector< std::vector< std::map > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++) + mcIdType nbOfSrcElt=ToIdType(_coeffs.size()); + for(std::vector< std::vector< std::map > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++) (*iter3).resize(nbOfSrcElt); id=0; for(std::vector< std::vector< std::pair > >::const_iterator iter4=_coeffs.begin();iter4!=_coeffs.end();iter4++,id++) { for(std::vector< std::pair >::const_iterator iter5=(*iter4).begin();iter5!=(*iter4).end();iter5++) { - const std::pair& elt=sendingIds[(*iter5).first]; + const std::pair& elt=sendingIds[(*iter5).first]; data1[fastProcAcc[elt.first]][id][elt.second]=(*iter5).second; } } @@ -334,7 +334,7 @@ namespace MEDCoupling void InterpolationMatrix::initialize() { - int lgth=_coeffs.size(); + mcIdType lgth=ToIdType(_coeffs.size()); _row_offsets.clear(); _row_offsets.resize(lgth+1); _coeffs.clear(); _coeffs.resize(lgth); _target_volume.clear(); _target_volume.resize(lgth); @@ -495,7 +495,7 @@ namespace MEDCoupling void InterpolationMatrix::computeGlobalRowSum(ElementLocator& elementLocator, std::vector >& denoStrorage, std::vector >& denoStrorageInv) { //stores id in distant procs sorted by lazy procs connected with - vector< vector > rowsPartialSumI; + vector< vector > rowsPartialSumI; //stores for each lazy procs connected with, if global info is available and if it's the case the policy vector policyPartial; //stores the corresponding values. @@ -513,11 +513,11 @@ namespace MEDCoupling //updateWithNewAdditionnalElements(addingElements); //stores for each lazy procs connected with, the ids in global mode if it exists (regarding policyPartial). This array has exactly the size of rowsPartialSumI, //if policyPartial has CUMALATIVE_POLICY in each. - vector< vector > globalIdsPartial; + vector< vector > globalIdsPartial; computeLocalRowSum(elementLocator.getDistantProcIds(),rowsPartialSumI,rowsPartialSumD); elementLocator.sendLocalIdsToLazyProcsW(rowsPartialSumI); elementLocator.recvCandidatesGlobalIdsFromLazyProcsW(globalIdsPartial); - std::vector< std::vector > addingElements; + std::vector< std::vector > addingElements; findAdditionnalElements(elementLocator,addingElements,rowsPartialSumI,globalIdsPartial); addGhostElements(elementLocator.getDistantProcIds(),addingElements); rowsPartialSumI.clear(); @@ -542,7 +542,7 @@ namespace MEDCoupling * It contains the element ids (2nd dimension) of the corresponding lazy proc. * @param resPerProcD out parameter with the same format than 'resPerProcI'. It contains corresponding sum values. */ - void InterpolationMatrix::computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, + void InterpolationMatrix::computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, std::vector >& resPerProcD) const { resPerProcI.resize(distantProcs.size()); @@ -552,9 +552,9 @@ namespace MEDCoupling for(vector >::const_iterator iter3=(*iter).begin();iter3!=(*iter).end();iter3++) res[(*iter3).first]+=(*iter3).second; set procsSet; - int id=-1; - const vector >& mapping=_mapping.getSendingIds(); - for(vector >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++) + std::size_t id=-1; + const vector >& mapping=_mapping.getSendingIds(); + for(vector >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++) { std::pair::iterator,bool> isIns=procsSet.insert((*iter2).first); if(isIns.second) @@ -568,56 +568,56 @@ namespace MEDCoupling * This method is only usable when CUMULATIVE_POLICY detected. This method finds elements ids (typically nodes) lazy side that * are not present in columns of 'this' and that should regarding cumulative merge of elements regarding their global ids. */ - void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, - const std::vector >& resPerProcI, const std::vector >& globalIdsPartial) + void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, + const std::vector >& resPerProcI, const std::vector >& globalIdsPartial) { - std::set globalIds; - int nbLazyProcs=globalIdsPartial.size(); - for(int i=0;i globalIds; + std::size_t nbLazyProcs=globalIdsPartial.size(); + for(std::size_t i=0;i tmp(globalIds.size()); + std::vector tmp(globalIds.size()); std::copy(globalIds.begin(),globalIds.end(),tmp.begin()); globalIds.clear(); elementLocator.sendCandidatesForAddElementsW(tmp); elementLocator.recvAddElementsFromLazyProcsW(elementsToAdd); } - void InterpolationMatrix::addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd) + void InterpolationMatrix::addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd) { - std::vector< std::vector< std::map > > data1; + std::vector< std::vector< std::map > > data1; std::vector data2; serializeMe(data1,data2); initialize(); - int nbOfDistProcs=distantProcs.size(); - for(int i=0;i& eltsForThisProc=elementsToAdd[i]; + const std::vector& eltsForThisProc=elementsToAdd[i]; if(!eltsForThisProc.empty()) { std::vector::iterator iter1=std::find(data2.begin(),data2.end(),procId); - std::map *toFeed=0; + std::map *toFeed=0; if(iter1!=data2.end()) {//to test - int rank=iter1-data2.begin(); + std::size_t rank=iter1-data2.begin(); toFeed=&(data1[rank].back()); } else { iter1=std::lower_bound(data2.begin(),data2.end(),procId); - int rank=iter1-data2.begin(); + std::size_t rank=iter1-data2.begin(); data2.insert(iter1,procId); - std::vector< std::map > tmp(data1.front().size()); + std::vector< std::map > tmp(data1.front().size()); data1.insert(data1.begin()+rank,tmp); toFeed=&(data1[rank].back()); } - for(std::vector::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++) + for(std::vector::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++) (*toFeed)[*iter2]=0.; } } // nbOfDistProcs=data2.size(); - for(int j=0;j >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, - std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding) + void InterpolationMatrix::mergeRowSum(const std::vector< std::vector >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, + std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding) { - std::map sumToReturn; - int nbLazyProcs=rowsPartialSumD.size(); - for(int i=0;i sumToReturn; + std::size_t nbLazyProcs=rowsPartialSumD.size(); + for(std::size_t i=0;i& rowSumOfP=rowsPartialSumD[i]; - const std::vector& globalIdsOfP=globalIdsPartial[i]; + const std::vector& globalIdsOfP=globalIdsPartial[i]; std::vector::const_iterator iter1=rowSumOfP.begin(); - std::vector::const_iterator iter2=globalIdsOfP.begin(); + std::vector::const_iterator iter2=globalIdsOfP.begin(); for(;iter1!=rowSumOfP.end();iter1++,iter2++) sumToReturn[*iter2]+=*iter1; } // - int lgth=sumToReturn.size(); + std::size_t lgth=sumToReturn.size(); globalIdsLazySideInteraction.resize(lgth); sumCorresponding.resize(lgth); - std::vector::iterator iter3=globalIdsLazySideInteraction.begin(); + std::vector::iterator iter3=globalIdsLazySideInteraction.begin(); std::vector::iterator iter4=sumCorresponding.begin(); - for(std::map::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++) + for(std::map::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++) { *iter3=(*iter5).first; *iter4=(*iter5).second; @@ -679,35 +679,35 @@ namespace MEDCoupling * @param globalIdsLazySideInteraction : in parameter that represents ALL the global ids of every lazy procs in interaction * @param sumCorresponding : in parameter with same size as 'globalIdsLazySideInteraction' that stores the corresponding sum of 'globalIdsLazySideInteraction' */ - void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, - const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding) + void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, + const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding) { - std::map acc; - std::vector::const_iterator iter1=globalIdsLazySideInteraction.begin(); + std::map acc; + std::vector::const_iterator iter1=globalIdsLazySideInteraction.begin(); std::vector::const_iterator iter2=sumCorresponding.begin(); for(;iter1!=globalIdsLazySideInteraction.end();iter1++,iter2++) acc[*iter1]=*iter2; // - int nbLazyProcs=globalIdsPartial.size(); - for(int i=0;i& tmp1=globalIdsPartial[i]; + const std::vector& tmp1=globalIdsPartial[i]; std::vector& tmp2=rowsPartialSumD[i]; - std::vector::const_iterator iter3=tmp1.begin(); + std::vector::const_iterator iter3=tmp1.begin(); std::vector::iterator iter4=tmp2.begin(); for(;iter3!=tmp1.end();iter3++,iter4++) *iter4=acc[*iter3]; } } - void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD) + void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD) { - std::map sum; - std::vector< std::vector >::const_iterator iter1=globalIdsPartial.begin(); + std::map sum; + std::vector< std::vector >::const_iterator iter1=globalIdsPartial.begin(); std::vector< std::vector >::iterator iter2=rowsPartialSumD.begin(); for(;iter1!=globalIdsPartial.end();iter1++,iter2++) { - std::vector::const_iterator iter3=(*iter1).begin(); + std::vector::const_iterator iter3=(*iter1).begin(); std::vector::const_iterator iter4=(*iter2).begin(); for(;iter3!=(*iter1).end();iter3++,iter4++) sum[*iter3]+=*iter4; @@ -715,7 +715,7 @@ namespace MEDCoupling iter2=rowsPartialSumD.begin(); for(iter1=globalIdsPartial.begin();iter1!=globalIdsPartial.end();iter1++,iter2++) { - std::vector::const_iterator iter3=(*iter1).begin(); + std::vector::const_iterator iter3=(*iter1).begin(); std::vector::iterator iter4=(*iter2).begin(); for(;iter3!=(*iter1).end();iter3++,iter4++) *iter4=sum[*iter3]; @@ -729,36 +729,36 @@ namespace MEDCoupling * @param rowsPartialSumI input parameter : local ids of distant lazy procs elements in interaction with * @param globalIdsPartial input parameter : global ids of distant lazy procs elements in interaction with */ - void InterpolationMatrix::mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, - const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv) + void InterpolationMatrix::mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, + const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv) { //preparing fast access structures std::map procT; int localProcId=0; for(std::vector::const_iterator iter1=procsInInteraction.begin();iter1!=procsInInteraction.end();iter1++,localProcId++) procT[*iter1]=localProcId; - int size=procsInInteraction.size(); - std::vector > localToGlobal(size); - for(int i=0;i& myLocalToGlobal=localToGlobal[i]; - const std::vector& locals=rowsPartialSumI[i]; - const std::vector& globals=globalIdsPartial[i]; - std::vector::const_iterator iter3=locals.begin(); - std::vector::const_iterator iter4=globals.begin(); + std::size_t size=procsInInteraction.size(); + std::vector > localToGlobal(size); + for(std::size_t i=0;i& myLocalToGlobal=localToGlobal[i]; + const std::vector& locals=rowsPartialSumI[i]; + const std::vector& globals=globalIdsPartial[i]; + std::vector::const_iterator iter3=locals.begin(); + std::vector::const_iterator iter4=globals.begin(); for(;iter3!=locals.end();iter3++,iter4++) myLocalToGlobal[*iter3]=*iter4; } // - const vector >& mapping=_mapping.getSendingIds(); - std::map globalIdVal; + const vector >& mapping=_mapping.getSendingIds(); + std::map globalIdVal; //accumulate for same global id on lazy part. for(vector > >::iterator iter1=_coeffs.begin();iter1!=_coeffs.end();iter1++) for(vector >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { - const std::pair& distantLocalLazyId=mapping[(*iter2).first]; + const std::pair& distantLocalLazyId=mapping[(*iter2).first]; int localLazyProcId=procT[distantLocalLazyId.first]; - int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; + mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; globalIdVal[globalDistantLazyId]+=(*iter2).second; } //perform merge @@ -770,9 +770,9 @@ namespace MEDCoupling std::vector::iterator iter4=(*iter3).begin(); for(vector >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter4++) { - const std::pair& distantLocalLazyId=mapping[(*iter2).first]; + const std::pair& distantLocalLazyId=mapping[(*iter2).first]; int localLazyProcId=procT[distantLocalLazyId.first]; - int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; + mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; double newVal=globalIdVal[globalDistantLazyId]; if((*iter2).second!=0.) (*iter4)=val*newVal/(*iter2).second; @@ -783,17 +783,17 @@ namespace MEDCoupling } } - void InterpolationMatrix::divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, + void InterpolationMatrix::divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, const std::vector >& resPerProcD, std::vector >& deno) { - map fastSums; + map fastSums; int procId=0; for(vector::const_iterator iter1=distantProcs.begin();iter1!=distantProcs.end();iter1++,procId++) { - const std::vector& currentProcI=resPerProcI[procId]; + const std::vector& currentProcI=resPerProcI[procId]; const std::vector& currentProcD=resPerProcD[procId]; vector::const_iterator iter3=currentProcD.begin(); - for(vector::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++) + for(vector::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++) fastSums[_col_offsets[std::make_pair(*iter1,*iter2)]]=*iter3; } deno.resize(_coeffs.size()); @@ -841,8 +841,8 @@ namespace MEDCoupling */ void InterpolationMatrix::prepare() { - int nbelems = _source_field->getField()->getNumberOfTuples(); - for (int ielem=0; ielem < nbelems; ielem++) + mcIdType nbelems = _source_field->getField()->getNumberOfTuples(); + for (mcIdType ielem=0; ielem < nbelems; ielem++) { _row_offsets[ielem+1]+=_row_offsets[ielem]; } @@ -864,24 +864,24 @@ namespace MEDCoupling */ void InterpolationMatrix::multiply(MEDCouplingFieldDouble& field) const { - int nbcomp = field.getArray()->getNumberOfComponents(); + mcIdType nbcomp = ToIdType(field.getArray()->getNumberOfComponents()); vector target_value(_col_offsets.size()* nbcomp,0.0); //computing the matrix multiply on source side if (_source_group.containsMyRank()) { - int nbrows = _coeffs.size(); + mcIdType nbrows = ToIdType(_coeffs.size()); // performing W.S // W is the intersection matrix // S is the source vector - for (int irow=0; irowgetNumberOfTuples() ; + mcIdType nbelems = field.getArray()->getNumberOfTuples() ; double* value = const_cast (field.getArray()->getPointer()); - for (int i=0; igetNumberOfComponents(); + std::size_t nbcomp = field.getArray()->getNumberOfComponents(); vector source_value(_col_offsets.size()* nbcomp,0.0); _mapping.reverseSendRecv(&source_value[0],field); //treatment of the transpose matrix multiply on the source side if (_source_group.containsMyRank()) { - int nbrows = _coeffs.size(); - double *array = field.getArray()->getPointer() ; + mcIdType nbrows = ToIdType( _coeffs.size() ); + double *array = field.getArray()->getPointer() ; // Initialization std::fill(array, array+nbrows*nbcomp, 0.0) ; @@ -939,14 +939,14 @@ namespace MEDCoupling //performing WT.T //WT is W transpose //T is the target vector - for (int irow = 0; irow < nbrows; irow++) + for (mcIdType irow = 0; irow < nbrows; irow++) { - for (int icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++) + for (mcIdType icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++) { int colid = _coeffs[irow][icol-_row_offsets[irow]].first; double value = _coeffs[irow][icol-_row_offsets[irow]].second; double deno = _deno_reverse_multiply[irow][icol-_row_offsets[irow]]; - for (int icomp=0; icomp& res) const; - void computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, + void computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, std::vector >& resPerProcD) const; void computeGlobalRowSum(ElementLocator& elementLocator, std::vector >& denoStrorage, std::vector >& denoStrorageInv); void computeGlobalColSum(std::vector >& denoStrorage); void resizeGlobalColSum(std::vector >& denoStrorage); - void fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf); - void serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const; + void fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf); + void serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const; void initialize(); - void findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, - const std::vector >& resPerProcI, const std::vector >& globalIdsPartial); - void addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd); + void findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, + const std::vector >& resPerProcI, const std::vector >& globalIdsPartial); + void addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd); int mergePolicies(const std::vector& policyPartial); - void mergeRowSum(const std::vector< std::vector >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, - std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding); - void mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, - const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding); - void mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD); - void mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, - const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv); - void divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, + void mergeRowSum(const std::vector< std::vector >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, + std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding); + void mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, + const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding); + void mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD); + void mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, + const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv); + void divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, const std::vector >& resPerProcD, std::vector >& deno); private: bool isSurfaceComputationNeeded(const std::string& method) const; private: const MEDCoupling::ParaFIELD *_source_field; - std::vector _row_offsets; - std::map, int > _col_offsets; + std::vector _row_offsets; + std::map, mcIdType > _col_offsets; MEDCouplingPointSet *_source_support; MxN_Mapping _mapping; diff --git a/src/ParaMEDMEM/MPIAccess.cxx b/src/ParaMEDMEM/MPIAccess.cxx index 8b5878dc9..27d19d91e 100644 --- a/src/ParaMEDMEM/MPIAccess.cxx +++ b/src/ParaMEDMEM/MPIAccess.cxx @@ -290,7 +290,7 @@ namespace MEDCoupling { int size = 0; for (int i = 0 ; i < _processor_group_size ; i++ ) - size += _send_requests[ i ].size() ; + size += (int)_send_requests[ i ].size() ; return size ; } @@ -315,7 +315,7 @@ namespace MEDCoupling { int size = 0 ; for (int i = 0 ; i < _processor_group_size ; i++ ) - size += _recv_requests[ i ].size() ; + size += (int)_recv_requests[ i ].size() ; return size ; } @@ -344,7 +344,7 @@ namespace MEDCoupling list< int >::const_iterator iter ; for (iter = _send_requests[ destrank ].begin() ; iter != _send_requests[destrank].end() ; iter++ ) ArrayOfSendRequests[i++] = *iter ; - return _send_requests[destrank].size() ; + return (int)_send_requests[destrank].size() ; } // Returns in ArrayOfRecvRequests with the dimension "size" all the @@ -358,7 +358,7 @@ namespace MEDCoupling _recv_requests[ sourcerank ] ; for (iter = _recv_requests[ sourcerank ].begin() ; iter != _recv_requests[sourcerank].end() ; iter++ ) ArrayOfRecvRequests[i++] = *iter ; - return _recv_requests[sourcerank].size() ; + return (int)_recv_requests[sourcerank].size() ; } // Send in synchronous mode count values of type datatype from buffer to target @@ -1052,6 +1052,14 @@ namespace MEDCoupling return aextent ; } + // Returns the MPI size of a MPI_LONG + MPI_Aint MPIAccess::longExtent() const + { + MPI_Aint aextent, lbound ; + MPI_Type_get_extent( MPI_LONG , &lbound, &aextent ) ; + return aextent ; + } + // Returns the MPI size of a MPI_DOUBLE MPI_Aint MPIAccess::doubleExtent() const { diff --git a/src/ParaMEDMEM/MPIAccess.hxx b/src/ParaMEDMEM/MPIAccess.hxx index 782c68a25..196fd41b6 100644 --- a/src/ParaMEDMEM/MPIAccess.hxx +++ b/src/ParaMEDMEM/MPIAccess.hxx @@ -124,6 +124,7 @@ namespace MEDCoupling bool isTimeMessage( int MPITag ) const ; MPI_Aint timeExtent() const ; MPI_Aint intExtent() const ; + MPI_Aint longExtent() const ; MPI_Aint doubleExtent() const ; MPI_Aint extent( MPI_Datatype datatype ) const ; @@ -236,14 +237,14 @@ namespace MEDCoupling // used to allocate ArrayOfSendRequests for the call to SendRequestIds inline int MPIAccess::sendRequestIdsSize(int destrank) { - return _send_requests[destrank].size() ; + return (int)_send_requests[destrank].size() ; } // Returns the number of all RecvRequestIds matching a source rank. It may be // used to allocate ArrayOfRecvRequests for the call to RecvRequestIds inline int MPIAccess::recvRequestIdsSize(int sourcerank) { - return _recv_requests[sourcerank].size() ; + return (int)_recv_requests[sourcerank].size() ; } // Returns the MPI_Datatype (registered in MPI in the constructor with @@ -266,6 +267,8 @@ namespace MEDCoupling return timeExtent() ; if ( adatatype == MPI_INT ) return intExtent() ; + if ( adatatype == MPI_LONG ) + return longExtent() ; if ( adatatype == MPI_DOUBLE ) return doubleExtent() ; return 0 ; diff --git a/src/ParaMEDMEM/MPIAccessDEC.cxx b/src/ParaMEDMEM/MPIAccessDEC.cxx index 5c74dbec7..f6bd17325 100644 --- a/src/ParaMEDMEM/MPIAccessDEC.cxx +++ b/src/ParaMEDMEM/MPIAccessDEC.cxx @@ -152,6 +152,11 @@ namespace MEDCoupling sts = _MPI_access->ISend( &((int *) sendbuf)[offset] , sendcount , sendtype , target , SendRequestId ) ; } + else if ( sendtype == MPI_LONG ) + { + sts = _MPI_access->ISend( &((long *) sendbuf)[offset] , sendcount , sendtype , + target , SendRequestId ) ; + } else { sts = _MPI_access->ISend( &((double *) sendbuf)[offset] , sendcount , sendtype , @@ -165,6 +170,11 @@ namespace MEDCoupling sts = _MPI_access->send( &((int *) sendbuf)[offset] , sendcount , sendtype , target , SendRequestId ) ; } + else if ( sendtype == MPI_LONG ) + { + sts = _MPI_access->send( &((long *) sendbuf)[offset] , sendcount , sendtype , + target , SendRequestId ) ; + } else { sts = _MPI_access->send( &((double *) sendbuf)[offset] , sendcount , sendtype , @@ -192,6 +202,11 @@ namespace MEDCoupling sts = _MPI_access->IRecv( &((int *) recvbuf)[offset] , recvcount , recvtype , target , RecvRequestId ) ; } + else if ( recvtype == MPI_LONG ) + { + sts = _MPI_access->IRecv( &((long *) recvbuf)[offset] , recvcount , recvtype , + target , RecvRequestId ) ; + } else { sts = _MPI_access->IRecv( &((double *) recvbuf)[offset] , recvcount , recvtype , @@ -205,6 +220,11 @@ namespace MEDCoupling sts = _MPI_access->recv( &((int *) recvbuf)[offset] , recvcount , recvtype , target , RecvRequestId ) ; } + else if ( recvtype == MPI_LONG ) + { + sts = _MPI_access->recv( &((long *) recvbuf)[offset] , recvcount , recvtype , + target , RecvRequestId ) ; + } else { sts = _MPI_access->recv( &((double *) recvbuf)[offset] , recvcount , recvtype , @@ -565,7 +585,7 @@ namespace MEDCoupling { for ( target = 0 ; target < _group_size ; target++ ) { - int recvsize = recvcount*_MPI_access->extent( recvtype ) ; + int recvsize = (int)(recvcount*_MPI_access->extent( recvtype )); checkTime( recvcount , recvtype , target , false ) ; //=========================================================================== //TODO : it is assumed actually that we have only 1 timestep before and after @@ -714,7 +734,7 @@ namespace MEDCoupling { if ( recvcounts[target] ) { - int recvsize = recvcounts[target]*_MPI_access->extent( recvtype ) ; + int recvsize = (int)(recvcounts[target]*_MPI_access->extent( recvtype )); checkTime( recvcounts[target] , recvtype , target , false ) ; //=========================================================================== //TODO : it is assumed actually that we have only 1 timestep before nad after diff --git a/src/ParaMEDMEM/MPIProcessorGroup.cxx b/src/ParaMEDMEM/MPIProcessorGroup.cxx index 7cbdb7692..91ec6faf7 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.cxx @@ -115,7 +115,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("invalid rank in set argument of MPIProcessorGroup constructor"); } - _comm_interface.groupIncl(group_world, _proc_ids.size(), ranks, &_group); + _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks, &_group); _comm_interface.commCreate(_world_comm, _group, &_comm); diff --git a/src/ParaMEDMEM/MxN_Mapping.cxx b/src/ParaMEDMEM/MxN_Mapping.cxx index b7d561304..d3a930b0c 100644 --- a/src/ParaMEDMEM/MxN_Mapping.cxx +++ b/src/ParaMEDMEM/MxN_Mapping.cxx @@ -52,7 +52,7 @@ namespace MEDCoupling \param distant_proc proc rank of the distant processor (in terms of the union group) \param distant_element id of the element on the distant processor */ - void MxN_Mapping::addElementFromSource(int distant_proc, int distant_element) + void MxN_Mapping::addElementFromSource(int distant_proc, mcIdType distant_element) { _sending_ids.push_back(make_pair(distant_proc,distant_element)); for (int i=distant_proc; i<_union_group->size(); i++) @@ -93,12 +93,12 @@ namespace MEDCoupling delete[] nbrecv; _recv_ids.resize(_recv_proc_offsets[_union_group->size()]); - int* isendbuf=0; - int* irecvbuf=0; + mcIdType* isendbuf=0; + mcIdType* irecvbuf=0; if (_sending_ids.size()>0) - isendbuf = new int[_sending_ids.size()]; + isendbuf = new mcIdType[_sending_ids.size()]; if (_recv_ids.size()>0) - irecvbuf = new int[_recv_ids.size()]; + irecvbuf = new mcIdType[_recv_ids.size()]; int* sendcounts = new int[_union_group->size()]; int* senddispls=new int[_union_group->size()]; int* recvcounts=new int[_union_group->size()]; @@ -111,14 +111,14 @@ namespace MEDCoupling recvdispls[i]=_recv_proc_offsets[i]; } vector offsets = _send_proc_offsets; - for (int i=0; i<(int)_sending_ids.size();i++) + for (std::size_t i=0; i<_sending_ids.size();i++) { int iproc = _sending_ids[i].first; isendbuf[offsets[iproc]]=_sending_ids[i].second; offsets[iproc]++; } - comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_INT, - irecvbuf, recvcounts, recvdispls, MPI_INT, + comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_ID_TYPE, + irecvbuf, recvcounts, recvdispls, MPI_ID_TYPE, *comm); for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++) @@ -146,7 +146,7 @@ namespace MEDCoupling CommInterface comm_interface=_union_group->getCommInterface(); const MPIProcessorGroup* group = static_cast(_union_group); - int nbcomp=field.getArray()->getNumberOfComponents(); + int nbcomp=(int)field.getArray()->getNumberOfComponents(); double* sendbuf=0; double* recvbuf=0; if (_sending_ids.size() >0) @@ -190,7 +190,7 @@ namespace MEDCoupling break; case PointToPoint: _access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE, - recvbuf, recvcounts, recvdispls, MPI_DOUBLE); + recvbuf, recvcounts, recvdispls, MPI_DOUBLE); break; } @@ -229,7 +229,7 @@ namespace MEDCoupling CommInterface comm_interface=_union_group->getCommInterface(); const MPIProcessorGroup* group = static_cast(_union_group); - int nbcomp=field.getArray()->getNumberOfComponents(); + int nbcomp=(int)field.getArray()->getNumberOfComponents(); double* sendbuf=0; double* recvbuf=0; if (_recv_ids.size() >0) diff --git a/src/ParaMEDMEM/MxN_Mapping.hxx b/src/ParaMEDMEM/MxN_Mapping.hxx index c19493db2..792a29485 100644 --- a/src/ParaMEDMEM/MxN_Mapping.hxx +++ b/src/ParaMEDMEM/MxN_Mapping.hxx @@ -42,14 +42,14 @@ namespace MEDCoupling public: MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group, const DECOptions& dec_options); virtual ~MxN_Mapping(); - void addElementFromSource(int distant_proc, int distant_elem); + void addElementFromSource(int distant_proc, mcIdType distant_elem); void prepareSendRecv(); void sendRecv(MEDCouplingFieldDouble& field); void sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const ; void reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const ; // - const std::vector >& getSendingIds() const { return _sending_ids; } + const std::vector >& getSendingIds() const { return _sending_ids; } const std::vector& getSendProcsOffsets() const { return _send_proc_offsets; } void initialize(); @@ -58,8 +58,8 @@ namespace MEDCoupling ProcessorGroup* _union_group; MPIAccessDEC * _access_DEC; int _nb_comps; - std::vector > _sending_ids; - std::vector _recv_ids; + std::vector > _sending_ids; + std::vector _recv_ids; std::vector _send_proc_offsets; std::vector _recv_proc_offsets; }; diff --git a/src/ParaMEDMEM/OverlapDEC.cxx b/src/ParaMEDMEM/OverlapDEC.cxx index fe06c5290..8cf451025 100644 --- a/src/ParaMEDMEM/OverlapDEC.cxx +++ b/src/ParaMEDMEM/OverlapDEC.cxx @@ -212,9 +212,9 @@ namespace MEDCoupling OverlapDEC::OverlapDEC(const std::set& procIds, const MPI_Comm& world_comm): _load_balancing_algo(1), _own_group(true),_interpolation_matrix(0), _locator(0), + _default_field_value(0.0), _source_field(0),_own_source_field(false), _target_field(0),_own_target_field(false), - _default_field_value(0.0), _comm(MPI_COMM_NULL) { MEDCoupling::CommInterface comm; @@ -222,7 +222,7 @@ namespace MEDCoupling std::copy(procIds.begin(),procIds.end(),ranks_world); MPI_Group group,world_group; comm.commGroup(world_comm,&world_group); - comm.groupIncl(world_group,procIds.size(),ranks_world,&group); + comm.groupIncl(world_group,(int)procIds.size(),ranks_world,&group); delete [] ranks_world; comm.commCreate(world_comm,group,&_comm); comm.groupFree(&group); @@ -233,7 +233,7 @@ namespace MEDCoupling return ; } std::set idsUnion; - for(std::size_t i=0;i >::const_iterator it=jobs.begin();it!=jobs.end();it++) { const MEDCouplingPointSet *src=_locator->getSourceMesh((*it).first); - const DataArrayInt *srcIds=_locator->getSourceIds((*it).first); + const DataArrayIdType *srcIds=_locator->getSourceIds((*it).first); const MEDCouplingPointSet *trg=_locator->getTargetMesh((*it).second); - const DataArrayInt *trgIds=_locator->getTargetIds((*it).second); + const DataArrayIdType *trgIds=_locator->getTargetIds((*it).second); _interpolation_matrix->computeLocalIntersection(src,srcIds,srcMeth,(*it).first,trg,trgIds,trgMeth,(*it).second); } _interpolation_matrix->prepare(_locator->getProcsToSendFieldData()); diff --git a/src/ParaMEDMEM/OverlapElementLocator.cxx b/src/ParaMEDMEM/OverlapElementLocator.cxx index 0138eec6e..db769075c 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.cxx +++ b/src/ParaMEDMEM/OverlapElementLocator.cxx @@ -48,8 +48,8 @@ namespace MEDCoupling _local_source_mesh(0), _local_target_mesh(0), _domain_bounding_boxes(0), - _group(group), - _epsAbs(epsAbs) + _epsAbs(epsAbs), + _group(group) { if(_local_source_field) _local_source_mesh=_local_source_field->getSupport()->getCellMesh(); @@ -201,9 +201,9 @@ namespace MEDCoupling else { if(cpl.first == procID) - (*itMap).second = full_set[cpl.second].size(); + (*itMap).second = (int)full_set[cpl.second].size(); else // cpl.second == srcProcID - (*itMap).second = full_set[cpl.first].size(); + (*itMap).second = (int)full_set[cpl.first].size(); } } INTERP_KERNEL::AutoPtr proc_valid = new bool[grp_size]; @@ -216,7 +216,7 @@ namespace MEDCoupling int max_sz = -1, max_id = -1; for(itVector = full_set.begin(), procID=0; itVector != full_set.end(); itVector++, procID++) { - int sz = (*itVector).size(); + int sz = (int)(*itVector).size(); if (proc_valid[procID] && sz > max_sz) { max_sz = sz; @@ -393,7 +393,7 @@ namespace MEDCoupling return (*it).second; } - const DataArrayInt *OverlapElementLocator::getSourceIds(int procId) const + const DataArrayIdType *OverlapElementLocator::getSourceIds(int procId) const { int myProcId=_group.myRank(); if(myProcId==procId) @@ -413,7 +413,7 @@ namespace MEDCoupling return (*it).second; } - const DataArrayInt *OverlapElementLocator::getTargetIds(int procId) const + const DataArrayIdType *OverlapElementLocator::getTargetIds(int procId) const { int myProcId=_group.myRank(); if(myProcId==procId) @@ -469,7 +469,7 @@ namespace MEDCoupling field=_local_target_field; } AutoDAInt elems=local_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment()); - DataArrayInt *old2new_map; + DataArrayIdType *old2new_map; MEDCouplingPointSet *send_mesh=static_cast(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map)); if(sourceOrTarget) matrix.keepTracksOfSourceIds(procId,old2new_map); @@ -486,7 +486,7 @@ namespace MEDCoupling */ void OverlapElementLocator::receiveRemoteMeshFrom(int procId, bool sourceOrTarget) { - DataArrayInt *old2new_map=0; + DataArrayIdType *old2new_map=0; MEDCouplingPointSet *m=0; receiveMesh(procId,m,old2new_map); Proc_SrcOrTgt p(procId,sourceOrTarget); @@ -494,57 +494,57 @@ namespace MEDCoupling _remote_elems[p]=old2new_map; } - void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const + void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const { CommInterface comInterface=_group.getCommInterface(); // First stage : exchanging sizes vector tinyInfoLocalD;//tinyInfoLocalD not used for the moment - vector tinyInfoLocal; + vector tinyInfoLocal; vector tinyInfoLocalS; mesh->getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); const MPI_Comm *comm=getCommunicator(); // - int lgth[2]; - lgth[0]=tinyInfoLocal.size(); + mcIdType lgth[2]; + lgth[0]=ToIdType(tinyInfoLocal.size()); lgth[1]=idsToSend->getNbOfElems(); - comInterface.send(&lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm); - comInterface.send(&tinyInfoLocal[0],tinyInfoLocal.size(),MPI_INT,procId,START_TAG_MESH_XCH+1,*comm); + comInterface.send(&lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm); + comInterface.send(&tinyInfoLocal[0],(int)tinyInfoLocal.size(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm); // - DataArrayInt *v1Local=0; + DataArrayIdType *v1Local=0; DataArrayDouble *v2Local=0; mesh->serialize(v1Local,v2Local); - comInterface.send(v1Local->getPointer(),v1Local->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm); - comInterface.send(v2Local->getPointer(),v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm); + comInterface.send(v1Local->getPointer(),(int)v1Local->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm); + comInterface.send(v2Local->getPointer(),(int)v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm); //finished for mesh, ids now - comInterface.send(const_cast(idsToSend->getConstPointer()),lgth[1],MPI_INT,procId,START_TAG_MESH_XCH+4,*comm); + comInterface.send(const_cast(idsToSend->getConstPointer()),(int)lgth[1],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+4,*comm); // v1Local->decrRef(); v2Local->decrRef(); } - void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const + void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const { - int lgth[2]; + mcIdType lgth[2]; MPI_Status status; const MPI_Comm *comm=getCommunicator(); CommInterface comInterface=_group.getCommInterface(); - comInterface.recv(lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm,&status); - std::vector tinyInfoDistant(lgth[0]); - ids=DataArrayInt::New(); + comInterface.recv(lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm,&status); + std::vector tinyInfoDistant(lgth[0]); + ids=DataArrayIdType::New(); ids->alloc(lgth[1],1); - comInterface.recv(&tinyInfoDistant[0],lgth[0],MPI_INT,procId,START_TAG_MESH_XCH+1,*comm,&status); + comInterface.recv(&tinyInfoDistant[0],(int)lgth[0],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm,&status); mesh=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]); std::vector unusedTinyDistantSts; vector tinyInfoDistantD(1);//tinyInfoDistantD not used for the moment - DataArrayInt *v1Distant=DataArrayInt::New(); + DataArrayIdType *v1Distant=DataArrayIdType::New(); DataArrayDouble *v2Distant=DataArrayDouble::New(); mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); - comInterface.recv(v1Distant->getPointer(),v1Distant->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm,&status); - comInterface.recv(v2Distant->getPointer(),v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status); + comInterface.recv(v1Distant->getPointer(),(int)v1Distant->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm,&status); + comInterface.recv(v2Distant->getPointer(),(int)v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status); mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); //finished for mesh, ids now - comInterface.recv(ids->getPointer(),lgth[1],MPI_INT,procId,1144,*comm,&status); + comInterface.recv(ids->getPointer(),(int)lgth[1],MPI_ID_TYPE,procId,1144,*comm,&status); // v1Distant->decrRef(); v2Distant->decrRef(); diff --git a/src/ParaMEDMEM/OverlapElementLocator.hxx b/src/ParaMEDMEM/OverlapElementLocator.hxx index fff82010f..59232d3ad 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.hxx +++ b/src/ParaMEDMEM/OverlapElementLocator.hxx @@ -55,9 +55,9 @@ namespace MEDCoupling std::string getSourceMethod() const; std::string getTargetMethod() const; const MEDCouplingPointSet *getSourceMesh(int procId) const; - const DataArrayInt *getSourceIds(int procId) const; + const DataArrayIdType *getSourceIds(int procId) const; const MEDCouplingPointSet *getTargetMesh(int procId) const; - const DataArrayInt *getTargetIds(int procId) const; + const DataArrayIdType *getTargetIds(int procId) const; bool isInMyTodoList(int i, int j) const; void debugPrintWorkSharing(std::ostream & ostr) const; private: @@ -68,11 +68,11 @@ namespace MEDCoupling bool intersectsBoundingBox(int i, int j) const; void sendLocalMeshTo(int procId, bool sourceOrTarget, OverlapInterpolationMatrix& matrix) const; void receiveRemoteMeshFrom(int procId, bool sourceOrTarget); - void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const; - void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const; + void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const; + void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const; private: typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet; - typedef MCAuto< DataArrayInt > AutoDAInt; + typedef MCAuto< DataArrayIdType > AutoDAInt; typedef std::pair Proc_SrcOrTgt; // a key indicating a proc ID and whether the data is for source mesh/field or target mesh/field static const int START_TAG_MESH_XCH; diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx index 5e03f9d6a..3f5479f3a 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -61,12 +61,12 @@ namespace MEDCoupling { } - void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayInt *ids) + void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayIdType *ids) { _mapping.keepTracksOfSourceIds(procId,ids); } - void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayInt *ids) + void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayIdType *ids) { _mapping.keepTracksOfTargetIds(procId,ids); } @@ -84,14 +84,14 @@ namespace MEDCoupling * * One of the 2 is necessarily null (the two can be null together) */ - void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId, - const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId) + void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId, + const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId) { std::string interpMethod(srcMeth); interpMethod+=trgMeth; //creating the interpolator structure vector sparse_matrix_part; - int colSize=0; + mcIdType colSize=0; //computation of the intersection volumes between source and target elements const MEDCouplingUMesh *trgC=dynamic_cast(trg); const MEDCouplingUMesh *srcC=dynamic_cast(src); @@ -160,7 +160,7 @@ namespace MEDCoupling vector matrixTranspose; colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,sparse_matrix_part,interpMethod);//not a bug target in source. TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part); - colSize=matrixTranspose.size(); + colSize=ToIdType(matrixTranspose.size()); } else if ( src->getMeshDimension() == 1 && trg->getMeshDimension() == 2 && trg->getSpaceDimension() == 2 && src->getSpaceDimension() == 2 ) @@ -181,7 +181,7 @@ namespace MEDCoupling vector matrixTranspose; colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,matrixTranspose,interpMethod);//not a bug target in source. TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part); - colSize=matrixTranspose.size(); + colSize=ToIdType(matrixTranspose.size()); } else if (trg->getMeshDimension() != _source_support->getMeshDimension()) { @@ -291,7 +291,7 @@ namespace MEDCoupling } void OverlapInterpolationMatrix::TransposeMatrix(const std::vector& matIn, - int nbColsMatIn, std::vector& matOut) + mcIdType nbColsMatIn, std::vector& matOut) { matOut.resize(nbColsMatIn); int id=0; diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx index 89715ec74..44945a79d 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx @@ -48,12 +48,12 @@ namespace MEDCoupling const InterpolationOptions& i_opt, const OverlapElementLocator & loc); - void keepTracksOfSourceIds(int procId, DataArrayInt *ids); + void keepTracksOfSourceIds(int procId, DataArrayIdType *ids); - void keepTracksOfTargetIds(int procId, DataArrayInt *ids); + void keepTracksOfTargetIds(int procId, DataArrayIdType *ids); - void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId, - const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId); + void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId, + const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId); void prepare(const std::vector< int > & procsToSendField); @@ -66,7 +66,7 @@ namespace MEDCoupling virtual ~OverlapInterpolationMatrix(); private: - static void TransposeMatrix(const std::vector& matIn, int nbColsMatIn, + static void TransposeMatrix(const std::vector& matIn, mcIdType nbColsMatIn, std::vector& matOut); private: ParaFIELD *_source_field; diff --git a/src/ParaMEDMEM/OverlapMapping.cxx b/src/ParaMEDMEM/OverlapMapping.cxx index 3a68b78e6..b9aa4be12 100644 --- a/src/ParaMEDMEM/OverlapMapping.cxx +++ b/src/ParaMEDMEM/OverlapMapping.cxx @@ -39,7 +39,7 @@ OverlapMapping::OverlapMapping(const ProcessorGroup& group, const OverlapElement /*! * Keeps the link between a given a proc holding source mesh data, and the corresponding cell IDs. */ -void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayInt *ids) +void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayIdType *ids) { ids->incrRef(); _sent_src_ids[procId] = ids; @@ -48,7 +48,7 @@ void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayInt *ids) /*! * Same as keepTracksOfSourceIds() but for target mesh data. */ -void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayInt *ids) +void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayIdType *ids) { ids->incrRef(); _sent_trg_ids[procId] = ids; @@ -64,7 +64,7 @@ void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayInt *ids) * * One of the 2 is necessarily null (the two can be null together) */ -void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId) +void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId) { _matrixes_st.push_back(matrixST); _source_proc_id_st.push_back(srcProcId); @@ -73,12 +73,12 @@ void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& mat _nb_of_rcv_src_ids[srcProcId] = srcIds->getNumberOfTuples(); else // source mesh part is local { - std::set s; + std::set s; // For all source IDs (=col indices) in the sparse matrix: for(std::vector< SparseDoubleVec >::const_iterator it1=matrixST.begin();it1!=matrixST.end();it1++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) s.insert((*it2).first); - vector v(s.begin(), s.end()); // turn set into vector + vector v(s.begin(), s.end()); // turn set into vector _src_ids_zip_comp[trgProcId] = v; } } @@ -91,7 +91,7 @@ void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& mat * * After the call of this method, 'this' contains the matrixST for all source cells of the current proc */ -void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbOfTrgElems) +void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdType nbOfTrgElems) { #ifdef DEC_DEBUG printMatrixesST(); @@ -100,45 +100,45 @@ void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbO CommInterface commInterface=_group.getCommInterface(); const MPIProcessorGroup *group=static_cast(&_group); const MPI_Comm *comm=group->getComm(); - int grpSize=_group.size(); - INTERP_KERNEL::AutoPtr nbsend=new int[grpSize]; + std::size_t grpSize=_group.size(); + INTERP_KERNEL::AutoPtr nbsend=new mcIdType[grpSize]; INTERP_KERNEL::AutoPtr nbsend2=new int[grpSize]; INTERP_KERNEL::AutoPtr nbsend3=new int[grpSize]; - std::fill(nbsend,nbsend+grpSize,0); + std::fill(nbsend,nbsend+grpSize,0); int myProcId=_group.myRank(); for(std::size_t i=0;i<_matrixes_st.size();i++) if(_source_proc_id_st[i]==myProcId) - nbsend[_target_proc_id_st[i]]=_matrixes_st[i].size(); - INTERP_KERNEL::AutoPtr nbrecv=new int[grpSize]; - commInterface.allToAll(nbsend,1,MPI_INT,nbrecv,1,MPI_INT,*comm); + nbsend[_target_proc_id_st[i]]=(int)_matrixes_st[i].size(); + INTERP_KERNEL::AutoPtr nbrecv=new mcIdType[grpSize]; + commInterface.allToAll(nbsend,1,MPI_ID_TYPE,nbrecv,1,MPI_ID_TYPE,*comm); //exchanging matrix //first exchanging offsets+ids_source INTERP_KERNEL::AutoPtr nbrecv1=new int[grpSize]; INTERP_KERNEL::AutoPtr nbrecv2=new int[grpSize]; // - int *tmp=0; + mcIdType *tmp=0; serializeMatrixStep0ST(nbrecv, tmp,nbsend2,nbsend3, nbrecv1,nbrecv2); - INTERP_KERNEL::AutoPtr bigArr=tmp; - INTERP_KERNEL::AutoPtr bigArrRecv=new int[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]]; - commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_INT, - bigArrRecv,nbrecv1,nbrecv2,MPI_INT, + INTERP_KERNEL::AutoPtr bigArr=tmp; + INTERP_KERNEL::AutoPtr bigArrRecv=new mcIdType[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]]; + commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_ID_TYPE, + bigArrRecv,nbrecv1,nbrecv2,MPI_ID_TYPE, *comm);// sending ids of sparse matrix (n+1 elems) //second phase echange target ids std::fill(nbsend2,nbsend2+grpSize,0); INTERP_KERNEL::AutoPtr nbrecv3=new int[grpSize]; INTERP_KERNEL::AutoPtr nbrecv4=new int[grpSize]; double *tmp2=0; - int lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2, + mcIdType lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2, tmp,tmp2, nbsend2,nbsend3,nbrecv3,nbrecv4); - INTERP_KERNEL::AutoPtr bigArr2=tmp; + INTERP_KERNEL::AutoPtr bigArr2=tmp; INTERP_KERNEL::AutoPtr bigArrD2=tmp2; - INTERP_KERNEL::AutoPtr bigArrRecv2=new int[lgthOfArr]; + INTERP_KERNEL::AutoPtr bigArrRecv2=new mcIdType[lgthOfArr]; INTERP_KERNEL::AutoPtr bigArrDRecv2=new double[lgthOfArr]; - commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_INT, - bigArrRecv2,nbrecv3,nbrecv4,MPI_INT, + commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_ID_TYPE, + bigArrRecv2,nbrecv3,nbrecv4,MPI_ID_TYPE, *comm); commInterface.allToAllV(bigArrD2,nbsend2,nbsend3,MPI_DOUBLE, bigArrDRecv2,nbrecv3,nbrecv4,MPI_DOUBLE, @@ -238,7 +238,7 @@ void OverlapMapping::computeDenoRevIntegral(const DataArrayDouble & targetAreas) /*! * Compute denominators for ConvervativeVolumic interp. */ -void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) +void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg) { int myProcId=_group.myRank(); // @@ -251,8 +251,8 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) { const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i]; int curSrcId=_the_matrix_st_source_proc_id[i]; - map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); - int rowId=0; + map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); + mcIdType rowId=0; if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId) // Local computation: simple, because rowId of mat are directly target cell ids. { for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) @@ -261,8 +261,8 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) } else // matrix was received, remote computation { - const DataArrayInt *trgIds = (*isItem1).second; - const int *trgIds2=trgIds->getConstPointer(); + const DataArrayIdType *trgIds = (*isItem1).second; + const mcIdType *trgIds2=trgIds->getConstPointer(); for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) deno[trgIds2[rowId]]+=(*it2).second; @@ -271,23 +271,23 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) // Broadcast the vector into a structure similar to the initial sparse matrix of numerators: for(std::size_t i=0;i& mat=_the_matrix_st[i]; int curSrcId=_the_matrix_st_source_proc_id[i]; - map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); + map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); std::vector< SparseDoubleVec >& denoM=_the_deno_st[i]; denoM.resize(mat.size()); if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId)//item1 of step2 main algo. Simple, because rowId of mat are directly target ids. { - int rowId=0; + mcIdType rowId=0; for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) denoM[rowId][(*it2).first]=deno[rowId]; } else { - const DataArrayInt *trgIds = (*isItem1).second; - const int *trgIds2=trgIds->getConstPointer(); + const DataArrayIdType *trgIds = (*isItem1).second; + const mcIdType *trgIds2=trgIds->getConstPointer(); for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) denoM[rowId][(*it2).first]=deno[trgIds2[rowId]]; @@ -302,43 +302,43 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) * \param offsets tells for a proc i where to start serialize#0 matrix. size equal to _group.size(). * \param nbOfElemsSrc of size _group.size(). Comes from previous all2all call. tells how many srcIds per proc contains matrix for current proc. */ -void OverlapMapping::serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets, +void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets, int *countForRecv, int *offsetsForRecv) const { - int grpSize=_group.size(); + std::size_t grpSize=_group.size(); std::fill(count,count+grpSize,0); - int szz=0; + std::size_t szz=0; int myProcId=_group.myRank(); for(std::size_t i=0;i<_matrixes_st.size();i++) { if(_source_proc_id_st[i]==myProcId)// && _target_proc_id_st[i]!=myProcId { - count[_target_proc_id_st[i]]=_matrixes_st[i].size()+1; + count[_target_proc_id_st[i]]=(int)_matrixes_st[i].size()+1; szz+=_matrixes_st[i].size()+1; } } - bigArr=new int[szz]; + bigArr=new mcIdType[szz]; offsets[0]=0; - for(int i=1;i& mat=_matrixes_st[i]; for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++,work++) - work[1]=work[0]+(*it).size(); + work[1]=work[0]+ToIdType((*it).size()); } } // offsetsForRecv[0]=0; - for(int i=0;i0) - countForRecv[i]=nbOfElemsSrc[i]+1; + countForRecv[i]=(int)nbOfElemsSrc[i]+1; else countForRecv[i]=0; if(i>0) @@ -350,18 +350,18 @@ void OverlapMapping::serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigAr * This method performs step#1 and step#2/3. It returns the size of expected array to get allToAllV. * It is where the locally computed matrices are serialized to be sent to adequate final proc. */ -int OverlapMapping::serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0, - int *&bigArrI, double *&bigArrD, int *count, int *offsets, +mcIdType OverlapMapping::serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0, + mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets, int *countForRecv, int *offsForRecv) const { - int grpSize=_group.size(); + std::size_t grpSize=_group.size(); int myProcId=_group.myRank(); offsForRecv[0]=0; - int szz=0; - for(int i=0;i& mat=_matrixes_st[i]; - int lgthToSend=0; + mcIdType lgthToSend=0; for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++) - lgthToSend+=(*it).size(); - count[_target_proc_id_st[i]]=lgthToSend; + lgthToSend+=ToIdType((*it).size()); + count[_target_proc_id_st[i]]=(int)lgthToSend; fullLgth+=lgthToSend; } } - for(int i=1;i& mat=_matrixes_st[i]; for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++) { - int j=0; + mcIdType j=0; for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++,j++) { bigArrI[fullLgth+j]=(*it2).first; @@ -418,31 +418,31 @@ int OverlapMapping::serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *r * - The second is the pseudo id of source proc (correspondence with true id is in attribute _the_matrix_st_source_proc_id and _the_matrix_st_source_ids) * - the third is the srcId in the pseudo source proc */ -void OverlapMapping::unserializationST(int nbOfTrgElems, - const int *nbOfElemsSrcPerProc,//first all2all - const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all - const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls +void OverlapMapping::unserializationST(mcIdType nbOfTrgElems, + const mcIdType *nbOfElemsSrcPerProc,//first all2all + const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all + const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls { _the_matrix_st.clear(); _the_matrix_st_source_proc_id.clear(); // - int grpSize=_group.size(); - for(int i=0;i& mat=_matrixes_st[i]; @@ -488,7 +488,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl { using namespace std; - int nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test + std::size_t nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test CommInterface commInterface=_group.getCommInterface(); const MPIProcessorGroup *group=static_cast(&_group); const MPI_Comm *comm=group->getComm(); @@ -530,21 +530,21 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl MCAuto vals; if(_locator.isInMyTodoList(myProcID, procID)) { - map >::const_iterator isItem11 = _src_ids_zip_comp.find(procID); + map >::const_iterator isItem11 = _src_ids_zip_comp.find(procID); if (isItem11 == _src_ids_zip_comp.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _src_ids_zip_comp!"); - const vector & v = (*isItem11).second; - int sz = v.size(); + const vector & v = (*isItem11).second; + std::size_t sz = v.size(); vals=fieldInput->getArray()->selectByTupleId(&(v[0]),&(v[0])+sz); } else { - map < int, MCAuto >::const_iterator isItem11 = _sent_src_ids.find( procID ); + map < int, MCAuto >::const_iterator isItem11 = _sent_src_ids.find( procID ); if (isItem11 == _sent_src_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _sent_src_ids!"); vals=fieldInput->getArray()->selectByTupleId(*(*isItem11).second); } - nbsend[procID] = vals->getNbOfElems(); + nbsend[procID] = (int)vals->getNbOfElems(); valsToSend.insert(valsToSend.end(),vals->getConstPointer(),vals->getConstPointer()+nbsend[procID]); } @@ -566,17 +566,17 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl { if(_locator.isInMyTodoList(procID, myProcID)) { - map ::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID); + map ::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID); if (isItem11 == _nb_of_rcv_src_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _nb_of_rcv_src_ids!"); - nbrecv[procID] = (*isItem11).second; + nbrecv[procID] = (int)((*isItem11).second); } else { - map >::const_iterator isItem11 = _src_ids_zip_recv.find(procID); + map >::const_iterator isItem11 = _src_ids_zip_recv.find(procID); if (isItem11 == _src_ids_zip_recv.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _src_ids_zip_recv!"); - nbrecv[procID] = (*isItem11).second.size()*nbOfCompo; + nbrecv[procID] = (int)((*isItem11).second.size()*nbOfCompo); } } } @@ -624,7 +624,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl // For each source processor corresponding to a locally held matrix: { int srcProcID = *itProc; - int id = distance(_the_matrix_st_source_proc_id.begin(),itProc); + std::size_t id = std::distance(_the_matrix_st_source_proc_id.begin(),itProc); const vector< SparseDoubleVec >& mat =_the_matrix_st[id]; const vector< SparseDoubleVec >& deno = _the_deno_st[id]; @@ -636,9 +636,9 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl */ if (srcProcID == myProcID) { - int nbOfTrgTuples=mat.size(); + std::size_t nbOfTrgTuples=mat.size(); double * targetBase = fieldOutput->getArray()->getPointer(); - for(int j=0; j revert_zip; - map >::const_iterator it11= _src_ids_zip_recv.find(srcProcID); + map revert_zip; + map >::const_iterator it11= _src_ids_zip_recv.find(srcProcID); if (it11 == _src_ids_zip_recv.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _src_ids_zip_recv!"); - const vector & vec = (*it11).second; + + const vector & vec = (*it11).second; int newId=0; - for(vector::const_iterator it=vec.begin();it!=vec.end();it++,newId++) + for(vector::const_iterator it=vec.begin();it!=vec.end();it++,newId++) revert_zip[*it]=newId; - map < int, MCAuto >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID); + map < int, MCAuto >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID); if (isItem24 == _sent_trg_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _sent_trg_ids!"); - const DataArrayInt *tgrIdsDA = (*isItem24).second; - const int *tgrIds = tgrIdsDA->getConstPointer(); + const DataArrayIdType *tgrIdsDA = (*isItem24).second; + const mcIdType *tgrIds = tgrIdsDA->getConstPointer(); - int nbOfTrgTuples=mat.size(); + std::size_t nbOfTrgTuples=mat.size(); double * targetBase = fieldOutput->getArray()->getPointer(); - for(int j=0;j::const_iterator it4=revert_zip.find((*it3).first); + map::const_iterator it4=revert_zip.find((*it3).first); if(it4==revert_zip.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in revert_zip!"); double ratio = (*it3).second/(*it5).second; @@ -722,9 +723,9 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl */ { // Same loop as in the case srcProcID == myProcID, except that instead of working on local field data, we work on bigArr - int nbOfTrgTuples=mat.size(); + std::size_t nbOfTrgTuples=mat.size(); double * targetBase = fieldOutput->getArray()->getPointer(); - for(int j=0;j& mat=_the_matrix_st[i]; - std::set s; + std::set s; for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) s.insert((*it2).first); - vector vec(s.begin(),s.end()); + vector vec(s.begin(),s.end()); _src_ids_zip_recv[curSrcProcId] = vec; } } diff --git a/src/ParaMEDMEM/OverlapMapping.hxx b/src/ParaMEDMEM/OverlapMapping.hxx index ef3ed4c49..fc541413f 100644 --- a/src/ParaMEDMEM/OverlapMapping.hxx +++ b/src/ParaMEDMEM/OverlapMapping.hxx @@ -35,7 +35,7 @@ namespace MEDCoupling class MEDCouplingFieldDouble; using namespace std; - typedef map SparseDoubleVec; + typedef map SparseDoubleVec; /*! * Internal class, not part of the public API. @@ -48,11 +48,11 @@ namespace MEDCoupling public: OverlapMapping(const ProcessorGroup& group, const OverlapElementLocator& locator); - void keepTracksOfSourceIds(int procId, DataArrayInt *ids); - void keepTracksOfTargetIds(int procId, DataArrayInt *ids); - void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId); - void prepare(const vector< int >& procsToSendField, int nbOfTrgElems); - void computeDenoConservativeVolumic(int nbOfTuplesTrg); + void keepTracksOfSourceIds(int procId, DataArrayIdType *ids); + void keepTracksOfTargetIds(int procId, DataArrayIdType *ids); + void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId); + void prepare(const vector< int >& procsToSendField, mcIdType nbOfTrgElems); + void computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg); // void computeDenoIntegralGlobConstraint(); // void computeDenoIntegral(); void computeDenoRevIntegral(const DataArrayDouble & targetAreas); @@ -60,13 +60,13 @@ namespace MEDCoupling void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput, double default_val) const; void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput); private: - void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets, + void serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets, int *countForRecv, int *offsetsForRecv) const; - int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0, - int *&bigArrI, double *&bigArrD, int *count, int *offsets, + mcIdType serializeMatrixStep1ST(const mcIdType *nbOfElemsSrc, const mcIdType *recvStep0, const int *countStep0, const int *offsStep0, + mcIdType *&bigArrI, double *&bigArrD, int *count, int *offsets, int *countForRecv, int *offsForRecv) const; - void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs, - const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs); + void unserializationST(mcIdType nbOfTrgElems, const mcIdType *nbOfElemsSrcPerProc, const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs, + const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs); void finishToFillFinalMatrixST(); void fillSourceIdsZipReceivedForMultiply(); @@ -83,10 +83,10 @@ namespace MEDCoupling * gives an old2new map for the local part of the source mesh that has been sent to proc#i, just based on the * bounding box computation (this is potentially a larger set than what is finally in the interp matrix). * Second member gives proc ID. */ - map < int, MCAuto > _sent_src_ids; + map < int, MCAuto > _sent_src_ids; //! See _sent_src_ids. Same for target mesh. - map < int, MCAuto > _sent_trg_ids; + map < int, MCAuto > _sent_trg_ids; /**! Vector of matrixes (partial interpolation ratios), result of the LOCAL interpolator run. * Indexing shared with _source_proc_id_st, and _target_proc_id_st. */ @@ -99,16 +99,16 @@ namespace MEDCoupling /**! Number of received source mesh IDs at mesh data exchange. Counting the number of IDs suffices, as we just need this to prepare the receive side, when doing the final vector matrix multiplication. First dimension is the remote proc ID from which we received. */ - map _nb_of_rcv_src_ids; + map _nb_of_rcv_src_ids; /**! Specifies for each (target) remote proc ID (first dim of the map) the corresponding * source cell IDs to use. * This information is stored from the *locally* COMPuted matrices, and corresponds hence to field value that will need to * sent later on, if this matrix bit itself is sent aways. */ - map > _src_ids_zip_comp; + map > _src_ids_zip_comp; /**! Same idea as _src_ids_zip_comp above, but for RECEIVED matrix. */ - map > _src_ids_zip_recv; + map > _src_ids_zip_recv; /**! THE matrix for matrix-vector product. The first dimension is indexed in the set of target procs * that interacts with local source mesh. The second dim is the target cell ID. diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index e1e1886fc..b3e65716b 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -112,7 +112,7 @@ namespace MEDCoupling */ ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& proc_group): _field(subdomain_field), - _component_topology(ComponentTopology(_field->getNumberOfComponents())),_topology(0),_own_support(false), + _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(0),_own_support(false), _support(sup) { if(_field) @@ -174,7 +174,7 @@ namespace MEDCoupling * For example if _field is a nodal field : returned array will be the nodal global numbers. * The content of this method is used to inform Working side to accumulate data received by lazy side. */ - DataArrayInt* ParaFIELD::returnCumulativeGlobalNumbering() const + DataArrayIdType* ParaFIELD::returnCumulativeGlobalNumbering() const { if(!_field) return 0; @@ -190,7 +190,7 @@ namespace MEDCoupling } } - DataArrayInt* ParaFIELD::returnGlobalNumbering() const + DataArrayIdType* ParaFIELD::returnGlobalNumbering() const { if(!_field) return 0; diff --git a/src/ParaMEDMEM/ParaFIELD.hxx b/src/ParaMEDMEM/ParaFIELD.hxx index afdfbc007..7ca217363 100644 --- a/src/ParaMEDMEM/ParaFIELD.hxx +++ b/src/ParaMEDMEM/ParaFIELD.hxx @@ -22,6 +22,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "ComponentTopology.hxx" +#include "MCType.hxx" namespace MEDCoupling { @@ -43,8 +44,8 @@ namespace MEDCoupling void synchronizeSource( MEDCoupling::ParaFIELD* target_field); MEDCouplingFieldDouble* getField() const { return _field; } void setOwnSupport(bool v) const { _own_support=v; } - DataArrayInt* returnCumulativeGlobalNumbering() const; - DataArrayInt* returnGlobalNumbering() const; + DataArrayIdType* returnCumulativeGlobalNumbering() const; + DataArrayIdType* returnGlobalNumbering() const; Topology* getTopology() const { return _topology; } ParaMESH* getSupport() const { return _support; } int nbComponents() const; diff --git a/src/ParaMEDMEM/ParaIdType.hxx b/src/ParaMEDMEM/ParaIdType.hxx new file mode 100644 index 000000000..8bc4dbb5b --- /dev/null +++ b/src/ParaMEDMEM/ParaIdType.hxx @@ -0,0 +1,31 @@ +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __ParaIdType_HXX__ +#define __ParaIdType_HXX__ + +#include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + +#endif diff --git a/src/ParaMEDMEM/ParaMESH.cxx b/src/ParaMEDMEM/ParaMESH.cxx index cc5598194..1fe4ddf9c 100644 --- a/src/ParaMEDMEM/ParaMESH.cxx +++ b/src/ParaMEDMEM/ParaMESH.cxx @@ -34,8 +34,8 @@ using namespace std; namespace MEDCoupling { ParaMESH::ParaMESH( MEDCouplingPointSet *subdomain_mesh, MEDCouplingPointSet *subdomain_face, - DataArrayInt *CorrespElt_local2global, DataArrayInt *CorrespFace_local2global, - DataArrayInt *CorrespNod_local2global, const ProcessorGroup& proc_group ): + DataArrayIdType *CorrespElt_local2global, DataArrayIdType *CorrespFace_local2global, + DataArrayIdType *CorrespNod_local2global, const ProcessorGroup& proc_group ): _cell_mesh(subdomain_mesh), _face_mesh(subdomain_face), _my_domain_id(proc_group.myRank()), @@ -67,20 +67,20 @@ namespace MEDCoupling { if(_cell_mesh) _cell_mesh->incrRef(); - int nb_elem=mesh->getNumberOfCells(); + mcIdType nb_elem=mesh->getNumberOfCells(); _explicit_topology=new BlockTopology(proc_group,nb_elem); - int nbOfCells=mesh->getNumberOfCells(); - _cell_global = DataArrayInt::New(); + mcIdType nbOfCells=mesh->getNumberOfCells(); + _cell_global = DataArrayIdType::New(); _cell_global->alloc(nbOfCells,1); - int *cellglobal=_cell_global->getPointer(); - int offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0)); - for (int i=0; igetPointer(); + mcIdType offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0)); + for (mcIdType i=0; iisStructured(); } MEDCouplingPointSet *getCellMesh() const { return _cell_mesh; } MEDCouplingPointSet *getFaceMesh() const { return _face_mesh; } BlockTopology* getBlockTopology() const { return _block_topology; } - DataArrayInt* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; } - DataArrayInt* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; } - DataArrayInt* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; } - const int* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; } - const int* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; } - const int* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; } + DataArrayIdType* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; } + DataArrayIdType* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; } + DataArrayIdType* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; } + const mcIdType* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; } + const mcIdType* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; } + const mcIdType* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; } private: //mesh object underlying the ParaMESH object @@ -84,9 +84,9 @@ namespace MEDCoupling MEDCoupling::BlockTopology* _block_topology; Topology* _explicit_topology; // pointers to global numberings - DataArrayInt* _node_global; - DataArrayInt* _face_global; - DataArrayInt* _cell_global; + DataArrayIdType* _node_global; + DataArrayIdType* _face_global; + DataArrayIdType* _cell_global; }; } diff --git a/src/ParaMEDMEM/ProcessorGroup.hxx b/src/ParaMEDMEM/ProcessorGroup.hxx index 2b10a2184..f4cd902f0 100644 --- a/src/ParaMEDMEM/ProcessorGroup.hxx +++ b/src/ParaMEDMEM/ProcessorGroup.hxx @@ -49,7 +49,7 @@ namespace MEDCoupling virtual void intersect (ProcessorGroup&) = 0; bool contains(int rank) const { return _proc_ids.find(rank)!=_proc_ids.end(); } virtual bool containsMyRank() const = 0; - int size() const { return _proc_ids.size(); } + int size() const { return (int)_proc_ids.size(); } const CommInterface& getCommInterface()const { return _comm_interface; } virtual int myRank() const = 0; virtual int translateRank(const ProcessorGroup*, int) const = 0; diff --git a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx index 2a8acfc29..36454c959 100644 --- a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx @@ -152,29 +152,29 @@ namespace MEDCoupling int myranksource = _topo_source->getProcGroup()->myRank(); - vector * target_arrays=new vector[_topo_target->getProcGroup()->size()]; + vector * target_arrays=new vector[_topo_target->getProcGroup()->size()]; //cout<<" topotarget size"<< _topo_target->getProcGroup()->size()< getNbLocalElements(); - for (int ielem=0; ielem< nb_local ; ielem++) + mcIdType nb_local = _topo_source-> getNbLocalElements(); + for (mcIdType ielem=0; ielem< nb_local ; ielem++) { // cout <<"source local :"<localToGlobal(make_pair(myranksource, ielem)); + mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem)); // cout << "global "< target_local =_topo_target->globalToLocal(global); + pair target_local =_topo_target->globalToLocal(global); // cout << "target local : "<size(); + std::size_t union_size=group->size(); _send_counts=new int[union_size]; _send_displs=new int[union_size]; _recv_counts=new int[union_size]; _recv_displs=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _send_counts[i]=0; _recv_counts[i]=0; @@ -186,7 +186,7 @@ namespace MEDCoupling { //converts the rank in target to the rank in union communicator int unionrank=group->translateRank(_topo_target->getProcGroup(),iproc); - _send_counts[unionrank]=target_arrays[iproc].size(); + _send_counts[unionrank]=(int)target_arrays[iproc].size(); } for (int iproc=1; iprocsize();iproc++) @@ -200,15 +200,15 @@ namespace MEDCoupling int* counter=new int [_topo_target->getProcGroup()->size()]; counter[0]=0; for (int i=1; i<_topo_target->getProcGroup()->size(); i++) - counter[i]=counter[i-1]+target_arrays[i-1].size(); + counter[i]=counter[i-1]+(int)target_arrays[i-1].size(); const double* value = _local_field->getField()->getArray()->getPointer(); //cout << "Nb local " << nb_local<localToGlobal(make_pair(myranksource, ielem)); - pair target_local =_topo_target->globalToLocal(global); + mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem)); + pair target_local =_topo_target->globalToLocal(global); //cout <<"global : "<< global<<" local :"<getProcGroup()->myRank(); - vector < vector > source_arrays(_topo_source->getProcGroup()->size()); - int nb_local = _topo_target-> getNbLocalElements(); - for (int ielem=0; ielem< nb_local ; ielem++) + vector < vector > source_arrays(_topo_source->getProcGroup()->size()); + mcIdType nb_local = _topo_target-> getNbLocalElements(); + for (mcIdType ielem=0; ielem< nb_local ; ielem++) { // cout <<"TS target local :"<localToGlobal(make_pair(myranktarget, ielem)); + mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem)); //cout << "TS global "< source_local =_topo_source->globalToLocal(global); + pair source_local =_topo_source->globalToLocal(global); // cout << "TS source local : "<size(); + std::size_t union_size=group->size(); _recv_counts=new int[union_size]; _recv_displs=new int[union_size]; _send_counts=new int[union_size]; _send_displs=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _send_counts[i]=0; _recv_counts[i]=0; @@ -257,9 +257,9 @@ namespace MEDCoupling { //converts the rank in target to the rank in union communicator int unionrank=group->translateRank(_topo_source->getProcGroup(),iproc); - _recv_counts[unionrank]=source_arrays[iproc].size(); + _recv_counts[unionrank]=(int)source_arrays[iproc].size(); } - for (int i=1; imyRank()<< "received master rank"<broadcast(&size, 1,MPI_INT,rank_master,*(group->getComm())); + _comm_interface->broadcast(&size, 1,MPI_ID_TYPE,rank_master,*(group->getComm())); - int* buffer=new int[size]; + mcIdType* buffer=new mcIdType[size]; if (topo!=0 && topo->getProcGroup()->myRank()==0) copy(serializer, serializer+size, buffer); - _comm_interface->broadcast(buffer,size,MPI_INT,rank_master,*(group->getComm())); + _comm_interface->broadcast(buffer,(int)size,MPI_ID_TYPE,rank_master,*(group->getComm())); // Processors which did not possess the source topology // unserialize it @@ -353,7 +353,7 @@ namespace MEDCoupling _recv_buffer, _recv_counts, _recv_displs, MPI_DOUBLE,comm); cout<<"end AllToAll"<getNbLocalElements(); + mcIdType nb_local = _topo_target->getNbLocalElements(); //double* value=new double[nb_local]; double* value=const_cast(_local_field->getField()->getArray()->getPointer()); @@ -368,10 +368,10 @@ namespace MEDCoupling delete group; } - for (int ielem=0; ielemlocalToGlobal(make_pair(myranktarget, ielem)); - pair source_local =_topo_source->globalToLocal(global); + mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem)); + pair source_local =_topo_source->globalToLocal(global); value[ielem]=_recv_buffer[counters[source_local.first]++]; } diff --git a/src/ParaMEDMEM/Topology.hxx b/src/ParaMEDMEM/Topology.hxx index 101ecbbe0..168b5bbd5 100644 --- a/src/ParaMEDMEM/Topology.hxx +++ b/src/ParaMEDMEM/Topology.hxx @@ -20,6 +20,8 @@ #ifndef __TOPOLOGY_HXX__ #define __TOPOLOGY_HXX__ +#include "MCType.hxx" + namespace MEDCoupling { class ProcessorGroup; @@ -36,8 +38,8 @@ namespace MEDCoupling public: Topology() { } virtual ~Topology() { } - virtual int getNbElements() const = 0; - virtual int getNbLocalElements() const = 0; + virtual mcIdType getNbElements() const = 0; + virtual mcIdType getNbLocalElements() const = 0; virtual const ProcessorGroup* getProcGroup()const = 0; }; } diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx index cb3725380..ebacc6dc6 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx @@ -80,7 +80,7 @@ void MPI2ParaMEDMEMTest::testBasicMPI2_1() const double sourceCoordsAll[2][8]={{0.4,0.5,0.4,1.5,1.6,1.5,1.6,0.5}, {0.3,-0.5,1.6,-0.5,1.6,-1.5,0.3,-1.5}}; - int conn4All[8]={0,1,2,3,4,5,6,7}; + mcIdType conn4All[8]={0,1,2,3,4,5,6,7}; std::ostringstream stream; stream << "sourcemesh2D proc " << grank; mesh=MEDCouplingUMesh::New(stream.str().c_str(),2); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx index 29265f665..b7a10c8ad 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx @@ -82,7 +82,7 @@ void MPI2ParaMEDMEMTest::testBasicMPI2_1() const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4}, {0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7}, {0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}}; - int conn4All[8]={0,1,2,3,4,5,6,7}; + mcIdType conn4All[8]={0,1,2,3,4,5,6,7}; double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}}; std::ostringstream stream; stream << "targetmesh2D proc " << grank-(gsize-lsize); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx index c8521a8cb..408084e31 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx @@ -69,8 +69,8 @@ void ParaMEDMEMTest::testBlockTopology_constructor() CommInterface interface; MPIProcessorGroup group(interface); BlockTopology blocktopo(group,1); - CPPUNIT_ASSERT_EQUAL(1,blocktopo.getNbLocalElements()); - CPPUNIT_ASSERT_EQUAL(size,blocktopo.getNbElements()); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),blocktopo.getNbLocalElements()); + CPPUNIT_ASSERT_EQUAL(ToIdType(size),blocktopo.getNbElements()); CPPUNIT_ASSERT_EQUAL(1,blocktopo.getDimension()); //checking access methods @@ -93,11 +93,11 @@ void ParaMEDMEMTest::testBlockTopology_constructor() global=blocktopo2.localToGlobal(local); CPPUNIT_ASSERT_EQUAL(global,2*size-1); - std::vector > bounds = blocktopo2.getLocalArrayMinMax(); + std::vector > bounds = blocktopo2.getLocalArrayMinMax(); int vecsize = bounds.size(); CPPUNIT_ASSERT_EQUAL(1,vecsize); CPPUNIT_ASSERT_EQUAL(2*rank, (bounds[0]).first); - CPPUNIT_ASSERT_EQUAL(2*rank+2, (bounds[0]).second); + CPPUNIT_ASSERT_EQUAL(ToIdType(2*rank+2), (bounds[0]).second); } void ParaMEDMEMTest::testBlockTopology_serialize() @@ -114,8 +114,8 @@ void ParaMEDMEMTest::testBlockTopology_serialize() //testing the serialization process that is used to transfer a //block topology via a MPI_Send/Recv comm BlockTopology blocktopo_recv; - int* serializer; - int sersize; + mcIdType* serializer; + mcIdType sersize; blocktopo.serialize(serializer,sersize); blocktopo_recv.unserialize(serializer,interface); CPPUNIT_ASSERT_EQUAL(blocktopo.getNbElements(),blocktopo_recv.getNbElements()); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx index 6e3d5a80c..514251c47 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx @@ -65,7 +65,7 @@ void ParaMEDMEMTest::testFabienAPI1() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->finishInsertingCells(); @@ -85,7 +85,7 @@ void ParaMEDMEMTest::testFabienAPI1() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[6]={0,2,1,2,3,1}; + mcIdType targetConn[6]={0,2,1,2,3,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3); @@ -150,7 +150,7 @@ void ParaMEDMEMTest::testFabienAPI2() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->finishInsertingCells(); @@ -170,7 +170,7 @@ void ParaMEDMEMTest::testFabienAPI2() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[6]={0,2,1,2,3,1}; + mcIdType targetConn[6]={0,2,1,2,3,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx index 5c05af4fa..c8e2d4948 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx @@ -60,7 +60,7 @@ MEDCouplingUMesh *init_quadGauthier1(int is_master) const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[8]={0,1,3,2,4,5,7,6}; + const mcIdType conn[8]={0,1,3,2,4,5,7,6}; m->allocateCells(2); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4); @@ -83,7 +83,7 @@ MEDCouplingUMesh *init_triangleGauthier1(int is_master) const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; + const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; m->allocateCells(2); for(int i=0;i<4;i++) m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); @@ -285,7 +285,7 @@ void ParaMEDMEMTest::testGauthier2() std::copy(cooData,cooData+189,arr->getPointer()); mesh->setCoords(arr); mesh->allocateCells(80); - const int conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29}; + const mcIdType conn[240]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29}; for(int i=0;i<80;i++) mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); MCAuto f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME)); @@ -307,7 +307,7 @@ void ParaMEDMEMTest::testGauthier2() std::copy(cooData,cooData+66,arr->getPointer()); mesh->setCoords(arr); mesh->allocateCells(10); - const int conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20}; + const mcIdType conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20}; for(int i=0;i<10;i++) mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4*i); MCAuto f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME)); @@ -338,7 +338,7 @@ void ParaMEDMEMTest::testGauthier2() { double pmin=1e38, pmax=-1e38; const double *p(vitesse->getField()->getArray()->begin()); - for(std::size_t i=0;igetField()->getArray()->getNbOfElems();i++,p++) + for(mcIdType i=0;igetField()->getArray()->getNbOfElems();i++,p++) { if (*ppmax) pmax=*p; @@ -555,12 +555,12 @@ void ParaMEDMEMTest::testGauthier4() { // const double sourceCoords[19*3]={0.5,0.5,0.1,0.5,0.5,1.2,0.5,0.5,1.6,0.5,0.5,1.8,0.5,0.5,2.43,0.5,0.5,2.55,0.5,0.5,4.1,0.5,0.5,4.4,0.5,0.5,4.9,0.5,0.5,5.1,0.5,0.5,7.6,0.5,0.5,7.7,0.5,0.5,8.2,0.5,0.5,8.4,0.5,0.5,8.6,0.5,0.5,8.8,0.5,0.5,9.2,0.5,0.5,9.6,0.5,0.5,11.5}; - const int sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18}; + const mcIdType sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18}; const double sourceVals[19]={0.49,2.8899999999999997,7.29,13.69,22.09,32.49,44.89,59.29,75.69,94.09, 114.49,136.89,161.29,187.69,216.09,246.49,278.89,313.29,349.69}; const double targetCoords0[20*3]={0.,0.,0.,1.,0.,0.,0.,1.,0.,1.,1.,0.,0.,0.,1.,1.,0.,1.,0.,1.,1.,1.,1.,1.,0.,0.,2.,1.,0.,2.,0.,1.,2.,1.,1.,2.,0.,0.,3.,1.,0.,3.,0.,1.,3.,1.,1.,3.,0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.}; - const int targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19}; + const mcIdType targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19}; const double targetCoords1[28*3]={0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.,0.,0.,5.,1.,0.,5.,0.,1.,5.,1.,1.,5.,0.,0.,6.,1.,0.,6.,0.,1.,6.,1.,1.,6.,0.,0.,7.,1.,0.,7.,0.,1.,7.,1.,1.,7.,0.,0.,8.,1.,0.,8.,0.,1.,8.,1.,1.,8.,0.,0.,9.,1.,0.,9.,0.,1.,9.,1.,1.,9.,0.,0.,10.,1.,0.,10.,0.,1.,10.,1.,1.,10.}; - const int targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27}; + const mcIdType targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27}; // int size; int rank; diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx index 46b42b8ca..2c846ac20 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx @@ -72,7 +72,7 @@ MEDCouplingUMesh *init_quad() const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[8]={0,1,3,2,4,5,7,6}; + const mcIdType conn[8]={0,1,3,2,4,5,7,6}; m->allocateCells(2); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4); @@ -87,7 +87,7 @@ MEDCouplingUMesh *init_triangle() const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; + const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; m->allocateCells(4); for(int i=0;i<4;i++) m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); @@ -144,7 +144,6 @@ void ParaMEDMEMTest::testICoco1() champ_recepteur->setOwnSupport(true); } - MPI_Barrier(MPI_COMM_WORLD); clock_t clock0(clock()); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 7be3eb003..d6aee48e8 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -105,7 +105,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==0) { double coords[4]={0.3,0.7, 0.9,1.0}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",1); mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -120,7 +120,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==1) { double coords[2]={0.7,0.9}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc1",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -134,7 +134,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==2) { double coords[2]={1.,1.12}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc2",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -169,7 +169,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==3) { double coords[2]={0.5,0.75}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc3",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -184,7 +184,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==4) { double coords[2]={0.75,1.2}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc4",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -294,7 +294,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==0) { double coords[8]={0.3,0.3,0.7,0.7, 0.9,0.9,1.0,1.0}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",1); mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -309,7 +309,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==1) { double coords[4]={0.7,0.7,0.9,0.9}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc1",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -323,7 +323,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==2) { double coords[4]={1.,1.,1.12,1.12}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc2",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -358,7 +358,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==3) { double coords[4]={0.5,0.5,0.75,0.75}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc3",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -373,7 +373,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==4) { double coords[4]={0.75,0.75,1.2,1.2}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc4",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -1091,7 +1091,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4}, {0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7}, {0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}}; - int conn4All[8]={0,1,2,3,4,5,6,7}; + mcIdType conn4All[8]={0,1,2,3,4,5,6,7}; double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}}; double targetResults2[3][2]={{0.28333333333333344,0.56666666666666687},{1.8564102564102569,2.0128205128205132},{1.0846153846153845,0.36153846153846159}}; double targetResults3[3][2]={{3.7777777777777781,7.5555555555555562},{24.511111111111113,26.355555555555558},{14.1,4.7}}; @@ -1410,7 +1410,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==0) { double coords[6]={-0.3,-0.3, 0.7,0.7, 0.7,-0.3}; - int conn[3]={0,1,2}; + mcIdType conn[3]={0,1,2}; //int globalNode[3]={1,2,0}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",2); mesh->allocateCells(1); @@ -1425,7 +1425,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==1) { double coords[6]={-0.3,-0.3, -0.3,0.7, 0.7,0.7}; - int conn[3]={0,1,2}; + mcIdType conn[3]={0,1,2}; //int globalNode[3]={1,3,2}; mesh=MEDCouplingUMesh::New("Source mesh Proc1",2); mesh->allocateCells(1); @@ -1462,7 +1462,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==2) { double coords[10]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2 }; - int conn[7]={0,3,4,1, 1,4,2}; + mcIdType conn[7]={0,3,4,1, 1,4,2}; //int globalNode[5]={4,3,0,2,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc2",2); mesh->allocateCells(2); @@ -1475,8 +1475,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() mesh->setCoords(myCoords); myCoords->decrRef(); paramesh=new ParaMESH(mesh,*target_group,targetMeshName); - DataArrayInt *da=DataArrayInt::New(); - const int globalNumberingP2[5]={0,1,2,3,4}; + DataArrayIdType *da=DataArrayIdType::New(); + const mcIdType globalNumberingP2[5]={0,1,2,3,4}; da->useArray(globalNumberingP2,false,DeallocType::CPP_DEALLOC,5,1); paramesh->setNodeGlobal(da); da->decrRef(); @@ -1484,7 +1484,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==3) { double coords[6]={0.2,0.2, 0.7,-0.3, 0.7,0.2}; - int conn[3]={0,2,1}; + mcIdType conn[3]={0,2,1}; //int globalNode[3]={1,0,5}; mesh=MEDCouplingUMesh::New("Target mesh Proc3",2); mesh->allocateCells(1); @@ -1496,8 +1496,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() mesh->setCoords(myCoords); myCoords->decrRef(); paramesh=new ParaMESH(mesh,*target_group,targetMeshName); - DataArrayInt *da=DataArrayInt::New(); - const int globalNumberingP3[3]={4,2,5}; + DataArrayIdType *da=DataArrayIdType::New(); + const mcIdType globalNumberingP3[3]={4,2,5}; da->useArray(globalNumberingP3,false,DeallocType::CPP_DEALLOC,3,1); paramesh->setNodeGlobal(da); da->decrRef(); @@ -1505,7 +1505,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==4) { double coords[12]={-0.3,0.2, -0.3,0.7, 0.2,0.7, 0.2,0.2, 0.7,0.7, 0.7,0.2}; - int conn[8]={0,1,2,3, 3,2,4,5}; + mcIdType conn[8]={0,1,2,3, 3,2,4,5}; //int globalNode[6]={2,6,7,1,8,5}; mesh=MEDCouplingUMesh::New("Target mesh Proc4",2); mesh->allocateCells(2); @@ -1518,8 +1518,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() mesh->setCoords(myCoords); myCoords->decrRef(); paramesh=new ParaMESH(mesh,*target_group,targetMeshName); - DataArrayInt *da=DataArrayInt::New(); - const int globalNumberingP4[6]={3,6,7,4,8,5}; + DataArrayIdType *da=DataArrayIdType::New(); + const mcIdType globalNumberingP4[6]={3,6,7,4,8,5}; da->useArray(globalNumberingP4,false,DeallocType::CPP_DEALLOC,6,1); paramesh->setNodeGlobal(da); da->decrRef(); @@ -1636,7 +1636,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() myCoords->decrRef(); if(rank==0) { - int targetConn[7]={0,3,4,1, 1,4,2}; + mcIdType targetConn[7]={0,3,4,1, 1,4,2}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4); @@ -1644,7 +1644,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() } else { - int targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4}; mesh->allocateCells(3); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+3); @@ -1869,7 +1869,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->finishInsertingCells(); @@ -1894,7 +1894,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[6]={0,2,1,2,3,1}; + mcIdType targetConn[6]={0,2,1,2,3,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3); @@ -1962,7 +1962,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() if(source_group->containsMyRank()) { double coords[15]={1.,0.,0., 2.,0.,0., 2.,2.,0., 0.,2.,0., 0.5,0.5,1.}; - int conn[7]={0,1,2,3,0,3,4}; + mcIdType conn[7]={0,1,2,3,0,3,4}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",2); mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); @@ -1987,7 +1987,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() if(rank==1) { double coords[12]={0.25,0.25,0.5, 0.,0.25,0.5, 0.,0.,0.5, 0.25,0.,0.5}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Target mesh Proc1",2); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); @@ -2002,7 +2002,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() if(rank==2) { double coords[12]={0.,0.25,0.5, 0.,0.,0.5, -1.,0.,0.5, -1.,0.25,0.5}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Target mesh Proc2",2); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx index 410b5ce6a..06c081ebb 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx @@ -196,7 +196,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsS,coordsS+10,myCoords->getPointer()); meshS->setCoords(myCoords); myCoords->decrRef(); - int connS[7]={0,3,4,1, 1,4,2}; + mcIdType connS[7]={0,3,4,1, 1,4,2}; meshS->allocateCells(2); meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS); meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS+4); @@ -215,7 +215,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsT,coordsT+6,myCoords->getPointer()); meshT->setCoords(myCoords); myCoords->decrRef(); - int connT[3]={0,2,1}; + mcIdType connT[3]={0,2,1}; meshT->allocateCells(1); meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT->finishInsertingCells(); @@ -238,7 +238,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsS,coordsS+10,myCoords->getPointer()); meshS->setCoords(myCoords); myCoords->decrRef(); - int connS[7]={0,1,2, 1,3,4,2}; + mcIdType connS[7]={0,1,2, 1,3,4,2}; meshS->allocateCells(2); meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS); meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS+3); @@ -257,7 +257,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsT,coordsT+6,myCoords->getPointer()); meshT->setCoords(myCoords); myCoords->decrRef(); - int connT[3]={0,2,1}; + mcIdType connT[3]={0,2,1}; meshT->allocateCells(1); meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT->finishInsertingCells(); @@ -280,7 +280,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsS,coordsS+8,myCoords->getPointer()); meshS->setCoords(myCoords); myCoords->decrRef(); - int connS[4]={0,2,3,1}; + mcIdType connS[4]={0,2,3,1}; meshS->allocateCells(1); meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS); meshS->finishInsertingCells(); @@ -298,7 +298,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsT,coordsT+6,myCoords->getPointer()); meshT->setCoords(myCoords); myCoords->decrRef(); - int connT[3]={0,1,2}; + mcIdType connT[3]={0,1,2}; meshT->allocateCells(1); meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT->finishInsertingCells(); @@ -319,7 +319,7 @@ void prepareData2_buildOneSquare(MEDCouplingUMesh* & meshS_0, MEDCouplingUMesh* myCoords->alloc(5,2); std::copy(coords,coords+10,myCoords->getPointer()); meshS_0->setCoords(myCoords); myCoords->decrRef(); - int connS[4]={0,1,2,3}; + mcIdType connS[4]={0,1,2,3}; meshS_0->allocateCells(2); meshS_0->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS); // @@ -329,7 +329,7 @@ void prepareData2_buildOneSquare(MEDCouplingUMesh* & meshS_0, MEDCouplingUMesh* std::copy(coords,coords+10,myCoords->getPointer()); meshT_0->setCoords(myCoords); myCoords->decrRef(); - int connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4}; + mcIdType connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4}; meshT_0->allocateCells(4); meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+3); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx index b538f7317..b898cd4fd 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx @@ -106,7 +106,7 @@ void ParaMEDMEMTest::testStructuredCoincidentDEC() { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); int nb_local=mesh->getNumberOfCells(); - const int* global_numbering = paramesh->getGlobalNumberingCell(); + const mcIdType* global_numbering = paramesh->getGlobalNumberingCell(); double *value=parafield->getField()->getArray()->getPointer(); for(int ielem=0; ielemgetGlobalNumberingCell(); - int size=self->getCellMesh()->getNumberOfCells(); + const mcIdType *tmp=self->getGlobalNumberingCell(); + mcIdType size=self->getCellMesh()->getNumberOfCells(); PyObject *ret=PyList_New(size); - for(int i=0;igetGlobalNumberingFace(); - int size=self->getFaceMesh()->getNumberOfCells(); + const mcIdType *tmp=self->getGlobalNumberingFace(); + mcIdType size=self->getFaceMesh()->getNumberOfCells(); PyObject *ret=PyList_New(size); - for(int i=0;igetGlobalNumberingNode(); - int size=self->getCellMesh()->getNumberOfNodes(); + const mcIdType *tmp=self->getGlobalNumberingNode(); + mcIdType size=self->getCellMesh()->getNumberOfNodes(); PyObject *ret=PyList_New(size); - for(int i=0;i workMesh=mc->getMeshAtLevel(0); @@ -83,7 +83,7 @@ int main(int argc, char** argv) ipermSafe=iperm; permSafe=perm; delete renumb; ipermSafe=0;//erase new2old, we are using only old 2 new - t_compute_graph=clock(); + t_compute_graph=(double)clock(); cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl; cout.flush(); // Connectivity @@ -97,7 +97,7 @@ int main(int argc, char** argv) mc->setFamilyFieldArr(0,famField2); } mc->write(filename_out,2); - t_family=clock(); + t_family=(double)clock(); cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush; // Fields cout << "Reordering fields and writing : " << flush; @@ -122,7 +122,7 @@ int main(int argc, char** argv) fs->write(filename_out,0); //fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged } - t_field=clock(); + t_field=(double)clock(); cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush; return 0; } diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index 0b224d8d5..42fddc97d 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -21,6 +21,10 @@ INCLUDE(${SWIG_USE_FILE}) ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_FLAGS "-py3") diff --git a/src/RENUMBER_Swig/MEDRenumber.i b/src/RENUMBER_Swig/MEDRenumber.i index 2060dd0e1..1a4c7bdbe 100644 --- a/src/RENUMBER_Swig/MEDRenumber.i +++ b/src/RENUMBER_Swig/MEDRenumber.i @@ -37,24 +37,42 @@ def MEDCouplingDataArrayDoubleIdiv(self,*args): def MEDCouplingDataArrayDoubleIpow(self,*args): import _MEDRenumber return _MEDRenumber.DataArrayDouble____ipow___(self, self, *args) -def MEDCouplingDataArrayIntIadd(self,*args): +def MEDCouplingDataArrayInt32Iadd(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____iadd___(self, self, *args) -def MEDCouplingDataArrayIntIsub(self,*args): + return _MEDRenumber.DataArrayInt32____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32Isub(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____isub___(self, self, *args) -def MEDCouplingDataArrayIntImul(self,*args): + return _MEDRenumber.DataArrayInt32____isub___(self, self, *args) +def MEDCouplingDataArrayInt32Imul(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____imul___(self, self, *args) -def MEDCouplingDataArrayIntIdiv(self,*args): + return _MEDRenumber.DataArrayInt32____imul___(self, self, *args) +def MEDCouplingDataArrayInt32Idiv(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____idiv___(self, self, *args) -def MEDCouplingDataArrayIntImod(self,*args): + return _MEDRenumber.DataArrayInt32____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32Imod(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____imod___(self, self, *args) -def MEDCouplingDataArrayIntIpow(self,*args): + return _MEDRenumber.DataArrayInt32____imod___(self, self, *args) +def MEDCouplingDataArrayInt32Ipow(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____ipow___(self, self, *args) + return _MEDRenumber.DataArrayInt32____ipow___(self, self, *args) +def MEDCouplingDataArrayInt64Iadd(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64Isub(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____isub___(self, self, *args) +def MEDCouplingDataArrayInt64Imul(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____imul___(self, self, *args) +def MEDCouplingDataArrayInt64Idiv(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64Imod(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____imod___(self, self, *args) +def MEDCouplingDataArrayInt64Ipow(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____ipow___(self, self, *args) def MEDCouplingDataArrayFloatIadd(self,*args): import _MEDRenumber return _MEDRenumber.DataArrayFloat____iadd___(self, self, *args) @@ -79,21 +97,36 @@ def MEDCouplingDataArrayDoubleTupleImul(self,*args): def MEDCouplingDataArrayDoubleTupleIdiv(self,*args): import _MEDRenumber return _MEDRenumber.DataArrayDoubleTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleIadd(self,*args): +def MEDCouplingDataArrayInt32TupleIadd(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt32Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIsub(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____iadd___(self, self, *args) -def MEDCouplingDataArrayIntTupleIsub(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImul(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____isub___(self, self, *args) -def MEDCouplingDataArrayIntTupleImul(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIdiv(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____imul___(self, self, *args) -def MEDCouplingDataArrayIntTupleIdiv(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImod(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleImod(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____imod___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIadd(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____imod___(self, self, *args) + return _MEDRenumber.DataArrayInt64Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIsub(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImul(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIdiv(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImod(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____imod___(self, self, *args) %} @@ -106,44 +139,79 @@ DataArrayDouble.__imul__=MEDCouplingDataArrayDoubleImul DataArrayDouble.__idiv__=MEDCouplingDataArrayDoubleIdiv DataArrayDouble.__ipow__=MEDCouplingDataArrayDoubleIpow -DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce -DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd -DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub -DataArrayInt.__imul__=MEDCouplingDataArrayIntImul -DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__imod__=MEDCouplingDataArrayIntImod -DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow +DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce +DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd +DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub +DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul +DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv +DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod +DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow +DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce +DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd +DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub +DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul +DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv +DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod +DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow DataArrayDoubleTuple.__iadd__=MEDCouplingDataArrayDoubleTupleIadd DataArrayDoubleTuple.__isub__=MEDCouplingDataArrayDoubleTupleIsub DataArrayDoubleTuple.__imul__=MEDCouplingDataArrayDoubleTupleImul DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv -DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd -DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub -DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul -DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod +DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd +DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub +DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul +DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod + +DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd +DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub +DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul +DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod + + + del INTERPKERNELExceptionReduce -del MEDCouplingDataArrayDoubleReduce -del MEDCouplingDataArrayIntReduce del MEDCouplingDataArrayDoubleIadd -del MEDCouplingDataArrayDoubleIsub -del MEDCouplingDataArrayDoubleImul del MEDCouplingDataArrayDoubleIdiv -del MEDCouplingDataArrayIntIadd -del MEDCouplingDataArrayIntIsub -del MEDCouplingDataArrayIntImul -del MEDCouplingDataArrayIntIdiv -del MEDCouplingDataArrayIntImod +del MEDCouplingDataArrayDoubleImul +del MEDCouplingDataArrayDoubleIpow +del MEDCouplingDataArrayDoubleIsub +del MEDCouplingDataArrayDoubleReduce del MEDCouplingDataArrayDoubleTupleIadd -del MEDCouplingDataArrayDoubleTupleIsub -del MEDCouplingDataArrayDoubleTupleImul del MEDCouplingDataArrayDoubleTupleIdiv -del MEDCouplingDataArrayIntTupleIadd -del MEDCouplingDataArrayIntTupleIsub -del MEDCouplingDataArrayIntTupleImul -del MEDCouplingDataArrayIntTupleIdiv -del MEDCouplingDataArrayIntTupleImod +del MEDCouplingDataArrayDoubleTupleImul +del MEDCouplingDataArrayDoubleTupleIsub +del MEDCouplingDataArrayInt32Iadd +del MEDCouplingDataArrayInt32Idiv +del MEDCouplingDataArrayInt32Imod +del MEDCouplingDataArrayInt32Imul +del MEDCouplingDataArrayInt32Ipow +del MEDCouplingDataArrayInt32Isub +del MEDCouplingDataArrayInt32Reduce +del MEDCouplingDataArrayInt32TupleIadd +del MEDCouplingDataArrayInt32TupleIdiv +del MEDCouplingDataArrayInt32TupleImod +del MEDCouplingDataArrayInt32TupleImul +del MEDCouplingDataArrayInt32TupleIsub +del MEDCouplingDataArrayInt64Iadd +del MEDCouplingDataArrayInt64Idiv +del MEDCouplingDataArrayInt64Imod +del MEDCouplingDataArrayInt64Imul +del MEDCouplingDataArrayInt64Ipow +del MEDCouplingDataArrayInt64Isub +del MEDCouplingDataArrayInt64Reduce +del MEDCouplingDataArrayInt64TupleIadd +del MEDCouplingDataArrayInt64TupleIdiv +del MEDCouplingDataArrayInt64TupleImod +del MEDCouplingDataArrayInt64TupleImul +del MEDCouplingDataArrayInt64TupleIsub + %} -- 2.39.2