From: eap Date: Tue, 3 Dec 2019 19:13:45 +0000 (+0300) Subject: LOT5: replace int->mcIdType in MEDLoader, MEDPartitioner, RENUMBER w/o MPI. Treat... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e4b0440fcf08a0a224e87195672318a9a524bd1a;p=tools%2Fmedcoupling.git LOT5: replace int->mcIdType in MEDLoader, MEDPartitioner, RENUMBER w/o MPI. Treat med_int --- diff --git a/src/MEDLoader/MEDFileBasis.hxx b/src/MEDLoader/MEDFileBasis.hxx index 6d6c1e39f..9e1646f1a 100644 --- a/src/MEDLoader/MEDFileBasis.hxx +++ b/src/MEDLoader/MEDFileBasis.hxx @@ -22,10 +22,13 @@ #define __MEDFILEBASIS_HXX__ #include "InterpKernelException.hxx" +#include "MEDCouplingMemArray.hxx" #include #include +#include + namespace MEDCoupling { class MEDFileString @@ -60,4 +63,113 @@ namespace MEDCoupling }; } +namespace MEDCoupling +{ + + class DataArrayMedInt : public DataArrayDiscreteSigned< med_int > + { + friend class DataArrayDiscrete; + public: + template + static DataArrayMedInt *Copy( const INTARRAY* array ); + static DataArrayMedInt *New() { return new DataArrayMedInt(); } + DataArrayMedInt *deepCopy() const { return new DataArrayMedInt(*this); } + //DataArrayMedInt *buildNewEmptyInstance() const { return new DataArrayMedInt(); }//ko + DataArray *buildNewEmptyInstance() const { if ( sizeof(med_int)==sizeof(long)) return DataArrayInt64::New(); return DataArrayInt32::New(); } + public: + DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArray *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } + DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArray *keepSelectedComponents(const std::vector& compoIds) const { return this->myKeepSelectedComponents(compoIds); } + DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); } + DataArray *selectByTupleRanges(const std::vector >& ranges) const { return this->mySelectByTupleRanges(ranges); } + private: + ~DataArrayMedInt() { } + DataArrayMedInt() { } + }; + + template< class T1, class T2 > + MCAuto StaticCast( const MCAuto< T2 >& array ) + { + DataArray *src = const_cast< T2* >((const T2*) array ); + T1* tgt = static_cast( src ); + if ( tgt ) + tgt->incrRef(); + return tgt; + } + + template< class INTARRAY > + MCAuto ToMedIntArray(const MCAuto& intArray ) + { + if ( sizeof( med_int ) == sizeof( typename INTARRAY::Type )) + return StaticCast< DataArrayMedInt >( intArray ); + return DataArrayMedInt::Copy((const INTARRAY*) intArray ); + } + + template< class INT > + MCAuto ToMedIntArray(const typename MEDCoupling::Traits::ArrayType* intArray ) + { + if ( sizeof( med_int ) == sizeof( INT )) + { + typedef typename MEDCoupling::Traits::ArrayType INTARRAY; + MCAuto< INTARRAY > ia = const_cast< INTARRAY* >( intArray ); + ia->incrRef(); + return StaticCast< DataArrayMedInt >( ia ); + } + return DataArrayMedInt::Copy( intArray ); + } + + template< class INT > + MCAuto< typename MEDCoupling::Traits::ArrayType> FromMedIntArray(MCAuto& medIntArray ) + { + typedef typename MEDCoupling::Traits::ArrayType INTARRAY; + if ( sizeof( med_int ) == sizeof( INT )) + return StaticCast< INTARRAY >( medIntArray ); + + INTARRAY* intArray = INTARRAY::New(); + intArray->alloc( medIntArray->getNumberOfTuples(), medIntArray->getNumberOfComponents() ); + intArray->copyStringInfoFrom( * medIntArray.operator->() ); + std::copy( medIntArray->begin(), medIntArray->end(), intArray->getPointer() ); + return intArray; + } + + template< class INT > + MCAuto ToMedIntArray(const std::vector& intVec ) + { + DataArrayMedInt* medIntArray = DataArrayMedInt::New(); + if ( sizeof( med_int ) == sizeof( INT )) + { + medIntArray->useArray( reinterpret_cast(intVec.data()), /*owner=*/false, DeallocType::CPP_DEALLOC, intVec.size(), /*nbComp=*/1 ); + } + else + { + medIntArray->alloc( intVec.size(), 1 ); + std::copy( intVec.begin(), intVec.end(), medIntArray->getPointer() ); + } + return medIntArray; + } + + template< class INT > + med_int ToMedInt( INT i ) + { + return static_cast< med_int >( i ); + } + + template< class INT > + INT FromMedInt( med_int mi ) + { + return static_cast< INT >( mi ); + } + + template + DataArrayMedInt * DataArrayMedInt::Copy( const INTARRAY* intArray ) + { + DataArrayMedInt* medIntArray = DataArrayMedInt::New(); + medIntArray->alloc( intArray->getNumberOfTuples(), intArray->getNumberOfComponents() ); + medIntArray->copyStringInfoFrom( *intArray ); + std::copy( intArray->begin(), intArray->end(), medIntArray->getPointer() ); + return medIntArray; + } +} + #endif diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index 91eb35f74..89524bb7d 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -95,7 +95,7 @@ MCAuto MEDFileBlowStrEltUp::dealWithMEDBALLInMesh(const M const DataArrayDouble *coo(mesh->getCoords()); if(!coo) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null coords !"); - MCAuto conn(zeStr->getConn()); + MCAuto conn(zeStr->getConn()); if(conn.isNull()) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null connectivity !"); conn->checkAllocated(); @@ -106,25 +106,25 @@ MCAuto MEDFileBlowStrEltUp::dealWithMEDBALLInMesh(const M MCAuto mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut)); mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR)); mOut->setMeshAtLevel(0,mcOut); - const DataArrayInt *ff1(mesh->getFamilyFieldAtLevel(1)); + const DataArrayIdType *ff1(mesh->getFamilyFieldAtLevel(1)); if(ff1) { - MCAuto ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end())); + MCAuto ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end())); mOut->setFamilyFieldArr(1,ff1o); } - const DataArrayInt *nf1(mesh->getNumberFieldAtLevel(1)); + const DataArrayIdType *nf1(mesh->getNumberFieldAtLevel(1)); if(nf1) { - MCAuto nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end())); + MCAuto nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end())); mOut->setRenumFieldArr(1,nf1o); } MCAuto md(zeStr->getMeshDef()); - const DataArrayInt *ff0(md->getFam()); + const DataArrayIdType *ff0(md->getFam()); if(ff0) - mOut->setFamilyFieldArr(0,const_cast(ff0)); - const DataArrayInt *nf0(md->getNum()); + mOut->setFamilyFieldArr(0,const_cast(ff0)); + const DataArrayIdType *nf0(md->getNum()); if(nf0) - mOut->setRenumFieldArr(0,const_cast(nf0)); + mOut->setRenumFieldArr(0,const_cast(nf0)); mOut->copyFamGrpMapsFrom(*mesh); const std::vector< MCAuto >& vars(zeStr->getVars()); for(std::vector< MCAuto >::const_iterator it=vars.begin();it!=vars.end();it++) @@ -223,7 +223,7 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons std::vector pfls(zeGuideForPfl->getPflsReallyUsed()); if(pfls.size()>=2) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : drink less coffee"); - MCAuto pflMyLove; + MCAuto pflMyLove; if(pfls.size()==1) pflMyLove.takeRef(zeGuideForPfl->getProfile(pfls[0])); // Yeah we have pfls @@ -386,7 +386,7 @@ void LocInfo::checkUniqueLoc(const std::string& loc) const MCAuto LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto& ptsForLoc) { - MCAuto conn(zeStr->getConn()); + MCAuto conn(zeStr->getConn()); conn=conn->deepCopy(); conn->rearrange(1); MCAuto geoMesh; { @@ -398,7 +398,7 @@ MCAuto LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellT // if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true); } // @@ -418,7 +418,7 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali MCConstAuto angleVrille; if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); } else @@ -431,7 +431,7 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); { const int TAB[3]={2,0,1}; - std::vector v(TAB,TAB+3); + std::vector v(TAB,TAB+3); secPts=secPts->keepSelectedComponents(v); } const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; @@ -467,7 +467,7 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize MCConstAuto zeThickness; if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); zeThickness=thickness->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); } else @@ -513,7 +513,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, MCConstAuto zeAngle,zeScale; if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); } @@ -535,7 +535,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); { const int TAB[3]={2,0,1}; - std::vector v(TAB,TAB+3); + std::vector v(TAB,TAB+3); secPts=secPts->keepSelectedComponents(v); } const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; @@ -648,11 +648,11 @@ MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileU if(um->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception(MSG1); gt=um->getTypeOfCell(0); - std::vector v; + std::vector v; um->getNodeIdsOfCell(0,v); std::size_t sz2(v.size()); for(std::size_t j=0;j >& strs(mesh->getAccessOfUndergroundEltStrs()); diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index 8c3c17173..28e075017 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -203,16 +203,16 @@ bool MEDFileData::unPolyzeMeshes() if(!ms) return false; std::vector< MEDFileMesh * > meshesImpacted; - std::vector< DataArrayInt * > renumParamsOfMeshImpacted;//same size as meshesImpacted - std::vector< std::vector > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted - std::vector > memSaverIfThrow;//same size as meshesImpacted + std::vector< DataArrayIdType * > renumParamsOfMeshImpacted;//same size as meshesImpacted + std::vector< std::vector > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted + std::vector > memSaverIfThrow;//same size as meshesImpacted for(int i=0;igetNumberOfMeshes();i++) { MEDFileMesh *m=ms->getMeshAtPos(i); if(m) { - std::vector oldCode,newCode; - DataArrayInt *o2nRenumCell=0; + std::vector oldCode,newCode; + DataArrayIdType *o2nRenumCell=0; bool modif=m->unPolyze(oldCode,newCode,o2nRenumCell); if(!modif) continue; @@ -252,7 +252,7 @@ MCAuto MEDFileData::Aggregate(const std::vector ret(MEDFileData::New()); std::vector ms(sz); - std::vector< std::vector< std::pair > > dts(sz); + std::vector< std::vector< std::pair > > dts(sz); for(std::vector::const_iterator it=mfds.begin();it!=mfds.end();it++,i++) { const MEDFileData *elt(*it); diff --git a/src/MEDLoader/MEDFileEquivalence.cxx b/src/MEDLoader/MEDFileEquivalence.cxx index 10fe80b86..25d599a93 100644 --- a/src/MEDLoader/MEDFileEquivalence.cxx +++ b/src/MEDLoader/MEDFileEquivalence.cxx @@ -21,6 +21,7 @@ #include "MEDFileEquivalence.hxx" #include "MEDFileSafeCaller.txx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDLoaderBase.hxx" #include "MEDFileMesh.hxx" #include "InterpKernelAutoPtr.hxx" @@ -674,12 +675,12 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) // std::vector gts(mm->getGeoTypesAtLevel(meshDimRelToMax)); int startId(0),endId; - std::vector compS(1,0); + std::vector compS(1,0); for(std::vector::const_iterator it=gts.begin();it!=gts.end();it++) { endId=startId+mm->getNumberOfCellsWithType(*it); MCAuto da0(da->keepSelectedComponents(compS)); - MCAuto ids(da0->findIdsInRange(startId,endId)); + MCAuto ids(da0->findIdsInRange(startId,endId)); MCAuto da1(da->selectByTupleIdSafe(ids->begin(),ids->end())); da1->applyLin(1,-startId); setArrayForType(*it,da1); diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index e18ca59cb..8ac073010 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -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(DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg)); + int nbOfEntriesToKill(DataArrayIdType::GetNumberOfItemGivenBESRelative(bg,end,step,msg)); std::vector b(_fields.size(),true); int k=bg; for(int i=0;i& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N) +bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N) { bool ret(false); for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) @@ -576,7 +576,7 @@ bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, con * * \return A new object that the caller is responsible to deallocate. */ -MEDFileFields *MEDFileFields::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const +MEDFileFields *MEDFileFields::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { if(!mm) throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !"); @@ -611,14 +611,14 @@ class PFLData { public: PFLData():_add_pts_in_pfl(0) { } - PFLData(const MCAuto& mat, const MCAuto& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { } + PFLData(const MCAuto& mat, const MCAuto& pfl, int 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; } - MCAuto getProfile() const { return _pfl; } - MCAuto getMatrix() const { return _matrix; } + MCAuto getProfile() const { return _pfl; } + MCAuto getMatrix() const { return _matrix; } private: - MCAuto _matrix; - MCAuto _pfl; + MCAuto _matrix; + MCAuto _pfl; int _add_pts_in_pfl; }; @@ -674,48 +674,48 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl()); return ; } - MCAuto pfl; + MCAuto pfl; if(pflName.empty()) - pfl=DataArrayInt::Range(0,pmptpd->getNumberOfVals(),1); + pfl=DataArrayIdType::Range(0,pmptpd->getNumberOfVals(),1); else pfl=_lin_globs->getProfile(pflName)->deepCopy(); // MCAuto mesh3D(_lin->getMeshAtLevel(0)),mesh3DQuadratic(_quad->getMeshAtLevel(0)); - MCAuto cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true)); + MCAuto cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true)); MCAuto mesh3DQuadraticRestricted(mesh3DQuadratic->buildPartOfMySelf(cellIds->begin(),cellIds->end(),true)); - MCAuto mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds()); + MCAuto mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds()); mesh3DQuadraticRestrictedNodeIds->checkMonotonic(true); - MCAuto newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl)); + MCAuto newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl)); MCAuto allSeg3; { - MCAuto a,b,c,d; + MCAuto a,b,c,d; MCAuto seg3Tmp(mesh3DQuadraticRestricted->explodeIntoEdges(a,b,c,d)); allSeg3=MEDCoupling1SGTUMesh::New(seg3Tmp); } if(allSeg3->getCellModelEnum()!=INTERP_KERNEL::NORM_SEG3) throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc : invalid situation where SEG3 expected !"); - MCAuto midPts,cellSeg3Ids,matrix; + MCAuto midPts,cellSeg3Ids,matrix; { - DataArrayInt *nodeConn(allSeg3->getNodalConnectivity()); + DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity()); nodeConn->rearrange(3); { - std::vector v(1,2); + std::vector v(1,2); midPts=nodeConn->keepSelectedComponents(v); } - cellSeg3Ids=DataArrayInt::FindPermutationFromFirstToSecond(midPts,newPtsIds); + cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds); { - std::vector v(2); v[0]=0; v[1]=1; - MCAuto tmp(nodeConn->keepSelectedComponents(v)); + std::vector v(2); v[0]=0; v[1]=1; + MCAuto tmp(nodeConn->keepSelectedComponents(v)); matrix=tmp->selectByTupleId(cellSeg3Ids->begin(),cellSeg3Ids->end()); } nodeConn->rearrange(1); } - MCAuto pflq; + MCAuto pflq; if(!pflName.empty()) { - std::vector vs(2); + std::vector vs(2); vs[0]=pfl; vs[1]=newPtsIds; - pflq=DataArrayInt::Aggregate(vs); + pflq=DataArrayIdType::Aggregate(vs); pflq->setName(pflName); } PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples()); @@ -766,7 +766,7 @@ void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSW return ; if(_1ts_update_requested) { - MCAuto matrix,oldPfl; + MCAuto matrix,oldPfl; for(std::vector::const_iterator it=_pfls_to_be_updated.begin();it!=_pfls_to_be_updated.end();it++) { std::map< std::string, PFLData >::const_iterator it2(_cache.find(*it)); @@ -786,9 +786,9 @@ void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSW DataArrayDouble *arr(_cur_f1ts->getUndergroundDataArray()); MCAuto res; { - std::vector v(1,0),v2(1,1); - MCAuto pts0(matrix->keepSelectedComponents(v)); - MCAuto pts1(matrix->keepSelectedComponents(v2)); + std::vector v(1,0),v2(1,1); + MCAuto pts0(matrix->keepSelectedComponents(v)); + MCAuto pts1(matrix->keepSelectedComponents(v2)); if(oldPfl.isNotNull()) { pts0=oldPfl->findIdForEach(pts0->begin(),pts0->end()); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index f79c2a870..7897ccc81 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -121,11 +121,11 @@ namespace MEDCoupling MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds); MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N); MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const; MEDLOADER_EXPORT MCAuto linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const; public: - MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; + MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; diff --git a/src/MEDLoader/MEDFileField.txx b/src/MEDLoader/MEDFileField.txx index d08370c77..c78b010f9 100644 --- a/src/MEDLoader/MEDFileField.txx +++ b/src/MEDLoader/MEDFileField.txx @@ -127,7 +127,7 @@ namespace MEDCoupling * \sa getUndergroundDataArrayTemplate() */ template - typename Traits::ArrayType *MEDFileField1TSTemplateWithoutSDA::getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const + typename Traits::ArrayType *MEDFileField1TSTemplateWithoutSDA::getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const { if(this->_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -151,7 +151,7 @@ namespace MEDCoupling } template - void MEDFileField1TSTemplateWithoutSDA::aggregate(const std::vector::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) + void MEDFileField1TSTemplateWithoutSDA::aggregate(const std::vector::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) { if(f1tss.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : empty vector !"); @@ -174,15 +174,15 @@ namespace MEDCoupling setName(refPt->getName()); const DataArray *arr(refPt->getUndergroundDataArray()); - int nbCompo(arr->getNumberOfComponents()); + std::size_t nbCompo(arr->getNumberOfComponents()); for(typename std::vector::F1TSWSDAType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++) { const typename Traits::ArrayType *myArr((*it)->getUndergroundDataArrayTemplate()); if(myArr->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : arrays must have same number of components !"); } - std::vector > > extractInfo; - int start(0); + std::vector > > extractInfo; + mcIdType start(0); MCAuto fpm(MEDFileFieldPerMesh::Aggregate(start,pms,dts,this,extractInfo)); _field_per_mesh.push_back(fpm); int iteration,order; @@ -191,7 +191,7 @@ namespace MEDCoupling _arr=Traits::ArrayType::New(); _arr->alloc(start,nbCompo); _arr->copyStringInfoFrom(*arr); start=0; - for(std::vector > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++) + for(std::vector > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++) { const DataArray *zeArr(das[(*it).first]); _arr->setContigPartOfSelectedValuesSlice(start,zeArr,(*it).second.first,(*it).second.second,1); @@ -401,7 +401,7 @@ namespace MEDCoupling * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ template - typename Traits::ArrayType *MEDFileTemplateField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const + typename Traits::ArrayType *MEDFileTemplateField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const { MCAuto arr(contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull())); return ReturnSafelyTypedDataArray(arr); @@ -420,7 +420,7 @@ namespace MEDCoupling } template - typename Traits::ArrayType *MEDFileTemplateField1TS::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const + typename Traits::ArrayType *MEDFileTemplateField1TS::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return contentNotNull()->getUndergroundDataArrayTemplateExt(entries); } @@ -685,7 +685,7 @@ namespace MEDCoupling * \sa setFieldNoProfileSBT, setFieldProfileFlatly */ template - void MEDFileTemplateField1TS::setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateField1TS::setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true); } @@ -695,13 +695,13 @@ namespace MEDCoupling * \sa setFieldProfile */ template - void MEDFileTemplateField1TS::setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateField1TS::setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false); } template - void MEDFileTemplateField1TS::setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller) + void MEDFileTemplateField1TS::setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller) { setFileName(""); MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); @@ -716,7 +716,7 @@ namespace MEDCoupling * \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart , MEDFileUMesh::extractPart */ template - typename MLFieldTraits::F1TSType *MEDFileTemplateField1TS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const + typename MLFieldTraits::F1TSType *MEDFileTemplateField1TS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const { if(!mm) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !"); @@ -730,10 +730,10 @@ namespace MEDCoupling getNonEmptyLevels(mm->getName(),levs); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - std::map >::const_iterator it2(extractDef.find(*lev)); + std::map >::const_iterator it2(extractDef.find(*lev)); if(it2!=extractDef.end()) { - MCAuto t((*it2).second); + MCAuto t((*it2).second); if(t.isNull()) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !"); MCAuto::FieldType> f(getFieldOnMeshAtLevel(ON_CELLS,(*lev),mm)); @@ -744,10 +744,10 @@ namespace MEDCoupling } else { - std::map >::const_iterator it2(extractDef.find(1)); + std::map >::const_iterator it2(extractDef.find(1)); if(it2==extractDef.end()) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a NODE field and no extract array available for NODE !"); - MCAuto t((*it2).second); + MCAuto t((*it2).second); if(t.isNull()) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : presence of a value with null pointer 1 !"); MCAuto::FieldType> f(getFieldOnMeshAtLevel(ON_NODES,0,mm)); @@ -888,7 +888,7 @@ namespace MEDCoupling * \return A new object that the caller is responsible to deallocate. */ template - typename MLFieldTraits::FMTSType *MEDFileTemplateFieldMultiTS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const + typename MLFieldTraits::FMTSType *MEDFileTemplateFieldMultiTS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const { if(!mm) throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS::extractPart : mesh is null !"); @@ -1175,7 +1175,7 @@ namespace MEDCoupling * \param [in] order - the iteration order number of required time step. * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. * \param [in] mesh - the supporting mesh. - * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the * field of interest lies on. If the field lies on all entities of the given * dimension, all ids in \a pfl are zero. The caller is to delete this array * using decrRef() as it is no more needed. @@ -1187,7 +1187,7 @@ namespace MEDCoupling * \throw If no field values of the required parameters are available. */ template - typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const + typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); const typename MLFieldTraits::F1TSWSDAType *myF1TSC(dynamic_cast::F1TSWSDAType *>(&myF1TS)); @@ -1241,7 +1241,7 @@ namespace MEDCoupling * \sa setFieldNoProfileSBT, appendFieldProfileFlatly */ template - void MEDFileTemplateFieldMultiTS::appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateFieldMultiTS::appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true); } @@ -1250,13 +1250,13 @@ namespace MEDCoupling * same as appendFieldProfile except that here profile is created unconditionaly */ template - void MEDFileTemplateFieldMultiTS::appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateFieldMultiTS::appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false); } template - void MEDFileTemplateFieldMultiTS::appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller) + void MEDFileTemplateFieldMultiTS::appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller) { const typename Traits::ArrayType *arr(NULL); if(field) @@ -1332,7 +1332,7 @@ namespace MEDCoupling } template - typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const + typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const { DataArray *ret(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries)); if(!ret) diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 36f517561..b0d2f08e3 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -140,7 +140,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi for(int i=0;i v(1,i); + std::vector v(1,i); MCAuto arr2=arr->keepSelectedComponents(v); ret[i]->setArray(arr2); } @@ -368,7 +368,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector * Length of this and of nested sequences is the same as that of \a typesF. * \throw If no field is lying on \a mname. */ -std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { if(_field_per_mesh.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldSplitedByType : This is empty !"); @@ -450,7 +450,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::convertMedBallIntoClassic() (*it)->convertMedBallIntoClassic(); } -void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl) +void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl) { if(!pfl) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : null pfl !"); @@ -557,7 +557,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe return sz; } -bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob) { bool ret=false; @@ -581,7 +581,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls,locs; - std::vector< std::vector > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); + std::vector< std::vector > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); std::set allEnt; for(std::vector< std::vector >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++) for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) @@ -590,9 +590,9 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::set::const_iterator it3(allEnt.begin()); for(std::size_t i=0;i > its; + std::vector< std::pair > its; ret[i]=shallowCpy(); - int newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its)); + mcIdType newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its)); ret[i]->updateData(newLgth,its); } return ret; @@ -609,7 +609,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls,locs; - std::vector< std::vector > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); + std::vector< std::vector > > bgEnd(getFieldSplitedByType(getMeshName().c_str(),types,typesF,pfls,locs)); std::set allEnt; std::size_t nbOfMDPGT(0),ii(0); for(std::vector< std::vector >::const_iterator it1=typesF.begin();it1!=typesF.end();it1++,ii++) @@ -631,31 +631,31 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector< MCAuto > ret(nbOfMDPGT); for(std::size_t i=0;i > its; + std::vector< std::pair > its; ret[i]=shallowCpy(); - int newLgth(ret[i]->keepOnlyGaussDiscretization(i,its)); + mcIdType newLgth(ret[i]->keepOnlyGaussDiscretization(i,its)); ret[i]->updateData(newLgth,its); } return ret; } -int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) +mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) { - int globalCounter(0); + mcIdType globalCounter(0); for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlySpatialDiscretization(tof,globalCounter,its); return globalCounter; } -int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) +mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) { - int globalCounter(0); + mcIdType globalCounter(0); for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its); return globalCounter; } -void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector< std::pair >& oldStartStops) +void MEDFileAnyTypeField1TSWithoutSDA::updateData(mcIdType newLgth, const std::vector< std::pair >& oldStartStops) { if(_nb_of_tuples_to_be_allocated>=0) { @@ -682,7 +682,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector if(oldArr) newArr->copyStringInfoFrom(*oldArr); int pos=0; - for(std::vector< std::pair >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++) + for(std::vector< std::pair >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++) { if((*it).second<(*it).first) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !"); @@ -832,14 +832,14 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th const MEDCouplingMesh *mesh(field->getMesh()); // TypeOfField type(field->getTypeOfField()); - std::vector dummy; + std::vector dummy; if(mesh) setMeshName(mesh->getName()); - int start(copyTinyInfoFrom(th,field,arr)); + mcIdType start(copyTinyInfoFrom(th,field,arr)); int pos(addNewEntryIfNecessary(mesh)); if(type!=ON_NODES) { - std::vector code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh); + std::vector code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh); _field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc); } else @@ -871,52 +871,52 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. * \sa setFieldNoProfileSBT() */ -void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller) +void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller) { if(!field) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input field is null !"); if(!arrOfVals || !arrOfVals->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input array is null or not allocated !"); TypeOfField type=field->getTypeOfField(); - std::vector idsInPflPerType; - std::vector idsPerType; - std::vector code,code2; + std::vector idsInPflPerType; + std::vector idsPerType; + std::vector code,code2; MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); if(type!=ON_NODES) { m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller); - std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); - std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); - std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); + std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); + std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); + std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); // start of check MCAuto field2=field->clone(false); - int nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3); + mcIdType nbOfTuplesExp=field2->getNumberOfTuplesExpectedRegardingCode(code,idsPerType3); if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : The array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } // end of check - int start(copyTinyInfoFrom(th,field,arrOfVals)); + mcIdType start(copyTinyInfoFrom(th,field,arrOfVals)); code2=m->getDistributionOfTypes(); // - int pos=addNewEntryIfNecessary(m); + mcIdType pos=addNewEntryIfNecessary(m); _field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc); } else { if(!profile || !profile->isAllocated() || profile->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : input profile is null, not allocated or with number of components != 1 !"); - std::vector v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0; - std::vector idsPerType3(1); idsPerType3[0]=profile; - int nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3); + std::vector v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0; + std::vector idsPerType3(1); idsPerType3[0]=profile; + mcIdType nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3); if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - int start(copyTinyInfoFrom(th,field,arrOfVals)); - int pos(addNewEntryIfNecessary(m)); + mcIdType start(copyTinyInfoFrom(th,field,arrOfVals)); + mcIdType pos(addNewEntryIfNecessary(m)); _field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc); } } @@ -924,7 +924,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con /*! * \param [in] newNbOfTuples - The new nb of tuples to be allocated. */ -void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples) +void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(mcIdType newNbOfTuples) { if(_nb_of_tuples_to_be_allocated>=0) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile : the object is expected to be appended to a data coming from a file but not loaded ! Load before appending data !"); @@ -945,7 +945,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples) * \throw If \a this->_arr is already allocated but has different number of components * than \a field. */ -int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) +mcIdType MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) { if(!field) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !"); @@ -969,8 +969,8 @@ int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, con } else { - int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples(); - int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples(); + mcIdType oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples(); + mcIdType newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples(); getOrCreateAndGetArray()->reAlloc(newNbOfTuples); _nb_of_tuples_to_be_allocated=-3; return oldNbOfTuples; @@ -981,7 +981,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, con * Returns number of components in \a this field * \return int - the number of components. */ -int MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const +std::size_t MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const { return getOrCreateAndGetArray()->getNumberOfComponents(); } @@ -1162,7 +1162,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOf MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax,false)); - const DataArrayInt *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1)); + const DataArrayIdType *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1)); if(meshDimRelToMax==1) (static_cast((MEDCouplingMesh *)m))->setMeshDimension(0); return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e,arrOut,nasc); @@ -1222,7 +1222,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !"; bool isPfl=false; @@ -1271,7 +1271,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( oss << "\"" << nasc.getName() << "\" not defined on all nodes !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); + MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); if(!dynamic_cast((DataArray *)arrOut)) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !"); ret->renumberNodes(nodeRenumSafe->getConstPointer()); @@ -1288,7 +1288,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \param [in] type - a spatial discretization of the field. * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. * \param [in] mesh - the supporting mesh. - * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the * field of interest lies on. If the field lies on all entities of the given * dimension, all ids in \a pfl are zero. The caller is to delete this array * using decrRef() as it is no more needed. @@ -1299,7 +1299,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the given \a type are available. */ -DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const +DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); MCAuto ret=_field_per_mesh[0]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); @@ -1330,32 +1330,32 @@ void MEDFileField1TSWithoutSDA::CheckMeshDimRel(int meshDimRelToMax) * These values are in full-interlace mode. * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. */ -std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) +std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) { if(!mesh) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !"); std::set geoTypes=mesh->getAllGeoTypes(); int nbOfTypes=geoTypes.size(); - std::vector code(3*nbOfTypes); - MCAuto arr1=DataArrayInt::New(); + std::vector code(3*nbOfTypes); + MCAuto arr1=DataArrayIdType::New(); arr1->alloc(nbOfTypes,1); - int *arrPtr=arr1->getPointer(); + mcIdType *arrPtr=arr1->getPointer(); std::set::const_iterator it=geoTypes.begin(); for(int i=0;i arr2=arr1->checkAndPreparePermutation(); - const int *arrPtr2=arr2->getConstPointer(); + MCAuto arr2=arr1->checkAndPreparePermutation(); + const mcIdType *arrPtr2=arr2->getConstPointer(); int i=0; for(it=geoTypes.begin();it!=geoTypes.end();it++,i++) { - int pos=arrPtr2[i]; - int nbCells=mesh->getNumberOfCellsWithType(*it); - code[3*pos]=(int)(*it); + mcIdType pos=arrPtr2[i]; + mcIdType nbCells=mesh->getNumberOfCellsWithType(*it); + code[3*pos]=(mcIdType)(*it); code[3*pos+1]=nbCells; code[3*pos+2]=-1;//no profiles } - std::vector idsPerType;//no profiles - DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType); + std::vector idsPerType;//no profiles + DataArrayIdType *da=mesh->checkTypeConsistencyAndContig(code,idsPerType); if(da) { da->decrRef(); @@ -1408,12 +1408,12 @@ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFiel if(mname.empty()) 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); + std::vector< std::vector< std::pair > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); int nbOfRet=ret0.size(); std::vector< std::vector > ret(nbOfRet); for(int i=0;i >& p=ret0[i]; + const std::vector< std::pair >& p=ret0[i]; int nbOfRet1=p.size(); ret[i].resize(nbOfRet1); for(int j=0;j arr2(arr->convertToIntArr()); + MCAuto arr2(arr->convertToIntArr()); ret->setArray(arr2); } return ret.retn(); @@ -1460,7 +1460,7 @@ MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayTemplateExt(entries); } @@ -1504,7 +1504,7 @@ MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA() MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos):MEDFileField1TSNDTemplateWithoutSDA(fieldName,meshName,csit,iteration,order,infos) { - DataArrayInt *arr(getOrCreateAndGetArrayTemplate()); + DataArrayInt32 *arr(getOrCreateAndGetArrayTemplate()); arr->setInfoAndChangeNbOfCompo(infos); } @@ -1514,9 +1514,9 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const } /*! - * Returns a pointer to the underground DataArrayInt instance and a + * Returns a pointer to the underground DataArrayIdType instance and a * sequence describing parameters of a support of each part of \a this field. The - * caller should not decrRef() the returned DataArrayInt. This method allows for a + * caller should not decrRef() the returned DataArrayIdType. This method allows for a * direct access to the field values. This method is intended for the field lying on one * mesh only. * \param [in,out] entries - the sequence describing parameters of a support of each @@ -1524,12 +1524,12 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const * first part describes a type of mesh entity and an id of discretization of a * current field part. The second part describes a range of values [begin,end) * within the returned array relating to the current field part. - * \return DataArrayInt * - the pointer to the field values array. + * \return DataArrayIdType * - the pointer to the field values array. * \throw If the number of underlying meshes is not equal to 1. * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayIntExt(entries); } @@ -1537,7 +1537,7 @@ DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< /*! * Returns a pointer to the underground DataArrayInt instance and a * sequence describing parameters of a support of each part of \a this field. The - * caller should not decrRef() the returned DataArrayInt. This method allows for a + * caller should not decrRef() the returned DataArrayIdType. This method allows for a * direct access to the field values. This method is intended for the field lying on one * mesh only. * \param [in,out] entries - the sequence describing parameters of a support of each @@ -1550,7 +1550,7 @@ DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const +DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -1614,7 +1614,7 @@ const char *MEDFileFloatField1TSWithoutSDA::getTypeStr() const * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayFloatExt(entries); } @@ -1635,7 +1635,7 @@ DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vecto * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const +DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -2086,7 +2086,7 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTE if(forceRenameOnGlob || (!existsPfl(newPflName) && nbOfOcc==1)) { disc->setProfile(newPflName); - DataArrayInt *pfl=getProfile(oldPflName.c_str()); + DataArrayIdType *pfl=getProfile(oldPflName.c_str()); pfl->setName(newPflName); } else @@ -2373,7 +2373,7 @@ int MEDFileAnyTypeField1TS::getMeshOrder() const return contentNotNullBase()->getMeshOrder(); } -int MEDFileAnyTypeField1TS::getNumberOfComponents() const +std::size_t MEDFileAnyTypeField1TS::getNumberOfComponents() const { return contentNotNullBase()->getNumberOfComponents(); } @@ -2437,7 +2437,7 @@ void MEDFileAnyTypeField1TS::convertMedBallIntoClassic() return contentNotNullBase()->convertMedBallIntoClassic(); } -void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl) +void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl) { return contentNotNullBase()->makeReduction(ct,tof,pfl); } @@ -2447,7 +2447,7 @@ std::vector MEDFileAnyTypeField1TS::getTypesOfFieldAvailable() cons return contentNotNullBase()->getTypesOfFieldAvailable(); } -std::vector< std::vector > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, +std::vector< std::vector > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs); @@ -2523,13 +2523,13 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const return ret.retn(); } -int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) +mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) { MCAuto ft(MEDCouplingFieldTemplate::New(*field)); return copyTinyInfoFrom(field->timeDiscrSafe(),ft,arr); } -int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) +mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) { return contentNotNullBase()->copyTinyInfoFrom(th,field,arr); } diff --git a/src/MEDLoader/MEDFileField1TS.hxx b/src/MEDLoader/MEDFileField1TS.hxx index 9190fb40b..7d7e874d0 100644 --- a/src/MEDLoader/MEDFileField1TS.hxx +++ b/src/MEDLoader/MEDFileField1TS.hxx @@ -64,15 +64,15 @@ namespace MEDCoupling // MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void convertMedBallIntoClassic(); - MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl); - MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl); + MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; // MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other); MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const; public: - MEDLOADER_EXPORT int getNumberOfComponents() const; + MEDLOADER_EXPORT std::size_t getNumberOfComponents() const; MEDLOADER_EXPORT const std::vector& getInfo() const; MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const; @@ -85,16 +85,16 @@ namespace MEDCoupling MEDLOADER_EXPORT void setInfo(const std::vector& infos); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); + MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); MEDLOADER_EXPORT void setFieldNoProfileSBT(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true); + MEDLOADER_EXPORT void setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true); MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0; MEDLOADER_EXPORT virtual std::vector< MCAuto > splitComponents() const; MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0; MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArray() const = 0; - MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const = 0; + MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const = 0; MEDLOADER_EXPORT virtual void setArray(DataArray *arr) = 0; MEDLOADER_EXPORT virtual DataArray *createNewEmptyDataArrayInstance() const = 0; MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0; @@ -104,16 +104,16 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; public: - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT std::vector< MCAuto > splitDiscretizations() const; MEDLOADER_EXPORT std::vector< MCAuto > splitMultiDiscrPerGeoTypes() const; - MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its); - MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its); + MEDLOADER_EXPORT mcIdType keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its); + MEDLOADER_EXPORT mcIdType keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its); public: - MEDLOADER_EXPORT void allocNotFromFile(int newNbOfTuples); + MEDLOADER_EXPORT void allocNotFromFile(mcIdType newNbOfTuples); MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile(); MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); @@ -125,7 +125,7 @@ namespace MEDCoupling protected: int getMeshIdFromMeshName(const std::string& mName) const; int addNewEntryIfNecessary(const MEDCouplingMesh *mesh); - void updateData(int newLgth, const std::vector< std::pair >& oldStartStops); + void updateData(mcIdType newLgth, const std::vector< std::pair >& oldStartStops); protected: std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh; int _iteration; @@ -138,7 +138,7 @@ namespace MEDCoupling // -2 means allocated and read from a file // -1 means not allocated and build from scratch // >=0 means not allocated and read from a file - mutable int _nb_of_tuples_to_be_allocated; + mutable mcIdType _nb_of_tuples_to_be_allocated; }; class MEDFileIntField1TSWithoutSDA; @@ -155,11 +155,11 @@ namespace MEDCoupling MEDLOADER_EXPORT typename Traits::ArrayType *getOrCreateAndGetArrayTemplate(); MEDLOADER_EXPORT typename Traits::ArrayType const *getOrCreateAndGetArrayTemplate() const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayTemplate() const; - MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT DataArray *getOrCreateAndGetArray(); MEDLOADER_EXPORT const DataArray *getOrCreateAndGetArray() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArray() const; - MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair > >& dts); + MEDLOADER_EXPORT void aggregate(const typename std::vector< typename MLFieldTraits::F1TSWSDAType const * >& f1tss, const std::vector< std::vector< std::pair > >& dts); MEDLOADER_EXPORT void copyTimeInfoFrom(const typename Traits::FieldType *mcf); protected: MCAuto< typename Traits::ArrayType > _arr; @@ -172,10 +172,10 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT std::vector< std::vector > getFieldSplitedByType2(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax); - MEDLOADER_EXPORT static std::vector CheckSBTMesh(const MEDCouplingMesh *mesh); + MEDLOADER_EXPORT static std::vector CheckSBTMesh(const MEDCouplingMesh *mesh); MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); @@ -208,8 +208,8 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; protected: MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: @@ -227,8 +227,8 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileFloatField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArrayFloat *getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const; protected: MEDFileFloatField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: @@ -278,7 +278,7 @@ namespace MEDCoupling MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getMeshIteration() const; MEDLOADER_EXPORT int getMeshOrder() const; - MEDLOADER_EXPORT int getNumberOfComponents() const; + MEDLOADER_EXPORT std::size_t getNumberOfComponents() const; MEDLOADER_EXPORT bool isDealingTS(int iteration, int order) const; MEDLOADER_EXPORT std::pair getDtIt() const; MEDLOADER_EXPORT void fillIteration(std::pair& p) const; @@ -288,14 +288,14 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const; MEDLOADER_EXPORT std::vector getTypesOfFieldAvailable() const; - MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, + MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void convertMedBallIntoClassic(); - MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl); - MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; + MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl); + MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0; public: MEDLOADER_EXPORT void loadArrays(); @@ -306,8 +306,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitDiscretizations() const; MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const; MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const; - MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); - MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); + MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); + MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); public: //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false); @@ -349,10 +349,10 @@ namespace MEDCoupling MEDLOADER_EXPORT static typename MLFieldTraits::F1TSType *New(const typename MLFieldTraits::F1TSWSDAType& other, bool shallowCopyOfContent); public: MEDLOADER_EXPORT static typename Traits::ArrayType *ReturnSafelyTypedDataArray(MCAuto& arr); - MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const; MEDLOADER_EXPORT void setArray(DataArray *arr); MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArray() const; - MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT static MCAuto::FieldType> SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto& arr); MEDLOADER_EXPORT static MCAuto ToFieldTemplateWithTime(const typename Traits::FieldType *f); public: @@ -364,10 +364,10 @@ namespace MEDCoupling MEDLOADER_EXPORT typename Traits::FieldType *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT void setFieldNoProfileSBT(const typename Traits::FieldType *field); - MEDLOADER_EXPORT void setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; - MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } + MEDLOADER_EXPORT void setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; + MEDLOADER_EXPORT MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } protected: ~MEDFileTemplateField1TS() { } MEDFileTemplateField1TS(); @@ -377,7 +377,7 @@ namespace MEDCoupling MEDFileTemplateField1TS(const typename MLFieldTraits::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent) { } const typename MLFieldTraits::F1TSWSDAType *contentNotNull() const; typename MLFieldTraits::F1TSWSDAType *contentNotNull(); - void setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller); + void setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller); }; /*! diff --git a/src/MEDLoader/MEDFileFieldGlobs.cxx b/src/MEDLoader/MEDFileFieldGlobs.cxx index af727fc7b..87890d36e 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.cxx +++ b/src/MEDLoader/MEDFileFieldGlobs.cxx @@ -28,6 +28,7 @@ #include "MEDFileBlowStrEltUp.hxx" #include "MEDFileFieldVisitor.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingFieldDiscretization.hxx" #include "MCType.hxx" @@ -43,11 +44,12 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string { if(id>=(int)_pfls.size()) _pfls.resize(id+1); - _pfls[id]=DataArrayInt::New(); + MCAuto miPfl=DataArrayMedInt::New(); int lgth(MEDprofileSizeByName(fid,pflName.c_str())); - _pfls[id]->setName(pflName); - _pfls[id]->alloc(lgth,1); - MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),_pfls[id]->getPointer())); + miPfl->setName(pflName); + miPfl->alloc(lgth,1); + MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer())); + _pfls[id]=FromMedIntArray(miPfl); _pfls[id]->applyLin(1,-1,0);//Converting into C format } @@ -59,10 +61,11 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i) std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE); if(i>=(int)_pfls.size()) _pfls.resize(i+1); - _pfls[i]=DataArrayInt::New(); - _pfls[i]->alloc(sz,1); - _pfls[i]->setName(pflCpp.c_str()); - MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,_pfls[i]->getPointer())); + MCAuto miPfl=DataArrayMedInt::New(); + miPfl->alloc(sz,1); + miPfl->setName(pflCpp.c_str()); + MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,miPfl->getPointer())); + _pfls[i]=FromMedIntArray(miPfl); _pfls[i]->applyLin(1,-1,0);//Converting into C format } @@ -71,7 +74,7 @@ void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) co int nbOfPfls=_pfls.size(); for(int i=0;i cpy=_pfls[i]->deepCopy(); + MCAuto 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()); @@ -86,7 +89,7 @@ void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) co void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) { std::vector pfls=getPfls(); - for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) { std::vector::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName()); if(it2==pfls.end()) @@ -181,8 +184,8 @@ std::size_t MEDFileFieldGlobs::getHeapMemorySizeWithoutChildren() const std::vector MEDFileFieldGlobs::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MCAuto< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) - ret.push_back((const DataArrayInt *)*it); + for(std::vector< MCAuto< DataArrayIdType > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + ret.push_back((const DataArrayIdType *)*it); for(std::vector< MCAuto >::const_iterator it=_locs.begin();it!=_locs.end();it++) ret.push_back((const MEDFileFieldLoc *)*it); return ret; @@ -192,9 +195,9 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCopy() const { MCAuto ret=new MEDFileFieldGlobs(*this); std::size_t i=0; - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { - if((const DataArrayInt *)*it) + if((const DataArrayIdType *)*it) ret->_pfls[i]=(*it)->deepCopy(); } i=0; @@ -216,11 +219,11 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { - DataArrayInt *pfl=const_cast(getProfile((*it1).c_str())); + DataArrayIdType *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::shallowCpyPart : internal error ! pfl null !"); pfl->incrRef(); - MCAuto pfl2(pfl); + MCAuto pfl2(pfl); ret->_pfls.push_back(pfl2); } for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) @@ -246,7 +249,7 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector MCAuto ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { - DataArrayInt *pfl=const_cast(getProfile((*it1).c_str())); + DataArrayIdType *pfl=const_cast(getProfile((*it1).c_str())); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::deepCpyPart : internal error ! pfl null !"); ret->_pfls.push_back(pfl->deepCopy()); @@ -281,7 +284,7 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const for(std::size_t i=0;igetName() << "\"\n"; else @@ -302,9 +305,9 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) { - DataArrayInt *elt(*it); + DataArrayIdType *elt(*it); if(elt) { std::string name(elt->getName()); @@ -375,7 +378,7 @@ namespace MEDCouplingImpl { public: PflFinder(const std::string& pfl):_pfl(pfl) { } - bool operator() (const MCAuto& loc) { return loc->getName()==_pfl; } + bool operator() (const MCAuto& loc) { return loc->getName()==_pfl; } private: const std::string _pfl; }; @@ -397,7 +400,7 @@ int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const { - std::vector< MCAuto >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl)); + std::vector< MCAuto >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pfl)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfileId : no such profile name : \"" << pfl << "\" Possible localizations are : "; @@ -411,12 +414,12 @@ int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const /*! * The returned value is never null. */ -const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const +const DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) const { return getProfileFromId(getProfileId(pflName)); } -const DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) const +const DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId) const { if(pflId<0 || pflId>=(int)_pfls.size()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !"); @@ -438,10 +441,10 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) /*! * The returned value is never null. Borrowed reference returned. */ -DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) +DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) { std::string pflNameCpp(pflName); - std::vector< MCAuto >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); + std::vector< MCAuto >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); if(it==_pfls.end()) { std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; @@ -452,7 +455,7 @@ DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) return *it; } -DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) +DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId) { if(pflId<0 || pflId>=(int)_pfls.size()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !"); @@ -461,9 +464,9 @@ DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) void MEDFileFieldGlobs::killProfileIds(const std::vector& pflIds) { - std::vector< MCAuto > newPfls; + std::vector< MCAuto > newPfls; int i=0; - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end()) newPfls.push_back(*it); @@ -532,9 +535,9 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { std::map > m; int i=0; - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { - const DataArrayInt *tmp=(*it); + const DataArrayIdType *tmp=(*it); if(tmp) { m[tmp->getHashCode()].push_back(i); @@ -573,12 +576,12 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualLocs(double eps) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !"); } -void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl) +void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl) { std::string name(pfl->getName()); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !"); - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) if(name==(*it)->getName()) { if(!pfl->isEqual(*(*it))) @@ -1088,10 +1091,10 @@ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) c /*! * Returns a profile array by its name. * \param [in] pflName - the name of the profile of interest. - * \return const DataArrayInt * - the profile array having the name \a pflName. + * \return const DataArrayIdType * - the profile array having the name \a pflName. * \throw If there is no a profile named \a pflName. */ -const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const +const DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const { return contentNotNull()->getProfile(pflName); } @@ -1099,10 +1102,10 @@ const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName /*! * Returns a profile array by its id. * \param [in] pflId - the id of the profile of interest. - * \return const DataArrayInt * - the profile array having the id \a pflId. + * \return const DataArrayIdType * - the profile array having the id \a pflId. * \throw If there is no a profile with id \a pflId. */ -const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const +const DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const { return contentNotNull()->getProfileFromId(pflId); } @@ -1134,10 +1137,10 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const std::string& locNa /*! * Returns a profile array, apt for modification, by its name. * \param [in] pflName - the name of the profile of interest. - * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName. + * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName. * \throw If there is no a profile named \a pflName. */ -DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) +DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) { return contentNotNull()->getProfile(pflName); } @@ -1145,10 +1148,10 @@ DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) /*! * Returns a profile array, apt for modification, by its id. * \param [in] pflId - the id of the profile of interest. - * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId. + * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId. * \throw If there is no a profile with id \a pflId. */ -DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) +DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId) { return contentNotNull()->getProfileFromId(pflId); } @@ -1178,7 +1181,7 @@ void MEDFileFieldGlobsReal::killLocalizationIds(const std::vector& locIds) * \throw If a profile with the same name as that of \a pfl already exists but contains * different ids. */ -void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl) +void MEDFileFieldGlobsReal::appendProfile(DataArrayIdType *pfl) { contentNotNull()->appendProfile(pfl); } diff --git a/src/MEDLoader/MEDFileFieldGlobs.hxx b/src/MEDLoader/MEDFileFieldGlobs.hxx index c39e19895..5744392ee 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.hxx +++ b/src/MEDLoader/MEDFileFieldGlobs.hxx @@ -72,17 +72,17 @@ namespace MEDCoupling std::string getFileName() const { return _file_name; } const MEDFileFieldLoc& getLocalizationFromId(int locId) const; const MEDFileFieldLoc& getLocalization(const std::string& locName) const; - const DataArrayInt *getProfileFromId(int pflId) const; - const DataArrayInt *getProfile(const std::string& pflName) const; + const DataArrayIdType *getProfileFromId(int pflId) const; + const DataArrayIdType *getProfile(const std::string& pflName) const; MEDFileFieldLoc& getLocalizationFromId(int locId); MEDFileFieldLoc& getLocalization(const std::string& locName); - DataArrayInt *getProfile(const std::string& pflName); - DataArrayInt *getProfileFromId(int pflId); + DataArrayIdType *getProfile(const std::string& pflName); + DataArrayIdType *getProfileFromId(int pflId); void killProfileIds(const std::vector& pflIds); void killLocalizationIds(const std::vector& locIds); void killStructureElementsInGlobs(); // - void appendProfile(DataArrayInt *pfl); + void appendProfile(DataArrayIdType *pfl); void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); // static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector& namesToAvoid); @@ -91,7 +91,7 @@ namespace MEDCoupling MEDFileFieldGlobs(); ~MEDFileFieldGlobs(); protected: - std::vector< MCAuto > _pfls; + std::vector< MCAuto > _pfls; std::vector< MCAuto > _locs; std::string _file_name; }; @@ -154,14 +154,14 @@ namespace MEDCoupling MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const; MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId); MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName); - MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const; - MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const; - MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName); - MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId); + MEDLOADER_EXPORT const DataArrayIdType *getProfile(const std::string& pflName) const; + MEDLOADER_EXPORT const DataArrayIdType *getProfileFromId(int pflId) const; + MEDLOADER_EXPORT DataArrayIdType *getProfile(const std::string& pflName); + MEDLOADER_EXPORT DataArrayIdType *getProfileFromId(int pflId); MEDLOADER_EXPORT void killProfileIds(const std::vector& pflIds); MEDLOADER_EXPORT void killLocalizationIds(const std::vector& locIds); // - MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl); + MEDLOADER_EXPORT void appendProfile(DataArrayIdType *pfl); MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); protected: MEDFileFieldGlobs *contentNotNull(); diff --git a/src/MEDLoader/MEDFileFieldInternal.cxx b/src/MEDLoader/MEDFileFieldInternal.cxx index c365fdff8..bea5faeb0 100644 --- a/src/MEDLoader/MEDFileFieldInternal.cxx +++ b/src/MEDLoader/MEDFileFieldInternal.cxx @@ -175,7 +175,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent } MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, - const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w):_name(locName),_gt(new MEDFileGTKeeperSta(geoType)),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w) + const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w):_gt(new MEDFileGTKeeperSta(geoType)),_name(locName),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w) { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _dim=cm.getDimension(); @@ -298,7 +298,7 @@ std::string MEDFileFieldLoc::repr() const return oss.str(); } -void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { _type=field->getTypeOfField(); _start=start; @@ -313,8 +313,8 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off } case ON_GAUSS_NE: { - MCAuto arr=field->getDiscretization()->getOffsetArr(field->getMesh()); - const int *arrPtr=arr->getConstPointer(); + MCAuto arr=field->getDiscretization()->getOffsetArr(field->getMesh()); + const mcIdType *arrPtr=arr->getConstPointer(); getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1); _end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]); _nval=nbOfCells; @@ -327,13 +327,13 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !"); - const DataArrayInt *dai(disc2->getArrayOfDiscIds()); - MCAuto dai2(disc2->getOffsetArr(field->getMesh())); - const int *dai2Ptr(dai2->getConstPointer()); + const DataArrayIdType *dai(disc2->getArrayOfDiscIds()); + MCAuto dai2(disc2->getOffsetArr(field->getMesh())); + const mcIdType *dai2Ptr(dai2->getConstPointer()); int nbi(gsLoc.getWeights().size()); - MCAuto da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1)); - MCAuto da3(da2->findIdsEqual(_loc_id)); - const int *da3Ptr(da3->getConstPointer()); + MCAuto da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1)); + MCAuto da3(da2->findIdsEqual(_loc_id)); + const mcIdType *da3Ptr(da3->getConstPointer()); if(da3->getNumberOfTuples()!=nbOfCells) {//profile : for gauss even in NoProfile !!! std::ostringstream oss; oss << "Pfl_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id; @@ -341,14 +341,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off da3->setName(_profile.c_str()); glob.appendProfile(da3); } - MCAuto da4(DataArrayInt::New()); + MCAuto da4(DataArrayIdType::New()); _nval=da3->getNbOfElems(); da4->alloc(_nval*nbi,1); - int *da4Ptr(da4->getPointer()); - for(int i=0;i<_nval;i++) + mcIdType *da4Ptr(da4->getPointer()); + for(mcIdType i=0;i<_nval;i++) { - int ref=dai2Ptr[offset+da3Ptr[i]]; - for(int j=0;jgetTypeOfField(); @@ -416,12 +416,12 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& } case ON_GAUSS_NE: { - MCAuto arr=field->getDiscretization()->getOffsetArr(mesh); - MCAuto arr2=arr->deltaShiftIndex(); - MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); + MCAuto arr=field->getDiscretization()->getOffsetArr(mesh); + MCAuto arr2=arr->deltaShiftIndex(); + MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); arr3->computeOffsetsFull(); - MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); - int trueNval=tmp->getNumberOfTuples(); + MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); + mcIdType trueNval=tmp->getNumberOfTuples(); _nval=idsInPfl->getNumberOfTuples(); getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp); _end=_start+trueNval; @@ -432,23 +432,23 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(field->getDiscretization()); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); - const DataArrayInt *da1=disc2->getArrayOfDiscIds(); + const DataArrayIdType *da1=disc2->getArrayOfDiscIds(); const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id); - MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); - MCAuto da3=da2->findIdsEqual(_loc_id); - MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); + MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); + MCAuto da3=da2->findIdsEqual(_loc_id); + MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); // MCAuto mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end()); - MCAuto arr=disc2->getOffsetArr(mesh2); + MCAuto arr=disc2->getOffsetArr(mesh2); // - MCAuto tmp=DataArrayInt::New(); - int trueNval=0; - for(const int *pt=da4->begin();pt!=da4->end();pt++) + MCAuto tmp=DataArrayIdType::New(); + mcIdType trueNval=0; + for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++) trueNval+=arr->getIJ(*pt+1,0)-arr->getIJ(*pt,0); tmp->alloc(trueNval,1); - int *tmpPtr=tmp->getPointer(); - for(const int *pt=da4->begin();pt!=da4->end();pt++) - for(int j=arr->getIJ(*pt,0);jgetIJ(*pt+1,0);j++) + mcIdType *tmpPtr=tmp->getPointer(); + for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++) + for(mcIdType j=arr->getIJ(*pt,0);jgetIJ(*pt+1,0);j++) *tmpPtr++=j; // _nval=da4->getNumberOfTuples(); @@ -457,7 +457,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& oss << "_loc_" << _loc_id; if(locIds) { - MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); + MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); da5->setName(oss.str()); glob.appendProfile(da5); _profile=oss.str(); @@ -482,7 +482,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& start=_end; } -void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob) +void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob) { _start=start; _nval=arrr->getNumberOfTuples(); @@ -491,7 +491,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& start, con start=_end; } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd) { return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,profileIt,pd); } @@ -525,7 +525,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCopy(M return ret.retn(); } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, int profileIt, const PartDefinition *pd) +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, mcIdType profileIt, const PartDefinition *pd) try:_type(atype),_father(fath),_profile_it(profileIt),_pd(const_cast(pd)) { if(pd) @@ -536,7 +536,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId) +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId, const std::string& dummy):_type(type),_father(fath),_loc_id(locId) { } @@ -544,8 +544,8 @@ MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFi { } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits::max()),_end(-std::numeric_limits::max()), - _nval(-std::numeric_limits::max()),_loc_id(-std::numeric_limits::max()) +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc():_type(ON_CELLS),_father(0),_start(-std::numeric_limits::max()),_end(-std::numeric_limits::max()), + _nval(-std::numeric_limits::max()),_loc_id(-std::numeric_limits::max()) { } @@ -587,7 +587,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { - int start,stop,step; + mcIdType start,stop,step; spd->getSlice(start,stop,step); int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile")); med_filter filter=MED_FILTER_INIT; @@ -603,7 +603,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const if(dpd) { dpd->checkConsistencyLight(); - MCAuto myIds(dpd->toDAI()); + MCAuto myIds(dpd->toDAI()); int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!! myIds->applyLin(1,-a); @@ -633,7 +633,7 @@ const MEDFileFieldPerMeshPerTypeCommon *MEDFileFieldPerMeshPerTypePerDisc::getFa return _father; } -void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc) { INTERP_KERNEL::AutoPtr locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); @@ -717,10 +717,10 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } - DataArrayInt *arrI(dynamic_cast(arr)); + DataArrayIdType *arrI(dynamic_cast(arr)); if(arrI) { - int *startFeeding(arrI->getPointer()+_start*nbOfCompo); + mcIdType *startFeeding(arrI->getPointer()+_start*nbOfCompo); goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } @@ -737,9 +737,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF /*! * Set a \c this->_start **and** \c this->_end keeping the same delta between the two. */ -void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(int newValueOfStart) +void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(mcIdType newValueOfStart) { - int delta=_end-_start; + mcIdType delta=_end-_start; _start=newValueOfStart; _end=_start+delta; } @@ -797,19 +797,19 @@ void MEDFileFieldPerMeshPerTypePerDisc::setType(TypeOfField newType) _type=newType; } -int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const +std::size_t MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const { return _father->getNumberOfComponents(); } -int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const +mcIdType MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const { return _end-_start; } -void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(int deltaNbVal) +void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(mcIdType deltaNbVal) { - int nbi((_end-_start)/_nval); + mcIdType nbi((_end-_start)/_nval); _nval+=deltaNbVal; _end+=nbi*deltaNbVal; } @@ -874,11 +874,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::changeLocsRefsNamesGen(const std::vector } } -void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const +void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const { if(type!=_type) return ; - dads.push_back(std::pair(_start,_end)); + dads.push_back(std::pair(_start,_end)); geoTypes.push_back(getGeoType()); if(_profile.empty()) pfls.push_back(0); @@ -894,9 +894,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const } } -void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startEntryId, std::vector< std::pair,std::pair > >& entries) const +void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const { - entries[startEntryId]=std::pair ,std::pair >(std::pair(getGeoType(),discId),std::pair(_start,_end)); + entries[startEntryId]=std::pair ,std::pair >(std::pair(getGeoType(),discId),std::pair(_start,_end)); startEntryId++; } @@ -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 DataArrayInt *arrI(dynamic_cast(arr)); + const DataArrayIdType *arrI(dynamic_cast(arr)); const DataArrayFloat *arrF(dynamic_cast(arr)); const unsigned char *locToWrite=0; if(arrD) @@ -929,7 +929,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN locToWrite)); } -void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const +void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const { type=_type; pfl=_profile; @@ -943,7 +943,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pa * \param [out] ptToFill memory zone where the output will be stored. * \return the size of data pushed into output param \a ptToFill */ -int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const +mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const { _loc_id=offset; std::ostringstream oss; @@ -958,7 +958,7 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: oss << "MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode : not found geometric type " << cm.getRepr() << " in the referenced mesh of field !"; throw INTERP_KERNEL::Exception(oss.str()); } - int *work=ptToFill; + mcIdType *work=ptToFill; if(_profile.empty()) { if(_nval!=codeOfMesh[3*found+1]) @@ -968,12 +968,12 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: oss << " whereas mesh has " << codeOfMesh[3*found+1] << " for this geometric type !"; throw INTERP_KERNEL::Exception(oss.str()); } - for(int ii=codeOfMesh[3*found+2];iigetNumberOfTuples()!=_nval) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getGeoType()); @@ -982,8 +982,8 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: oss << pfl->getNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !"; throw INTERP_KERNEL::Exception(oss.str()); } - int offset2=codeOfMesh[3*found+2]; - for(const int *pflId=pfl->begin();pflId!=pfl->end();pflId++) + mcIdType offset2=codeOfMesh[3*found+2]; + for(const mcIdType *pflId=pfl->begin();pflId!=pfl->end();pflId++) { if(*pflId > MEDFileFi * \param [out] result All new entries will be appended on it. * \return false if the configuration of renumbering leads to an unnecessary resplit of input \a entriesOnSameDisc. If not true is returned (the most general case !) */ -bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, - const DataArrayInt *explicitIdsInMesh, - const std::vector& newCode, +bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, + const DataArrayIdType *explicitIdsInMesh, + const std::vector& newCode, MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto >& result) { if(entriesOnSameDisc.empty()) return false; TypeOfField type=entriesOnSameDisc[0]->getType(); - int szEntities=0,szTuples=0; + mcIdType szEntities=0,szTuples=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++) { szEntities+=(*it)->_nval; szTuples+=(*it)->_end-(*it)->_start; } - int nbi=szTuples/szEntities; + mcIdType nbi=szTuples/szEntities; if(szTuples%szEntities!=0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !"); - MCAuto renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1); - MCAuto ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); - std::vector< MCAuto > newGeoTypesPerChunk(entriesOnSameDisc.size()); - std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size()); - std::vector< MCAuto > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); - std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); - MCAuto newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); + MCAuto renumTuples=DataArrayIdType::New(); renumTuples->alloc(szTuples,1); + MCAuto ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); + std::vector< MCAuto > newGeoTypesPerChunk(entriesOnSameDisc.size()); + std::vector< const DataArrayIdType * > newGeoTypesPerChunk2(entriesOnSameDisc.size()); + std::vector< MCAuto > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); + std::vector< const DataArrayIdType * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); + MCAuto newGeoTypesPerChunk4=DataArrayIdType::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); int id=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { int startOfEltIdOfChunk=(*it)->_start; - MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); - MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); - MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); + MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); + MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); + MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); // - MCAuto tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); + MCAuto tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); newGeoTypesPerChunk4->setPartOfValues1(tmp,(*it)->_tmp_work1-offset,(*it)->_tmp_work1+(*it)->_nval*nbi-offset,1,0,nbi,1); // newGeoTypesPerChunk[id]=rangeIdsForChunk; newGeoTypesPerChunk2[id]=rangeIdsForChunk; newGeoTypesPerChunk_bis[id]=idsInRrangeForChunk; newGeoTypesPerChunk3[id]=idsInRrangeForChunk; } - MCAuto newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); - MCAuto newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); - MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); - MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); + MCAuto newGeoTypesEltIdsAllGather=DataArrayIdType::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); + MCAuto newGeoTypesEltIdsAllGather2=DataArrayIdType::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); + MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); + MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); // - MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); + MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); // MCAuto arrPart=arr->subArray(offset,offset+szTuples); arrPart->renumberInPlace(renumTupleIds->begin()); arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1); bool ret=false; - const int *idIt=diffVals->begin(); + const mcIdType *idIt=diffVals->begin(); std::list li(entriesOnSameDisc.begin(),entriesOnSameDisc.end()); - int offset2=0; - for(int i=0;igetNumberOfTuples();i++,idIt++) + mcIdType offset2=0; + for(mcIdType i=0;igetNumberOfTuples();i++,idIt++) { - MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); - MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); - int nbEntityElts=subIds->getNumberOfTuples(); + MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); + MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); + mcIdType nbEntityElts=subIds->getNumberOfTuples(); bool ret2; MCAuto eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi, @@ -1122,13 +1122,13 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve * and corresponding entry erased from \a entriesOnSameDisc. * \return a newly allocated chunk */ -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt, - bool isPfl, int nbi, int offset, +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt, + bool isPfl, int nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting) { - int nbMeshEntities=idsOfMeshElt->getNumberOfTuples(); + mcIdType nbMeshEntities=idsOfMeshElt->getNumberOfTuples(); std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin(); for(;it!=entriesOnSameDisc.end();it++) { @@ -1141,7 +1141,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO else if(!(*it)->_profile.empty()) { - const DataArrayInt *pfl=glob.getProfile((*it)->_profile.c_str()); + const DataArrayIdType *pfl=glob.getProfile((*it)->_profile.c_str()); if(pfl->isEqualWithoutConsideringStr(*idsOfMeshElt)) break; } @@ -1221,10 +1221,10 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getDirect return ret; } -void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::vector pos=addNewEntryIfNecessary(field,offset,nbOfCells); - for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) + std::vector pos=addNewEntryIfNecessary(field,offset,nbOfCells); + for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) _field_pm_pt_pd[*it]->assignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc); } @@ -1237,23 +1237,23 @@ void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offs * \param [in] nbOfEltsInWholeMesh nb of elts of type \a this->_geo_type in \b WHOLE mesh * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored. */ -void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::vector pos=addNewEntryIfNecessary(field,idsInPfl); - for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) + std::vector pos=addNewEntryIfNecessary(field,idsInPfl); + for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) _field_pm_pt_pd[*it]->assignFieldProfile(isPflAlone,start,multiTypePfl,idsInPfl,locIds,nbOfEltsInWholeMesh,field,arr,mesh,glob,nasc); } -void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) +void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) { _field_pm_pt_pd.resize(1); _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3); _field_pm_pt_pd[0]->assignNodeFieldNoProfile(start,field,arr,glob); } -void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - MCAuto pfl2=pfl->deepCopy(); + MCAuto pfl2=pfl->deepCopy(); if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile : input array is null, or not allocated !"); _field_pm_pt_pd.resize(1); @@ -1261,7 +1261,7 @@ void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const _field_pm_pt_pd[0]->assignFieldProfile(true,start,pfl,pfl2,pfl2,-1,field,arr,0,glob,nasc);//mesh is not requested so 0 is send. } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells) { TypeOfField type=field->getTypeOfField(); if(type!=ON_GAUSS_PT) @@ -1282,21 +1282,21 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const _field_pm_pt_pd.resize(sz+1); _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); } - std::vector ret(1,(int)sz); + std::vector ret(1,(mcIdType)sz); return ret; } else { - std::vector ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells); - int sz2=ret2.size(); - std::vector ret3(sz2); - int k=0; - for(int i=0;i ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells); + mcIdType sz2=ret2.size(); + std::vector ret3(sz2); + mcIdType k=0; + for(mcIdType i=0;igetLocId()==locIdToFind) { @@ -1316,32 +1316,32 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const } } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells) { const MEDCouplingFieldDiscretization *disc=field->getDiscretization(); const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(disc); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); - const DataArrayInt *da=disc2->getArrayOfDiscIds(); + const DataArrayIdType *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss (no profile) : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MCAuto da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); - MCAuto retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); - std::vector ret(retTmp->begin(),retTmp->end()); + std::vector ret(retTmp->begin(),retTmp->end()); return ret; } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells) { TypeOfField type=field->getTypeOfField(); if(type!=ON_GAUSS_PT) { int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - int sz=_field_pm_pt_pd.size(); + mcIdType sz=_field_pm_pt_pd.size(); bool found=false; - for(int j=0;jgetLocId()==locIdToFind) { @@ -1354,21 +1354,21 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const _field_pm_pt_pd.resize(sz+1); _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); } - std::vector ret(1,0); + std::vector ret(1,0); return ret; } else { - std::vector ret2=addNewEntryIfNecessaryGauss(field,subCells); - int sz2=ret2.size(); - std::vector ret3(sz2); - int k=0; - for(int i=0;i ret2=addNewEntryIfNecessaryGauss(field,subCells); + mcIdType sz2=ret2.size(); + std::vector ret3(sz2); + mcIdType k=0; + for(mcIdType i=0;igetLocId()==locIdToFind) { @@ -1388,20 +1388,20 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const } } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells) { const MEDCouplingFieldDiscretization *disc=field->getDiscretization(); const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(disc); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); - const DataArrayInt *da=disc2->getArrayOfDiscIds(); + const DataArrayIdType *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MCAuto da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); - MCAuto retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); - std::vector ret(retTmp->begin(),retTmp->end()); + std::vector ret(retTmp->begin(),retTmp->end()); return ret; } @@ -1432,11 +1432,11 @@ void MEDFileFieldPerMeshPerTypeCommon::fillTypesOfFieldAvailable(std::set >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const +void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const { - int sz=_field_pm_pt_pd.size(); + mcIdType sz=_field_pm_pt_pd.size(); dads.resize(sz); types.resize(sz); pfls.resize(sz); locs.resize(sz); - for(int i=0;igetCoarseData(types[i],dads[i],pfls[i],locs[i]); } @@ -1462,16 +1462,16 @@ std::string MEDFileFieldPerMeshPerTypeCommon::getMeshName() const return _father->getMeshName(); } -void MEDFileFieldPerMeshPerTypeCommon::getSizes(int& globalSz, int& nbOfEntries) const +void MEDFileFieldPerMeshPerTypeCommon::getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const { for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { globalSz+=(*it)->getNumberOfTuples(); } - nbOfEntries+=(int)_field_pm_pt_pd.size(); + nbOfEntries+=(mcIdType)_field_pm_pt_pd.size(); } -int MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const +std::size_t MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const { return _father->getNumberOfComponents(); } @@ -1624,7 +1624,7 @@ int MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf(const MEDFileFieldPerMeshPerTy throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::locIdOfLeaf : not found such a leaf in this !"); } -void MEDFileFieldPerMeshPerTypeCommon::fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const +void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const { int i=0; for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) @@ -1645,7 +1645,7 @@ void MEDFileFieldPerMeshPerTypeCommon::setLeaves(const std::vector< MCAuto< MEDF * \param [out] its - list of pair (start,stop) kept * \return bool - false if the type of field \a tof is not contained in \a this. */ -bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) +bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its) { bool ret(false); std::vector< MCAuto > newPmPtPd; @@ -1653,7 +1653,7 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField if((*it)->getType()==tof) { newPmPtPd.push_back(*it); - std::pair bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd(); + std::pair bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd(); (*it)->setNewStart(globalNum); globalNum=(*it)->getEnd(); its.push_back(bgEnd); @@ -1669,13 +1669,13 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField * \param [out] its - list of pair (start,stop) kept * \return bool - false if the type of field \a tof is not contained in \a this. */ -bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its) +bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its) { if(_field_pm_pt_pd.size()<=idOfDisc) return false; MCAuto elt(_field_pm_pt_pd[idOfDisc]); std::vector< MCAuto > newPmPtPd(1,elt); - std::pair bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd(); + std::pair bgEnd; bgEnd.first=_field_pm_pt_pd[idOfDisc]->getStart(); bgEnd.second=_field_pm_pt_pd[idOfDisc]->getEnd(); elt->setNewStart(globalNum); globalNum=elt->getEnd(); its.push_back(bgEnd); @@ -1683,7 +1683,7 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t i return true; } -void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc) { for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); @@ -1746,7 +1746,7 @@ MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCopy(MEDFileFieldPer return ret.retn(); } -void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const +void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const { if(_geo_type!=INTERP_KERNEL::NORM_ERROR) { @@ -1846,7 +1846,7 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField } } -MCAuto MEDFileFieldPerMeshPerType::Aggregate(int &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo) +MCAuto MEDFileFieldPerMeshPerType::Aggregate(mcIdType &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo) { MCAuto ret(MEDFileFieldPerMeshPerType::New(father,gt)); std::map > > m; @@ -1948,7 +1948,7 @@ MEDFileFieldPerMeshPerTypeDyn *MEDFileFieldPerMeshPerTypeDyn::deepCopy(MEDFileFi return ret.retn(); } -void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const +void MEDFileFieldPerMeshPerTypeDyn::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const { throw INTERP_KERNEL::Exception("not implemented yet !"); } @@ -2013,15 +2013,15 @@ void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) mesh->getTime(_mesh_iteration,_mesh_order); } -void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - int nbOfTypes=code.size()/3; + std::size_t nbOfTypes=code.size()/3; int offset=0; - for(int i=0;iassignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc); offset+=nbOfCells; } @@ -2036,18 +2036,18 @@ void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vec * \param [in] idsPerType is a vector containing the profiles needed to be created for MED file format. \b WARNING these processed MED file profiles can be subdivided again in case of Gauss points. * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored. */ -void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector& code, const std::vector& code2, const std::vector& idsInPflPerType, const std::vector& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector& code, const std::vector& code2, const std::vector& idsInPflPerType, const std::vector& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - int nbOfTypes(code.size()/3); - for(int i=0;iassignNodeFieldNoProfile(start,field,arr,glob); } -void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - int pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR); + mcIdType pos=addNewEntryIfNecessary(INTERP_KERNEL::NORM_ERROR); _field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc); } -void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc) { for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); @@ -2083,8 +2083,8 @@ void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFie void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { - int nbOfTypes=_field_pm_pt.size(); - for(int i=0;icopyOptionsFrom(*this); _field_pm_pt[i]->writeLL(fid,nasc); @@ -2111,10 +2111,10 @@ void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set& types (*it)->fillTypesOfFieldAvailable(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 +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::vector< std::vector > > ret(sz); + std::vector< std::vector > > ret(sz); types.resize(sz); typesF.resize(sz); pfls.resize(sz); locs.resize(sz); for(int i=0;igetOrder(); } -int MEDFileFieldPerMesh::getNumberOfComponents() const +std::size_t MEDFileFieldPerMesh::getNumberOfComponents() const { return _father->getNumberOfComponents(); } @@ -2282,7 +2282,7 @@ const std::vector& MEDFileFieldPerMesh::getInfo() const * - 'notNullPfls' contains sz2 values that are extracted from 'pfls' in which null profiles have been removed. * 'code' and 'notNullPfls' are in MEDCouplingUMesh::checkTypeConsistencyAndContig format. */ -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) +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(); @@ -2299,7 +2299,7 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T { int startZone=j; INTERP_KERNEL::NormalizedCellType refType=geoTypes[j]; - std::vector notNullTmp; + std::vector notNullTmp; if(pfls[j]) notNullTmp.push_back(pfls[j]); j++; @@ -2311,17 +2311,17 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T } else break; - std::vector< std::pair > tmpDads(dads.begin()+startZone,dads.begin()+j); - std::vector tmpPfls(pfls.begin()+startZone,pfls.begin()+j); + std::vector< std::pair > tmpDads(dads.begin()+startZone,dads.begin()+j); + std::vector tmpPfls(pfls.begin()+startZone,pfls.begin()+j); std::vector tmpLocs(locs.begin()+startZone,locs.begin()+j); - code[3*i]=(int)refType; + code[3*i]=(mcIdType)refType; std::vector refType2(1,refType); code[3*i+1]=ComputeNbOfElems(glob,type,refType2,tmpDads,tmpLocs); if(notNullTmp.empty()) code[3*i+2]=-1; else { - notNullPfls[notNullPflsSz]=DataArrayInt::Aggregate(notNullTmp); + notNullPfls[notNullPflsSz]=DataArrayIdType::Aggregate(notNullTmp); code[3*i+2]=notNullPflsSz++; } } @@ -2330,7 +2330,7 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T /*! * 'dads' 'geoTypes' and 'locs' are input parameters that should have same size sz. sz should be >=1. */ -int MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs) +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; @@ -2447,14 +2447,14 @@ void MEDFileFieldPerMesh::convertMedBallIntoClassic() _field_pm_pt[0]=DynamicCast(pt2); } -bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob) { if(getMeshName()!=meshName) return false; std::set typesToKeep; for(std::size_t i=0;i,std::pair > > entries; + std::vector< std::pair,std::pair > > entries; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKept; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> otherEntries; getUndergroundDataArrayExt(entries); @@ -2467,7 +2467,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam int 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++) + for(std::vector< std::pair,std::pair > >::const_iterator it=entries.begin();it!=entries.end();it++) { if(typesToKeep.find((*it).first.first)!=typesToKeep.end()) { @@ -2477,31 +2477,31 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam else otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second)); } - MCAuto renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); + MCAuto renumDefrag=DataArrayIdType::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); //////////////////// - MCAuto explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after - int *workI2=explicitIdsOldInMesh->getPointer(); + 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; 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++) { // tupleIdOfStartOfNewChuncksV[sid-1]=sz2; - MCAuto explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1); - int *workI=explicitIdsOldInArr->getPointer(); + MCAuto explicitIdsOldInArr=DataArrayIdType::New(); explicitIdsOldInArr->alloc(sz,1); + mcIdType *workI=explicitIdsOldInArr->getPointer(); for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++) { - int delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1; + mcIdType delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1; (*itL2)->setLocId(sz2); (*itL2)->_tmp_work1=(*itL2)->getStart(); - int delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2; + mcIdType delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2; } renumDefrag->setPartOfValuesSimple3(sid,explicitIdsOldInArr->begin(),explicitIdsOldInArr->end(),0,1,1); } explicitIdsOldInMesh->reAlloc(sz2); - int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; + mcIdType tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; //////////////////// - MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; + MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; // perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc std::vector< MCAuto > otherEntriesNew; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++) @@ -2515,7 +2515,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++) { MCAuto elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); - int newStart=elt->getLocId(); + mcIdType newStart=elt->getLocId(); elt->setLocId((*it)->getGeoType()); elt->setNewStart(newStart); elt->_tmp_work1=permArrDefrag->getIJ(elt->_tmp_work1,0); @@ -2524,7 +2524,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam } MCAuto arr2=arr->renumber(permArrDefrag->getConstPointer()); // perform redispatching of concerned MEDFileFieldPerMeshPerTypePerDisc -> values are in arr2 - MCAuto explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); + MCAuto explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2); bool ret=false; for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++) @@ -2550,12 +2550,12 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam * \param [in,out] globalNum a global numbering counter for the renumbering. * \param [out] its - list of pair (start,stop) kept */ -void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) +void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector< std::pair > its2; + std::vector< std::pair > its2; if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2)) { ret.push_back(*it); @@ -2569,12 +2569,12 @@ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &gl * \param [in,out] globalNum a global numbering counter for the renumbering. * \param [out] its - list of pair (start,stop) kept */ -void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its) +void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector< std::pair > its2; + std::vector< std::pair > its2; if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2)) { ret.push_back(*it); @@ -2623,10 +2623,11 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t if(_field_pm_pt.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !"); // - std::vector< std::pair > dads; - std::vector pfls; - std::vector notNullPflsPerGeoType; - std::vector locs,code; + std::vector< std::pair > dads; + std::vector pfls; + std::vector notNullPflsPerGeoType; + std::vector locs; + std::vectorcode; std::vector geoTypes; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); @@ -2638,16 +2639,16 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t throw INTERP_KERNEL::Exception(oss.str()); } // - std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); - std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { - DataArrayInt *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); + DataArrayIdType *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); if(!arr) return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); else { - MCAuto arr2(arr); + MCAuto arr2(arr); return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc); } } @@ -2671,15 +2672,16 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t } } -DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const +DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { if(_field_pm_pt.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !"); // - std::vector > dads; - std::vector pfls; - std::vector notNullPflsPerGeoType; - std::vector locs,code; + std::vector > dads; + std::vector pfls; + std::vector notNullPflsPerGeoType; + std::vector locs; + std::vector code; std::vector geoTypes; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->getFieldAtLevel(mesh->getMeshDimension(),type,glob,dads,pfls,locs,geoTypes); @@ -2690,11 +2692,11 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !"; throw INTERP_KERNEL::Exception(oss.str()); } - std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); - std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); + std::vector< const DataArrayIdType *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); if(type!=ON_NODES) { - MCAuto arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); + MCAuto arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); return finishField4(dads,arr,mesh->getNumberOfCells(),pfl); } else @@ -2728,10 +2730,10 @@ void MEDFileFieldPerMesh::accept(MEDFileFieldVisitor& visitor) const } } -void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { - int globalSz=0; - int nbOfEntries=0; + mcIdType globalSz=0; + mcIdType nbOfEntries=0; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { (*it)->getSizes(globalSz,nbOfEntries); @@ -2786,7 +2788,7 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAn * \param [in] dts - (Distribution of types) = level 1 : meshes to aggregate. Level 2 : all geo type. Level 3 pair specifying geo type and number of elem in geotype. * \param [out] extractInfo - Gives information about the where the data comes from. It is a vector of triplet. First element in the triplet the mesh pos. The 2nd one the start pos. The 3rd the end pos. */ -MCAuto MEDFileFieldPerMeshPerTypePerDisc::Aggregate(int &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo) +MCAuto MEDFileFieldPerMeshPerTypePerDisc::Aggregate(mcIdType &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo) { MCAuto ret(new MEDFileFieldPerMeshPerTypePerDisc(father,tof)); if(pms.empty()) @@ -2803,8 +2805,8 @@ MCAuto MEDFileFieldPerMeshPerTypePerDisc::Agg INTERP_KERNEL::NormalizedCellType gt(pms[0].second->getGeoType()); std::size_t i(0); std::vector< std::pair > filteredDTS; - for(std::vector< std::vector< std::pair > >::const_iterator it=dts.begin();it!=dts.end();it++,i++) - for(std::vector< std::pair >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++) + for(std::vector< std::vector< std::pair > >::const_iterator it=dts.begin();it!=dts.end();it++,i++) + for(std::vector< std::pair >::const_iterator it2=(*it).begin();it2!=(*it).end();it2++) if((*it2).first==gt) filteredDTS.push_back(std::pair(i,(*it2).second)); if(pms.size()!=filteredDTS.size()) @@ -2825,7 +2827,7 @@ MCAuto MEDFileFieldPerMeshPerTypePerDisc::Agg return ret; } -MCAuto MEDFileFieldPerMesh::Aggregate(int &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo) +MCAuto MEDFileFieldPerMesh::Aggregate(mcIdType &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo) { MCAuto ret(new MEDFileFieldPerMesh(father,pms[0]->getMeshName(),pms[0]->getMeshIteration(),pms[0]->getMeshOrder())); std::map > > m; @@ -2878,7 +2880,7 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp * \param [in] mesh is \b NOT the global mesh, but the possibly reduced mesh. \a mesh parameter will be directly aggregated in the returned field */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, + const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { isPfl=false; @@ -2894,10 +2896,10 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const int nbOfArrs=dads.size(); for(int i=0;i > dads2(1,dads[i]); const std::vector locs2(1,locs[i]); + std::vector > 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); - MCAuto di=DataArrayInt::New(); + MCAuto di=DataArrayIdType::New(); di->alloc(nbOfElems,1); di->iota(offset); const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]); @@ -2917,9 +2919,9 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const * \param [in] mesh is the global mesh. */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector >& dads, const std::vector& locs, + const std::vector >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(da->isIota(mesh->getNumberOfCells())) return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); @@ -2934,8 +2936,8 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons * This method is the complement of MEDFileFieldPerMesh::finishField2 method except that this method works for node profiles. */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob, - const std::vector >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const + const std::vector >& dads, const std::vector& locs, + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(da->isIota(mesh->getNumberOfNodes())) return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); @@ -2946,11 +2948,11 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField if(meshu->getNodalConnectivity()==0) { MCAuto ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); - int nb=da->getNbOfElems(); - const int *ptr=da->getConstPointer(); + mcIdType nb=da->getNbOfElems(); + const mcIdType *ptr=da->getConstPointer(); MEDCouplingUMesh *meshuc=const_cast(meshu); meshuc->allocateCells(nb); - for(int i=0;iinsertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i); meshuc->finishInsertingCells(); ret->setMesh(meshuc); @@ -2963,14 +2965,14 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField // MCAuto ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); isPfl=true; - DataArrayInt *arr2=0; - MCAuto cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + DataArrayIdType *arr2=0; + MCAuto cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); MCAuto mesh2=mesh->buildPartAndReduceNodes(cellIds->getConstPointer(),cellIds->getConstPointer()+cellIds->getNbOfElems(),arr2); - MCAuto arr3(arr2); - int nnodes=mesh2->getNumberOfNodes(); - if(nnodes==(int)da->getNbOfElems()) + MCAuto arr3(arr2); + mcIdType nnodes=mesh2->getNumberOfNodes(); + if(nnodes==(mcIdType)da->getNbOfElems()) { - MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); + MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); arrOut->renumberInPlace(da3->getConstPointer()); mesh2->setName(mesh->getName().c_str()); ret->setMesh(mesh2); @@ -2992,24 +2994,24 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField /*! * This method is the most light method of field retrieving. */ -DataArray *MEDFileFieldPerMesh::finishField4(const std::vector >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const +DataArray *MEDFileFieldPerMesh::finishField4(const std::vector >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const { if(!pflIn) { - pflOut=DataArrayInt::New(); + pflOut=DataArrayIdType::New(); pflOut->alloc(nbOfElems,1); pflOut->iota(0); } else { - pflOut=const_cast(pflIn); + pflOut=const_cast(pflIn); pflOut->incrRef(); } - MCAuto safePfl(pflOut); + MCAuto safePfl(pflOut); MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); - int nbOfComp=infos.size(); - for(int i=0;isetInfoOnComponent(i,infos[i].c_str()); safePfl->incrRef(); return da.retn(); diff --git a/src/MEDLoader/MEDFileFieldInternal.hxx b/src/MEDLoader/MEDFileFieldInternal.hxx index 48d24b5a7..04217f36e 100644 --- a/src/MEDLoader/MEDFileFieldInternal.hxx +++ b/src/MEDLoader/MEDFileFieldInternal.hxx @@ -132,21 +132,21 @@ namespace MEDCoupling class MEDFileFieldPerMeshPerTypePerDisc : public RefCountObject, public MEDFileWritable { public: - static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); + static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd); static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId); static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const; - void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob); - void getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const; + void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob); + void getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const; void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; const MEDFileFieldPerMeshPerTypeCommon *getFather() const; - void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc); + void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc); void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc); - void setNewStart(int newValueOfStart); + void setNewStart(mcIdType newValueOfStart); int getIteration() const; int getOrder() const; double getTime() const; @@ -156,13 +156,13 @@ namespace MEDCoupling void fillTypesOfFieldAvailable(std::set& types) const; void setType(TypeOfField newType); INTERP_KERNEL::NormalizedCellType getGeoType() const; - int getNumberOfComponents() const; - int getNumberOfTuples() const; - int getStart() const { return _start; } - int getEnd() const { return _end; } - void setEnd(int endd) { _end=endd; } - int getNumberOfVals() const { return _nval; } - void incrementNbOfVals(int deltaNbVal); + std::size_t getNumberOfComponents() const; + mcIdType getNumberOfTuples() const; + mcIdType getStart() const { return _start; } + mcIdType getEnd() const { return _end; } + void setEnd(mcIdType endd) { _end=endd; } + mcIdType getNumberOfVals() const { return _nval; } + void incrementNbOfVals(mcIdType deltaNbVal); DataArray *getOrCreateAndGetArray(); const DataArray *getOrCreateAndGetArray() const; const std::vector& getInfo() const; @@ -175,24 +175,24 @@ namespace MEDCoupling 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); - void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, + void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; - void fillValues(int discId, int& startEntryId, std::vector< std::pair,std::pair > >& entries) const; - int fillEltIdsFromCode(int offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const; - int fillTupleIds(int *ptToFill) const; + 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 std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries); - static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, - const DataArrayInt *explicitIdsInMesh, const std::vector& newCode, + 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, DataArrayInt *idsOfMeshElt, - bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, + static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt, + bool isPfl, int nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting); - static MCAuto Aggregate(int &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo); + 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) { } private: - MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); - MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const std::string& dummy); MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other); MEDFileFieldPerMeshPerTypePerDisc(); private: @@ -200,15 +200,15 @@ namespace MEDCoupling private: TypeOfField _type; MEDFileFieldPerMeshPerTypeCommon *_father; - int _start; - int _end; + mcIdType _start; + mcIdType _end; //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi) - int _nval; + mcIdType _nval; 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 int _profile_it; + mutable mcIdType _profile_it; MCAuto _pd; public: mutable int _tmp_work1; @@ -222,23 +222,23 @@ namespace MEDCoupling public: std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignFieldProfile(bool isPflAlone, mcIdType& start, const DataArrayIdType *multiTypePfl, const DataArrayIdType *idsInPfl, DataArrayIdType *locIds, mcIdType nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); + void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); const MEDFileFieldPerMesh *getFather() const; - void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc); + void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc); void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; bool isUniqueLevel(int& dim) const; void fillTypesOfFieldAvailable(std::set& types) const; - void fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const; + void fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const; int getIteration() const; int getOrder() const; double getTime() const; std::string getMeshName() const; - void getSizes(int& globalSz, int& nbOfEntries) const; - int getNumberOfComponents() const; + void getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const; + std::size_t getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc); DataArray *getOrCreateAndGetArray(); @@ -254,10 +254,10 @@ namespace MEDCoupling const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const; int getNumberOfLoc() const { return _field_pm_pt_pd.size(); } int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const; - void fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const; + void fillValues(mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const; void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); - bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); - bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); + bool keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its); + bool keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its); static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType); MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { } void setFather(MEDFileFieldPerMesh *father); @@ -270,13 +270,13 @@ namespace MEDCoupling virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0; virtual std::string getGeoTypeRepr() const = 0; virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0; - virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const = 0; + virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const = 0; protected: void deepCopyElements(); - std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells); - std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells); - std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells); - std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells); + std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells); + std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells); + std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells); + std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells); private: MEDFileFieldPerMesh *_father; protected: @@ -288,7 +288,7 @@ namespace MEDCoupling public: static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); - static MCAuto Aggregate(int &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo); + static MCAuto Aggregate(mcIdType &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo); public:// overload of abstract methods void getDimension(int& dim) const; INTERP_KERNEL::NormalizedCellType getGeoType() const; @@ -296,7 +296,7 @@ namespace MEDCoupling void simpleRepr(int bkOffset, std::ostream& oss, int id) const; std::string getGeoTypeRepr() const; MEDFileFieldPerMeshPerType *deepCopy(MEDFileFieldPerMesh *father) const; - void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; + void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; private: MEDFileFieldPerMeshPerType(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *father, INTERP_KERNEL::NormalizedCellType gt); @@ -317,7 +317,7 @@ namespace MEDCoupling void simpleRepr(int bkOffset, std::ostream& oss, int id) const; std::string getGeoTypeRepr() const; MEDFileFieldPerMeshPerTypeDyn *deepCopy(MEDFileFieldPerMesh *father) const; - void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; + void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; private: MEDFileFieldPerMeshPerTypeDyn(med_idt fid, MEDFileFieldPerMesh *fath, const MEDFileStructureElement *se, const MEDFileFieldNameScope& nasc); private: @@ -338,15 +338,15 @@ namespace MEDCoupling MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const; void simpleRepr(int bkOffset,std::ostream& oss, int id) const; void copyTinyInfoFrom(const MEDCouplingMesh *mesh); - void assignFieldProfile(int& start, const DataArrayInt *multiTypePfl, const std::vector& code, const std::vector& code2, const std::vector& idsInPflPerType, const std::vector& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignFieldNoProfileNoRenum(int& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc); + void assignFieldProfile(mcIdType& start, const DataArrayIdType *multiTypePfl, const std::vector& code, const std::vector& code2, const std::vector& idsInPflPerType, const std::vector& idsPerType, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignFieldNoProfileNoRenum(mcIdType& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); + void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc); void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; void fillTypesOfFieldAvailable(std::set& types) const; - std::vector< std::vector< std::pair > > getFieldSplitedByType(std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + std::vector< std::vector< std::pair > > getFieldSplitedByType(std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; void accept(MEDFileFieldVisitor& visitor) const; void getDimension(int& dim) const; bool isUniqueLevel(int& dim) const; @@ -357,7 +357,7 @@ namespace MEDCoupling int getMeshOrder() const { return _mesh_order; } std::string getMeshName() const; void setMeshName(const std::string& meshName); - int getNumberOfComponents() const; + std::size_t getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; bool presenceOfStructureElements() const; bool onlyStructureElements() const; @@ -374,37 +374,37 @@ namespace MEDCoupling std::vector getLocsReallyUsedMulti() const; void convertMedBallIntoClassic(); bool changeMeshNames(const std::vector< std::pair >& modifTab); - bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); - void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); - void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); + bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob); + void keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its); + void keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its); void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); 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, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; - void getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) 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; - static MCAuto Aggregate(int &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo); + 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); MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, + const std::vector< std::pair >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - DataArray *finishField4(const std::vector< std::pair >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const; + const std::vector< std::pair >& dads, const std::vector& locs, + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + DataArray *finishField4(const std::vector< std::pair >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const; void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); static void 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); - static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs); + const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& pfls, const std::vector& locs, + std::vector& code, std::vector& notNullPfls); + static mcIdType ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs); MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); - MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_iteration(meshIt),_mesh_order(meshOrd) { } + MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_mesh_iteration(meshIt),_mesh_order(meshOrd),_father(fath) { } private: int _mesh_iteration; int _mesh_order; diff --git a/src/MEDLoader/MEDFileFieldMultiTS.cxx b/src/MEDLoader/MEDFileFieldMultiTS.cxx index 26bdcb1be..5d7975a83 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -167,7 +167,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair >& timeSteps) const { - int id=0; + mcIdType 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 { - int id=0; + mcIdType 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++) { @@ -368,12 +368,12 @@ DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArray(int ite /*! * See doc at MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt */ -DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const { return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries); } -bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob) { bool ret=false; @@ -840,7 +840,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMultiTSWithoutSDA::ge /*! * entry point for users that want to iterate into MEDFile DataStructure without any overhead. */ -std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs); } @@ -1049,7 +1049,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCoup _time_steps.push_back(obj); } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller) { if(!field) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !"); @@ -1076,7 +1076,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAutogetNumberOfComponents()!=(int)_infos.size()) + if(tsPtr->getNumberOfComponents()!=_infos.size()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() << " !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -1484,7 +1484,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::getTypesOfFi return contentNotNullBase()->getTypesOfFieldAvailable(); } -std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const +std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); } @@ -1951,7 +1951,7 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT } template -MCAuto AggregateHelperF1TS(const std::vector< typename MLFieldTraits::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) +MCAuto AggregateHelperF1TS(const std::vector< typename MLFieldTraits::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) { MCAuto< typename MLFieldTraits::F1TSType > ret(MLFieldTraits::F1TSType::New()); if(f1tss.empty()) @@ -1974,7 +1974,7 @@ MCAuto AggregateHelperF1TS(const std::vector< typename M } template -MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair > >& dts) +MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair > >& dts) { MCAuto< typename MLFieldTraits::FMTSType > ret(MLFieldTraits::FMTSType::New()); if(fmtss.empty()) @@ -2007,7 +2007,7 @@ MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< type /*! * \a dts and \a ftmss are expected to have same size. */ -MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts) +MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts) { if(fmtss.empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !"); diff --git a/src/MEDLoader/MEDFileFieldMultiTS.hxx b/src/MEDLoader/MEDFileFieldMultiTS.hxx index e51a9c9e9..dd7b082aa 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.hxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.hxx @@ -85,12 +85,12 @@ namespace MEDCoupling MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const; MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller); - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller); + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT std::vector< std::vector > getTypesOfFieldAvailable() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const; MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const; @@ -265,12 +265,12 @@ namespace MEDCoupling MEDLOADER_EXPORT int getNumberOfComponents() const; MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT std::vector< std::vector > getTypesOfFieldAvailable() const; - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; MEDLOADER_EXPORT MCAuto getContent(); public: MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0; - MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; - MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts); + MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; + MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts); public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; @@ -299,8 +299,8 @@ namespace MEDCoupling MEDLOADER_EXPORT static typename MLFieldTraits::FMTSType *New(med_idt fid, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static typename MLFieldTraits::FMTSType *New(const typename MLFieldTraits::FMTSWSDAType& other, bool shallowCopyOfContent); MEDLOADER_EXPORT static typename MLFieldTraits::FMTSType *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, const std::vector< std::pair >& entities, bool loadAll=true); - MEDLOADER_EXPORT typename MLFieldTraits::FMTSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; - MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } + MEDLOADER_EXPORT typename MLFieldTraits::FMTSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; + MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { return this->extractPartImpl(extractDef,mm); } // MEDLOADER_EXPORT typename Traits::FieldType *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; @@ -308,21 +308,21 @@ namespace MEDCoupling MEDLOADER_EXPORT typename Traits::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; - MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const; // MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits::FieldType *field); - MEDLOADER_EXPORT void appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + MEDLOADER_EXPORT void appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); // MEDLOADER_EXPORT typename MLFieldTraits::F1TSType *getTimeStepAtPos(int pos) const; MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArray(int iteration, int order) const; - MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT typename MLFieldTraits::FMTSType *buildNewEmptyImpl() const; MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const; protected: const typename MLFieldTraits::FMTSWSDAType *contentNotNull() const; typename MLFieldTraits::FMTSWSDAType *contentNotNull(); - void appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller); + void appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller); protected: ~MEDFileTemplateFieldMultiTS() { } MEDFileTemplateFieldMultiTS(); diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 394309003..69bf68c12 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -42,9 +42,9 @@ MEDFileMeshStruct *MEDFileMeshStruct::New(const MEDFileMesh *mesh) std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const { std::size_t ret(0); - for(std::vector< std::vector >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++) + for(std::vector< std::vector >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++) ret+=(*it0).capacity()*sizeof(int); - ret+=_geo_types_distrib.capacity()*sizeof(std::vector); + ret+=_geo_types_distrib.capacity()*sizeof(std::vector); return ret; } @@ -69,7 +69,7 @@ MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh) int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const { int j=0; - for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--) + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++,j--) { std::size_t sz=(*it1).size(); if(sz%3!=0) @@ -85,9 +85,9 @@ int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) co /*! * \sa MEDFileMeshStruct::doesManageGeoType */ -int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const +mcIdType MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const { - for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) { std::size_t sz=(*it1).size(); if(sz%3!=0) @@ -105,7 +105,7 @@ int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellTy */ bool MEDFileMeshStruct::doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const { - for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) { std::size_t sz=(*it1).size(); if(sz%3!=0) @@ -131,7 +131,7 @@ void MEDFileMeshStruct::appendIfImplicitType(INTERP_KERNEL::NormalizedCellType t std::size_t nbGeo(sz/3); if(nbGeo!=1) throw INTERP_KERNEL::Exception(MSG); - std::vector arr(3); arr[0]=(int)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1; + std::vector arr(3); arr[0]=(mcIdType)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1; _geo_types_distrib.push_back(arr); } @@ -180,7 +180,7 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : null input pointer !"); @@ -196,25 +196,25 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels())); ret->selectPartOfNodes(pflOnNode); return ret.retn(); } -void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr) +void MEDMeshMultiLev::setNodeReduction(const DataArrayIdType *nr) { if(nr) nr->incrRef(); - _node_reduction=const_cast(nr); + _node_reduction=const_cast(nr); } -void MEDMeshMultiLev::setCellReduction(const DataArrayInt *cr) +void MEDMeshMultiLev::setCellReduction(const DataArrayIdType *cr) { if(_pfls.size()!=1) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::setCellReduction : can be used only for single geo type mesh !"); - _pfls[0]=const_cast(cr); + _pfls[0]=const_cast(cr); if(cr) cr->incrRef(); } @@ -227,7 +227,7 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !"); const MEDFileField1TSStructItem2& p(fst[0]); std::string pflName(p.getPflName()); - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(pflName.empty() && !nr) return true; if(!pflName.empty() && !nr) @@ -241,7 +241,7 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst std::size_t sz(fst.getNumberOfItems()); if(sz!=_geo_types.size()) return false; - int strt(0); + mcIdType strt(0); for(std::size_t i=0;i(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; } + { famIds=const_cast(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; } //bad luck the slowest part isWithoutCopy=false; - std::vector< MCAuto > retSafe(sz); - std::vector< const DataArrayInt *> ret(sz); + std::vector< MCAuto > retSafe(sz); + std::vector< const DataArrayIdType *> ret(sz); int start(0); for(std::size_t i=0;i tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); + MCAuto tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end()); } else @@ -301,40 +301,40 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isW ret[i]=retSafe[i]; start+=lgth; } - famIds=DataArrayInt::Aggregate(ret); + famIds=DataArrayIdType::Aggregate(ret); } /*! * \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef). * \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure. */ -void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const +void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const { - const DataArrayInt *nids(_cell_num_ids); + const DataArrayIdType *nids(_cell_num_ids); if(!nids) { numIds=0; isWithoutCopy=true; return ; } std::size_t sz(_geo_types.size()); bool presenceOfPfls(false); for(std::size_t i=0;i(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; } + { numIds=const_cast(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; } //bad luck the slowest part isWithoutCopy=false; - std::vector< MCAuto > retSafe(sz); - std::vector< const DataArrayInt *> ret(sz); + std::vector< MCAuto > retSafe(sz); + std::vector< const DataArrayIdType *> ret(sz); int start(0); for(std::size_t i=0;i tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); + MCAuto tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end()); } else @@ -344,19 +344,19 @@ void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isW ret[i]=retSafe[i]; start+=lgth; } - numIds=DataArrayInt::Aggregate(ret); + numIds=DataArrayIdType::Aggregate(ret); } /*! * \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef). * \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure. */ -void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const +void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const { - const DataArrayInt *fids(_node_fam_ids); + const DataArrayIdType *fids(_node_fam_ids); if(!fids) { famIds=0; isWithoutCopy=true; return ; } - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(nr) { isWithoutCopy=false; @@ -364,7 +364,7 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isW } else { - famIds=const_cast(fids); famIds->incrRef(); + famIds=const_cast(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); } } @@ -373,12 +373,12 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isW * \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef). * \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure. */ -void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const +void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const { - const DataArrayInt *fids(_node_num_ids); + const DataArrayIdType *fids(_node_num_ids); if(!fids) { numIds=0; isWithoutCopy=true; return ; } - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(nr) { isWithoutCopy=false; @@ -386,7 +386,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW } else { - numIds=const_cast(fids); numIds->incrRef(); + numIds=const_cast(fids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); } } @@ -395,7 +395,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW * This method returns, if any, a new object containing the global node ids **BUT CONTRARY TO OTHER RETRIEVE METHODS** the returned object is always a NON AGGREGATED object. So the returned object if not null * can be used as this safely. */ -DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const +DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const { const MEDFileUMesh *umesh(dynamic_cast(_mesh)); if(!umesh) @@ -403,12 +403,12 @@ DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const const PartDefinition *pd(umesh->getPartDefAtLevel(1)); if(!pd) return 0; - MCAuto tmp(pd->toDAI()); - const DataArrayInt *tmpCpp(tmp); + MCAuto tmp(pd->toDAI()); + const DataArrayIdType *tmpCpp(tmp); if(!tmpCpp) return 0; // - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(nr) return tmp->selectByTupleIdSafe(nr->begin(),nr->end()); else @@ -420,28 +420,28 @@ std::vector< INTERP_KERNEL::NormalizedCellType > MEDMeshMultiLev::getGeoTypes() return _geo_types; } -void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayInt *famIds) +void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayIdType *famIds) { _cell_fam_ids=famIds; if(famIds) famIds->incrRef(); } -void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayInt *numIds) +void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayIdType *numIds) { _cell_num_ids=numIds; if(numIds) numIds->incrRef(); } -void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayInt *famIds) +void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayIdType *famIds) { _node_fam_ids=famIds; if(famIds) famIds->incrRef(); } -void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayInt *numIds) +void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayIdType *numIds) { _node_num_ids=numIds; if(numIds) @@ -453,7 +453,7 @@ std::string MEDMeshMultiLev::getPflNameOfId(int id) const std::size_t sz(_pfls.size()); if(id<0 || id>=(int)sz) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !"); - const DataArrayInt *pfl(_pfls[id]); + const DataArrayIdType *pfl(_pfls[id]); if(!pfl) return std::string(""); return pfl->getName(); @@ -463,7 +463,7 @@ std::string MEDMeshMultiLev::getPflNameOfId(int id) const * Returns the number of cells having geometric type \a t. * The profiles are **NOT** taken into account here. */ -int MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const +mcIdType MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const { std::size_t sz(_nb_entities.size()); for(std::size_t i=0;ideepCopy(); if(pflName.empty() && nr) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !"); if(!pflName.empty() && nr) { - MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); - MCAuto p2(nr->deepCopy()); + MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); + MCAuto p2(nr->deepCopy()); p1->sort(true); p2->sort(true); if(!p1->isEqualWithoutConsideringStr(*p2)) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !"); - p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr); + p1=DataArrayIdType::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr); MCAuto ret(vals->deepCopy()); ret->renumberInPlace(p1->begin()); return ret.retn(); } if(!pflName.empty() && !nr) { - MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); + MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); p1->sort(true); if(!p1->isIota(getNumberOfNodes())) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !"); @@ -527,7 +527,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& std::vector compInfo(vals->getInfoOnComponents()); for(std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator it=_geo_types.begin();it!=_geo_types.end();it++,iii++) { - const DataArrayInt *thisP(_pfls[iii]); + const DataArrayIdType *thisP(_pfls[iii]); std::vector ps; for(std::size_t i=0;igetNbOfIntegrationPts(globs)); - const DataArrayInt *otherP(ps[0]->getPfl(globs)); + const DataArrayIdType *otherP(ps[0]->getPfl(globs)); const std::pair& strtStop(ps[0]->getStartStop()); MCAuto ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); if(!thisP && !otherP) @@ -550,8 +550,8 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } if(thisP && otherP) { - MCAuto p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo()))); - MCAuto p2(thisP->deepCopy()); + MCAuto p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo()))); + MCAuto p2(thisP->deepCopy()); p2->transformWithIndArr(p1->begin(),p1->end()); //p1=p2->findIdsNotEqual(-1); //p1=p2->selectByTupleIdSafe(p1->begin(),p1->end()); @@ -561,10 +561,10 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } if(!thisP && otherP) { - MCAuto p1(otherP->deepCopy()); + MCAuto p1(otherP->deepCopy()); p1->sort(true); p1->checkAllIdsInRange(0,getNumberOfCells(ps[0]->getGeo())); - p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,p1); + p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,p1); ret->rearrange(nbi*nc); ret->renumberInPlace(p1->begin()); ret->rearrange(nc); ret->setInfoOnComponents(compInfo); arrSafe[iii]=ret; arr[iii]=ret; continue; @@ -573,47 +573,47 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } else { - std::vector< const DataArrayInt * >otherPS(ps.size()); + std::vector< const DataArrayIdType * >otherPS(ps.size()); std::vector< const DataArray * > arr2(ps.size()); std::vector< MCAuto > arr2Safe(ps.size()); - std::vector< const DataArrayInt * > nbis(ps.size()); - std::vector< MCAuto > nbisSafe(ps.size()); + std::vector< const DataArrayIdType * > nbis(ps.size()); + std::vector< MCAuto > nbisSafe(ps.size()); int jj(0); for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { int nbi((*it2)->getNbOfIntegrationPts(globs)); - const DataArrayInt *otherPfl((*it2)->getPfl(globs)); + const DataArrayIdType *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); if(!otherPfl) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 4 !"); arr2[jj]=ret2; arr2Safe[jj]=ret2; otherPS[jj]=otherPfl; - nbisSafe[jj]=DataArrayInt::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi); + nbisSafe[jj]=DataArrayIdType::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi); nbis[jj]=nbisSafe[jj]; } MCAuto arr3(DataArray::Aggregate(arr2)); - MCAuto otherP(DataArrayInt::Aggregate(otherPS)); - MCAuto zenbis(DataArrayInt::Aggregate(nbis)); - MCAuto otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it))); - MCAuto p1; + MCAuto otherP(DataArrayIdType::Aggregate(otherPS)); + MCAuto zenbis(DataArrayIdType::Aggregate(nbis)); + MCAuto otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it))); + MCAuto p1; if(thisP) - p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,thisP); + p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,thisP); else p1=otherP->deepCopy(); - MCAuto zenbisN(zenbis->renumber(p1->begin())); + MCAuto zenbisN(zenbis->renumber(p1->begin())); zenbisN->computeOffsetsFull(); jj=0; for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { //int nbi((*it2)->getNbOfIntegrationPts(globs)); - const DataArrayInt *otherPfl((*it2)->getPfl(globs)); + const DataArrayIdType *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); // - MCAuto p2(otherPfl->deepCopy()); + MCAuto p2(otherPfl->deepCopy()); p2->transformWithIndArr(otherPN->begin(),otherPN->end()); p2->transformWithIndArr(p1->begin(),p1->end()); - MCAuto idsN(p2->buildExplicitArrByRanges(zenbisN)); + MCAuto idsN(p2->buildExplicitArrByRanges(zenbisN)); arr3->setPartOfValuesBase3(ret2,idsN->begin(),idsN->end(),0,nc,1); } arrSafe[iii]=arr3; arr[iii]=arr3; @@ -627,7 +627,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& /*! * This method is called to add NORM_POINT1 cells in \a this so that orphan nodes in \a verticesToAdd will be fetched. */ -void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr) +void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { int nbOfVertices(verticesToAdd->getNumberOfTuples()); std::size_t sz(_pfls.size()); @@ -636,34 +636,34 @@ void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArra _nb_entities.resize(sz+1,nbOfVertices); _node_reduction=nr; nr->incrRef(); _nb_nodes+=nbOfVertices; - const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids); + const DataArrayIdType *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids); if(cf) { - MCAuto tmp; - std::vector a(2); + MCAuto tmp; + std::vector a(2); a[0]=cf; if(nf) tmp=nf->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end()); else { - tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); + tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); } a[1]=tmp; - _cell_fam_ids=DataArrayInt::Aggregate(a); + _cell_fam_ids=DataArrayIdType::Aggregate(a); } if(cn) { - MCAuto tmp; - std::vector a(2); + MCAuto tmp; + std::vector a(2); a[0]=cn; if(nn) tmp=nn->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end()); else { - tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); + tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); } a[1]=tmp; - _cell_num_ids=DataArrayInt::Aggregate(a); + _cell_num_ids=DataArrayIdType::Aggregate(a); } } @@ -671,7 +671,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh):_mesh(mesh),_nb_nodes( { } -MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes) +MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes) { std::size_t sz(_geo_types.size()); if(sz!=pfls.size() || sz!=nbEntities.size()) @@ -681,7 +681,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std { if(pfls[i]) pfls[i]->incrRef(); - _pfls[i]=const_cast(pfls[i]); + _pfls[i]=const_cast(pfls[i]); } } @@ -730,16 +730,16 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector bool cellFamIdsNoCpy(levs.size()==1); if(cellFamIdsNoCpy) { - const DataArrayInt *tmp(m->getFamilyFieldAtLevel(levs[0])); + const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(levs[0])); if(tmp) { tmp->incrRef(); - _cell_fam_ids=(const_cast(tmp)); + _cell_fam_ids=(const_cast(tmp)); } } else { - std::vector tmps(levs.size()); + std::vector tmps(levs.size()); bool f(true); for(std::size_t i=0;i f=false; } if(f && !tmps.empty()) - _cell_fam_ids=DataArrayInt::Aggregate(tmps); + _cell_fam_ids=DataArrayIdType::Aggregate(tmps); } bool cellNumIdsNoCpy(levs.size()==1); if(cellNumIdsNoCpy) { - const DataArrayInt *tmp(m->getNumberFieldAtLevel(levs[0])); + const DataArrayIdType *tmp(m->getNumberFieldAtLevel(levs[0])); if(tmp) { tmp->incrRef(); - _cell_num_ids=(const_cast(tmp)); + _cell_num_ids=(const_cast(tmp)); } } else { - std::vector tmps(levs.size()); + std::vector tmps(levs.size()); bool n(true); for(std::size_t i=0;i n=false; } if(n && !tmps.empty()) - _cell_num_ids=DataArrayInt::Aggregate(tmps); + _cell_num_ids=DataArrayIdType::Aggregate(tmps); } // node part { - const DataArrayInt *tmp(m->getFamilyFieldAtLevel(1)); + const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(1)); if(tmp) { tmp->incrRef(); - _node_fam_ids=(const_cast(tmp)); + _node_fam_ids=(const_cast(tmp)); } } { - const DataArrayInt *tmp(m->getNumberFieldAtLevel(1)); + const DataArrayIdType *tmp(m->getNumberFieldAtLevel(1)); if(tmp) { tmp->incrRef(); - _node_num_ids=(const_cast(tmp)); + _node_num_ids=(const_cast(tmp)); } } } -MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { return new MEDUMeshMultiLev(m,gts,pfls,nbEntities); } -MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) +MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { std::size_t sz(gts.size()); if(sz<1) @@ -820,23 +820,23 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vectorgetMeshDimension()); if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part { - const DataArrayInt *famIds(m->getFamilyFieldAtLevel(lev)); + const DataArrayIdType *famIds(m->getFamilyFieldAtLevel(lev)); if(famIds) - { _cell_fam_ids=const_cast(famIds); famIds->incrRef(); } - const DataArrayInt *numIds(m->getNumberFieldAtLevel(lev)); + { _cell_fam_ids=const_cast(famIds); famIds->incrRef(); } + const DataArrayIdType *numIds(m->getNumberFieldAtLevel(lev)); if(numIds) - { _cell_num_ids=const_cast(numIds); numIds->incrRef(); } + { _cell_num_ids=const_cast(numIds); numIds->incrRef(); } famIds=m->getFamilyFieldAtLevel(1); if(famIds) - { _node_fam_ids=const_cast(famIds); famIds->incrRef(); } + { _node_fam_ids=const_cast(famIds); famIds->incrRef(); } numIds=m->getNumberFieldAtLevel(1); if(numIds) - { _node_num_ids=const_cast(numIds); numIds->incrRef(); } + { _node_num_ids=const_cast(numIds); numIds->incrRef(); } return ; } // - std::vector< MCAuto > famIdsSafe(sz); - std::vector famIds(sz); + std::vector< MCAuto > famIdsSafe(sz); + std::vector famIds(sz); bool f(true); for(std::size_t i=0;i > numIdsSafe(sz); - std::vector numIds(sz); + _cell_fam_ids=DataArrayIdType::Aggregate(famIds); + std::vector< MCAuto > numIdsSafe(sz); + std::vector numIds(sz); bool n(true); for(std::size_t i=0;igetFamilyFieldAtLevel(1)); + const DataArrayIdType *nodeFamIds(m->getFamilyFieldAtLevel(1)); if(nodeFamIds) - { _node_fam_ids=const_cast(nodeFamIds); nodeFamIds->incrRef(); } - const DataArrayInt *nodeNumIds(m->getNumberFieldAtLevel(1)); + { _node_fam_ids=const_cast(nodeFamIds); nodeFamIds->incrRef(); } + const DataArrayIdType *nodeNumIds(m->getNumberFieldAtLevel(1)); if(nodeNumIds) - { _node_num_ids=const_cast(nodeNumIds); nodeNumIds->incrRef(); } + { _node_num_ids=const_cast(nodeNumIds); nodeNumIds->incrRef(); } } -void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) +void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) return ; std::size_t sz(_parts.size()); - std::vector< MCAuto > a(sz); - std::vector< const DataArrayInt *> aa(sz); + std::vector< MCAuto > a(sz); + std::vector< const DataArrayIdType *> aa(sz); for(std::size_t i=0;i m(_parts[i]); if(pfl) m=dynamic_cast(_parts[i]->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MCAuto cellIdsSafe(cellIds); + MCAuto cellIdsSafe(cellIds); MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); - int tmp=-1; - MCAuto o2n(m2->getNodeIdsInUse(tmp)); + mcIdType tmp=-1; + MCAuto o2n(m2->getNodeIdsInUse(tmp)); a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i]; if(pfl) _pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end()); @@ -894,7 +894,7 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) _pfls[i]=cellIdsSafe; } if(!aa.empty()) - _node_reduction=DataArrayInt::Aggregate(aa);//general case + _node_reduction=DataArrayIdType::Aggregate(aa);//general case else _node_reduction=pflNodes->deepCopy();//case where no cells in read mesh. _node_reduction->sort(true); @@ -904,9 +904,9 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !"); // Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts... - MCAuto pflNodes2(pflNodes->deepCopy()); + MCAuto pflNodes2(pflNodes->deepCopy()); pflNodes2->sort(true); - MCAuto diff(pflNodes2->buildSubstractionOptimized(_node_reduction)); + MCAuto diff(pflNodes2->buildSubstractionOptimized(_node_reduction)); appendVertices(diff,pflNodes2); } @@ -933,7 +933,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const * If returned value is false output pointer \a coords is not the internal pointer. If returned value is true output pointer \a coords is directly the internal pointer. * If true is returned, the \a coords output parameter should be used with care (non const method call) to avoid to change the internal state of MEDFileUMesh instance. */ -bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const +bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const { const DataArrayDouble *tmp(0); if(_parts.empty()) @@ -952,7 +952,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * if(!cur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : a part is null !"); // - const DataArrayInt *pfl(_pfls[iii]); + const DataArrayIdType *pfl(_pfls[iii]); MCAuto cur2; if(!pfl) { cur2=const_cast(cur); cur2->incrRef(); } @@ -966,15 +966,15 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * else { isPolyh=true; - MCAuto tmp2(cur->computeEffectiveNbOfNodesPerCell()); + MCAuto tmp2(cur->computeEffectiveNbOfNodesPerCell()); szD+=tmp2->accumulate((std::size_t)0)+curNbCells; szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples(); } } MCAuto b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer()); - MCAuto c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer()); - MCAuto d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer()); - MCAuto e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0); + MCAuto c(DataArrayIdType::New()); c->alloc(szBCE,1); mcIdType *cPtr(c->getPointer()); + MCAuto d(DataArrayIdType::New()); d->alloc(szD,1); mcIdType *dPtr(d->getPointer()); + 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); @@ -983,7 +983,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { const MEDCoupling1GTUMesh *cur(*it); // - const DataArrayInt *pfl(_pfls[iii]); + const DataArrayIdType *pfl(_pfls[iii]); MCAuto cur2; if(!pfl) { cur2=const_cast(cur); cur2->incrRef(); } @@ -1000,7 +1000,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * std::fill(bPtr,bPtr+curNbCells,gtvtk); bPtr+=curNbCells; const MEDCoupling1SGTUMesh *scur(dynamic_cast(cur)); const MEDCoupling1DGTUMesh *dcur(dynamic_cast(cur)); - const int *connPtr(cur->getNodalConnectivity()->begin()); + const mcIdType *connPtr(cur->getNodalConnectivity()->begin()); if(!scur && !dcur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : internal error !"); if(scur) @@ -1030,7 +1030,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * } else { - const int *connIPtr(dcur->getNodalConnectivityIndex()->begin()); + const mcIdType *connIPtr(dcur->getNodalConnectivityIndex()->begin()); if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) { for(int i=0;i s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1); - *dPtr++=(int)s.size(); + std::set s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1); + *dPtr++=(mcIdType)s.size(); dPtr=std::copy(s.begin(),s.end(),dPtr); - *cPtr++=k; k+=(int)s.size()+1; + *cPtr++=k; k+=(mcIdType)s.size()+1; } } if(isPolyh) @@ -1062,10 +1062,10 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { int nbFace(std::count(connPtr+connIPtr[0],connPtr+connIPtr[1],-1)+1); *fPtr++=nbFace; - const int *work(connPtr+connIPtr[0]); + const mcIdType *work(connPtr+connIPtr[0]); for(int j=0;jisObjectInTheProgeny(coords); } -void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const +void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const { - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(!nr) return ; if(nodalConnVTK->empty() && !polyhedNodalConnVTK) @@ -1102,7 +1102,7 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, } int sz(coords->getNumberOfTuples()); std::vector b(sz,false); - const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); + const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); while(work!=endW) { int nb(*work++); @@ -1137,16 +1137,16 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, if(szExp!=nr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::reorderNodesIfNecessary : internal error #3 !"); // Go renumbering ! - MCAuto o2n(DataArrayInt::New()); o2n->alloc(sz,1); - int *o2nPtr(o2n->getPointer()); + MCAuto o2n(DataArrayIdType::New()); o2n->alloc(sz,1); + mcIdType *o2nPtr(o2n->getPointer()); int newId(0); for(int i=0;ibegin()); - MCAuto n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples())); - MCAuto perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr)); - const int *permPtr(perm->begin()); - int *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); + const mcIdType *o2nPtrc(o2n->begin()); + MCAuto n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples())); + MCAuto perm(DataArrayIdType::FindPermutationFromFirstToSecond(n2o,nr)); + const mcIdType *permPtr(perm->begin()); + mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); while(work2!=endW2) { int nb(*work2++); @@ -1171,7 +1171,7 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, } -void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr) +void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1 MEDMeshMultiLev::appendVertices(verticesToAdd,nr); @@ -1179,7 +1179,7 @@ void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArr elt->allocateCells(nbOfCells); for(int i=0;igetIJ(i,0)); + mcIdType pt(verticesToAdd->getIJ(i,0)); elt->insertNextCell(&pt,&pt+1); } if(_parts.empty()) @@ -1196,7 +1196,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh initStdFieldOfIntegers(m); } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true) { initStdFieldOfIntegers(m); } @@ -1208,18 +1208,18 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMult void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m) { // ids fields management - const DataArrayInt *tmp(0); + const DataArrayIdType *tmp(0); tmp=m->getFamilyFieldAtLevel(0); if(tmp) { tmp->incrRef(); - _cell_fam_ids=const_cast(tmp); + _cell_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(0); if(tmp) { tmp->incrRef(); - _cell_num_ids=const_cast(tmp); + _cell_num_ids=const_cast(tmp); } // tmp=0; @@ -1227,26 +1227,26 @@ void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMe if(tmp) { tmp->incrRef(); - _node_fam_ids=const_cast(tmp); + _node_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(1); if(tmp) { tmp->incrRef(); - _node_num_ids=const_cast(tmp); + _node_num_ids=const_cast(tmp); } // faces (if any) tmp=m->getFamilyFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _face_fam_ids=const_cast(tmp); + _face_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _face_num_ids=const_cast(tmp); + _face_num_ids=const_cast(tmp); } } @@ -1269,7 +1269,7 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu MEDCoupling1GTUMesh *facesIfPresent((static_cast(_mesh))->getImplicitFaceMesh()); if(!facesIfPresent) return false; - const DataArrayInt *pfl(0),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; MCAuto facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); @@ -1285,39 +1285,39 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m) { - const DataArrayInt *tmp(0); + const DataArrayIdType *tmp(0); tmp=m->getFamilyFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _cell_fam_ids=const_cast(tmp); + _cell_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _cell_num_ids=const_cast(tmp); + _cell_num_ids=const_cast(tmp); } } -void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) +void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) return ; - std::vector ngs(getNodeGridStructure()); - MCAuto conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); + std::vector ngs(getNodeGridStructure()); + MCAuto conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); MCAuto m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size()))); m->setNodalConnectivity(conn); - const DataArrayInt *pfl(_pfls[0]); + const DataArrayIdType *pfl(_pfls[0]); if(pfl) { m=dynamic_cast(m->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); } - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MCAuto cellIdsSafe(cellIds); + MCAuto cellIdsSafe(cellIds); MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); - int tmp=-1; + mcIdType tmp=-1; _node_reduction=m2->getNodeIdsInUse(tmp); if(pfl) _pfls[0]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end()); @@ -1332,7 +1332,7 @@ MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector return new MEDCMeshMultiLev(m,levs); } -MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { return new MEDCMeshMultiLev(m,gts,pfls,nbEntities); } @@ -1355,7 +1355,7 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector } } -MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) +MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !"); @@ -1382,9 +1382,9 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredM { } -std::vector MEDCMeshMultiLev::getNodeGridStructure() const +std::vector MEDCMeshMultiLev::getNodeGridStructure() const { - std::vector ret(_coords.size()); + std::vector ret(_coords.size()); for(std::size_t i=0;i<_coords.size();i++) ret[i]=_coords[i]->getNumberOfTuples(); return ret; @@ -1395,16 +1395,16 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const MEDMeshMultiLev *retSpecific(0); if(prepareForImplicitUnstructuredMeshCase(retSpecific)) return retSpecific; - const DataArrayInt *pfl(0),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MCAuto nnr; - std::vector cgs,ngs(getNodeGridStructure()); + MCAuto nnr; + std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); - std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); if(pfl) { - std::vector< std::pair > cellParts; + std::vector< std::pair > cellParts; MCAuto ret2; if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { @@ -1432,15 +1432,15 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const { m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef(); } - const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids); + const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids); if(famIds) { - MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setFamilyIdsOnCells(tmp); } if(numIds) { - MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setNumberIdsOnCells(tmp); } return ret2.retn(); @@ -1478,7 +1478,7 @@ MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLi return new MEDCurveLinearMeshMultiLev(m,levs); } -MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { return new MEDCurveLinearMeshMultiLev(m,gts,pfls,nbEntities); } @@ -1497,7 +1497,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM _structure=m->getMesh()->getNodeGridStructure(); } -MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) +MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !"); @@ -1521,7 +1521,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshM { } -std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const +std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const { return _structure; } @@ -1531,27 +1531,27 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const MEDMeshMultiLev *retSpecific(0); if(prepareForImplicitUnstructuredMeshCase(retSpecific)) return retSpecific; - const DataArrayInt *pfl(0),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MCAuto nnr; - std::vector cgs,ngs(getNodeGridStructure()); + MCAuto nnr; + std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); - std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); if(pfl) { - std::vector< std::pair > cellParts,nodeParts; + std::vector< std::pair > cellParts,nodeParts; MCAuto ret2; if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { nodeParts=cellParts; - std::vector st(ngs.size()); + std::vector st(ngs.size()); for(std::size_t i=0;i p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); + MCAuto p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); MCAuto ret(new MEDCurveLinearMeshMultiLev(*this)); ret->_is_internal=false; if(nr) @@ -1573,15 +1573,15 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const { m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef(); } - const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids); + const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids); if(famIds) { - MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setFamilyIdsOnCells(tmp); } if(numIds) { - MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setNumberIdsOnCells(tmp); } return ret2.retn(); @@ -1595,7 +1595,7 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const } } -void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const +void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const { isInternal=_is_internal; nodeStrct=_structure; @@ -1611,7 +1611,7 @@ MEDFileField1TSStructItem2::MEDFileField1TSStructItem2() { } -MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayInt::New()),_loc(d),_nb_of_entity(-1) +MEDFileField1TSStructItem2::MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& c, const std::string& d):_geo_type(a),_start_end(b),_pfl(DataArrayIdType::New()),_loc(d),_nb_of_entity(-1) { _pfl->setName(c.c_str()); } @@ -1623,13 +1623,13 @@ void MEDFileField1TSStructItem2::checkWithMeshStructForCells(const MEDFileMeshSt MEDFileMeshStruct *mstUnConstCasted(const_cast(mst)); mstUnConstCasted->appendIfImplicitType(_geo_type); } - int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,1,globs); } void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) { - int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type); checkInRange(nbOfEnt,(int)cm.getNumberOfNodes(),globs); } @@ -1641,7 +1641,7 @@ void MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT(const MEDFileMesh if(_loc.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkWithMeshStructForGaussPT : no localization specified !"); const MEDFileFieldLoc& loc=globs->getLocalization(_loc.c_str()); - int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs); } @@ -1666,7 +1666,7 @@ std::string MEDFileField1TSStructItem2::getPflName() const return _pfl->getName(); } -const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const +const DataArrayIdType *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const { if(!_pfl->isAllocated()) { @@ -1683,7 +1683,7 @@ const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsRe * \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possibility. * \param [in] nip - number of integration points. 1 for ON_CELLS and NO_NODES */ -void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) +void MEDFileField1TSStructItem2::checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) { _nb_of_entity=nbOfEntity; if(_pfl->getName().empty()) @@ -1696,14 +1696,14 @@ void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MED { if(!globs) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no globals found in file !"); - const DataArrayInt *pfl=globs->getProfile(_pfl->getName().c_str()); + const DataArrayIdType *pfl=globs->getProfile(_pfl->getName().c_str()); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no such profile found in file !"); pfl->checkAllIdsInRange(0,nbOfEntity); } } -bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const +bool MEDFileField1TSStructItem2::isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const { if(startExp!=_start_end.first) return false; @@ -1732,7 +1732,7 @@ bool MEDFileField1TSStructItem2::isCellSupportEqual(const MEDFileField1TSStructI return false; if(_pfl->getName().empty() && other._pfl->getName().empty()) return true; - const DataArrayInt *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs)); + const DataArrayIdType *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs)); return pfl1->isEqualWithoutConsideringStr(*pfl2); } @@ -1751,9 +1751,9 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const if(objs.size()==1) return MEDFileField1TSStructItem2(*objs[0]); INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type); - int nbEntityRef(objs[0]->_nb_of_entity); + mcIdType nbEntityRef(objs[0]->_nb_of_entity); std::size_t sz(objs.size()); - std::vector arrs(sz); + std::vector arrs(sz); for(std::size_t i=0;igetProfile(obj->_pfl->getName().c_str()); } - MCAuto arr(DataArrayInt::Aggregate(arrs)); + MCAuto arr(DataArrayIdType::Aggregate(arrs)); arr->sort(); - int oldNbTuples(arr->getNumberOfTuples()); + mcIdType oldNbTuples(arr->getNumberOfTuples()); arr=arr->buildUnique(); if(oldNbTuples!=arr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::BuildAggregationOf : some entities are present several times !"); if(arr->isIota(nbEntityRef)) { - std::pair p(0,nbEntityRef); + std::pair p(0,nbEntityRef); std::string a,b; MEDFileField1TSStructItem2 ret(gt,p,a,b); ret._nb_of_entity=nbEntityRef; @@ -1782,7 +1782,7 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const else { arr->setName(NEWLY_CREATED_PFL_NAME); - std::pair p(0,oldNbTuples); + std::pair p(0,oldNbTuples); std::string a,b; MEDFileField1TSStructItem2 ret(gt,p,a,b); ret._nb_of_entity=nbEntityRef; @@ -1800,7 +1800,7 @@ std::size_t MEDFileField1TSStructItem2::getHeapMemorySizeWithoutChildren() const std::vector MEDFileField1TSStructItem2::getDirectChildrenWithNull() const { std::vector ret; - ret.push_back((const DataArrayInt *)_pfl); + ret.push_back((const DataArrayIdType *)_pfl); return ret; } @@ -1816,7 +1816,7 @@ void MEDFileField1TSStructItem::checkWithMeshStruct(const MEDFileMeshStruct *mst { case ON_NODES: { - int nbOfEnt=mst->getNumberOfNodes(); + mcIdType nbOfEnt=mst->getNumberOfNodes(); if(_items.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem::checkWithMeshStruct : for nodes field only one subdivision supported !"); _items[0].checkInRange(nbOfEnt,1,globs); @@ -1945,7 +1945,7 @@ bool MEDFileField1TSStructItem::isCompatibleWithNodesDiscr(const MEDFileField1TS int theFirstLevFull; bool ret0=isFullyOnOneLev(meshSt,theFirstLevFull); const MEDFileField1TSStructItem2& otherNodeIt(other._items[0]); - int nbOfNodes(meshSt->getNumberOfNodes()); + mcIdType nbOfNodes(meshSt->getNumberOfNodes()); if(otherNodeIt.getPflName().empty()) {//on all nodes if(!ret0) @@ -1959,8 +1959,8 @@ bool MEDFileField1TSStructItem::isCompatibleWithNodesDiscr(const MEDFileField1TS } else { - const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str()); - MCAuto cpyPfl(pfl->deepCopy()); + const DataArrayIdType *pfl=globs->getProfile(otherNodeIt.getPflName().c_str()); + MCAuto cpyPfl(pfl->deepCopy()); cpyPfl->sort(); if(cpyPfl->isIota(nbOfNodes)) {//on all nodes also ! @@ -2028,8 +2028,8 @@ MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCell { std::size_t sz(_items.size()); std::vector a0(sz); - std::vector a1(sz); - std::vector a2(sz); + std::vector a1(sz); + std::vector a2(sz); std::size_t i(0); for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++) { @@ -2072,7 +2072,7 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFile std::vector< std::vector > pfls,locs; std::vector< std::vector > typesF; std::vector geoTypes; - std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); + std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); std::size_t nbOfGeoTypes(geoTypes.size()); if(nbOfGeoTypes==0) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !"); diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 19c839925..b59d3cccb 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -53,9 +53,9 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; const MEDFileMesh *getTheMesh() const { return _mesh; } - int getNumberOfNodes() const { return _nb_nodes; } + mcIdType getNumberOfNodes() const { return _nb_nodes; } bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const; - int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; + mcIdType getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getNumberOfLevs() const; int getNumberOfGeoTypesInLev(int relativeLev) const; @@ -66,8 +66,8 @@ namespace MEDCoupling private: const MEDFileMesh *_mesh; std::string _name; - int _nb_nodes; - std::vector< std::vector > _geo_types_distrib; + mcIdType _nb_nodes; + std::vector< std::vector > _geo_types_distrib; }; class MEDFileField1TSStructItem; @@ -78,47 +78,47 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; public: - static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs); - static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode); - void setNodeReduction(const DataArrayInt *nr); - void setCellReduction(const DataArrayInt *cr); + static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayIdType *pflOnNode); + void setNodeReduction(const DataArrayIdType *nr); + void setCellReduction(const DataArrayIdType *cr); bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const; MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; - MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT DataArrayInt *retrieveGlobalNodeIdsIfAny() const; + MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT DataArrayIdType *retrieveGlobalNodeIdsIfAny() const; MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const; - void setFamilyIdsOnCells(DataArrayInt *famIds); - void setNumberIdsOnCells(DataArrayInt *numIds); - void setFamilyIdsOnNodes(DataArrayInt *famIds); - void setNumberIdsOnNodes(DataArrayInt *numIds); - virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0; + void setFamilyIdsOnCells(DataArrayIdType *famIds); + void setNumberIdsOnCells(DataArrayIdType *numIds); + void setFamilyIdsOnNodes(DataArrayIdType *famIds); + void setNumberIdsOnNodes(DataArrayIdType *numIds); + virtual void selectPartOfNodes(const DataArrayIdType *pflNodes) = 0; virtual MEDMeshMultiLev *prepare() const = 0; - int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const; - int getNumberOfNodes() const; + mcIdType getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const; + mcIdType getNumberOfNodes() const; protected: std::string getPflNameOfId(int id) const; DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; - virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); + virtual void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr); protected: MEDMeshMultiLev(const MEDFileMesh *mesh); MEDMeshMultiLev(const MEDMeshMultiLev& other); - MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); protected: const MEDFileMesh *_mesh; - std::vector< MCAuto > _pfls; + std::vector< MCAuto > _pfls; std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types; - std::vector _nb_entities; - MCAuto _node_reduction; - int _nb_nodes; + std::vector _nb_entities; + MCAuto _node_reduction; + mcIdType _nb_nodes; // - MCAuto _cell_fam_ids; - MCAuto _cell_num_ids; - MCAuto _node_fam_ids; - MCAuto _node_num_ids; + MCAuto _cell_fam_ids; + MCAuto _cell_num_ids; + MCAuto _node_fam_ids; + MCAuto _node_num_ids; public: MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34; MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH]; @@ -131,19 +131,19 @@ namespace MEDCoupling { public: static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& levs); - static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); - void selectPartOfNodes(const DataArrayInt *pflNodes); + static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + void selectPartOfNodes(const DataArrayIdType *pflNodes); MEDMeshMultiLev *prepare() const; MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part); - MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const; + MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const; protected: - void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); + void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr); private: - void reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; + void reorderNodesIfNecessary(MCAuto& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const; private: MEDUMeshMultiLev(const MEDUMeshMultiLev& other); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs); - MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: std::vector< MCAuto > _parts; //! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts. @@ -153,12 +153,12 @@ namespace MEDCoupling class MEDStructuredMeshMultiLev : public MEDMeshMultiLev { public: - void selectPartOfNodes(const DataArrayInt *pflNodes); - virtual std::vector getNodeGridStructure() const = 0; + void selectPartOfNodes(const DataArrayIdType *pflNodes); + virtual std::vector getNodeGridStructure() const = 0; protected: MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other); MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev); - MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m); protected: void moveFaceToCell() const; @@ -167,22 +167,22 @@ namespace MEDCoupling void initStdFieldOfIntegers(const MEDFileStructuredMesh *m); protected: bool _is_internal; - MCAuto _face_fam_ids; - MCAuto _face_num_ids; + MCAuto _face_fam_ids; + MCAuto _face_num_ids; }; class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev { public: static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& levs); - static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); - std::vector getNodeGridStructure() const; + static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + std::vector getNodeGridStructure() const; MEDMeshMultiLev *prepare() const; MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const; private: MEDCMeshMultiLev(const MEDCMeshMultiLev& other); MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& levs); - MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: std::vector< MCAuto > _coords; }; @@ -191,24 +191,24 @@ namespace MEDCoupling { public: static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& levs); - static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls , const std::vector& nbEntities); - std::vector getNodeGridStructure() const; + static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls , const std::vector& nbEntities); + std::vector getNodeGridStructure() const; MEDMeshMultiLev *prepare() const; - MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const; + MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const; private: MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other); MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& levs); - MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: MCAuto _coords; - std::vector _structure; + std::vector _structure; }; class MEDFileField1TSStructItem2 : public BigMemoryObject { public: MEDFileField1TSStructItem2(); - MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& pfl, const std::string& loc); + MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& pfl, const std::string& loc); void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); @@ -216,15 +216,15 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; // - const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const; + const DataArrayIdType *getPfl(const MEDFileFieldGlobsReal *globs) const; INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; } - int getNbEntity() const { return _nb_of_entity; } - const std::pair& getStartStop() const { return _start_end; } + mcIdType getNbEntity() const { return _nb_of_entity; } + const std::pair& getStartStop() const { return _start_end; } std::string getPflName() const; int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const; //! warning this method also set _nb_of_entity attribute ! - void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs); - bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const; + void checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs); + bool isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const; bool operator==(const MEDFileField1TSStructItem2& other) const; bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; @@ -233,10 +233,10 @@ namespace MEDCoupling static const char NEWLY_CREATED_PFL_NAME[]; private: INTERP_KERNEL::NormalizedCellType _geo_type; - std::pair _start_end; - MCAuto _pfl; + std::pair _start_end; + MCAuto _pfl; std::string _loc; - int _nb_of_entity; + mcIdType _nb_of_entity; }; class MEDFileField1TSStructItem : public BigMemoryObject diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index a1ed652a7..0981456c6 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -18,6 +18,7 @@ // #include "MEDFileJoint.hxx" +#include "MEDFileBasis.hxx" #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileSafeCaller.txx" @@ -33,7 +34,7 @@ using namespace MEDCoupling; std::size_t MEDFileJointCorrespondence::getHeapMemorySizeWithoutChildren() const { - return sizeof(MCAuto); + return sizeof(MCAuto); } std::vector MEDFileJointCorrespondence::getDirectChildrenWithNull() const @@ -55,7 +56,7 @@ MEDFileJointCorrespondence::MEDFileJointCorrespondence(): * \param [in] loc_geo_type - the local geometry type of correspondence. * \param [in] rem_geo_type - the remote geometry type of correspondence. */ -MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayInt* correspondence, +MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayIdType* correspondence, bool isNodal, INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type): @@ -66,7 +67,7 @@ MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayInt* corresponde MEDFileJointCorrespondence::setCorrespondence( correspondence ); } -MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayInt* correspondence, +MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayIdType* correspondence, INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type) { @@ -76,7 +77,7 @@ MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayInt* corres /*! * Returns a new MEDFileJointCorrespondence of nodes */ -MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayInt* correspondence) +MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayIdType* correspondence) { return new MEDFileJointCorrespondence(correspondence); } @@ -117,7 +118,7 @@ void MEDFileJointCorrespondence::write(const std::string& fileName, int mode, co throw INTERP_KERNEL::Exception( "Geometric type not specified for a cell Joint" ); } - if ( (const DataArrayInt *)_correspondence ) + if ( (const DataArrayIdType *)_correspondence ) { writeLL(fid, localMeshName, jointName, order, iteration); } @@ -136,7 +137,7 @@ void MEDFileJointCorrespondence::writeLL(med_idt fid, const std::string& localMe MED_NODE, MED_NONE, MED_NODE, MED_NONE, _correspondence->getNbOfElems()/2, - _correspondence->getConstPointer())); + ToMedIntArray(_correspondence)->getConstPointer())); } else { @@ -145,11 +146,11 @@ void MEDFileJointCorrespondence::writeLL(med_idt fid, const std::string& localMe MED_CELL, typmai3[ _loc_geo_type ], MED_CELL, typmai3[ _rem_geo_type ], _correspondence->getNbOfElems()/2, - _correspondence->getConstPointer())); + ToMedIntArray(_correspondence)->getConstPointer())); } } -void MEDFileJointCorrespondence::setCorrespondence(DataArrayInt *corr) +void MEDFileJointCorrespondence::setCorrespondence(DataArrayIdType *corr) { _correspondence=corr; if ( corr ) @@ -198,13 +199,13 @@ std::string MEDFileJointCorrespondence::simpleRepr() const oss << "- entity type of the correspondence : " << ( getIsNodal() ? "NODE" : "CELL" ) << "\n"; oss << "- Local geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _loc_geo_type ).getRepr() << "\n"; oss << "- Remote geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _rem_geo_type ).getRepr() << "\n"; - if ( (const DataArrayInt *)_correspondence ) + if ( (const DataArrayIdType *)_correspondence ) { oss << "- Number entity of the correspondence : " << getCorrespondence()->getNumberOfTuples() << "\n"; - const DataArrayInt* tmp=getCorrespondence(); + const DataArrayIdType* tmp=getCorrespondence(); oss << "- Correspondence : <<"; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) oss<< *it << " "; } else @@ -222,7 +223,7 @@ MEDFileJointOneStep::MEDFileJointOneStep():_order(-1),_iteration(-1) std::size_t MEDFileJointOneStep::getHeapMemorySizeWithoutChildren() const { - return _correspondences.capacity()*sizeof(MCAuto); + return _correspondences.capacity()*sizeof(MCAuto); } std::vector MEDFileJointOneStep::getDirectChildrenWithNull() const @@ -275,7 +276,7 @@ MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, &loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity)); if ( num_entity > 0 ) { - MCAuto correspondence=DataArrayInt::New(); + MCAuto correspondence=DataArrayMedInt::New(); correspondence->alloc(num_entity*2, 1); MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceRd,(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type, loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer())); @@ -283,7 +284,7 @@ MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, cor->setIsNodal( loc_ent_type == MED_NODE ); cor->setLocalGeometryType ( convertGeometryType( loc_geo_type )); cor->setRemoteGeometryType( convertGeometryType( rem_geo_type )); - cor->setCorrespondence( correspondence ); + cor->setCorrespondence( FromMedIntArray(correspondence )); _correspondences.push_back(cor); } } diff --git a/src/MEDLoader/MEDFileJoint.hxx b/src/MEDLoader/MEDFileJoint.hxx index 421bca3fa..567d97abf 100644 --- a/src/MEDLoader/MEDFileJoint.hxx +++ b/src/MEDLoader/MEDFileJoint.hxx @@ -39,8 +39,8 @@ class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable { public: MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(); - MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence); // nodes - MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells + MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence); // nodes + MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; @@ -54,15 +54,15 @@ public: MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const { return _loc_geo_type; } MEDLOADER_EXPORT void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type) { _rem_geo_type=type; } MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const { return _rem_geo_type; } - MEDLOADER_EXPORT void setCorrespondence(DataArrayInt *corr); - MEDLOADER_EXPORT const DataArrayInt *getCorrespondence() const { return _correspondence; } + MEDLOADER_EXPORT void setCorrespondence(DataArrayIdType *corr); + MEDLOADER_EXPORT const DataArrayIdType *getCorrespondence() const { return _correspondence; } MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const; private: MEDFileJointCorrespondence(); - MEDFileJointCorrespondence(DataArrayInt* correspondence, + MEDFileJointCorrespondence(DataArrayIdType* correspondence, bool is_nodal = true, INTERP_KERNEL::NormalizedCellType loc_geo_type = INTERP_KERNEL::NORM_ERROR, INTERP_KERNEL::NormalizedCellType rem_geo_type = INTERP_KERNEL::NORM_ERROR); @@ -70,7 +70,7 @@ private: bool _is_nodal; INTERP_KERNEL::NormalizedCellType _loc_geo_type; INTERP_KERNEL::NormalizedCellType _rem_geo_type; - MCAuto _correspondence; + MCAuto _correspondence; }; /*! diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 49d4755ae..34c072714 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -28,6 +28,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" +#include "MEDCouplingMemArray.txx" #include "InterpKernelAutoPtr.hxx" @@ -57,8 +58,8 @@ std::size_t MEDFileMesh::getHeapMemorySizeWithoutChildren() const for(std::vector::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++) ret+=(*it2).capacity(); } - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) - ret+=(*it).first.capacity()+sizeof(int); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + ret+=(*it).first.capacity()+sizeof(mcIdType); return ret; } @@ -379,7 +380,7 @@ std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector - sequence of ids of the families. * \throw If the name of a nonexistent group is specified. */ -std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const +std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const { std::string oname(name); std::map >::const_iterator it=_groups.find(oname); @@ -406,7 +407,7 @@ void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector< _groups[oname]=fams; for(std::vector::const_iterator it1=fams.begin();it1!=fams.end();it1++) { - std::map::iterator it2=_families.find(*it1); + std::map::iterator it2=_families.find(*it1); if(it2==_families.end()) _families[*it1]=0; } @@ -420,12 +421,12 @@ void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector< * \param [in] famIds - a sequence of ids of families constituting the group. * \throw If a family name is not found by its id. */ -void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) +void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) { std::string oname(name); std::vector fams(famIds.size()); int i=0; - for(std::vector::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++) + for(std::vector::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++) { std::string name2=getFamilyNameGivenId(*it1); fams[i]=name2; @@ -462,7 +463,7 @@ std::vector MEDFileMesh::getGroupsOnFamily(const std::string& name) void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector& grps) { std::string fName(famName); - const std::map::const_iterator it=_families.find(fName); + const std::map::const_iterator it=_families.find(fName); if(it==_families.end()) { std::vector fams=getFamiliesNames(); @@ -504,7 +505,7 @@ std::vector MEDFileMesh::getFamiliesNames() const { std::vector ret(_families.size()); int i=0; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++,i++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++,i++) ret[i]=(*it).first; return ret; } @@ -534,7 +535,7 @@ std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMa std::vector allGrps(getGroupsNames()); for(std::vector::const_iterator it=allGrps.begin();it!=allGrps.end();it++) { - std::vector levs(getGrpNonEmptyLevelsExt((*it))); + std::vector levs(getGrpNonEmptyLevelsExt((*it))); if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)!=levs.end()) ret.push_back(*it); } @@ -544,9 +545,9 @@ std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMa /*! * Returns all relative mesh levels (including nodes) where a given group is defined. * \param [in] grp - the name of the group of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const +std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const { std::vector fams(getFamiliesOnGroup(grp)); return getFamsNonEmptyLevelsExt(fams); @@ -556,9 +557,9 @@ std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) co * Returns all relative mesh levels (**excluding nodes**) where given groups are defined. * To include nodes, call getGrpsNonEmptyLevelsExt() method. * \param [in] grps - a sequence of names of the groups of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector& grps) const +std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector& grps) const { std::vector fams(getFamiliesOnGroups(grps)); return getFamsNonEmptyLevels(fams); @@ -567,9 +568,9 @@ std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector& grps) const +std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector& grps) const { std::vector fams(getFamiliesOnGroups(grps)); return getFamsNonEmptyLevelsExt(fams); @@ -579,9 +580,9 @@ std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const +std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const { std::vector fams(getFamiliesOnGroup(grp)); return getFamsNonEmptyLevels(fams); @@ -591,9 +592,9 @@ std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const * Returns all relative mesh levels (**excluding nodes**) where a given family is defined. * To include nodes, call getFamNonEmptyLevelsExt() method. * \param [in] fam - the name of the family of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const +std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const { std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevels(fams); @@ -602,9 +603,9 @@ std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const /*! * Returns all relative mesh levels (including nodes) where a given family is defined. * \param [in] fam - the name of the family of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const +std::vector MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const { std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevelsExt(fams); @@ -622,8 +623,8 @@ std::string MEDFileMesh::GetMagicFamilyStr() void MEDFileMesh::assignFamilyNameWithGroupName() { std::map > groups(_groups); - std::map newFams; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::map newFams; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { std::vector grps=getGroupsOnFamily((*it).first); if(grps.size()==1 && groups[grps[0]].size()==1) @@ -684,13 +685,13 @@ void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& throw INTERP_KERNEL::Exception(oss.str().c_str()); } const std::vector &famsOnGrp((*it).second); - std::vector famIds(getFamiliesIdsOnGroup(name)); - const DataArrayInt *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt)); + std::vector famIds(getFamiliesIdsOnGroup(name)); + const DataArrayIdType *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt)); if(!famArr) return ; - MCAuto vals(famArr->getDifferentValues()); - MCAuto famIds2(DataArrayInt::NewFromStdVector(famIds)); - MCAuto idsToKill(famIds2->buildIntersection(vals)); + MCAuto vals(famArr->getDifferentValues()); + MCAuto famIds2(DataArrayIdType::NewFromStdVector(famIds)); + MCAuto idsToKill(famIds2->buildIntersection(vals)); if(idsToKill->empty()) return ; std::vector newFamsOnGrp; @@ -728,7 +729,7 @@ void MEDFileMesh::removeGroup(const std::string& name) void MEDFileMesh::removeFamily(const std::string& name) { std::string oname(name); - std::map::iterator it=_families.find(oname); + std::map::iterator it=_families.find(oname); std::vector fams=getFamiliesNames(); if(it==_families.end()) { @@ -770,17 +771,17 @@ std::vector MEDFileMesh::removeOrphanGroups() */ std::vector MEDFileMesh::removeOrphanFamilies() { - MCAuto allFamIdsInUse=computeAllFamilyIdsInUse(); + MCAuto allFamIdsInUse=computeAllFamilyIdsInUse(); std::vector ret; - if(!((DataArrayInt*)allFamIdsInUse)) + if(!((DataArrayIdType*)allFamIdsInUse)) { ret=getFamiliesNames(); _families.clear(); _groups.clear(); return ret; } - std::map famMap; + std::map famMap; std::map > grps(_groups); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { if(allFamIdsInUse->presenceOfValue((*it).second)) famMap[(*it).first]=(*it).second; @@ -811,9 +812,9 @@ std::vector MEDFileMesh::removeOrphanFamilies() */ void MEDFileMesh::removeFamiliesReferedByNoGroups() { - std::map fams; + std::map fams; std::set sfams; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) sfams.insert((*it).first); for(std::map >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++) for(std::vector::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) @@ -839,7 +840,7 @@ void MEDFileMesh::rearrangeFamilies() // std::vector levels(getNonEmptyLevelsExt()); std::set idsRefed; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { idsRefed.insert((*it).second); if((*it).second==0) @@ -853,7 +854,7 @@ void MEDFileMesh::rearrangeFamilies() } for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { - const DataArrayInt *fams(0); + const DataArrayIdType *fams(0); try { fams=getFamilyFieldAtLevel(*it); @@ -864,10 +865,10 @@ void MEDFileMesh::rearrangeFamilies() std::vector v(fams->getNumberOfTuples(),false); for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) fams->switchOnTupleEqualTo(*pt,v); - MCAuto unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v)); + MCAuto unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v)); if(!unfetchedIds->empty()) { - MCAuto newFams(fams->deepCopy()); + MCAuto newFams(fams->deepCopy()); newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1); setFamilyFieldArr(*it,newFams); } @@ -895,9 +896,9 @@ void MEDFileMesh::zipFamilies() } // std::map > newGroups(_groups); - std::map newFams(_families); + std::map newFams(_families); std::vector levels(getNonEmptyLevelsExt()); - std::map > famIdsToSubstitute; + std::map > famIdsToSubstitute; // iterate on all different set of groups std::set familiesToKill; for(auto setOfCommonGrp : setOfFamilies) @@ -936,7 +937,7 @@ void MEDFileMesh::zipFamilies() { for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { - DataArrayInt *fams(nullptr); + DataArrayIdType *fams(nullptr); try { fams=getFamilyFieldAtLevel(*it); @@ -944,7 +945,7 @@ void MEDFileMesh::zipFamilies() catch(INTERP_KERNEL::Exception& e) { } if(!fams) continue; - MCAuto idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size())); + MCAuto idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size())); fams->setPartOfValuesSimple3(famIdsSubstSession.first,idsToModif->begin(),idsToModif->end(),0,1,1); } } @@ -1003,11 +1004,11 @@ void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& * \param [in] oldId - a current id of the family. * \param [in] newId - a new family id. */ -void MEDFileMesh::changeFamilyId(int oldId, int newId) +void MEDFileMesh::changeFamilyId(mcIdType oldId, mcIdType newId) { changeFamilyIdArr(oldId,newId); - std::map fam2; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::map fam2; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { if((*it).second==oldId) fam2[(*it).first]=newId; @@ -1027,7 +1028,7 @@ void MEDFileMesh::changeFamilyId(int oldId, int newId) void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName) { std::string oname(oldName); - std::map::iterator it=_families.find(oname); + std::map::iterator it=_families.find(oname); std::vector fams=getFamiliesNames(); if(it==_families.end()) { @@ -1036,13 +1037,13 @@ void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string throw INTERP_KERNEL::Exception(oss.str().c_str()); } std::string nname(newName); - std::map::iterator it2=_families.find(nname); + std::map::iterator it2=_families.find(nname); if(it2!=_families.end()) { std::ostringstream oss; oss << "Such familyname \"" << newName << " already exists ! Kill it before !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int cpy=(*it).second; + mcIdType cpy=(*it).second; _families.erase(it); _families[newName]=cpy; for(std::map >::iterator it3=_groups.begin();it3!=_groups.end();it3++) @@ -1065,12 +1066,12 @@ bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) cons { if(_families==other->_families) return true; - std::map fam0; - std::map fam1; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::map fam0; + std::map fam1; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) if((*it).second!=0) fam0[(*it).first]=(*it).second; - for(std::map::const_iterator it=other->_families.begin();it!=other->_families.end();it++) + for(std::map::const_iterator it=other->_families.begin();it!=other->_families.end();it++) if((*it).second!=0) fam1[(*it).first]=(*it).second; return fam0==fam1; @@ -1152,9 +1153,9 @@ bool MEDFileMesh::existsGroup(const std::string& groupName) const * \param [in] famId - the family id. * \return bool - \c true the family with the id \a famId exists in \a this mesh. */ -bool MEDFileMesh::existsFamily(int famId) const +bool MEDFileMesh::existsFamily(mcIdType famId) const { - for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) + for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) if((*it2).second==famId) return true; return false; @@ -1176,16 +1177,16 @@ bool MEDFileMesh::existsFamily(const std::string& familyName) const * \param [in] familyName - the family name. * \param [in] id - a new id of the family. */ -void MEDFileMesh::setFamilyId(const std::string& familyName, int id) +void MEDFileMesh::setFamilyId(const std::string& familyName, mcIdType id) { std::string fname(familyName); _families[fname]=id; } -void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id) +void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id) { std::string fname(familyName); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) if((*it).second==id) { if((*it).first!=familyName) @@ -1203,13 +1204,13 @@ void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id) * \param [in] famId - an id of the family. * \throw If a family with the same name or id already exists in \a this mesh. */ -void MEDFileMesh::addFamily(const std::string& familyName, int famId) +void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId) { std::string fname(familyName); - std::map::const_iterator it=_families.find(fname); + std::map::const_iterator it=_families.find(fname); if(it==_families.end()) { - for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) + for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) if((*it2).second==famId) { std::ostringstream oss; @@ -1261,12 +1262,12 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr oss << std::endl << "Please choose an another group name or call removeGroup(\"" << grpName << "\") method !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt); if(fieldFamIds==0) throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !"); - MCAuto famIds=fieldFamIds->getDifferentValues(); + MCAuto famIds=fieldFamIds->getDifferentValues(); std::vector familiesOnWholeGroup; - for(const int *it=famIds->begin();it!=famIds->end();it++) + for(const mcIdType *it=famIds->begin();it!=famIds->end();it++) { bool tmp; familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(*it,tmp)); @@ -1283,28 +1284,28 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr * famIds should exclusively belong. * \return bool - \c true if no modification is done in \a this mesh by this method. */ -bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& vMeshDimRelToMaxExt) +bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& vMeshDimRelToMaxExt) { std::set levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end()); std::vector levs=getNonEmptyLevelsExt(); std::set levs2(levs.begin(),levs.end()); std::vector levsToTest; std::set_difference(levs2.begin(),levs2.end(),levsInput.begin(),levsInput.end(),std::back_insert_iterator< std::vector >(levsToTest)); - std::set famIds2(famIds.begin(),famIds.end()); + std::set famIds2(famIds.begin(),famIds.end()); bool ret=true; - int maxFamId=1; + mcIdType maxFamId=1; if(!_families.empty()) maxFamId=getMaxFamilyId()+1; std::vector allFams=getFamiliesNames(); for(std::vector::const_iterator it=levsToTest.begin();it!=levsToTest.end();it++) { - const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(*it); + const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(*it); if(fieldFamIds) { - MCAuto famIds3=fieldFamIds->getDifferentValues(); - std::vector tmp; - std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector >(tmp)); - for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + MCAuto famIds3=fieldFamIds->getDifferentValues(); + std::vector tmp; + std::set_intersection(famIds3->begin(),famIds3->end(),famIds2.begin(),famIds2.end(),std::back_insert_iterator< std::vector >(tmp)); + for(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) { ret=false; std::string famName=getFamilyNameGivenId(*it2); @@ -1312,7 +1313,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std std::string zeName=CreateNameNotIn(oss.str(),allFams); addFamilyOnAllGroupsHaving(famName,zeName); _families[zeName]=maxFamId; - (const_cast(fieldFamIds))->changeValue(*it2,maxFamId); + (const_cast(fieldFamIds))->changeValue(*it2,maxFamId); maxFamId++; } } @@ -1374,12 +1375,12 @@ void MEDFileMesh::addFamilyOnAllGroupsHaving(const std::string& famName, const s } } -void MEDFileMesh::checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const +void MEDFileMesh::checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const { std::vector grpsNames(getGroupsNames()); if(std::find(grpsNames.begin(),grpsNames.end(),grpName)==grpsNames.end()) return ; - std::vector famIds(getFamiliesIdsOnGroup(grpName)); + std::vector famIds(getFamiliesIdsOnGroup(grpName)); if(famArr->presenceOfValue(famIds)) { std::ostringstream oss; oss << "MEDFileUMesh::addGroup : Group with name \"" << grpName << "\" already exists at specified level ! Destroy it before calling this method !"; @@ -1389,9 +1390,9 @@ void MEDFileMesh::checkNoGroupClash(const DataArrayInt *famArr, const std::strin /*! * \param [in] ids ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm). - * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed) + * \param [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed) */ -void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr) +void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr) { if(!ids) throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !"); @@ -1400,28 +1401,28 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !"); ids->checkStrictlyMonotonic(true); checkNoGroupClash(famArr,grpName); - MCAuto famArrTmp; famArrTmp.takeRef(famArr); - std::list< MCAuto > allFamIds(getAllNonNullFamilyIds()); + MCAuto famArrTmp; famArrTmp.takeRef(famArr); + std::list< MCAuto > allFamIds(getAllNonNullFamilyIds()); allFamIds.erase(std::find(allFamIds.begin(),allFamIds.end(),famArrTmp)); - MCAuto famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end()); - MCAuto diffFamIds=famIds->getDifferentValues(); - std::vector familyIds; - std::vector< MCAuto > idsPerfamiliyIds; - int maxVal=getTheMaxAbsFamilyId()+1; - std::map families(_families); + MCAuto famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end()); + MCAuto diffFamIds=famIds->getDifferentValues(); + std::vector familyIds; + std::vector< MCAuto > idsPerfamiliyIds; + mcIdType maxVal=getTheMaxAbsFamilyId()+1; + std::map families(_families); std::map > groups(_groups); std::vector fams; bool created(false); - for(const int *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++) + for(const mcIdType *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++) { - MCAuto ids2Tmp=famIds->findIdsEqual(*famId); - MCAuto ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end()); - MCAuto ids1=famArr->findIdsEqual(*famId); - MCAuto ret0(ids1->buildSubstractionOptimized(ids2)); + MCAuto ids2Tmp=famIds->findIdsEqual(*famId); + MCAuto ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end()); + MCAuto ids1=famArr->findIdsEqual(*famId); + MCAuto ret0(ids1->buildSubstractionOptimized(ids2)); if(ret0->empty()) { bool isFamPresent=false; - for(std::list< MCAuto >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) + for(std::list< MCAuto >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) isFamPresent=(*itl)->presenceOfValue(*famId); if(!isFamPresent && *famId!=0) { familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp @@ -1453,7 +1454,7 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, } for(std::size_t i=0;isetPartOfValuesSimple3(familyIds[i],da->begin(),da->end(),0,1,1); } _families=families; @@ -1496,7 +1497,7 @@ void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map& families, int id, bool& created) +std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map& families, mcIdType id, bool& created) { std::vector famAlreadyExisting(families.size()); int ii=0; - for(std::map::const_iterator it=families.begin();it!=families.end();it++,ii++) + for(std::map::const_iterator it=families.begin();it!=families.end();it++,ii++) { if((*it).second!=id) { @@ -1536,7 +1537,7 @@ std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map& info) +void MEDFileMesh::setFamilyInfo(const std::map& info) { _families=info; } @@ -1554,12 +1555,12 @@ void MEDFileMesh::setGroupInfo(const std::map::const_iterator it=_families.find(name); + std::map::const_iterator it=_families.find(name); if(it==_families.end()) { std::vector fams(getFamiliesNames()); @@ -1573,16 +1574,16 @@ int MEDFileMesh::getFamilyId(const std::string& name) const /*! * Returns ids of the families having given names. * \param [in] fams - a sequence of the names of families of interest. - * \return std::vector - a sequence of the ids of families of interest. + * \return std::vector - a sequence of the ids of families of interest. * \throw If \a fams contains a name of an inexistent family. */ -std::vector MEDFileMesh::getFamiliesIds(const std::vector& fams) const +std::vector MEDFileMesh::getFamiliesIds(const std::vector& fams) const { - std::vector ret(fams.size()); + std::vector ret(fams.size()); int i=0; for(std::vector::const_iterator it=fams.begin();it!=fams.end();it++,i++) { - std::map::const_iterator it2=_families.find(*it); + std::map::const_iterator it2=_families.find(*it); if(it2==_families.end()) { std::vector fams2=getFamiliesNames(); @@ -1597,15 +1598,15 @@ std::vector MEDFileMesh::getFamiliesIds(const std::vector& fam /*! * Returns a maximal abs(id) of families in \a this mesh. - * \return int - the maximal norm of family id. + * \return mcIdType - the maximal norm of family id. * \throw If there are no families in \a this mesh. */ -int MEDFileMesh::getMaxAbsFamilyId() const +mcIdType MEDFileMesh::getMaxAbsFamilyId() const { if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !"); - int ret=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType ret=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { ret=std::max(std::abs((*it).second),ret); } @@ -1614,15 +1615,15 @@ int MEDFileMesh::getMaxAbsFamilyId() const /*! * Returns a maximal id of families in \a this mesh. - * \return int - the maximal family id. + * \return mcIdType - the maximal family id. * \throw If there are no families in \a this mesh. */ -int MEDFileMesh::getMaxFamilyId() const +mcIdType MEDFileMesh::getMaxFamilyId() const { if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !"); - int ret=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType ret=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { ret=std::max((*it).second,ret); } @@ -1631,15 +1632,15 @@ int MEDFileMesh::getMaxFamilyId() const /*! * Returns a minimal id of families in \a this mesh. - * \return int - the minimal family id. + * \return mcIdType - the minimal family id. * \throw If there are no families in \a this mesh. */ -int MEDFileMesh::getMinFamilyId() const +mcIdType MEDFileMesh::getMinFamilyId() const { if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !"); - int ret=std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType ret=std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { ret=std::min((*it).second,ret); } @@ -1649,42 +1650,42 @@ int MEDFileMesh::getMinFamilyId() const /*! * Returns a maximal id of families in \a this mesh. Not only named families are * considered but all family fields as well. - * \return int - the maximal family id. + * \return mcIdType - the maximal family id. */ -int MEDFileMesh::getTheMaxAbsFamilyId() const +mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const { - int m1=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType m1=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) m1=std::max(std::abs((*it).second),m1); - int m2=getMaxAbsFamilyIdInArrays(); + mcIdType m2=getMaxAbsFamilyIdInArrays(); return std::max(m1,m2); } /*! * Returns a maximal id of families in \a this mesh. Not only named families are * considered but all family fields as well. - * \return int - the maximal family id. + * \return mcIdType - the maximal family id. */ -int MEDFileMesh::getTheMaxFamilyId() const +mcIdType MEDFileMesh::getTheMaxFamilyId() const { - int m1=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType m1=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) m1=std::max((*it).second,m1); - int m2=getMaxFamilyIdInArrays(); + mcIdType m2=getMaxFamilyIdInArrays(); return std::max(m1,m2); } /*! * Returns a minimal id of families in \a this mesh. Not only named families are * considered but all family fields as well. - * \return int - the minimal family id. + * \return mcIdType - the minimal family id. */ -int MEDFileMesh::getTheMinFamilyId() const +mcIdType MEDFileMesh::getTheMinFamilyId() const { - int m1=std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType m1=std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) m1=std::min((*it).second,m1); - int m2=getMinFamilyIdInArrays(); + mcIdType m2=getMinFamilyIdInArrays(); return std::min(m1,m2); } @@ -1693,13 +1694,13 @@ int MEDFileMesh::getTheMinFamilyId() const * * \sa MEDFileMesh::computeAllFamilyIdsInUse */ -DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const +DataArrayIdType *MEDFileMesh::getAllFamiliesIdsReferenced() const { - MCAuto ret=DataArrayInt::New(); - std::set v; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + MCAuto ret=DataArrayIdType::New(); + std::set v; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) v.insert((*it).second); - ret->alloc((int)v.size(),1); + ret->alloc((mcIdType)v.size(),1); std::copy(v.begin(),v.end(),ret->getPointer()); return ret.retn(); } @@ -1709,15 +1710,15 @@ DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const * * \sa MEDFileMesh::getAllFamiliesIdsReferenced */ -DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const +DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const { std::vector famLevs=getFamArrNonEmptyLevelsExt(); - MCAuto ret; + MCAuto ret; for(std::vector::const_iterator it=famLevs.begin();it!=famLevs.end();it++) { - const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt - MCAuto dv=arr->getDifferentValues(); - if((DataArrayInt *) ret) + const DataArrayIdType *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt + MCAuto dv=arr->getDifferentValues(); + if((DataArrayIdType *) ret) ret=dv->buildUnion(ret); else ret=dv; @@ -1732,32 +1733,32 @@ DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const bool MEDFileMesh::ensureDifferentFamIdsPerLevel() { std::vector levs=getNonEmptyLevelsExt(); - std::set allFamIds; - int maxId=getMaxFamilyId()+1; - std::map > famIdsToRenum; + std::set allFamIds; + mcIdType maxId=getMaxFamilyId()+1; + std::map > famIdsToRenum; for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - const DataArrayInt *fam=getFamilyFieldAtLevel(*it); + const DataArrayIdType *fam=getFamilyFieldAtLevel(*it); if(fam) { - MCAuto tmp=fam->getDifferentValues(); - std::set r2; + MCAuto tmp=fam->getDifferentValues(); + std::set r2; std::set_intersection(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r2,r2.end())); if(!r2.empty()) famIdsToRenum[*it].insert(famIdsToRenum[*it].end(),r2.begin(),r2.end()); - std::set r3; + std::set r3; std::set_union(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r3,r3.end())); } } if(famIdsToRenum.empty()) return true; - MCAuto allIds=getAllFamiliesIdsReferenced(); - for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) + MCAuto allIds=getAllFamiliesIdsReferenced(); + for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) { - DataArrayInt *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); - int *famIdsToChange=fam->getPointer(); - std::map ren; - for(std::vector::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++) + DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); + mcIdType *famIdsToChange=fam->getPointer(); + std::map ren; + for(std::vector::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++) { if(allIds->presenceOfValue(*it3)) { @@ -1770,8 +1771,8 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() addFamilyOnGrp((*it4),newFam); } } - MCAuto ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); - for(const int *id=ids->begin();id!=ids->end();id++) + MCAuto ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); + for(const mcIdType *id=ids->begin();id!=ids->end();id++) famIdsToChange[*id]=ren[famIdsToChange[*id]]; } return false; @@ -1787,27 +1788,27 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() void MEDFileMesh::normalizeFamIdsTrio() { ensureDifferentFamIdsPerLevel(); - MCAuto allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); std::vector levs=getNonEmptyLevelsExt(); std::set levsS(levs.begin(),levs.end()); std::set famsFetched; - std::map families; + std::map families; if(std::find(levs.begin(),levs.end(),0)!=levs.end()) { levsS.erase(0); - const DataArrayInt *fam=getFamilyFieldAtLevel(0); + const DataArrayIdType *fam=getFamilyFieldAtLevel(0); if(fam) { - int refId=1; - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId++) + mcIdType refId=1; + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1821,19 +1822,19 @@ void MEDFileMesh::normalizeFamIdsTrio() if(std::find(levs.begin(),levs.end(),-1)!=levs.end()) { levsS.erase(-1); - const DataArrayInt *fam=getFamilyFieldAtLevel(-1); + const DataArrayIdType *fam=getFamilyFieldAtLevel(-1); if(fam) { - int refId=-1; - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId--) + mcIdType refId=-1; + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1846,12 +1847,12 @@ void MEDFileMesh::normalizeFamIdsTrio() } for(std::set::const_iterator it2=levsS.begin();it2!=levsS.end();it2++) { - DataArrayInt *fam=const_cast(getFamilyFieldAtLevel(*it2)); + DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel(*it2)); if(fam) { - MCAuto tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); fam->fillWithZero(); - for(const int *it3=tmp->begin();it3!=tmp->end();it3++) + for(const mcIdType *it3=tmp->begin();it3!=tmp->end();it3++) if(allIds->presenceOfValue(*it3)) { std::string famName=getFamilyNameGivenId(*it3); @@ -1879,27 +1880,27 @@ void MEDFileMesh::normalizeFamIdsTrio() void MEDFileMesh::normalizeFamIdsMEDFile() { ensureDifferentFamIdsPerLevel(); - MCAuto allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); std::vector levs=getNonEmptyLevelsExt(); std::set levsS(levs.begin(),levs.end()); std::set famsFetched; - std::map families; - int refId=1; + std::map families; + mcIdType refId=1; if(std::find(levs.begin(),levs.end(),1)!=levs.end()) { levsS.erase(1); - const DataArrayInt *fam=getFamilyFieldAtLevel(1); + const DataArrayIdType *fam=getFamilyFieldAtLevel(1); if(fam) { - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId++) + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1913,18 +1914,18 @@ void MEDFileMesh::normalizeFamIdsMEDFile() refId=-1; for(std::set::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++) { - const DataArrayInt *fam=getFamilyFieldAtLevel(*it2); + const DataArrayIdType *fam=getFamilyFieldAtLevel(*it2); if(fam) { - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId--) + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1952,9 +1953,9 @@ void MEDFileMesh::normalizeFamIdsMEDFile() * \return std::string - the name of the found family. * \throw If no family with the given \a id exists. */ -std::string MEDFileMesh::getFamilyNameGivenId(int id) const +std::string MEDFileMesh::getFamilyNameGivenId(mcIdType id) const { - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) if((*it).second==id) return (*it).first; std::ostringstream oss; oss << "MEDFileUMesh::getFamilyNameGivenId : no such family id : " << id; @@ -1979,12 +1980,12 @@ std::string MEDFileMesh::simpleRepr() const * This method is nearly like getFamilyFieldAtLevel method. Except that if the array does not exist at the specified level \a meshDimRelToMaxExt * an empty one is created. */ -DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt) +DataArrayIdType *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt) { - DataArrayInt *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt)); + DataArrayIdType *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt)); if(ret) return ret; - MCAuto arr(DataArrayInt::New()); + MCAuto arr(DataArrayIdType::New()); arr->alloc(getSizeAtLevel(meshDimRelToMaxExt),1); arr->fillWithZero(); setFamilyFieldArr(meshDimRelToMaxExt,arr); @@ -1998,17 +1999,17 @@ DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToM * \param [in] grp - the name of the group of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the group. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const +DataArrayIdType *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const { std::vector tmp(1); tmp[0]=grp; - DataArrayInt *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum); + DataArrayIdType *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum); ret->setName(grp); return ret; } @@ -2020,13 +2021,13 @@ DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string * \param [in] grps - the names of the groups of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the groups. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is present in \a grps. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const +DataArrayIdType *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const { std::vector fams2=getFamiliesOnGroups(grps); return getFamiliesArr(meshDimRelToMaxExt,fams2,renum); @@ -2039,16 +2040,16 @@ DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vecto * \param [in] fam - the name of the family of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the family. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const +DataArrayIdType *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const { std::vector tmp(1); tmp[0]=fam; - DataArrayInt *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum); + DataArrayIdType *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum); ret->setName(fam); return ret; } @@ -2058,17 +2059,17 @@ DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::strin * \param [in] grp - the name of the group of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the group. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const { std::vector tmp(1); tmp[0]=grp; - DataArrayInt *ret=getNodeGroupsArr(tmp,renum); + DataArrayIdType *ret=getNodeGroupsArr(tmp,renum); ret->setName(grp); return ret; } @@ -2078,13 +2079,13 @@ DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) c * \param [in] grps - the names of the groups of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the groups. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is present in \a grps. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector& grps, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeGroupsArr(const std::vector& grps, bool renum) const { return getGroupsArr(1,grps,renum); } @@ -2094,17 +2095,17 @@ DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector& grps * \param [in] grp - the name of the group of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the group. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const { std::vector tmp(1); tmp[0]=fam; - DataArrayInt *ret=getNodeFamiliesArr(tmp,renum); + DataArrayIdType *ret=getNodeFamiliesArr(tmp,renum); ret->setName(fam); return ret; } @@ -2114,12 +2115,12 @@ DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) * \param [in] fams - the names of the families of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the families. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector& fams, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeFamiliesArr(const std::vector& fams, bool renum) const { return getFamiliesArr(1,fams,renum); } @@ -2136,7 +2137,7 @@ DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector& fa * \throw If \a grps includes invalid ids (or numbers if \a renum == \c true ). * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum) +void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum) { if(grps.empty()) return ; @@ -2144,7 +2145,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector grpsName2(grps.size()); int i=0; - for(std::vector::const_iterator it=grps.begin();it!=grps.end();it++,i++) + for(std::vector::const_iterator it=grps.begin();it!=grps.end();it++,i++) { grpsName.insert((*it)->getName()); grpsName2[i]=(*it)->getName(); @@ -2154,28 +2155,28 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector fam; - std::vector< std::vector > fidsOfGroups; + MCAuto fam; + std::vector< std::vector > fidsOfGroups; if(!renum) { - fam=DataArrayInt::MakePartition(grps,sz,fidsOfGroups); + fam=DataArrayIdType::MakePartition(grps,sz,fidsOfGroups); } else { - std::vector< MCAuto > grps2(grps.size()); + std::vector< MCAuto > grps2(grps.size()); for(unsigned int ii=0;iisetName(grps[ii]->getName()); } - std::vector grps3(grps2.begin(),grps2.end()); - fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups); + std::vector grps3(grps2.begin(),grps2.end()); + fam=DataArrayIdType::MakePartition(grps3,sz,fidsOfGroups); } - int offset=1; + mcIdType offset=1; if(!_families.empty()) offset=getMaxAbsFamilyId()+1; TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups); - MCAuto ids=fam->getDifferentValues(); + MCAuto ids=fam->getDifferentValues(); appendFamilyEntries(ids,fidsOfGroups,grpsName2); setFamilyFieldArr(meshDimRelToMaxExt,fam); } @@ -2185,10 +2186,10 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector >& fidsOfGrps, const std::vector& grpNames) +void MEDFileMesh::appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames) { - std::map famInv; - for(const int *it=famIds->begin();it!=famIds->end();it++) + std::map famInv; + for(const mcIdType *it=famIds->begin();it!=famIds->end();it++) { std::ostringstream oss; oss << "Family_" << (*it); @@ -2196,9 +2197,9 @@ void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vec famInv[*it]=oss.str(); } int i=0; - for(std::vector< std::vector >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++) + for(std::vector< std::vector >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++) { - for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) { _groups[grpNames[i]].push_back(famInv[*it2]); } @@ -2220,7 +2221,7 @@ std::vector MEDFileMesh::getAllGeoTypes() con /*! * \sa getAllDistributionOfTypes */ -std::vector MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const +std::vector MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const { MCAuto mLev(getMeshAtLevel(meshDimRelToMax)); return mLev->getDistributionOfTypes(); @@ -2233,14 +2234,14 @@ void MEDFileMesh::loadLLWithAdditionalItems(med_idt fid, const std::string& mNam loadEquivalences(fid); } -void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp) +void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector >& famIdsPerGrp) { famArr->applyLin(offset>0?1:-1,offset,0); - for(std::vector< std::vector >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++) + for(std::vector< std::vector >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++) { if(offset<0) - std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate()); - std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus(),offset)); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate()); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus(),offset)); } } @@ -2282,12 +2283,12 @@ std::string MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std:: throw INTERP_KERNEL::Exception("MEDFileMesh::CreateNameNotIn : impossible to find a not already used name !"); } -int MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, int strt) +mcIdType MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, mcIdType strt) { std::size_t nbOfChunks=code.size()/3; if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDFileMesh::PutInThirdComponentOfCodeOffset : code has invalid size : should be of size 3*x !"); - int ret=strt; + mcIdType ret=strt; for(std::size_t i=0;i::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl; oss << " - Groups lying on this family : "; @@ -2429,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(); } @@ -2459,7 +2460,7 @@ MEDFileUMesh *MEDFileUMesh::New() * \param [in] mrs - the request for what to be loaded. * \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this mesh using decrRef() as it is no more needed. */ -MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); @@ -2470,7 +2471,7 @@ MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::s * Please refer to the other MEDFileUMesh::LoadPartOf method that has the same semantic and the same parameter (excepted the first). * This method is \b NOT wrapped into python. */ -MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MCAuto ret(MEDFileUMesh::New()); ret->loadPartUMeshFromFile(fid,mName,types,slicPerTyp,dt,it,mrs); @@ -2488,10 +2489,10 @@ std::vector MEDFileUMesh::getDirectChildrenWithNull() c { std::vector ret(MEDFileMesh::getDirectChildrenWithNull()); ret.push_back((const DataArrayDouble*)_coords); - ret.push_back((const DataArrayInt *)_fam_coords); - ret.push_back((const DataArrayInt *)_num_coords); - ret.push_back((const DataArrayInt *)_global_num_coords); - ret.push_back((const DataArrayInt *)_rev_num_coords); + ret.push_back((const DataArrayIdType *)_fam_coords); + ret.push_back((const DataArrayIdType *)_num_coords); + ret.push_back((const DataArrayIdType *)_global_num_coords); + ret.push_back((const DataArrayIdType *)_rev_num_coords); ret.push_back((const DataArrayAsciiChar *)_name_coords); ret.push_back((const PartDefinition *)_part_coords); for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) @@ -2575,7 +2576,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } } { - const DataArrayInt *famc1(_fam_coords),*famc2(otherC->_fam_coords); + const DataArrayIdType *famc1(_fam_coords),*famc2(otherC->_fam_coords); if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on nodes ! One is defined and not other !"; @@ -2592,7 +2593,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } } { - const DataArrayInt *numc1(_num_coords),*numc2(otherC->_num_coords); + const DataArrayIdType *numc1(_num_coords),*numc2(otherC->_num_coords); if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; @@ -2609,7 +2610,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } } { - const DataArrayInt *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords); + const DataArrayIdType *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords); if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; @@ -2695,14 +2696,14 @@ void MEDFileUMesh::checkConsistency() const } else { - int nbCoo = _coords->getNumberOfTuples(); + mcIdType nbCoo = _coords->getNumberOfTuples(); if (_fam_coords.isNotNull()) _fam_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node family array!"); if (_num_coords.isNotNull()) { _num_coords->checkNbOfTuplesAndComp(nbCoo,1,"MEDFileUMesh::checkConsistency(): inconsistent internal node numbering array!"); - int pos; - int maxValue=_num_coords->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_coords->getMaxValue(pos); if (!_rev_num_coords || _rev_num_coords->getNumberOfTuples() != (maxValue+1)) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): inconsistent internal revert node numbering array!"); } @@ -2736,7 +2737,7 @@ void MEDFileUMesh::checkSMESHConsistency() const if (_ms.size()) { std::vector< MCAuto >::const_iterator it=_ms.begin(); - std::vector< const DataArrayInt * > v; + std::vector< const DataArrayIdType * > v; bool voidOrNot = ((*it)->_num == 0); for (it++; it != _ms.end(); it++) if( ((*it)->_num == 0) != voidOrNot ) @@ -2747,7 +2748,7 @@ void MEDFileUMesh::checkSMESHConsistency() const { // don't forget the 1st one: v.push_back(_ms[0]->_num); - MCAuto inter = DataArrayInt::BuildIntersection(v); + MCAuto inter = DataArrayIdType::BuildIntersection(v); if (inter->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): overlapping entity numbering between mesh sub-levels!"); } @@ -2820,7 +2821,7 @@ catch(INTERP_KERNEL::Exception& e) * * \sa loadLL */ -void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUMeshL2 loaderl2; MEDCoupling::MEDCouplingMeshType meshType; @@ -3080,7 +3081,7 @@ std::vector MEDFileUMesh::getNonEmptyLevelsExt() const std::vector MEDFileUMesh::getFamArrNonEmptyLevelsExt() const { std::vector ret; - const DataArrayInt *famCoo(_fam_coords); + const DataArrayIdType *famCoo(_fam_coords); if(famCoo) ret.push_back(1); int lev=0; @@ -3133,11 +3134,11 @@ std::vector MEDFileUMesh::getNameArrNonEmptyLevelsExt() const * \param [in] fams - the name of the family of interest. * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector& fams) const +std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector& fams) const { - std::vector ret; + std::vector ret; std::vector levs(getNonEmptyLevels()); - std::vector famIds(getFamiliesIds(fams)); + std::vector famIds(getFamiliesIds(fams)); for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) if(_ms[-(*it)]->presenceOfOneFams(famIds)) ret.push_back(*it); @@ -3149,16 +3150,16 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const +std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const { - std::vector ret0(getFamsNonEmptyLevels(fams)); - const DataArrayInt *famCoords(_fam_coords); + std::vector ret0(getFamsNonEmptyLevels(fams)); + const DataArrayIdType *famCoords(_fam_coords); if(!famCoords) return ret0; - std::vector famIds(getFamiliesIds(fams)); + std::vector famIds(getFamiliesIds(fams)); if(famCoords->presenceOfValue(famIds)) { - std::vector ret(ret0.size()+1); + std::vector ret(ret0.size()+1); ret[0]=1; std::copy(ret0.begin(),ret0.end(),ret.begin()+1); return ret; @@ -3167,22 +3168,22 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector::max(),tmp=-1; - if((const DataArrayInt *)_fam_coords) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_coords) { - int val=_fam_coords->getMaxValue(tmp); + mcIdType val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayInt *da=(*it)->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - int val=da->getMaxValue(tmp); + mcIdType val=da->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } } @@ -3190,22 +3191,22 @@ int MEDFileUMesh::getMaxAbsFamilyIdInArrays() const return ret; } -int MEDFileUMesh::getMaxFamilyIdInArrays() const +mcIdType MEDFileUMesh::getMaxFamilyIdInArrays() const { - int ret=-std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_coords) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_coords) { - int val=_fam_coords->getMaxValue(tmp); + mcIdType val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,val); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayInt *da=(*it)->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - int val=da->getMaxValue(tmp); + mcIdType val=da->getMaxValue(tmp); ret=std::max(ret,val); } } @@ -3213,22 +3214,22 @@ int MEDFileUMesh::getMaxFamilyIdInArrays() const return ret; } -int MEDFileUMesh::getMinFamilyIdInArrays() const +mcIdType MEDFileUMesh::getMinFamilyIdInArrays() const { - int ret=std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_coords) + mcIdType ret=std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_coords) { - int val=_fam_coords->getMinValue(tmp); + mcIdType val=_fam_coords->getMinValue(tmp); ret=std::min(ret,val); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayInt *da=(*it)->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - int val=da->getMinValue(tmp); + mcIdType val=da->getMinValue(tmp); ret=std::min(ret,val); } } @@ -3329,10 +3330,10 @@ std::string MEDFileUMesh::advancedRepr() const /*! * Returns number of mesh entities of a given relative dimension in \a this mesh. * \param [in] meshDimRelToMaxExt - the relative dimension of interest. - * \return int - the number of entities. + * \return mcIdType - the number of entities. * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. */ -int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) { @@ -3346,10 +3347,10 @@ int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const /*! * Returns the family field for mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the family field. It is an array of ids of families + * \return const DataArrayIdType * - the family field. It is an array of ids of families * each mesh entity belongs to. It can be \c NULL. */ -const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) return _fam_coords; @@ -3357,7 +3358,7 @@ const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) return l1->getFamilyField(); } -DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) +DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) { if(meshDimRelToMaxExt==1) return _fam_coords; @@ -3368,10 +3369,10 @@ DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) /*! * Returns the optional numbers of mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers. + * \return const DataArrayIdType * - the array of the entity numbers. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) return _num_coords; @@ -3387,7 +3388,7 @@ const DataArrayAsciiChar *MEDFileUMesh::getNameFieldAtLevel(int meshDimRelToMaxE return l1->getNameField(); } -MCAuto MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const +MCAuto MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !"); @@ -3409,7 +3410,7 @@ const PartDefinition *MEDFileUMesh::getPartDefAtLevel(int meshDimRelToMaxExt, IN return l1->getPartDef(gt); } -int MEDFileUMesh::getNumberOfNodes() const +mcIdType MEDFileUMesh::getNumberOfNodes() const { const DataArrayDouble *coo(_coords); if(!coo) @@ -3417,7 +3418,7 @@ int MEDFileUMesh::getNumberOfNodes() const return coo->getNumberOfTuples(); } -int MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const { const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMaxExt)); return l1->getNumberOfCells(); @@ -3428,7 +3429,7 @@ bool MEDFileUMesh::hasImplicitPart() const return false; } -int MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const +mcIdType MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const { throw INTERP_KERNEL::Exception("MEDFileUMesh::buildImplicitPartIfAny : unstructured meshes do not have implicit part !"); } @@ -3448,7 +3449,7 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con m->computeNodeIdsAlg(nodesFetched); else { - const DataArrayInt *arr(globs->getProfile(st[i].getPflName())); + const DataArrayIdType *arr(globs->getProfile(st[i].getPflName())); MCAuto m2(dynamic_cast(m->buildPartOfMySelf(arr->begin(),arr->end(),true))); m2->computeNodeIdsAlg(nodesFetched); } @@ -3493,13 +3494,13 @@ void MEDFileUMesh::killStructureElements() /*! * Returns the optional numbers of mesh entities of a given dimension transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * DataArrayIdType::invertArrayN2O2O2N(). * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * \return const DataArrayIdType * - the array of the entity numbers transformed using + * DataArrayIdType::invertArrayN2O2O2N(). * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) { @@ -3617,13 +3618,13 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v synchronizeTinyInfoOnLeaves(); if(meshDimRelToMaxExt==1) { - MCAuto arr=getFamiliesArr(1,fams,renum); + MCAuto arr=getFamiliesArr(1,fams,renum); MCAuto ret=MEDCouplingUMesh::New(); MCAuto c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems()); ret->setCoords(c); return ret.retn(); } - std::vector famIds=getFamiliesIds(fams); + std::vector famIds=getFamiliesIds(fams); const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt); MCAuto zeRet; if(!famIds.empty()) @@ -3642,19 +3643,19 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v * \param [in] fams - the names of the families of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the families. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const +DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const { - std::vector famIds=getFamiliesIds(fams); + std::vector famIds=getFamiliesIds(fams); if(meshDimRelToMaxExt==1) { - if((const DataArrayInt *)_fam_coords) + if((const DataArrayIdType *)_fam_coords) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -3707,7 +3708,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu return l1->getWholeMesh(renum); } -std::vector MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const +std::vector MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const { const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMax)); return l1->getDistributionOfTypes(); @@ -3815,20 +3816,20 @@ MEDCoupling1GTUMesh *MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh(INTERP_ * * \sa getDistributionOfTypes */ -std::vector< std::pair > MEDFileUMesh::getAllDistributionOfTypes() const +std::vector< std::pair > MEDFileUMesh::getAllDistributionOfTypes() const { - std::vector< std::pair > ret; + std::vector< std::pair > ret; std::vector nel(getNonEmptyLevels()); for(std::vector::reverse_iterator it=nel.rbegin();it!=nel.rend();it++) { std::vector gt(getGeoTypesAtLevel(*it)); for(std::vector::const_iterator it1=gt.begin();it1!=gt.end();it1++) { - int nbCells(getNumberOfCellsWithType(*it1)); - ret.push_back(std::pair(*it1,nbCells)); + mcIdType nbCells(getNumberOfCellsWithType(*it1)); + ret.push_back(std::pair(*it1,nbCells)); } } - ret.push_back(std::pair(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes())); + ret.push_back(std::pair(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes())); return ret; } @@ -3842,7 +3843,7 @@ std::vector MEDFileUMesh::getGeoTypesAtLevel( return sp->getGeoTypes(); } -int MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(ct); const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe( ((int)cm.getDimension())-getMeshDimension() )); @@ -3852,11 +3853,11 @@ int MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) /*! * This method extracts from whole family field ids the part relative to the input parameter \a gt. * \param [in] gt - the geometric type for which the family field is asked. - * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to + * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to * delete using decrRef() as it is no more needed. * \sa MEDFileUMesh::extractNumberFieldOnGeoType */ -DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); int lev=(int)cm.getDimension()-getMeshDimension(); @@ -3867,11 +3868,11 @@ DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::Normalize /*! * This method extracts from whole number field ids the part relative to the input parameter \a gt. * \param [in] gt - the geometric type for which the number field is asked. - * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to + * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to * delete using decrRef() as it is no more needed. * \sa MEDFileUMesh::extractFamilyFieldOnGeoType */ -DataArrayInt *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); int lev=(int)cm.getDimension()-getMeshDimension(); @@ -3949,7 +3950,7 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords) coords->checkAllocated(); int nbOfTuples(coords->getNumberOfTuples()); _coords.takeRef(coords); - _fam_coords=DataArrayInt::New(); + _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfTuples,1); _fam_coords->fillWithZero(); _num_coords.nullify(); _rev_num_coords.nullify(); _name_coords.nullify(); _global_num_coords.nullify(); @@ -3996,7 +3997,7 @@ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) { if(meshDimRelToMaxExt==1) { - if((DataArrayInt *)_fam_coords) + if((DataArrayIdType *)_fam_coords) _fam_coords->fillWithZero(); return ; } @@ -4014,14 +4015,14 @@ void MEDFileUMesh::optimizeFamilies() std::set allFamsIds; for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - const DataArrayInt *ffield=getFamilyFieldAtLevel(*it); - MCAuto ids=ffield->getDifferentValues(); + const DataArrayIdType *ffield=getFamilyFieldAtLevel(*it); + MCAuto ids=ffield->getDifferentValues(); std::set res; std::set_union(ids->begin(),ids->end(),allFamsIds.begin(),allFamsIds.end(),std::inserter(res,res.begin())); allFamsIds=res; } std::set famNamesToKill; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { if(allFamsIds.find((*it).second)!=allFamsIds.end()) famNamesToKill.insert((*it).first); @@ -4069,32 +4070,32 @@ void MEDFileUMesh::optimizeFamilies() * \param[out] cellsNotModified ids of the rest of cells bordering the new boundary whose connectivity remains unchanged. * \sa clearNodeAndCellNumbers() */ -void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, - DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) +void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, + DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified) { typedef MCAuto MUMesh; - typedef MCAuto DAInt; + typedef MCAuto DAInt; std::vector levs=getNonEmptyLevels(); if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end()) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group : This method works only for mesh defined on level 0 and -1 !"); MUMesh m0=getMeshAtLevel(0); MUMesh m1=getMeshAtLevel(-1); - int nbNodes=m0->getNumberOfNodes(); + mcIdType nbNodes=m0->getNumberOfNodes(); MUMesh m11=getGroup(-1,grpNameM1); - DataArrayInt *tmp00=0,*tmp11=0,*tmp22=0; + DataArrayIdType *tmp00=0,*tmp11=0,*tmp22=0; m0->findNodesToDuplicate(*m11,tmp00,tmp11,tmp22); DAInt nodeIdsToDuplicate(tmp00); DAInt cellsToModifyConn0(tmp11); DAInt cellsToModifyConn1(tmp22); MUMesh tmp0=static_cast(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true)); // node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1 - DAInt descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New(); + DAInt descTmp0=DataArrayIdType::New(),descITmp0=DataArrayIdType::New(),revDescTmp0=DataArrayIdType::New(),revDescITmp0=DataArrayIdType::New(); MUMesh tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0); descTmp0=0; descITmp0=0; revDescTmp0=0; revDescITmp0=0; DAInt cellsInM1ToRenumW2=tmp0Desc->getCellIdsLyingOnNodes(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),false); MUMesh cellsInM1ToRenumW3=static_cast(tmp0Desc->buildPartOfMySelf(cellsInM1ToRenumW2->begin(),cellsInM1ToRenumW2->end(),true)); - DataArrayInt *cellsInM1ToRenumW4Tmp=0; + DataArrayIdType *cellsInM1ToRenumW4Tmp=0; m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp); DAInt cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp); DAInt cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells()); @@ -4113,7 +4114,7 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, _coords=m0->getCoords(); _coords->incrRef(); // duplication of cells in group 'grpNameM1' on level -1, but not duplicating cells for which nothing has changed m11->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m11->setCoords(m0->getCoords()); - DataArrayInt * duplCells; + DataArrayIdType * duplCells; m1->areCellsIncludedIn(m11, 0, duplCells); DAInt zeIds = duplCells->findIdsNotInRange(-1, m1->getNumberOfCells()-1); duplCells->decrRef(); MUMesh m11Part=static_cast(m11->buildPartOfMySelf(zeIds->begin(),zeIds->end(),true)); @@ -4123,21 +4124,21 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DAInt idInMsOfCellGrpOfSameType(tmp11); // newm1->setName(getName()); - const DataArrayInt *fam=getFamilyFieldAtLevel(-1); + const DataArrayIdType *fam=getFamilyFieldAtLevel(-1); if(!fam) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group(): internal error no family field !"); - DAInt newFam=DataArrayInt::New(); + DAInt newFam=DataArrayIdType::New(); newFam->alloc(newm1->getNumberOfCells(),1); // Get a new family ID: care must be taken if we need a positive ID or a negative one: // Positive ID for family of nodes, negative for all the rest. - int idd; + mcIdType idd; if (m1->getMeshDimension() == 0) idd=getMaxFamilyId()+1; else idd=getMinFamilyId()-1; - int globStart=0,start=0,end,globEnd; - int nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples(); - for(int i=0;igetNumberOfTuples(); + for(mcIdType i=0;igetIJ(i,0); if(idInMsOfCellGrpOfSameType->getIJ(i,0)==0) @@ -4163,8 +4164,8 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, fam=_fam_coords; if(fam) { - int newNbOfNodes=getCoords()->getNumberOfTuples(); - newFam=DataArrayInt::New(); newFam->alloc(newNbOfNodes,1); + mcIdType newNbOfNodes=getCoords()->getNumberOfTuples(); + newFam=DataArrayIdType::New(); newFam->alloc(newNbOfNodes,1); newFam->setPartOfValues1(fam,0,nbNodes,1,0,1,1,true); newFam->setPartOfValuesSimple1(0,nbNodes,newNbOfNodes,1,0,1,1); _fam_coords=newFam; @@ -4188,43 +4189,43 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, * in this method. * * \param [out] oldCode retrieves the distribution of types before the call if true is returned - * \param [out] newCode etrieves the distribution of types after the call if true is returned + * \param [out] newCode retrieves the distribution of types after the call if true is returned * \param [out] o2nRenumCell tells for **all levels** the old 2 new renumbering of cells. * * \return false if no modification has been performed linked to the unpolyzation. Neither cell type, not cell numbers. When false is returned no need of field on cells or on gauss renumbering. * Inversely, if true is returned, it means that distribution of cell by geometric type has changed and field on cell and field on gauss point must be renumbered. */ -bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) +bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) { o2nRenumCell=0; oldCode.clear(); newCode.clear(); std::vector levs=getNonEmptyLevels(); bool ret=false; - std::vector< const DataArrayInt* > renumCellsSplited;//same than memorySaverIfThrow - std::vector< MCAuto > memorySaverIfThrow;//same than renumCellsSplited only in case of throw - int start=0; - int end=0; + std::vector< const DataArrayIdType* > renumCellsSplited;//same than memorySaverIfThrow + std::vector< MCAuto > memorySaverIfThrow;//same than renumCellsSplited only in case of throw + mcIdType start=0; + mcIdType end=0; for(std::vector::reverse_iterator it=levs.rbegin();it!=levs.rend();it++) { MCAuto m=getMeshAtLevel(*it); - std::vector code1=m->getDistributionOfTypes(); + std::vector code1=m->getDistributionOfTypes(); end=PutInThirdComponentOfCodeOffset(code1,start); oldCode.insert(oldCode.end(),code1.begin(),code1.end()); bool hasChanged=m->unPolyze(); - DataArrayInt *fake=0; - MCAuto o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, + DataArrayIdType *fake=0; + MCAuto o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake); fake->decrRef(); renumCellsSplited.push_back(o2nCellsPart); memorySaverIfThrow.push_back(o2nCellsPart); if(hasChanged) { - MCAuto o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel(); + MCAuto o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel(); m->renumberCells(o2nCellsPart2->getConstPointer(),false); ret=true; - MCAuto famField2,numField2; - const DataArrayInt *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast(famField); } - const DataArrayInt *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast(numField); } + MCAuto famField2,numField2; + const DataArrayIdType *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast(famField); } + const DataArrayIdType *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast(numField); } setMeshAtLevel(*it,m); - std::vector code2=m->getDistributionOfTypes(); + std::vector code2=m->getDistributionOfTypes(); end=PutInThirdComponentOfCodeOffset(code2,start); newCode.insert(newCode.end(),code2.begin(),code2.end()); // @@ -4232,12 +4233,12 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode continue; if(famField) { - MCAuto newFamField=famField->renumber(o2nCellsPart2->getConstPointer()); + MCAuto newFamField=famField->renumber(o2nCellsPart2->getConstPointer()); setFamilyFieldArr(*it,newFamField); } if(numField) { - MCAuto newNumField=numField->renumber(o2nCellsPart2->getConstPointer()); + MCAuto newNumField=numField->renumber(o2nCellsPart2->getConstPointer()); setRenumFieldArr(*it,newNumField); } } @@ -4249,8 +4250,8 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode } if(ret) { - MCAuto renumCells=DataArrayInt::Aggregate(renumCellsSplited); - MCAuto o2nRenumCellRet=renumCells->buildPermArrPerLevel(); + MCAuto renumCells=DataArrayIdType::Aggregate(renumCellsSplited); + MCAuto o2nRenumCellRet=renumCells->buildPermArrPerLevel(); o2nRenumCell=o2nRenumCellRet.retn(); } return ret; @@ -4260,8 +4261,8 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode struct MEDLoaderAccVisit1 { MEDLoaderAccVisit1():_new_nb_of_nodes(0) { } - int operator()(bool val) { return val?_new_nb_of_nodes++:-1; } - int _new_nb_of_nodes; + mcIdType operator()(bool val) { return val?_new_nb_of_nodes++:-1; } + mcIdType _new_nb_of_nodes; }; /*! \endcond */ @@ -4276,12 +4277,12 @@ struct MEDLoaderAccVisit1 * \throw If no coordinates are set in \a this or if there is in any available mesh in \a this a cell having a nodal connectivity containing a node id not in the range of * set coordinates. */ -DataArrayInt *MEDFileUMesh::zipCoords() +DataArrayIdType *MEDFileUMesh::zipCoords() { const DataArrayDouble *coo(getCoords()); if(!coo) throw INTERP_KERNEL::Exception("MEDFileUMesh::zipCoords : no coordinates set in this !"); - int nbOfNodes(coo->getNumberOfTuples()); + mcIdType nbOfNodes(coo->getNumberOfTuples()); std::vector nodeIdsInUse(nbOfNodes,false); std::vector neLevs(getNonEmptyLevels()); for(std::vector::const_iterator lev=neLevs.begin();lev!=neLevs.end();lev++) @@ -4300,18 +4301,18 @@ DataArrayInt *MEDFileUMesh::zipCoords() mesh->computeNodeIdsAlg(nodeIdsInUse); } } - int nbrOfNodesInUse((int)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); + mcIdType nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); if(nbrOfNodesInUse==nbOfNodes) return 0;//no need to update _part_coords - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1); std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1()); - MCAuto ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); + MCAuto ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); MCAuto newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end())); - MCAuto newFamCoords; + MCAuto newFamCoords; MCAuto newNameCoords; - if((const DataArrayInt *)_fam_coords) + if((const DataArrayIdType *)_fam_coords) newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()); - MCAuto newNumCoords,newGlobalNumCoords; + MCAuto newNumCoords,newGlobalNumCoords; if(_num_coords.isNotNull()) newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()); if(_global_num_coords.isNotNull()) @@ -4342,14 +4343,14 @@ DataArrayInt *MEDFileUMesh::zipCoords() * The extraction of \a this is specified by the extractDef \a input map. * This map tells for each level of cells, the cells kept in the extraction. * - * \return - a new reference of DataArrayInt that represents sorted node ids, the extraction is lying on. + * \return - a new reference of DataArrayIdType that represents sorted node ids, the extraction is lying on. * \sa MEDFileField1TS::extractPart, MEDFileUMesh::extractPart */ -DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const +DataArrayIdType *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const { std::vector levs(getNonEmptyLevels()); std::vector fetchedNodes(getNumberOfNodes(),false); - for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) + for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) { if((*it).first>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid key ! Must be <=1 !"); @@ -4366,7 +4367,7 @@ DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true)); mPart->computeNodeIdsAlg(fetchedNodes); } - return DataArrayInt::BuildListOfSwitchedOn(fetchedNodes); + return DataArrayIdType::BuildListOfSwitchedOn(fetchedNodes); } /*! @@ -4375,11 +4376,11 @@ DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const +MEDFileUMesh *MEDFileUMesh::extractPart(const std::map >& extractDef) const { MCAuto ret(MEDFileUMesh::New()); ret->setName(getName()); ret->copyFamGrpMapsFrom(*this); std::vector levs(getNonEmptyLevels()); - for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) + for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) { if((*it).first>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : invalid key ! Must be <=1 !"); @@ -4395,39 +4396,39 @@ MEDFileUMesh *MEDFileUMesh::extractPart(const std::map MCAuto m(getMeshAtLevel((*it).first)); MCAuto mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true)); ret->setMeshAtLevel((*it).first,mPart); - const DataArrayInt *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first)); + const DataArrayIdType *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first)); if(fam) { - MCAuto famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); + MCAuto famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); ret->setFamilyFieldArr((*it).first,famPart); } if(num) { - MCAuto numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); + MCAuto numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); ret->setFamilyFieldArr((*it).first,numPart); } } - std::map >::const_iterator it2(extractDef.find(1)); + std::map >::const_iterator it2(extractDef.find(1)); if(it2!=extractDef.end()) { const DataArrayDouble *coo(ret->getCoords()); if(!coo) throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : trying to extract nodes whereas there is no nodes !"); - MCAuto o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples())); + MCAuto o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples())); MCAuto cooPart(coo->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setCoords(cooPart); - const DataArrayInt *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1)); + const DataArrayIdType *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1)); if(fam) { - MCAuto famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); + MCAuto famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setFamilyFieldArr(1,famPart); } if(num) { - MCAuto numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); + MCAuto numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setFamilyFieldArr(1,numPart); } - for(std::map >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++) + for(std::map >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++) { if((*it3).first==1) continue; @@ -4462,13 +4463,13 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p m1D->checkConsistencyLight(); if(m1D->getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildExtrudedMesh : input mesh must have a mesh dimension equal to one !"); - int nbRep(m1D->getNumberOfCells()); + mcIdType nbRep(m1D->getNumberOfCells()); std::vector levs(getNonEmptyLevels()); std::vector grps(getGroupsNames()); std::vector< MCAuto > zeList; DataArrayDouble *coords(0); std::size_t nbOfLevsOut(levs.size()+1); - std::vector< MCAuto > o2ns(nbOfLevsOut); + std::vector< MCAuto > o2ns(nbOfLevsOut); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { MCAuto item(getMeshAtLevel(*lev)); @@ -4496,7 +4497,7 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p { MCAuto elt1(getMeshAtLevel(lev+1)); MCAuto elt2(elt1->clone(false)); - MCAuto tmp(elt2->getNodalConnectivity()->deepCopy()); + MCAuto tmp(elt2->getNodalConnectivity()->deepCopy()); elt2->setConnectivity(tmp,elt2->getNodalConnectivityIndex()); elt2->shiftNodeNumbersInConn(nbRep*elt1->getNumberOfNodes()); elt1->setCoords(elt->getCoords()); elt2->setCoords(elt->getCoords()); @@ -4511,7 +4512,7 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } MCAuto endLev(getMeshAtLevel(levs.back())),endLev2; endLev=endLev->clone(false); endLev->setCoords(coords); - MCAuto tmp(endLev->getNodalConnectivity()->deepCopy()); + MCAuto tmp(endLev->getNodalConnectivity()->deepCopy()); endLev2=endLev->clone(false); endLev2->setConnectivity(tmp,endLev->getNodalConnectivityIndex()); endLev2->shiftNodeNumbersInConn(nbRep*getNumberOfNodes()); endLev=MEDCouplingUMesh::MergeUMeshesOnSameCoords(endLev,endLev2); @@ -4522,18 +4523,18 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p for(std::size_t ii=0;ii!=zeList.size();ii++) { int lev(levs[ii]); - std::vector< MCAuto > outGrps; - std::vector< const DataArrayInt * > outGrps2; + std::vector< MCAuto > outGrps; + std::vector< const DataArrayIdType * > outGrps2; if(lev<=-1) { for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MCAuto grpArr(getGroupArr(lev+1,*grp)); + MCAuto grpArr(getGroupArr(lev+1,*grp)); if(!grpArr->empty()) { - MCAuto grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy()); - int offset0(zeList[ii]->getNumberOfCells()); - int offset1(offset0+getNumberOfCellsAtLevel(lev+1)); + MCAuto grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy()); + mcIdType offset0(zeList[ii]->getNumberOfCells()); + mcIdType offset1(offset0+getNumberOfCellsAtLevel(lev+1)); grpArr1->applyLin(1,offset0); grpArr2->applyLin(1,offset1); std::ostringstream oss; oss << grpArr2->getName() << "_top"; grpArr2->setName(oss.str()); @@ -4547,18 +4548,18 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p // for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MCAuto grpArr(getGroupArr(lev,*grp)); + MCAuto grpArr(getGroupArr(lev,*grp)); if(!grpArr->empty()) { - int nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); - std::vector< MCAuto > grpArrs(nbRep); - std::vector< const DataArrayInt *> grpArrs2(nbRep); + mcIdType nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); + std::vector< MCAuto > grpArrs(nbRep); + std::vector< const DataArrayIdType *> grpArrs2(nbRep); for(int iii=0;iiideepCopy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion); grpArrs2[iii]=grpArrs[iii]; } - MCAuto grpArrExt(DataArrayInt::Aggregate(grpArrs2)); + MCAuto grpArrExt(DataArrayIdType::Aggregate(grpArrs2)); grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end()); std::ostringstream grpName; grpName << *grp << "_extruded"; grpArrExt->setName(grpName.str()); @@ -4568,14 +4569,14 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } ret->setGroupsAtLevel(lev,outGrps2); } - std::vector< MCAuto > outGrps; - std::vector< const DataArrayInt * > outGrps2; + std::vector< MCAuto > outGrps; + std::vector< const DataArrayIdType * > outGrps2; for(std::vector::const_iterator grp=grps.begin();grp!=grps.end();grp++) { - MCAuto grpArr1(getGroupArr(levs.back(),*grp)); + MCAuto grpArr1(getGroupArr(levs.back(),*grp)); if(grpArr1->empty()) continue; - MCAuto grpArr2(grpArr1->deepCopy()); + MCAuto grpArr2(grpArr1->deepCopy()); std::ostringstream grpName; grpName << *grp << "_top"; grpArr2->setName(grpName.str()); grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back())); @@ -4602,25 +4603,25 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co { checkCartesian(); MCAuto ret(MEDFileUMesh::New()); - int initialNbNodes(getNumberOfNodes()); + mcIdType initialNbNodes(getNumberOfNodes()); MCAuto m0Tmp(getMeshAtLevel(0)); MCAuto m0(dynamic_cast(m0Tmp->deepCopy())); { - MCAuto notUsed(m0->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m0->convertLinearCellsToQuadratic(conversionType)); } DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); std::vector levs(getNonEmptyLevels()); - const DataArrayInt *famField(getFamilyFieldAtLevel(0)); + const DataArrayIdType *famField(getFamilyFieldAtLevel(0)); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(0,famFieldCpy); } famField=getFamilyFieldAtLevel(1); if(famField) { - MCAuto fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1); + MCAuto fam(DataArrayIdType::New()); fam->alloc(zeCoords->getNumberOfTuples(),1); fam->fillWithZero(); fam->setPartOfValues1(famField,0,initialNbNodes,1,0,1,1); ret->setFamilyFieldArr(1,fam); @@ -4636,21 +4637,21 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co if(m1->getMeshDimension()!=0) { { - MCAuto notUsed(m1->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m1->convertLinearCellsToQuadratic(conversionType)); }//kill unused notUsed var MCAuto m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1)); - DataArrayInt *b(0); + DataArrayIdType *b(0); bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b)); - MCAuto bSafe(b); + MCAuto bSafe(b); if(!a) { std::ostringstream oss; oss << "MEDFileUMesh::linearCellsToQuadratic : for level " << *lev << " problem to identify nodes generated !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } b->applyLin(1,initialNbNodes); - MCAuto l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota(); - std::vector v(2); v[0]=l0; v[1]=b; - MCAuto renum(DataArrayInt::Aggregate(v)); + MCAuto l0(DataArrayIdType::New()); l0->alloc(initialNbNodes,1); l0->iota(); + std::vector v(2); v[0]=l0; v[1]=b; + MCAuto renum(DataArrayIdType::Aggregate(v)); m1->renumberNodesInConn(renum->begin()); } m1->setCoords(zeCoords); @@ -4658,7 +4659,7 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co famField=getFamilyFieldAtLevel(*lev); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(*lev,famFieldCpy); } } @@ -4686,16 +4687,16 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); std::vector levs(getNonEmptyLevels()); - const DataArrayInt *famField(getFamilyFieldAtLevel(0)); + const DataArrayIdType *famField(getFamilyFieldAtLevel(0)); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(0,famFieldCpy); } famField=getFamilyFieldAtLevel(1); if(famField) { - MCAuto fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1)); + MCAuto fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1)); ret->setFamilyFieldArr(1,fam); } ret->copyFamGrpMapsFrom(*this); @@ -4707,9 +4708,9 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const MCAuto m1(dynamic_cast(m1Tmp->deepCopy())); m1->convertQuadraticCellsToLinear(); m1->zipCoords(); - DataArrayInt *b(0); + DataArrayIdType *b(0); bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b)); - MCAuto bSafe(b); + MCAuto bSafe(b); if(!a) { std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !"; @@ -4721,7 +4722,7 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const famField=getFamilyFieldAtLevel(*lev); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(*lev,famFieldCpy); } } @@ -4755,7 +4756,7 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector coos(sz); - std::vector fam_coos(sz),num_coos(sz); + std::vector fam_coos(sz),num_coos(sz); for(auto it=meshes.begin();it!=meshes.end();it++,i++) { if(!(*it)) @@ -4767,19 +4768,19 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetSpaceDimension()),meshDim(ref->getMeshDimension()); std::vector levs(ref->getNonEmptyLevels()); - std::map > m_fam,m_renum; + std::map > m_fam,m_renum; std::map > > m_mesh2; std::map > m_mesh; - std::map famNumMap; - std::map famNumMap_rev; + std::map famNumMap; + std::map famNumMap_rev; std::map > grpFamMap; - std::set< MCAuto > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated. + std::set< MCAuto > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated. // Identify min family number used: - int min_fam_num(0); + mcIdType min_fam_num(0); for(const auto& msh : meshes) { - const std::map& locMap1(msh->getFamilyInfo()); + const std::map& locMap1(msh->getFamilyInfo()); for(const auto& it3 : locMap1) if(it3.second < min_fam_num) min_fam_num = it3.second; @@ -4794,14 +4795,14 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetNonEmptyLevels()!=levs) throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : levels must be the same for elements in input vector !"); - const std::map& locMap1(msh->getFamilyInfo()); + const std::map& locMap1(msh->getFamilyInfo()); std::map substitute; - std::map substituteN; + std::map substituteN; bool fam_conflict(false); for(const auto& it3 : locMap1) { const std::string& famName = it3.first; - int famNum = it3.second; + mcIdType famNum = it3.second; if (famNumMap_rev.find(famNum) != famNumMap_rev.end()) // Family number is already used! { // Is it used by a group of the current mesh or a group from a previous mesh? @@ -4849,8 +4850,8 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetFamilyFieldAtLevel(level)->deepCopy()); // Need a copy - mem_cleanup.insert(MCAuto(dai)); // Make sure array will decrRef() at end of method + DataArrayIdType* dai(msh->getFamilyFieldAtLevel(level)->deepCopy()); // Need a copy + mem_cleanup.insert(MCAuto(dai)); // Make sure array will decrRef() at end of method for (const auto& subN : substituteN) dai->changeValue(subN.first, subN.second); m_fam[level].push_back(dai); @@ -4892,14 +4893,14 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector ret(MEDFileUMesh::New()); MCAuto coo(DataArrayDouble::Aggregate(coos)); ret->setCoords(coo); - if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayInt *)0)==fam_coos.end()) + if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)0)==fam_coos.end()) { - MCAuto fam_coo(DataArrayInt::Aggregate(fam_coos)); + MCAuto fam_coo(DataArrayIdType::Aggregate(fam_coos)); ret->setFamilyFieldArr(1,fam_coo); } - if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayInt *)0)==num_coos.end()) + if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)0)==num_coos.end()) { - MCAuto num_coo(DataArrayInt::Aggregate(num_coos)); + MCAuto num_coo(DataArrayIdType::Aggregate(num_coos)); ret->setRenumFieldArr(1,num_coo); } // cells @@ -4910,7 +4911,7 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector mesh(MEDCouplingUMesh::MergeUMeshes((*it2).second)); mesh->setCoords(coo); mesh->setName(ref->getName()); - MCAuto renum(mesh->sortCellsInMEDFileFrmt()); + MCAuto renum(mesh->sortCellsInMEDFileFrmt()); ret->setMeshAtLevel(level,mesh); auto it3(m_fam.find(level)),it4(m_renum.find(level)); if(it3==m_fam.end()) // Should never happen (all levels exist for all meshes) @@ -4918,18 +4919,18 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector& fams((*it3).second); - if(std::find(fams.begin(),fams.end(),(const DataArrayInt *)0)==fams.end()) + const std::vector& fams((*it3).second); + if(std::find(fams.begin(),fams.end(),(const DataArrayIdType *)0)==fams.end()) { - MCAuto famm(DataArrayInt::Aggregate(fams)); + MCAuto famm(DataArrayIdType::Aggregate(fams)); famm->renumberInPlace(renum->begin()); ret->setFamilyFieldArr(level,famm); } // Set optional number field if defined for all input meshes: - const std::vector& renums((*it4).second); - if(std::find(renums.begin(),renums.end(),(const DataArrayInt *)0)==renums.end()) + const std::vector& renums((*it4).second); + if(std::find(renums.begin(),renums.end(),(const DataArrayIdType *)0)==renums.end()) { - MCAuto renumm(DataArrayInt::Aggregate(renums)); + MCAuto renumm(DataArrayIdType::Aggregate(renums)); renumm->renumberInPlace(renum->begin()); ret->setRenumFieldArr(level,renumm); } @@ -4948,12 +4949,12 @@ 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 !"); - int 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(); } -void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) +void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) { clearNonDiscrAttributes(); forceComputationOfParts(); @@ -4969,12 +4970,12 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& for(int i=0;igetInfoOnComponent(i)); layer0.push_back((int)_families.size());//4 i <- key info aa layer#0 - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { tinyStr.push_back((*it).first); layer0.push_back((*it).second); } - layer0.push_back((int)_groups.size());//4+aa i <- key info bb layer#0 + layer0.push_back((mcIdType)_groups.size());//4+aa i <- key info bb layer#0 for(std::map >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++) { layer0.push_back((int)(*it0).second.size()); @@ -4991,15 +4992,15 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& layer0.push_back(-1); else { - std::vector tmp0; + std::vector tmp0; pd->serialize(tmp0,bigArraysI); tinyInt.push_back(tmp0.size()); tinyInt.insert(tinyInt.end(),tmp0.begin(),tmp0.end()); } // - std::vector layer1; + std::vector layer1; std::vector levs(getNonEmptyLevels()); - layer1.push_back((int)levs.size());// 0 i <- key + layer1.push_back((mcIdType)levs.size());// 0 i <- key layer1.insert(layer1.end(),levs.begin(),levs.end()); for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { @@ -5013,13 +5014,13 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt.insert(tinyInt.end(),layer1.begin(),layer1.end()); } -void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) +void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) { - int sz0(tinyInt[0]); - std::vector layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0); - int sz1(tinyInt[sz0+1]); - std::vector layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1); + mcIdType sz0(tinyInt[0]); + std::vector layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0); + mcIdType sz1(tinyInt[sz0+1]); + std::vector layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1); // std::reverse(layer0.begin(),layer0.end()); std::reverse(layer1.begin(),layer1.end()); @@ -5040,21 +5041,21 @@ void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector _coords->setInfoOnComponent(i,tinyStr.back()); tinyStr.pop_back(); } - int nbOfFams(layer0.back()); layer0.pop_back(); + mcIdType nbOfFams(layer0.back()); layer0.pop_back(); _families.clear(); - for(int i=0;i fams(nbOfFamsOnGrp); - for(int j=0;j& tinyDouble, std::vector _fam_coords=bigArraysI.back(); bigArraysI.pop_back(); _num_coords=bigArraysI.back(); bigArraysI.pop_back(); _part_coords=0; - int isPd(layer0.back()); layer0.pop_back(); + mcIdType isPd(layer0.back()); layer0.pop_back(); if(isPd!=-1) { - std::vector tmp0(layer0.begin(),layer0.begin()+isPd); + std::vector tmp0(layer0.begin(),layer0.begin()+isPd); layer0.erase(layer0.begin(),layer0.begin()+isPd); _part_coords=PartDefinition::Unserialize(tmp0,bigArraysI); } if(!layer0.empty()) throw INTERP_KERNEL::Exception("MEDFileUMesh::unserialize : something wrong during unserialization #1 !"); // - int nbLevs(layer1.back()); layer1.pop_back(); - std::vector levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end()); + mcIdType nbLevs(layer1.back()); layer1.pop_back(); + std::vector levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end()); _ms.clear(); - int maxLev(-(*std::min_element(levs.begin(),levs.end()))); + mcIdType maxLev(-(*std::min_element(levs.begin(),levs.end()))); _ms.resize(maxLev+1); - for(int i=0;i& tinyDouble, std::vector * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) +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()); if(_fam_coords.isNull()) - { _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); } + { _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); } // addGroupUnderground(true,ids,_fam_coords); } @@ -5115,7 +5116,7 @@ void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) /*! * Adds a group of nodes/cells/faces/edges to \a this mesh. * - * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add. * The ids should be sorted and different each other (MED file norm). * * \warning this method can alter default "FAMILLE_ZERO" family. @@ -5127,7 +5128,7 @@ void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) +void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) { std::vector levs(getNonEmptyLevelsExt()); if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)==levs.end()) @@ -5138,7 +5139,7 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) if(meshDimRelToMaxExt==1) { addNodeGroup(ids); return ; } MEDFileUMeshSplitL1 *lev(getMeshAtLevSafe(meshDimRelToMaxExt)); - DataArrayInt *fam(lev->getOrCreateAndGetFamilyField()); + DataArrayIdType *fam(lev->getOrCreateAndGetFamilyField()); addGroupUnderground(false,ids,fam); } @@ -5148,7 +5149,7 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) * \param [in] newFamName - the new family name. * \throw If no family with the given \a id exists. */ -void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamName) +void MEDFileUMesh::setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName) { std::string oldName=getFamilyNameGivenId(id); _families.erase(oldName); @@ -5308,11 +5309,11 @@ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector corr; + std::vector corr; MCAuto m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr); - std::vector< MCAuto > corr3(corr.begin(),corr.end()); + std::vector< MCAuto > corr3(corr.begin(),corr.end()); setMeshAtLevel(meshDimRelToMax,m,renum); - std::vector corr2(corr.begin(),corr.end()); + std::vector corr2(corr.begin(),corr.end()); setGroupsAtLevel(meshDimRelToMax,corr2,true); } @@ -5353,11 +5354,11 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector > corr(ms.size()); + std::vector< MCAuto > corr(ms.size()); int i=0; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++,i++) { - DataArrayInt *arr=0; + DataArrayIdType *arr=0; bool test=m->areCellsIncludedIn(*it,_zipconn_pol,arr); corr[i]=arr; if(!test) @@ -5366,7 +5367,7 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector corr2(corr.begin(),corr.end()); + std::vector corr2(corr.begin(),corr.end()); setGroupsAtLevel(meshDimRelToMax,corr2,renum); } @@ -5393,7 +5394,7 @@ DataArrayDouble *MEDFileUMesh::checkMultiMesh(const std::vectorsetNameArr(nameArr); } -void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) +void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) { if(meshDimRelToMaxExt!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::setGlobalNumFieldAtLevel : Only implemented for meshDimRelToMaxExt==1 for the moment !"); @@ -5505,9 +5506,9 @@ void MEDFileUMesh::synchronizeTinyInfoOnLeaves() const /*! * This method is called by MEDFileMesh::changeFamilyId. It performs only one part of the family id modification. */ -void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId) +void MEDFileUMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId) { - DataArrayInt *arr=_fam_coords; + DataArrayIdType *arr=_fam_coords; if(arr) arr->changeValue(oldId,newId); for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) @@ -5520,12 +5521,12 @@ void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId) } } -std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const +std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const { - std::list< MCAuto > ret; - const DataArrayInt *da(_fam_coords); + std::list< MCAuto > ret; + const DataArrayIdType *da(_fam_coords); if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { const MEDFileUMeshSplitL1 *elt(*it); @@ -5533,7 +5534,7 @@ std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const { da=elt->getFamilyField(); if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } } } return ret; @@ -5543,8 +5544,8 @@ void MEDFileUMesh::computeRevNum() const { if(_num_coords.isNotNull()) { - int pos; - int maxValue=_num_coords->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_coords->getMaxValue(pos); _rev_num_coords=_num_coords->invertArrayN2O2O2N(maxValue+1); } } @@ -5557,79 +5558,79 @@ std::size_t MEDFileStructuredMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDFileStructuredMesh::getDirectChildrenWithNull() const { std::vector ret(MEDFileMesh::getDirectChildrenWithNull()); - ret.push_back((const DataArrayInt *)_fam_nodes); - ret.push_back((const DataArrayInt *)_num_nodes); + ret.push_back((const DataArrayIdType *)_fam_nodes); + ret.push_back((const DataArrayIdType *)_num_nodes); ret.push_back((const DataArrayAsciiChar *)_names_nodes); - ret.push_back((const DataArrayInt *)_fam_cells); - ret.push_back((const DataArrayInt *)_num_cells); + ret.push_back((const DataArrayIdType *)_fam_cells); + ret.push_back((const DataArrayIdType *)_num_cells); ret.push_back((const DataArrayAsciiChar *)_names_cells); - ret.push_back((const DataArrayInt *)_fam_faces); - ret.push_back((const DataArrayInt *)_num_faces); - ret.push_back((const DataArrayInt *)_rev_num_nodes); + ret.push_back((const DataArrayIdType *)_fam_faces); + ret.push_back((const DataArrayIdType *)_num_faces); + ret.push_back((const DataArrayIdType *)_rev_num_nodes); ret.push_back((const DataArrayAsciiChar *)_names_faces); - ret.push_back((const DataArrayInt *)_rev_num_cells); + ret.push_back((const DataArrayIdType *)_rev_num_cells); ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary); return ret; } -int MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const +mcIdType MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const { - int ret=-std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_nodes) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_nodes) { - int val=_fam_nodes->getMaxValue(tmp); + mcIdType val=_fam_nodes->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - int val=_fam_cells->getMaxValue(tmp); + mcIdType val=_fam_cells->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - int val=_fam_faces->getMaxValue(tmp); + mcIdType val=_fam_faces->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } return ret; } -int MEDFileStructuredMesh::getMaxFamilyIdInArrays() const +mcIdType MEDFileStructuredMesh::getMaxFamilyIdInArrays() const { - int ret=-std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_nodes) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_nodes) { - int val=_fam_nodes->getMaxValue(tmp); + mcIdType val=_fam_nodes->getMaxValue(tmp); ret=std::max(ret,val); } - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - int val=_fam_cells->getMaxValue(tmp); + mcIdType val=_fam_cells->getMaxValue(tmp); ret=std::max(ret,val); } - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - int val=_fam_faces->getMaxValue(tmp); + mcIdType val=_fam_faces->getMaxValue(tmp); ret=std::max(ret,val); } return ret; } -int MEDFileStructuredMesh::getMinFamilyIdInArrays() const +mcIdType MEDFileStructuredMesh::getMinFamilyIdInArrays() const { - int ret=std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_nodes) + mcIdType ret=std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_nodes) { - int val=_fam_nodes->getMinValue(tmp); + mcIdType val=_fam_nodes->getMinValue(tmp); ret=std::min(ret,val); } - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - int val=_fam_cells->getMinValue(tmp); + mcIdType val=_fam_cells->getMinValue(tmp); ret=std::min(ret,val); } - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - int val=_fam_faces->getMinValue(tmp); + mcIdType val=_fam_faces->getMinValue(tmp); ret=std::min(ret,val); } return ret; @@ -5645,8 +5646,8 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s what="Mesh types differ ! This is structured and other is NOT !"; return false; } - const DataArrayInt *famc1=_fam_nodes; - const DataArrayInt *famc2=otherC->_fam_nodes; + const DataArrayIdType *famc1=_fam_nodes; + const DataArrayIdType *famc2=otherC->_fam_nodes; if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on nodes ! One is defined and not other !"; @@ -5795,24 +5796,24 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s void MEDFileStructuredMesh::clearNonDiscrAttributes() const { MEDFileMesh::clearNonDiscrAttributes(); - const DataArrayInt *tmp=_fam_nodes; + const DataArrayIdType *tmp=_fam_nodes; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_num_nodes; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_fam_cells; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_num_cells; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_fam_faces; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_num_faces; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); } /*! @@ -5822,21 +5823,21 @@ void MEDFileStructuredMesh::clearNonDiscrAttributes() const * \param [in] fams - the names of the families of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the families. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const +DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const { - std::vector famIds(getFamiliesIds(fams)); + std::vector famIds(getFamiliesIds(fams)); switch(meshDimRelToMaxExt) { case 1: { - if((const DataArrayInt *)_fam_nodes) + if((const DataArrayIdType *)_fam_nodes) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -5852,9 +5853,9 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons } case 0: { - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -5870,9 +5871,9 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons } case -1: { - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -5901,7 +5902,7 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons * \throw If \a famArr has an invalid size. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1 and \a meshDimRelToMaxExt != -1. */ -void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) +void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) { const MEDCouplingStructuredMesh *mesh(getStructuredMesh()); if(!mesh) @@ -5910,7 +5911,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI { case 0: { - int nbCells(mesh->getNumberOfCells()); + mcIdType nbCells(mesh->getNumberOfCells()); if(famArr) famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of cells of mesh !"); _fam_cells=famArr; @@ -5918,7 +5919,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI } case 1: { - int nbNodes(mesh->getNumberOfNodes()); + mcIdType nbNodes(mesh->getNumberOfNodes()); if(famArr) famArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !"); _fam_nodes=famArr; @@ -5926,7 +5927,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI } case -1: { - int nbCells(mesh->getNumberOfCellsOfSubLevelMesh()); + mcIdType nbCells(mesh->getNumberOfCellsOfSubLevelMesh()); if(famArr) famArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setFamilyFieldArr : Problem in size of Family arr ! Mismatch with number of faces of mesh !"); _fam_faces=famArr; @@ -5947,7 +5948,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI * \throw If \a renumArr has an invalid size. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) +void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) { const MEDCouplingStructuredMesh *mesh=getStructuredMesh(); if(!mesh) @@ -5956,21 +5957,21 @@ void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIn { case 0: { - int nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=mesh->getNumberOfCells(); renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of cells of mesh !"); _num_cells=renumArr; break; } case 1: { - int nbNodes=mesh->getNumberOfNodes(); + mcIdType nbNodes=mesh->getNumberOfNodes(); renumArr->checkNbOfTuplesAndComp(nbNodes,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Family arr ! Mismatch with number of nodes of mesh !"); _num_nodes=renumArr; break; } case -1: { - int nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); + mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); renumArr->checkNbOfTuplesAndComp(nbCells,1,"MEDFileStructuredMesh::setRenumFieldArr : Problem in size of Renum arr ! Mismatch with number of faces of mesh !"); _num_faces=renumArr; break; @@ -5998,21 +5999,21 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra { case 0: { - int nbCells=mesh->getNumberOfCells(); + mcIdType nbCells=mesh->getNumberOfCells(); nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of cells of mesh !"); _names_cells=nameArr; break; } case 1: { - int nbNodes=mesh->getNumberOfNodes(); + mcIdType nbNodes=mesh->getNumberOfNodes(); nameArr->checkNbOfTuplesAndComp(nbNodes,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of nodes of mesh !"); _names_nodes=nameArr; break; } case -1: { - int nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); + mcIdType nbCells=mesh->getNumberOfCellsOfSubLevelMesh(); nameArr->checkNbOfTuplesAndComp(nbCells,MED_SNAME_SIZE,"MEDFileStructuredMesh::setNameFieldAtLevel : Problem in size of names arr ! Mismatch with number of faces of mesh !"); _names_faces=nameArr; } @@ -6023,14 +6024,14 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra nameArr->incrRef(); } -void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) +void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) { throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !"); } /*! * Adds a group of nodes to \a this mesh. - * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add. * The ids should be sorted and different each other (MED file norm). * * \warning this method can alter default "FAMILLE_ZERO" family. @@ -6042,7 +6043,7 @@ void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, Dat * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids) +void MEDFileStructuredMesh::addNodeGroup(const DataArrayIdType *ids) { addGroup(1,ids); } @@ -6050,7 +6051,7 @@ void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids) /*! * Adds a group of nodes/cells/faces/edges to \a this mesh. * - * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add. * The ids should be sorted and different each other (MED file norm). * * \warning this method can alter default "FAMILLE_ZERO" family. @@ -6062,9 +6063,9 @@ void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids) * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) +void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) { - DataArrayInt *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt)); + DataArrayIdType *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt)); addGroupUnderground(false,ids,fam); return ; } @@ -6072,11 +6073,11 @@ void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt /*! * Returns the family field for mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the family field. It is an array of ids of families + * \return const DataArrayIdType * - the family field. It is an array of ids of families * each mesh entity belongs to. It can be \c NULL. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const { switch(meshDimRelToMaxExt) { @@ -6094,11 +6095,11 @@ const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelT /*! * Returns the family field for mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the family field. It is an array of ids of families + * \return const DataArrayIdType * - the family field. It is an array of ids of families * each mesh entity belongs to. It can be \c NULL. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) +DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) { switch(meshDimRelToMaxExt) { @@ -6116,11 +6117,11 @@ DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxEx /*! * Returns the optional numbers of mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers. + * \return const DataArrayIdType * - the array of the entity numbers. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const { switch(meshDimRelToMaxExt) { @@ -6137,23 +6138,23 @@ const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelT /*! * Returns the optional numbers of mesh entities of a given dimension transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * DataArrayIdType::invertArrayN2O2O2N(). * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * \return const DataArrayIdType * - the array of the entity numbers transformed using + * DataArrayIdType::invertArrayN2O2O2N(). * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getRevNumberFieldAtLevel : Only available for levels 0 or 1 !"); if(meshDimRelToMaxExt==0) { - if((const DataArrayInt *)_num_cells) + if((const DataArrayIdType *)_num_cells) { - int pos; - int maxValue=_num_cells->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_cells->getMaxValue(pos); _rev_num_cells=_num_cells->invertArrayN2O2O2N(maxValue+1); return _rev_num_cells; } @@ -6162,10 +6163,10 @@ const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimR } else { - if((const DataArrayInt *)_num_nodes) + if((const DataArrayIdType *)_num_nodes) { - int pos; - int maxValue=_num_nodes->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_nodes->getMaxValue(pos); _rev_num_nodes=_num_nodes->invertArrayN2O2O2N(maxValue+1); return _rev_num_nodes; } @@ -6189,7 +6190,7 @@ const DataArrayAsciiChar *MEDFileStructuredMesh::getNameFieldAtLevel(int meshDim } } -MCAuto MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const +MCAuto MEDFileStructuredMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const { throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !"); } @@ -6221,7 +6222,7 @@ std::vector MEDFileStructuredMesh::getNonEmptyLevelsExt() const std::vector MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const { std::vector ret; - const DataArrayInt *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces); + const DataArrayIdType *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces); if(famNodes) ret.push_back(1); if(famCells) @@ -6237,7 +6238,7 @@ std::vector MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const std::vector MEDFileStructuredMesh::getNumArrNonEmptyLevelsExt() const { std::vector ret; - const DataArrayInt *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces); + const DataArrayIdType *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces); if(numNodes) ret.push_back(1); if(numCells) @@ -6266,15 +6267,15 @@ std::vector MEDFileStructuredMesh::getNameArrNonEmptyLevelsExt() const /*! * no implementation here, it is not a bug, but intresically no polyhedra in \a this. */ -bool MEDFileStructuredMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) +bool MEDFileStructuredMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) { oldCode.clear(); newCode.clear(); o2nRenumCell=0; return false; } -void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId) +void MEDFileStructuredMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId) { - DataArrayInt *arr=_fam_nodes; + DataArrayIdType *arr=_fam_nodes; if(arr) arr->changeValue(oldId,newId); arr=_fam_cells; @@ -6285,44 +6286,44 @@ void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId) arr->changeValue(oldId,newId); } -std::list< MCAuto > MEDFileStructuredMesh::getAllNonNullFamilyIds() const +std::list< MCAuto > MEDFileStructuredMesh::getAllNonNullFamilyIds() const { - std::list< MCAuto > ret; - const DataArrayInt *da(_fam_nodes); + std::list< MCAuto > ret; + const DataArrayIdType *da(_fam_nodes); if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } da=_fam_cells; if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } da=_fam_faces; if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } return ret; } void MEDFileStructuredMesh::deepCpyAttributes() { - if((const DataArrayInt*)_fam_nodes) + if((const DataArrayIdType*)_fam_nodes) _fam_nodes=_fam_nodes->deepCopy(); - if((const DataArrayInt*)_num_nodes) + if((const DataArrayIdType*)_num_nodes) _num_nodes=_num_nodes->deepCopy(); if((const DataArrayAsciiChar*)_names_nodes) _names_nodes=_names_nodes->deepCopy(); - if((const DataArrayInt*)_fam_cells) + if((const DataArrayIdType*)_fam_cells) _fam_cells=_fam_cells->deepCopy(); - if((const DataArrayInt*)_num_cells) + if((const DataArrayIdType*)_num_cells) _num_cells=_num_cells->deepCopy(); if((const DataArrayAsciiChar*)_names_cells) _names_cells=_names_cells->deepCopy(); - if((const DataArrayInt*)_fam_faces) + if((const DataArrayIdType*)_fam_faces) _fam_faces=_fam_faces->deepCopy(); - if((const DataArrayInt*)_num_faces) + if((const DataArrayIdType*)_num_faces) _num_faces=_num_faces->deepCopy(); if((const DataArrayAsciiChar*)_names_faces) _names_faces=_names_faces->deepCopy(); - if((const DataArrayInt*)_rev_num_nodes) + if((const DataArrayIdType*)_rev_num_nodes) _rev_num_nodes=_rev_num_nodes->deepCopy(); - if((const DataArrayInt*)_rev_num_cells) + if((const DataArrayIdType*)_rev_num_cells) _rev_num_cells=_rev_num_cells->deepCopy(); } @@ -6369,10 +6370,10 @@ MEDCouplingMesh *MEDFileStructuredMesh::getMeshAtLevel(int meshDimRelToMax, bool } } -std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector& fams) const +std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector& fams) const { - std::vector ret; - const DataArrayInt *famCells(_fam_cells),*famFaces(_fam_faces); + std::vector ret; + const DataArrayIdType *famCells(_fam_cells),*famFaces(_fam_faces); if(famCells && famCells->presenceOfValue(ret)) ret.push_back(0); if(famFaces && famFaces->presenceOfValue(ret)) @@ -6380,10 +6381,10 @@ std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector< return ret; } -std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const +std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const { - std::vector ret(getFamsNonEmptyLevels(fams)); - const DataArrayInt *famNodes(_fam_nodes); + std::vector ret(getFamsNonEmptyLevels(fams)); + const DataArrayIdType *famNodes(_fam_nodes); if(famNodes && famNodes->presenceOfValue(ret)) ret.push_back(1); return ret; @@ -6392,10 +6393,10 @@ std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vect /*! * Returns number of mesh entities of a given relative dimension in \a this mesh. * \param [in] meshDimRelToMaxExt - the relative dimension of interest. - * \return int - the number of entities. + * \return mcIdType - the number of entities. * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. */ -int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); if(!cmesh) @@ -6413,7 +6414,7 @@ int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const } } -int MEDFileStructuredMesh::getNumberOfNodes() const +mcIdType MEDFileStructuredMesh::getNumberOfNodes() const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); if(!cmesh) @@ -6421,7 +6422,7 @@ int MEDFileStructuredMesh::getNumberOfNodes() const return cmesh->getNumberOfNodes(); } -int MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); if(!cmesh) @@ -6445,7 +6446,7 @@ bool MEDFileStructuredMesh::hasImplicitPart() const /*! * \sa MEDFileStructuredMesh::getImplicitFaceMesh */ -int MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const +mcIdType MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const { static const char MSG[]="MEDFileStructuredMesh::buildImplicitPartIfAny : the given geo type is not manageable by a structured mesh !"; const MEDCoupling1SGTUMesh *zeFaceMesh(_faces_if_necessary); @@ -6522,7 +6523,7 @@ std::vector MEDFileStructuredMesh::getGeoType } } -int MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { if(ct!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension())) return 0; @@ -6536,21 +6537,21 @@ void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on single geo type ! it is not managed yet for structured mesh !"); if(st[0].getGeo()!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension())) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on expected geo type !"); - if(getNumberOfNodes()!=(int)nodesFetched.size()) + if(getNumberOfNodes()!=(mcIdType)nodesFetched.size()) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : invalid size of array !"); if(st[0].getPflName().empty()) { std::fill(nodesFetched.begin(),nodesFetched.end(),true); return ; } - const DataArrayInt *arr(globs->getProfile(st[0].getPflName())); + const DataArrayIdType *arr(globs->getProfile(st[0].getPflName())); const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before - int sz(nodesFetched.size()); - for(const int *work=arr->begin();work!=arr->end();work++) + mcIdType sz(nodesFetched.size()); + for(const mcIdType *work=arr->begin();work!=arr->end();work++) { - std::vector conn; + std::vector conn; cmesh->getNodeIdsOfCell(*work,conn); - for(std::vector::const_iterator it=conn.begin();it!=conn.end();it++) + for(std::vector::const_iterator it=conn.begin();it!=conn.end();it++) if(*it>=0 && *it& famCells, MCAuto& numCells, MCAuto& namesCells) + MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells) { med_bool chgt=MED_FALSE,trsf=MED_FALSE; med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim); - int nbOfElt(0); + mcIdType nbOfElt(0); nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isCellFamilyFieldReading()) { - famCells=DataArrayInt::New(); - famCells->alloc(nbOfElt,1); - MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer())); + MCAuto miFamCells=DataArrayMedInt::New(); + miFamCells->alloc(nbOfElt,1); + MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miFamCells->getPointer())); + famCells = FromMedIntArray( miFamCells ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf); @@ -6585,9 +6587,10 @@ void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int { if(!mrs || mrs->isCellNumFieldReading()) { - numCells=DataArrayInt::New(); - numCells->alloc(nbOfElt,1); - MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer())); + MCAuto miNumCells=DataArrayMedInt::New(); + miNumCells->alloc(nbOfElt,1); + MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miNumCells->getPointer())); + numCells = FromMedIntArray( miNumCells ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf); @@ -6614,19 +6617,20 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt setTimeUnit(strm->getTimeUnit()); MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf)); + mcIdType nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf)); if(nbOfElt>0) { if(!mrs || mrs->isNodeFamilyFieldReading()) { - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); if(nbOfElt>nbNodes) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::loadStrMeshFromFile : invalid size of family node array regarding number of nodes in this ! File seems to be corrupted !"); - _fam_nodes=DataArrayInt::New(); - _fam_nodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line. + MCAuto miFamNodes=DataArrayMedInt::New(); + miFamNodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line. if(nbNodes>nbOfElt)//yes it appends some times... It explains surely the mdump implementation. Bug revealed by PARAVIS EDF #2475 on structured.med file where only 12 first nodes are !=0 so nbOfElt=12 and nbOfNodes=378... - _fam_nodes->fillWithZero(); - MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer())); + miFamNodes->fillWithZero(); + MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miFamNodes->getPointer())); + _fam_nodes = FromMedIntArray( miFamNodes ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf); @@ -6634,9 +6638,10 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt { if(!mrs || mrs->isNodeNumFieldReading()) { - _num_nodes=DataArrayInt::New(); - _num_nodes->alloc(nbOfElt,1); - MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer())); + MCAuto miNumNodes=DataArrayMedInt::New(); + miNumNodes->alloc(nbOfElt,1); + MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miNumNodes->getPointer())); + _num_nodes = FromMedIntArray( miNumNodes ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf); @@ -6661,18 +6666,18 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma int meshDim(getStructuredMesh()->getMeshDimension()); med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1)); // - if((const DataArrayInt *)_fam_cells) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer())); - if((const DataArrayInt *)_fam_faces) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),_fam_faces->getConstPointer())); - if((const DataArrayInt *)_fam_nodes) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer())); - if((const DataArrayInt *)_num_cells) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer())); - if((const DataArrayInt *)_num_faces) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),_num_faces->getConstPointer())); - if((const DataArrayInt *)_num_nodes) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer())); + if((const DataArrayIdType *)_fam_cells) + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_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())); + if((const DataArrayIdType *)_fam_nodes) + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_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())); + if((const DataArrayIdType *)_num_faces) + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_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())); if((const DataArrayAsciiChar *)_names_cells) { if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -7228,8 +7233,8 @@ void MEDFileCurveLinearMesh::writeMeshLL(med_idt fid) const if(_univ_wr_status) MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa)); MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID)); - std::vector nodeGridSt=_clmesh->getNodeGridStructure(); - MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,&nodeGridSt[0])); + 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())); // diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 4b54ed0ce..aadb0fcc3 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -74,21 +74,21 @@ namespace MEDCoupling MEDLOADER_EXPORT void setAxisType(MEDCouplingAxisType at) { _axis_type=at; } MEDLOADER_EXPORT MEDCouplingAxisType getAxisType() const { return _axis_type; } MEDLOADER_EXPORT std::vector getAllGeoTypes() const; - MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0; - MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual mcIdType getNumberOfNodes() const = 0; + MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual bool hasImplicitPart() const = 0; - MEDLOADER_EXPORT virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0; + MEDLOADER_EXPORT virtual mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0; MEDLOADER_EXPORT virtual void releaseImplicitPartIfAny() const = 0; MEDLOADER_EXPORT virtual std::vector getGeoTypesAtLevel(int meshDimRelToMax) const = 0; - MEDLOADER_EXPORT virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0; + MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevels() const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getFamArrNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getNumArrNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getNameArrNonEmptyLevelsExt() const = 0; - MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0; - MEDLOADER_EXPORT virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; + MEDLOADER_EXPORT virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; MEDLOADER_EXPORT virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *cartesianize() const = 0; MEDLOADER_EXPORT virtual bool presenceOfStructureElements() const = 0; @@ -97,41 +97,41 @@ namespace MEDCoupling MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const; MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const; MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const; - MEDLOADER_EXPORT bool existsFamily(int famId) const; + MEDLOADER_EXPORT bool existsFamily(mcIdType famId) const; MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const; - MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id); - MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id); - MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id); + MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, mcIdType id); + MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, mcIdType id); + MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, mcIdType id); MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName); - MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); + MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName); - MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created); - MEDLOADER_EXPORT void setFamilyInfo(const std::map& info); + MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(mcIdType id, bool& created); + MEDLOADER_EXPORT void setFamilyInfo(const std::map& info); MEDLOADER_EXPORT void setGroupInfo(const std::map >&info); MEDLOADER_EXPORT void copyFamGrpMapsFrom(const MEDFileMesh& other); MEDLOADER_EXPORT void clearGrpMap(); MEDLOADER_EXPORT void clearFamMap(); MEDLOADER_EXPORT void clearFamGrpMaps(); - MEDLOADER_EXPORT const std::map& getFamilyInfo() const { return _families; } + MEDLOADER_EXPORT const std::map& getFamilyInfo() const { return _families; } MEDLOADER_EXPORT const std::map >& getGroupInfo() const { return _groups; } MEDLOADER_EXPORT std::vector getFamiliesOnGroup(const std::string& name) const; MEDLOADER_EXPORT std::vector getFamiliesOnGroups(const std::vector& grps) const; - MEDLOADER_EXPORT std::vector getFamiliesIdsOnGroup(const std::string& name) const; + MEDLOADER_EXPORT std::vector getFamiliesIdsOnGroup(const std::string& name) const; MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector& fams); - MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); + MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); MEDLOADER_EXPORT std::vector getGroupsOnFamily(const std::string& name) const; MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector& grps); MEDLOADER_EXPORT std::vector getGroupsNames() const; MEDLOADER_EXPORT std::vector getFamiliesNames() const; MEDLOADER_EXPORT std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; - MEDLOADER_EXPORT std::vector getGrpNonEmptyLevels(const std::string& grp) const; - MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; - MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; - MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevels(const std::vector& fams) const = 0; - MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const = 0; - MEDLOADER_EXPORT std::vector getFamNonEmptyLevels(const std::string& fam) const; - MEDLOADER_EXPORT std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; + MEDLOADER_EXPORT std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; + MEDLOADER_EXPORT std::vector getGrpNonEmptyLevels(const std::string& grp) const; + MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; + MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; + MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevels(const std::vector& fams) const = 0; + MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const = 0; + MEDLOADER_EXPORT std::vector getFamNonEmptyLevels(const std::string& fam) const; + MEDLOADER_EXPORT std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; MEDLOADER_EXPORT std::vector getFamiliesNamesWithFilePointOfView() const; MEDLOADER_EXPORT static std::string GetMagicFamilyStr(); MEDLOADER_EXPORT void assignFamilyNameWithGroupName(); @@ -147,22 +147,22 @@ namespace MEDCoupling MEDLOADER_EXPORT void checkOrphanFamilyZero() const; MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName); MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName); - MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId); + MEDLOADER_EXPORT void changeFamilyId(mcIdType oldId, mcIdType newId); MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames); - MEDLOADER_EXPORT int getFamilyId(const std::string& name) const; - MEDLOADER_EXPORT int getMaxAbsFamilyId() const; - MEDLOADER_EXPORT int getMaxFamilyId() const; - MEDLOADER_EXPORT int getMinFamilyId() const; - MEDLOADER_EXPORT int getTheMaxAbsFamilyId() const; - MEDLOADER_EXPORT int getTheMaxFamilyId() const; - MEDLOADER_EXPORT int getTheMinFamilyId() const; - MEDLOADER_EXPORT virtual int getMaxAbsFamilyIdInArrays() const = 0; - MEDLOADER_EXPORT virtual int getMaxFamilyIdInArrays() const = 0; - MEDLOADER_EXPORT virtual int getMinFamilyIdInArrays() const = 0; - MEDLOADER_EXPORT DataArrayInt *getAllFamiliesIdsReferenced() const; - MEDLOADER_EXPORT DataArrayInt *computeAllFamilyIdsInUse() const; - MEDLOADER_EXPORT std::vector getFamiliesIds(const std::vector& famNames) const; - MEDLOADER_EXPORT std::string getFamilyNameGivenId(int id) const; + MEDLOADER_EXPORT mcIdType getFamilyId(const std::string& name) const; + MEDLOADER_EXPORT mcIdType getMaxAbsFamilyId() const; + MEDLOADER_EXPORT mcIdType getMaxFamilyId() const; + MEDLOADER_EXPORT mcIdType getMinFamilyId() const; + MEDLOADER_EXPORT mcIdType getTheMaxAbsFamilyId() const; + MEDLOADER_EXPORT mcIdType getTheMaxFamilyId() const; + MEDLOADER_EXPORT mcIdType getTheMinFamilyId() const; + MEDLOADER_EXPORT virtual mcIdType getMaxAbsFamilyIdInArrays() const = 0; + MEDLOADER_EXPORT virtual mcIdType getMaxFamilyIdInArrays() const = 0; + MEDLOADER_EXPORT virtual mcIdType getMinFamilyIdInArrays() const = 0; + MEDLOADER_EXPORT DataArrayIdType *getAllFamiliesIdsReferenced() const; + MEDLOADER_EXPORT DataArrayIdType *computeAllFamilyIdsInUse() const; + MEDLOADER_EXPORT std::vector getFamiliesIds(const std::vector& famNames) const; + MEDLOADER_EXPORT std::string getFamilyNameGivenId(mcIdType id) const; MEDLOADER_EXPORT bool ensureDifferentFamIdsPerLevel(); MEDLOADER_EXPORT void normalizeFamIdsTrio(); MEDLOADER_EXPORT void normalizeFamIdsMEDFile(); @@ -170,30 +170,30 @@ namespace MEDCoupling MEDLOADER_EXPORT virtual std::string simpleRepr() const; MEDLOADER_EXPORT virtual std::string advancedRepr() const = 0; // - MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false); - MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) = 0; - MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) = 0; + MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false); + MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) = 0; + MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) = 0; MEDLOADER_EXPORT virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) = 0; - MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) = 0; - MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayInt *ids) = 0; - MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) = 0; - MEDLOADER_EXPORT virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0; - MEDLOADER_EXPORT DataArrayInt *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) = 0; + MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayIdType *ids) = 0; + MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) = 0; + MEDLOADER_EXPORT virtual const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0; + MEDLOADER_EXPORT DataArrayIdType *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt); + MEDLOADER_EXPORT virtual const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const = 0; - MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; + MEDLOADER_EXPORT virtual MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const = 0; + MEDLOADER_EXPORT virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; // tools - MEDLOADER_EXPORT virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) = 0; + MEDLOADER_EXPORT virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) = 0; MEDLOADER_EXPORT int getNumberOfJoints() const; MEDLOADER_EXPORT MEDFileJoints *getJoints() const; MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints ); @@ -211,17 +211,17 @@ namespace MEDCoupling void dealWithTinyInfo(const MEDCouplingMesh *m); virtual void synchronizeTinyInfoOnLeaves() const = 0; void getFamilyRepr(std::ostream& oss) const; - virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); - virtual void changeFamilyIdArr(int oldId, int newId) = 0; - virtual std::list< MCAuto > getAllNonNullFamilyIds() const = 0; + virtual void appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); + virtual void changeFamilyIdArr(mcIdType oldId, mcIdType newId) = 0; + virtual std::list< MCAuto > getAllNonNullFamilyIds() const = 0; virtual void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) = 0; void loadLLWithAdditionalItems(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr); - static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp); + void addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr); + static void TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector >& famIdsPerGrp); static void ChangeAllGroupsContainingFamily(std::map >& groups, const std::string& familyNameToChange, const std::vector& newFamiliesNames); - static std::string FindOrCreateAndGiveFamilyWithId(std::map& families, int id, bool& created); + static std::string FindOrCreateAndGiveFamilyWithId(std::map& families, mcIdType id, bool& created); static std::string CreateNameNotIn(const std::string& nameTry, const std::vector& namesToAvoid); - static int PutInThirdComponentOfCodeOffset(std::vector& code, int strt); + static mcIdType PutInThirdComponentOfCodeOffset(std::vector& code, mcIdType strt); void writeJoints(med_idt fid) const; void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0); void loadEquivalences(med_idt fid); @@ -229,7 +229,7 @@ namespace MEDCoupling bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const; void getEquivalencesRepr(std::ostream& oss) const; void checkCartesian() const; - void checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const; + void checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const; private: virtual void writeMeshLL(med_idt fid) const = 0; protected: @@ -247,7 +247,7 @@ namespace MEDCoupling MCAuto _equiv; protected: std::map > _groups; - std::map _families; + std::map _families; public: MEDLOADER_EXPORT static const char DFT_FAM_NAME[]; }; @@ -265,8 +265,8 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem); MEDLOADER_EXPORT static MEDFileUMesh *New(); - MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); - MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + MEDLOADER_EXPORT static MEDFileUMesh *LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -281,28 +281,28 @@ namespace MEDCoupling MEDLOADER_EXPORT void setName(const std::string& name); MEDLOADER_EXPORT const std::vector< MCAuto >& getAccessOfUndergroundEltStrs() const { return _elt_str; } // - MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMinFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const; MEDLOADER_EXPORT int getMeshDimension() const; MEDLOADER_EXPORT int getSpaceDimension() const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT std::string advancedRepr() const; - MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt); + MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const; - MEDLOADER_EXPORT int getNumberOfNodes() const; - MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodes() const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT bool hasImplicitPart() const; - MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; MEDLOADER_EXPORT void releaseImplicitPartIfAny() const; MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const; - MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const; MEDLOADER_EXPORT MEDFileMesh *cartesianize() const; MEDLOADER_EXPORT bool presenceOfStructureElements() const; @@ -312,17 +312,17 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; MEDLOADER_EXPORT DataArrayDouble *getCoords() const; MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const; - MEDLOADER_EXPORT std::vector getDistributionOfTypes(int meshDimRelToMax) const; - MEDLOADER_EXPORT std::vector< std::pair > getAllDistributionOfTypes() const; + MEDLOADER_EXPORT std::vector getDistributionOfTypes(int meshDimRelToMax) const; + MEDLOADER_EXPORT std::vector< std::pair > getAllDistributionOfTypes() const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const; MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const; @@ -330,20 +330,20 @@ namespace MEDCoupling MEDLOADER_EXPORT void forceComputationOfParts() const; MEDLOADER_EXPORT std::vector getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const; MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const; - MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; MEDLOADER_EXPORT int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; // - MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName); + MEDLOADER_EXPORT void setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName); MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords); MEDLOADER_EXPORT void setCoordsForced(DataArrayDouble *coords); MEDLOADER_EXPORT void eraseGroupsAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); - MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); + MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr); + MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr); MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr); - MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr); - MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids); - MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids); + MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr); + MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids); + MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids); MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax); MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m); MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false); @@ -352,11 +352,11 @@ namespace MEDCoupling MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum=false); MEDLOADER_EXPORT void optimizeFamilies(); // tools - MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified); - MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); - MEDLOADER_EXPORT DataArrayInt *zipCoords(); - MEDLOADER_EXPORT DataArrayInt *deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const; - MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map >& extractDef) const; + MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified); + MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell); + MEDLOADER_EXPORT DataArrayIdType *zipCoords(); + MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const; + MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map >& extractDef) const; MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const; MEDLOADER_EXPORT MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const; MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const; @@ -364,16 +364,16 @@ namespace MEDCoupling MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& meshes); MEDLOADER_EXPORT MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const; // serialization - MEDLOADER_EXPORT void serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); - MEDLOADER_EXPORT void unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); + MEDLOADER_EXPORT void serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); + MEDLOADER_EXPORT void unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); private: MEDLOADER_EXPORT ~MEDFileUMesh(); void writeMeshLL(med_idt fid) const; MEDFileUMesh(); MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void dispatchLoadedPart(med_idt fid, const MEDFileUMeshL2& loaderl2, const std::string& mName, MEDFileMeshReadSelector *mrs); const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const; @@ -382,19 +382,19 @@ namespace MEDCoupling DataArrayDouble *checkMultiMesh(const std::vector& ms) const; void computeRevNum() const; void synchronizeTinyInfoOnLeaves() const; - void changeFamilyIdArr(int oldId, int newId); - std::list< MCAuto > getAllNonNullFamilyIds() const; + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); + std::list< MCAuto > getAllNonNullFamilyIds() const; MCAuto& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m); private: static const char SPE_FAM_STR_EXTRUDED_MESH[]; private: std::vector< MCAuto > _ms; MCAuto _coords; - MCAuto _fam_coords; ///< Node family indices - MCAuto _num_coords; - MCAuto _global_num_coords; + MCAuto _fam_coords; ///< Node family indices + MCAuto _num_coords; + MCAuto _global_num_coords; MCAuto _name_coords; - mutable MCAuto _rev_num_coords; + mutable MCAuto _rev_num_coords; MCAuto _part_coords; std::vector< MCAuto > _elt_str; }; @@ -405,50 +405,50 @@ namespace MEDCoupling public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMinFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMaxAbsFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMaxFamilyIdInArrays() const; + MEDLOADER_EXPORT mcIdType getMinFamilyIdInArrays() const; MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const; MEDLOADER_EXPORT void clearNonDiscrAttributes() const; - MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); - MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); + MEDLOADER_EXPORT DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + MEDLOADER_EXPORT const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt); + MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr); + MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr); MEDLOADER_EXPORT void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr); - MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr); - MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids); - MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids); - MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr); + MEDLOADER_EXPORT void addNodeGroup(const DataArrayIdType *ids); + MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids); + MEDLOADER_EXPORT const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT std::vector getNonEmptyLevels() const; MEDLOADER_EXPORT std::vector getNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getFamArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getNumArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT std::vector getNameArrNonEmptyLevelsExt() const; MEDLOADER_EXPORT MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; - MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; - MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT int getNumberOfNodes() const; - MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevels(const std::vector& fams) const; + MEDLOADER_EXPORT std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; + MEDLOADER_EXPORT mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodes() const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT bool hasImplicitPart() const; - MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const; MEDLOADER_EXPORT void releaseImplicitPartIfAny() const; MEDLOADER_EXPORT MEDCoupling1SGTUMesh *getImplicitFaceMesh() const; MEDLOADER_EXPORT std::vector getGeoTypesAtLevel(int meshDimRelToMax) const; - MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const; MEDLOADER_EXPORT bool presenceOfStructureElements() const { return false; } MEDLOADER_EXPORT virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0; // tools - MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); + MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell); protected: ~MEDFileStructuredMesh() { } - void changeFamilyIdArr(int oldId, int newId); - std::list< MCAuto > getAllNonNullFamilyIds() const; + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); + std::list< MCAuto > getAllNonNullFamilyIds() const; void deepCpyAttributes(); void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); void writeStructuredLL(med_idt fid, const std::string& maa) const; @@ -457,19 +457,19 @@ namespace MEDCoupling static med_geometry_type GetGeoTypeFromMeshDim(int meshDim); private: static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs, - MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells); + MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells); private: - MCAuto _fam_nodes; - MCAuto _num_nodes; + MCAuto _fam_nodes; + MCAuto _num_nodes; MCAuto _names_nodes; - MCAuto _fam_cells; - MCAuto _num_cells; + MCAuto _fam_cells; + MCAuto _num_cells; MCAuto _names_cells; - MCAuto _fam_faces; - MCAuto _num_faces; + MCAuto _fam_faces; + MCAuto _num_faces; MCAuto _names_faces; - mutable MCAuto _rev_num_nodes; - mutable MCAuto _rev_num_cells; + mutable MCAuto _rev_num_nodes; + mutable MCAuto _rev_num_cells; mutable MCAuto _faces_if_necessary; }; diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index f222b32c9..5f682cfda 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -21,6 +21,7 @@ #include "MEDFileMeshElt.hxx" #include "MEDFileSafeCaller.txx" #include "MEDFileMeshReadSelector.hxx" +#include "MEDFileBasis.hxx" #include "MEDCouplingUMesh.hxx" @@ -48,10 +49,11 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i { if(!mrs || mrs->isCellFamilyFieldReading()) { - _fam=DataArrayInt::New(); - _fam->alloc(curNbOfElem,1); - if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0) - std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0); + MCAuto miFam=DataArrayMedInt::New(); + miFam->alloc(curNbOfElem,1); + if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,miFam->getPointer())!=0) + std::fill(miFam->getPointer(),miFam->getPointer()+curNbOfElem,0); + _fam=FromMedIntArray( miFam ); } } _num=0; @@ -59,10 +61,11 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i { if(!mrs || mrs->isCellNumFieldReading()) { - _num=DataArrayInt::New(); - _num->alloc(curNbOfElem,1); - if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,_num->getPointer())!=0) - _num=0; + MCAuto miNum=DataArrayMedInt::New(); + miNum->alloc(curNbOfElem,1); + if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0) + miNum=0; + _num=FromMedIntArray(miNum); } } _names=0; @@ -88,8 +91,8 @@ std::size_t MEDFileUMeshPerTypeCommon::getHeapMemorySizeWithoutChildren() const std::vector MEDFileUMeshPerTypeCommon::getDirectChildrenWithNull() const { std::vector ret; - ret.push_back((const DataArrayInt *)_num); - ret.push_back((const DataArrayInt *)_fam); + ret.push_back((const DataArrayIdType *)_num); + ret.push_back((const DataArrayIdType *)_fam); ret.push_back((const DataArrayAsciiChar *)_names); return ret; } @@ -196,12 +199,12 @@ void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int { _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); - MCAuto conn(DataArrayInt::New()); + MCAuto conn(DataArrayMedInt::New()); int 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)); - mc->setNodalConnectivity(conn); + mc->setNodalConnectivity(FromMedIntArray(conn)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } @@ -215,7 +218,7 @@ void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType")); _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); - MCAuto conn(DataArrayInt::New()); + MCAuto conn(DataArrayMedInt::New()); int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; @@ -226,7 +229,7 @@ void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int 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)); - mc->setNodalConnectivity(conn); + mc->setNodalConnectivity(FromMedIntArray(conn)); loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs); } @@ -239,7 +242,7 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam { if(!mrs || mrs->isCellFamilyFieldReading()) { - _fam=DataArrayInt::New(); + _fam=DataArrayIdType::New(); _fam->alloc(nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, @@ -256,7 +259,7 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam { if(!mrs || mrs->isCellNumFieldReading()) { - _num=DataArrayInt::New(); + _num=DataArrayIdType::New(); _num->alloc(nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, @@ -296,12 +299,12 @@ void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int med_int 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(DataArrayInt::New()),connI(DataArrayInt::New()); + 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)); - mc->setNodalConnectivity(conn,connI); + mc->setNodalConnectivity(FromMedIntArray(conn),FromMedIntArray(connI)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } @@ -317,31 +320,31 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int INTERP_KERNEL::AutoPtr indexFace=new int[indexFaceLgth]; INTERP_KERNEL::AutoPtr locConn=new int[connFaceLgth]; MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn)); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); int arraySize=connFaceLgth; for(int i=0;ialloc(arraySize,1); - int *wFinalConn=conn->getPointer(); + mcIdType *wFinalConn=conn->getPointer(); connI->alloc(curNbOfElem+1,1); - int *finalIndex(connI->getPointer()); + mcIdType *finalIndex(connI->getPointer()); finalIndex[0]=0; - for(int i=0;i(),-1)); - for(int j=index[i];j(),-1)); + for(mcIdType j=index[i];j(),-1)); + wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus(),-1)); } } mc->setNodalConnectivity(conn,connI); loadCommonPart(fid,mName,dt,it,curNbOfElem,MED_POLYHEDRON,entity,mrs); } -void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names) +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(); if(nbOfCells<1) @@ -356,7 +359,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1SGTUMesh *m0(dynamic_cast(m)); if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); - MCAuto arr(m0->getNodalConnectivity()->deepCopy()); + 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())); } @@ -367,29 +370,29 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !"); if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG) { - MCAuto arr(m0->getNodalConnectivity()->deepCopy()),arrI(m0->getNodalConnectivityIndex()->deepCopy()); + 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())); } else { - const int *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin()); - int meshLgth=m0->getNodalConnectivityLength(); - int nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells; - INTERP_KERNEL::AutoPtr tab1=new int[nbOfCells+1]; - int *w1=tab1; *w1=1; - INTERP_KERNEL::AutoPtr tab2=new int[nbOfFaces+1]; - int *w2=tab2; *w2=1; - INTERP_KERNEL::AutoPtr bigtab=new int[meshLgth]; - int *bt=bigtab; - for(int i=0;igetNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin()); + mcIdType meshLgth=m0->getNodalConnectivityLength(); + mcIdType nbOfFaces=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]; + med_int *w2=tab2; *w2=1; + INTERP_KERNEL::AutoPtr bigtab=new med_int[meshLgth]; + med_int *bt=bigtab; + for(mcIdType i=0;i(),1)); + 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; if(wend!=conn+connI[i+1]) @@ -404,9 +407,9 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, } } if(fam) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray(fam)->getConstPointer())); if(num) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,ToMedIntArray(num)->getConstPointer())); if(names) { if(names->getNumberOfComponents()!=MED_SNAME_SIZE) diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index c6fef7af0..c81d55c67 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -43,12 +43,12 @@ namespace MEDCoupling med_entity_type entity, MEDFileMeshReadSelector *mrs); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - const DataArrayInt *getFam() const { return _fam; } - const DataArrayInt *getNum() const { return _num; } + const DataArrayIdType *getFam() const { return _fam; } + const DataArrayIdType *getNum() const { return _num; } const DataArrayAsciiChar *getNames() const { return _names; } protected: - MCAuto _num; - MCAuto _fam; + MCAuto _num; + MCAuto _fam; MCAuto _names; }; @@ -63,7 +63,7 @@ namespace MEDCoupling int getDim() const; MEDCoupling1GTUMesh *getMesh() const { return const_cast((const MEDCoupling1GTUMesh *)_m); } const PartDefinition *getPartDef() const { return _pd; } - static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names); + static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names); private: MEDFileUMeshPerType(); MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 898c50145..e5ad01db8 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -256,7 +256,7 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( { meshType=UNSTRUCTURED; dt=MED_NO_DT; it=MED_NO_IT; dtunit1.clear(); - axType=axType=TraduceAxisType(axistype); + axType=TraduceAxisType(axistype); return new StructMeshCls(ret); } default: @@ -278,15 +278,15 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, const Mes return mId->getAxisInfoOnMesh(fid,mName,meshType,axType,nstep,Mdim,_description,_dt_unit,_univ_name); } -void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs) +void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs) { if(mrs && !(mrs->isCellFamilyFieldReading() || mrs->isNodeFamilyFieldReading())) return ; char nomfam[MED_NAME_SIZE+1]; med_int numfam; - int nfam=MEDnFamily(fid,meshName.c_str()); - std::vector< std::pair > > > crudeFams(nfam); - for(int i=0;i > > > crudeFams(nfam); + for(mcIdType i=0;i > >(famName,std::pair >(numfam,grps)); } RenameFamiliesFromFileToMemInternal(crudeFams); - for(std::vector< std::pair > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++) + for(std::vector< std::pair > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++) { fams[(*it0).first]=(*it0).second.first; for(std::vector::const_iterator it1=(*it0).second.second.begin();it1!=(*it0).second.second.end();it1++) @@ -310,11 +310,11 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName } } -void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol) +void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol) { - std::vector< std::pair > > > crudeFams(fams.size()); + std::vector< std::pair > > > crudeFams(fams.size()); std::size_t ii(0); - for(std::map::const_iterator it=fams.begin();it!=fams.end();it++,ii++) + for(std::map::const_iterator it=fams.begin();it!=fams.end();it++,ii++) { std::vector grpsOfFam; for(std::map >::const_iterator it1=grps.begin();it1!=grps.end();it1++) @@ -322,12 +322,12 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, if(std::find((*it1).second.begin(),(*it1).second.end(),(*it).first)!=(*it1).second.end()) grpsOfFam.push_back((*it1).first); } - crudeFams[ii]=std::pair > >((*it).first,std::pair >((*it).second,grpsOfFam)); + crudeFams[ii]=std::pair > >((*it).first,std::pair >((*it).second,grpsOfFam)); } RenameFamiliesFromMemToFileInternal(crudeFams); - for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++) + for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++) { - int ngro((*it).second.second.size()); + mcIdType 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++) @@ -339,16 +339,16 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, } } -void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func) +void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func) { std::size_t ii(0); std::vector fams(crudeFams.size()); - for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) + for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) fams[ii]=(*it).first; if(!func(fams)) return ; ii=0; - for(std::vector< std::pair > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) + for(std::vector< std::pair > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) (*it).first=fams[ii]; } @@ -356,14 +356,14 @@ void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams) +void MEDFileMeshL2::RenameFamiliesFromFileToMemInternal(std::vector< std::pair > > >& crudeFams) { RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromFileToMem); } bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famNames) { - std::map m; + std::map m; std::set s; for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++) { @@ -375,7 +375,7 @@ bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famN return false;// the general case ! for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++) { - std::map::iterator it2(m.find(*it)); + std::map::iterator it2(m.find(*it)); if(it2!=m.end()) { std::ostringstream oss; oss << *it << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++; @@ -389,7 +389,7 @@ bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famN * This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it. * So this method renames families (if needed generally not !) in order to have a discriminant name for families. */ -void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams) +void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams) { RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromMemToFile); } @@ -413,7 +413,7 @@ bool MEDFileMeshL2::RenameFamiliesFromMemToFile(std::vector< std::string >& famN if(found!=std::string::npos && found>=1) { std::string s1((*it).substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1)); - if(s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS) + if((int)s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS) continue; int k(-1); std::istringstream iss(s1); @@ -544,7 +544,7 @@ void MEDFileUMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const loadCoords(fid,infosOnComp,mName,dt,it); } -void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { int Mdim; std::vector infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim)); @@ -552,13 +552,13 @@ void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const return ; loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs); med_bool changement,transformation; - int nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + mcIdType nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); std::vector fetchedNodeIds(nCoords,false); 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); - int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))); - int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),true))); + 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))); 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++) @@ -579,7 +579,7 @@ void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& sortTypes(); } -void MEDFileUMeshL2::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 MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { std::size_t nbOfTypes(types.size()); if(slicPerTyp.size()!=3*nbOfTypes) @@ -591,7 +591,7 @@ void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::st _per_type_mesh[0].clear(); for(std::size_t ii=0;ii tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs)); _per_type_mesh[0].push_back(tmp); } @@ -610,17 +610,19 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr)); if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _fam_coords=DataArrayInt::New(); - _fam_coords->alloc(nCoords,1); - MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer())); + MCAuto miFamCoord=DataArrayMedInt::New(); + miFamCoord->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miFamCoord->getPointer())); + _fam_coords=FromMedIntArray(miFamCoord); } else _fam_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _num_coords=DataArrayInt::New(); - _num_coords->alloc(nCoords,1); - MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer())); + MCAuto miNumCoord=DataArrayMedInt::New(); + miNumCoord->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer())); + _num_coords=FromMedIntArray(miNumCoord); } else _num_coords=0; @@ -635,9 +637,10 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf _name_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _global_num_coords=DataArrayInt::New(); - _global_num_coords->alloc(nCoords,1); - MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_global_num_coords->getPointer())); + MCAuto miNumCoord=DataArrayMedInt::New(); + miNumCoord->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer())); + _global_num_coords=FromMedIntArray(miNumCoord); } for(int i=0;isetInfoOnComponent(i,infosOnComp[i]); @@ -662,17 +665,19 @@ void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector& MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2); if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _fam_coords=DataArrayInt::New(); - _fam_coords->alloc(nbNodesToLoad,1); - MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer())); + MCAuto miFamCoord=DataArrayMedInt::New(); + miFamCoord->alloc(nbNodesToLoad,1); + MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miFamCoord->getPointer())); + _fam_coords=FromMedIntArray(miFamCoord); } else _fam_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _num_coords=DataArrayInt::New(); - _num_coords->alloc(nbNodesToLoad,1); - MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer())); + MCAuto miNumCoord=DataArrayMedInt::New(); + miNumCoord->alloc(nbNodesToLoad,1); + MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miNumCoord->getPointer())); + _num_coords=FromMedIntArray(miNumCoord); } else _num_coords=0; @@ -722,15 +727,15 @@ void MEDFileUMeshL2::sortTypes() _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev); } -void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords) +void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords) { if(!coords) return ; MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin())); if(famCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),ToMedIntArray(famCoords)->begin())); if(numCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),ToMedIntArray(numCoords)->begin())); if(nameCoords) { if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -742,7 +747,7 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin())); } if(globalNumCoords) - MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),globalNumCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),ToMedIntArray(globalNumCoords)->begin())); } bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const @@ -840,9 +845,11 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const _order=it; // _clmesh=MEDCouplingCurveLinearMesh::New(); - INTERP_KERNEL::AutoPtr stGrid=new int[Mdim]; - MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,stGrid)); - _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim); + MCAuto miStGrid=DataArrayMedInt::New(); + miStGrid->alloc(Mdim,1); + MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,miStGrid->getPointer())); + MCAuto stGrid=FromMedIntArray(miStGrid); + _clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end()); med_bool chgt=MED_FALSE,trsf=MED_FALSE; int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf)); MCAuto da=DataArrayDouble::New(); @@ -917,7 +924,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st return; int sz=v.size(); std::vector ms(sz); - std::vector fams(sz),nums(sz); + std::vector fams(sz),nums(sz); std::vector names(sz); std::vector pds(sz); for(int i=0;igetFam(); if(sz!=1) - _fam=DataArrayInt::Aggregate(fams); + _fam=DataArrayIdType::Aggregate(fams); else { fams[0]->incrRef(); - _fam=const_cast(fams[0]); + _fam=const_cast(fams[0]); } } if(l2.isNumDefinedOnLev(id)) @@ -947,11 +954,11 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st for(int i=0;igetNum(); if(sz!=1) - _num=DataArrayInt::Aggregate(nums); + _num=DataArrayIdType::Aggregate(nums); else { nums[0]->incrRef(); - _num=const_cast(nums[0]); + _num=const_cast(nums[0]); } computeRevNum(); } @@ -995,9 +1002,9 @@ std::vector MEDFileUMeshSplitL1::getDirectChildrenWithN std::vector ret; ret.push_back(&_m_by_types); ret.push_back(&_m); - ret.push_back((const DataArrayInt*)_fam); - ret.push_back((const DataArrayInt*)_num); - ret.push_back((const DataArrayInt*)_rev_num); + ret.push_back((const DataArrayIdType*)_fam); + ret.push_back((const DataArrayIdType*)_num); + ret.push_back((const DataArrayIdType*)_rev_num); ret.push_back((const DataArrayAsciiChar*)_names); return ret; } @@ -1014,11 +1021,11 @@ MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::deepCopy(DataArrayDouble *coords) cons { MCAuto ret(new MEDFileUMeshSplitL1(*this)); ret->_m_by_types=_m_by_types.deepCopy(coords); - if((const DataArrayInt *)_fam) + if((const DataArrayIdType *)_fam) ret->_fam=_fam->deepCopy(); - if((const DataArrayInt *)_num) + if((const DataArrayIdType *)_num) ret->_num=_num->deepCopy(); - if((const DataArrayInt *)_rev_num) + if((const DataArrayIdType *)_rev_num) ret->_rev_num=_rev_num->deepCopy(); if((const DataArrayAsciiChar *)_names) ret->_names=_names->deepCopy(); @@ -1029,12 +1036,12 @@ void MEDFileUMeshSplitL1::checkConsistency() const { if (!_fam || _fam->getNumberOfTuples() != getSize()) throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): internal family array has an invalid size!"); - int nbCells = getSize(); + mcIdType nbCells = getSize(); if (_num) { _num->checkNbOfTuplesAndComp(nbCells,1,"MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal node numbering array!"); - int pos; - int maxValue=_num->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num->getMaxValue(pos); if (!_rev_num || _rev_num->getNumberOfTuples() != (maxValue+1)) throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal revert node numbering array!"); } @@ -1052,8 +1059,8 @@ bool MEDFileUMeshSplitL1::isEqual(const MEDFileUMeshSplitL1 *other, double eps, { if(!_m_by_types.isEqual(other->_m_by_types,eps,what)) return false; - const DataArrayInt *d1=_fam; - const DataArrayInt *d2=other->_fam; + const DataArrayIdType *d1=_fam; + const DataArrayIdType *d2=other->_fam; if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Presence of family arr in one sublevel and not in other!"; @@ -1126,7 +1133,7 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) m->incrRef(); _m=m; _m_by_types.assignUMesh(dynamic_cast(m->deepCopy())); - MCAuto da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO); + MCAuto da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO); if(!da->isIota(m->getNumberOfCells())) { _num=da->invertArrayO2N2N2O(m->getNumberOfCells()); @@ -1162,7 +1169,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1():_m(this) void MEDFileUMeshSplitL1::assignCommonPart() { - _fam=DataArrayInt::New(); + _fam=DataArrayIdType::New(); _fam->alloc(_m_by_types.getSize(),1); _fam->fillWithValue(0); } @@ -1172,9 +1179,9 @@ bool MEDFileUMeshSplitL1::empty() const return _m_by_types.empty(); } -bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector& ids) const +bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector& ids) const { - const DataArrayInt *fam=_fam; + const DataArrayIdType *fam=_fam; if(!fam) return false; return fam->presenceOfValue(ids); @@ -1187,32 +1194,32 @@ int MEDFileUMeshSplitL1::getMeshDimension() const void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const { - std::vector code=_m_by_types.getDistributionOfTypes(); - int nbOfTypes=code.size()/3; - for(int i=0;i code=_m_by_types.getDistributionOfTypes(); + std::size_t nbOfTypes=code.size()/3; + for(std::size_t i=0;i eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); + MCAuto eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true); if(renum) return renumIfNeeded(m,eltsToKeep->begin()); return m; } -DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const +DataArrayIdType *MEDFileUMeshSplitL1::getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const { - MCAuto da=_fam->findIdsEqualList(idsBg,idsEnd); + MCAuto da=_fam->findIdsEqualList(idsBg,idsEnd); if(renum) return renumIfNeededArr(da); return da.retn(); @@ -1223,7 +1230,7 @@ std::vector MEDFileUMeshSplitL1::getGeoTypes( return _m_by_types.getGeoTypes(); } -int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { return _m_by_types.getNumberOfCellsWithType(ct); } @@ -1231,58 +1238,58 @@ int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellT MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const { MCAuto tmp; - if(renum && ((const DataArrayInt *)_num)) + if(renum && ((const DataArrayIdType *)_num)) tmp=_m; else { tmp=_m_by_types.getUmesh(); if(tmp) tmp->incrRef(); } return tmp.retn(); } -int MEDFileUMeshSplitL1::getNumberOfCells() const +mcIdType MEDFileUMeshSplitL1::getNumberOfCells() const { return _m_by_types.getNumberOfCells(); } -DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { - const DataArrayInt *fam(_fam); + const DataArrayIdType *fam(_fam); if(!fam) return 0; - int start(0),stop(0); + mcIdType start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); return fam->selectByTupleIdSafeSlice(start,stop,1); } -DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { - const DataArrayInt *num(_num); + const DataArrayIdType *num(_num); if(!num) return 0; - int start(0),stop(0); + mcIdType start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); return num->selectByTupleIdSafeSlice(start,stop,1); } -DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() +DataArrayIdType *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() { - if((DataArrayInt *)_fam) + if((DataArrayIdType *)_fam) return _fam; - int nbOfTuples=_m_by_types.getSize(); - _fam=DataArrayInt::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero(); + mcIdType nbOfTuples=_m_by_types.getSize(); + _fam=DataArrayIdType::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero(); return _fam; } -const DataArrayInt *MEDFileUMeshSplitL1::getFamilyField() const +const DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField() const { return _fam; } -const DataArrayInt *MEDFileUMeshSplitL1::getNumberField() const +const DataArrayIdType *MEDFileUMeshSplitL1::getNumberField() const { return _num; } -const DataArrayInt *MEDFileUMeshSplitL1::getRevNumberField() const +const DataArrayIdType *MEDFileUMeshSplitL1::getRevNumberField() const { return _rev_num; } @@ -1305,37 +1312,37 @@ void MEDFileUMeshSplitL1::eraseFamilyField() /*! * This method ignores _m and _m_by_types. */ -void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, +void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, std::map >& groups) { - std::vector< DataArrayInt * > corr; + std::vector< DataArrayIdType * > corr; _m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr); - std::vector< MCAuto > corrMSafe(corr.begin(),corr.end()); - std::vector< std::vector > fidsOfGroups; - std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end()); - _fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups); - int nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells(); - std::map newfams; - std::map famIdTrad; + std::vector< MCAuto > corrMSafe(corr.begin(),corr.end()); + std::vector< std::vector > fidsOfGroups; + std::vector< const DataArrayIdType * > corr2(corr.begin(),corr.end()); + _fam=DataArrayIdType::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups); + mcIdType nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells(); + std::map newfams; + std::map famIdTrad; TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams); - int *w=_fam->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;i ms(_m_by_types.getParts()); - int start=0; + mcIdType start=0; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { - int nbCells=(*it)->getNumberOfCells(); - int end=start+nbCells; - MCAuto fam,num; + mcIdType nbCells=(*it)->getNumberOfCells(); + mcIdType end=start+nbCells; + MCAuto fam,num; MCAuto names; - if((const DataArrayInt *)_fam) + if((const DataArrayIdType *)_fam) fam=_fam->subArray(start,end); - if((const DataArrayInt *)_num) + if((const DataArrayIdType *)_num) num=_num->subArray(start,end); if((const DataArrayAsciiChar *)_names) names=static_cast(_names->subArray(start,end)); @@ -1344,51 +1351,51 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) } } -void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N) +void MEDFileUMeshSplitL1::renumberNodesInConn(const mcIdType *newNodeNumbersO2N) { _m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N); } -void MEDFileUMeshSplitL1::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const +void MEDFileUMeshSplitL1::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { bigArraysI.push_back(_fam); bigArraysI.push_back(_num); _m_by_types.serialize(tinyInt,bigArraysI); } -void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { _fam=bigArraysI.back(); bigArraysI.pop_back(); _num=bigArraysI.back(); bigArraysI.pop_back(); _m_by_types.unserialize(name,coo,tinyInt,bigArraysI); } -void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId) +void MEDFileUMeshSplitL1::changeFamilyIdArr(mcIdType oldId, mcIdType newId) { - DataArrayInt *arr=_fam; + DataArrayIdType *arr=_fam; if(arr) arr->changeValue(oldId,newId); } -void MEDFileUMeshSplitL1::setFamilyArr(DataArrayInt *famArr) +void MEDFileUMeshSplitL1::setFamilyArr(DataArrayIdType *famArr) { if(!famArr) { _fam=0; return ; } - int sz(_m_by_types.getSize()); + mcIdType sz(_m_by_types.getSize()); famArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setFamilyArr : Problem in size of Family arr ! "); famArr->incrRef(); _fam=famArr; } -DataArrayInt *MEDFileUMeshSplitL1::getFamilyField() +DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField() { return _fam; } -void MEDFileUMeshSplitL1::setRenumArr(DataArrayInt *renumArr) +void MEDFileUMeshSplitL1::setRenumArr(DataArrayIdType *renumArr) { if(!renumArr) { @@ -1396,7 +1403,7 @@ void MEDFileUMeshSplitL1::setRenumArr(DataArrayInt *renumArr) _rev_num=0; return ; } - int sz(_m_by_types.getSize()); + mcIdType sz(_m_by_types.getSize()); renumArr->checkNbOfTuplesAndComp(sz,1,"MEDFileUMeshSplitL1::setRenumArr : Problem in size of numbering arr ! "); renumArr->incrRef(); _num=renumArr; @@ -1410,13 +1417,13 @@ void MEDFileUMeshSplitL1::setNameArr(DataArrayAsciiChar *nameArr) _names=0; return ; } - int sz(_m_by_types.getSize()); + mcIdType sz(_m_by_types.getSize()); nameArr->checkNbOfTuplesAndComp(sz,MED_SNAME_SIZE,"MEDFileUMeshSplitL1::setNameArr : Problem in size of name arr ! "); nameArr->incrRef(); _names=nameArr; } -MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds) +MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds) { if(renum==0) return m; @@ -1424,63 +1431,63 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDC m->renumberCells(renum->begin(),true); else { - MCAuto locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); + MCAuto locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); m->renumberCells(locnum->begin(),true); } return m; } -MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { MCAuto ret(new MEDFileUMeshSplitL1); ret->unserialize(name,coo,tinyInt,bigArraysI); return ret.retn(); } -MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const +MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const { return Renumber2(_num,m,cellIds); } -DataArrayInt *MEDFileUMeshSplitL1::Renumber(const DataArrayInt *renum, const DataArrayInt *da) +DataArrayIdType *MEDFileUMeshSplitL1::Renumber(const DataArrayIdType *renum, const DataArrayIdType *da) { - if((const DataArrayInt *)renum==0) + if((const DataArrayIdType *)renum==0) { da->incrRef(); - return const_cast(da); + return const_cast(da); } return renum->selectByTupleId(da->begin(),da->end()); } -DataArrayInt *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayInt *da) const +DataArrayIdType *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayIdType *da) const { return Renumber(_num,da); } -std::vector MEDFileUMeshSplitL1::GetNewFamiliesNumber(int nb, const std::map& families) +std::vector MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, const std::map& families) { - int id=-1; - for(std::map::const_iterator it=families.begin();it!=families.end();it++) + mcIdType id=-1; + for(std::map::const_iterator it=families.begin();it!=families.end();it++) id=std::max(id,(*it).second); if(id==-1) id=0; - std::vector ret(nb); - for(int i=1;i<=nb;i++) + std::vector ret(nb); + for(mcIdType i=1;i<=nb;i++) ret[i]=id+i; return ret; } -void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, - std::map& famIdTrad, std::map& newfams) +void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, + std::map& famIdTrad, std::map& newfams) { - std::set allfids; + std::set allfids; //tony } void MEDFileUMeshSplitL1::computeRevNum() const { - int pos; - int maxValue=_num->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num->getMaxValue(pos); _rev_num=_num->invertArrayN2O2O2N(maxValue+1); } @@ -1561,11 +1568,11 @@ MEDCouplingUMesh *MEDFileUMeshAggregateCompute::getUmesh() const return _m; } -int MEDFileUMeshAggregateCompute::getNumberOfCells() const +mcIdType MEDFileUMeshAggregateCompute::getNumberOfCells() const { if(_mp_time<=_m_time) return _m->getNumberOfCells(); - int ret(0); + mcIdType ret(0); for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) ret+=(*it)->getNumberOfCells(); return ret; @@ -1585,7 +1592,7 @@ std::vector MEDFileUMeshAggregateCompute::get return _m->getAllGeoTypesSorted(); } -int MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { if(_mp_time>=_m_time) { @@ -1636,7 +1643,7 @@ MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::retrievePartWithoutComputatio throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !"); } -void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const +void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const { start=0; stop=0; std::vector v(retrievePartsWithoutComputation()); @@ -1657,7 +1664,7 @@ void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTER throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !"); } -void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N) +void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N) { if(_mp_time>_m_time) { @@ -1715,12 +1722,12 @@ const PartDefinition *MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputati throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : The input geo type is not existing in this !"); } -void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const +void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { if(_mp_time<_m_time) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !"); std::size_t sz(_m_parts.size()); - tinyInt.push_back((int)sz); + tinyInt.push_back((mcIdType)sz); for(std::size_t i=0;i& tinyInt, std::vec const MEDCoupling1DGTUMesh *mesh2(dynamic_cast(mesh)); if(mesh1) { - DataArrayInt *elt(mesh1->getNodalConnectivity()); + DataArrayIdType *elt(mesh1->getNodalConnectivity()); if(elt) elt->incrRef(); - MCAuto elt1(elt); + MCAuto elt1(elt); bigArraysI.push_back(elt1); } else if(mesh2) { - DataArrayInt *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex()); + DataArrayIdType *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex()); if(elt1) elt1->incrRef(); if(elt2) elt2->incrRef(); - MCAuto elt11(elt1),elt22(elt2); + MCAuto elt11(elt1),elt22(elt2); bigArraysI.push_back(elt11); bigArraysI.push_back(elt22); } else @@ -1754,20 +1761,20 @@ void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vec tinyInt.push_back(-1); else { - std::vector tinyTmp; + std::vector tinyTmp; pd->serialize(tinyTmp,bigArraysI); - tinyInt.push_back((int)tinyTmp.size()); + tinyInt.push_back((mcIdType)tinyTmp.size()); tinyInt.insert(tinyInt.end(),tinyTmp.begin(),tinyTmp.end()); } } } -void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { - int nbParts(tinyInt.back()); tinyInt.pop_back(); + mcIdType nbParts(tinyInt.back()); tinyInt.pop_back(); _part_def.clear(); _part_def.resize(nbParts); _m_parts.clear(); _m_parts.resize(nbParts); - for(int i=0;i mesh(MEDCoupling1GTUMesh::New(name,tp)); @@ -1780,7 +1787,7 @@ void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArra } else if(mesh2) { - MCAuto elt0,elt1; + MCAuto elt0,elt1; elt0=bigArraysI.back(); bigArraysI.pop_back(); elt1=bigArraysI.back(); bigArraysI.pop_back(); mesh2->setNodalConnectivity(elt0,elt1); @@ -1788,7 +1795,7 @@ void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArra else throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::unserialize : unrecognized single geo type mesh !"); _m_parts[i]=mesh; - int pdid(tinyInt.back()); tinyInt.pop_back(); + mcIdType pdid(tinyInt.back()); tinyInt.pop_back(); if(pdid!=-1) _part_def[i]=PartDefinition::Unserialize(tinyInt,bigArraysI); _mp_time=std::max(_mp_time,_m_time)+1; @@ -2005,7 +2012,7 @@ int MEDFileUMeshAggregateCompute::getMeshDimension() const } } -std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const +std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const { if(_mp_time<_m_time) { @@ -2016,20 +2023,20 @@ std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const } else { - std::vector ret; + std::vector ret; for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *tmp(*it); if(!tmp) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getDistributionOfTypes : part mesh contains null instance !"); - std::vector ret0(tmp->getDistributionOfTypes()); + std::vector ret0(tmp->getDistributionOfTypes()); ret.insert(ret.end(),ret0.begin(),ret0.end()); } return ret; } } -int MEDFileUMeshAggregateCompute::getSize() const +mcIdType MEDFileUMeshAggregateCompute::getSize() const { if(_mp_time<_m_time) { @@ -2040,7 +2047,7 @@ int MEDFileUMeshAggregateCompute::getSize() const } else { - int ret=0; + mcIdType ret=0; for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *m(*it); @@ -2092,16 +2099,17 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa MEDFILESAFECALLERRD0(MEDmeshEntityInfo,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,iterOnStEltOfMesh+1,geoTypeName,&geoType)); _geo_type=geoType; _geo_type_name=MEDLoaderBase::buildStringFromFortran(geoTypeName,MED_NAME_SIZE); - int nCells(0); + mcIdType nCells(0); { med_bool chgt=MED_FALSE,trsf=MED_FALSE; nCells=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,geoType,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf); } MCAuto mss(MEDFileMeshSupports::New(fid)); MCAuto mse(MEDFileStructureElements::New(fid,mss)); - int nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name)); - _conn=DataArrayInt::New(); _conn->alloc(nCells*nbEntities); - MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,_conn->getPointer())); + mcIdType nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name)); + MCAuto miConn=DataArrayMedInt::New(); miConn->alloc(nCells*nbEntities); + MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,miConn->getPointer())); + _conn=FromMedIntArray(miConn); _conn->applyLin(1,-1); _conn->rearrange(nbEntities); _common=MEDFileUMeshPerTypeCommon::New(); diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index f57b311f4..75bad8ff4 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -86,8 +86,8 @@ namespace MEDCoupling MCAuto getPartDefOfCoo() const { return _part_coords; } std::vector getAxisInfoOnMesh(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim); static INTERP_KERNEL::AutoCppPtr GetMeshIdFromName(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& dt, int& it, std::string& dtunit1); - static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); - static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); + static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); + static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); static bool RenameFamiliesFromFileToMem(std::vector< std::string >& famNames); static bool RenameFamiliesFromMemToFile(std::vector< std::string >& famNames); static MEDCoupling::MEDCouplingAxisType TraduceAxisType(med_axis_type at); @@ -96,9 +96,9 @@ namespace MEDCoupling static med_grid_type TraduceAxisTypeRevStruct(MEDCoupling::MEDCouplingAxisType at); private: typedef bool (*RenameFamiliesPatternFunc)(std::vector< std::string >&); - static void RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func); - static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair > > >& crudeFams); - static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams); + static void RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func); + static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair > > >& crudeFams); + static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams); public: static const char ZE_SEP_FOR_FAMILY_KILLERS[]; static int ZE_SEP2_FOR_FAMILY_KILLERS; @@ -119,9 +119,9 @@ namespace MEDCoupling MEDFileUMeshL2(); std::vector loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim); void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); 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 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(); } @@ -131,19 +131,19 @@ namespace MEDCoupling bool isNumDefinedOnLev(int levId) const; bool isNamesDefinedOnLev(int levId) const; MCAuto getCoords() const { return _coords; } - MCAuto getCoordsFamily() const { return _fam_coords; } - MCAuto getCoordsNum() const { return _num_coords; } - MCAuto getCoordsGlobalNum() const { return _global_num_coords; } + MCAuto getCoordsFamily() const { return _fam_coords; } + MCAuto getCoordsNum() const { return _num_coords; } + MCAuto getCoordsGlobalNum() const { return _global_num_coords; } MCAuto getCoordsName() const { return _name_coords; } - static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords); + static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords); private: void sortTypes(); private: std::vector< std::vector< MCAuto > > _per_type_mesh; MCAuto _coords; - MCAuto _fam_coords; - MCAuto _num_coords; - MCAuto _global_num_coords; + MCAuto _fam_coords; + MCAuto _num_coords; + MCAuto _global_num_coords; MCAuto _name_coords; }; @@ -203,14 +203,14 @@ namespace MEDCoupling void assignDefParts(const std::vector& partDefs); void assignUMesh(MEDCouplingUMesh *m); MEDCouplingUMesh *getUmesh() const; - int getNumberOfCells() const; + mcIdType getNumberOfCells() const; std::vector getParts() const; std::vector getGeoTypes() const; - int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; std::vector retrievePartsWithoutComputation() const; MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; - void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const; - void renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N); + void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const; + void renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N); bool isStoredSplitByType() const; std::size_t getTimeOfThis() const; std::size_t getHeapMemorySizeWithoutChildren() const; @@ -223,13 +223,13 @@ namespace MEDCoupling void synchronizeTinyInfo(const MEDFileMesh& master) const; bool empty() const; int getMeshDimension() const; - std::vector getDistributionOfTypes() const; - int getSize() const; + std::vector getDistributionOfTypes() const; + mcIdType getSize() const; void setCoords(DataArrayDouble *coords); void forceComputationOfPartsFromUMesh() const; const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; - void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; - void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); private: std::size_t getTimeOfParts() const; std::size_t getTimeOfUMesh() const; @@ -265,64 +265,64 @@ namespace MEDCoupling void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts); void forceComputationOfParts() const; bool empty() const; - bool presenceOfOneFams(const std::vector& ids) const; + bool presenceOfOneFams(const std::vector& ids) const; int getMeshDimension() const; void simpleRepr(std::ostream& oss) const; - int getSize() const; - MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const; - DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const; + mcIdType getSize() const; + MEDCouplingUMesh *getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const; + DataArrayIdType *getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const; MEDCouplingUMesh *getWholeMesh(bool renum) const; - int getNumberOfCells() const; + mcIdType getNumberOfCells() const; bool isMeshStoredSplitByType() const { return _m_by_types.isStoredSplitByType(); } std::vector getGeoTypes() const; - int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; std::vector getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); } MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); } - DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - std::vector getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); } - DataArrayInt *getOrCreateAndGetFamilyField(); - const DataArrayInt *getFamilyField() const; - const DataArrayInt *getNumberField() const; + DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + std::vector getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); } + DataArrayIdType *getOrCreateAndGetFamilyField(); + const DataArrayIdType *getFamilyField() const; + const DataArrayIdType *getNumberField() const; const DataArrayAsciiChar *getNameField() const; - const DataArrayInt *getRevNumberField() const; + const DataArrayIdType *getRevNumberField() const; const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const; void eraseFamilyField(); - void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, + void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, std::map >& groups); void write(med_idt fid, const std::string& mName, int mdim) const; // - void setFamilyArr(DataArrayInt *famArr); - DataArrayInt *getFamilyField(); - void setRenumArr(DataArrayInt *renumArr); + void setFamilyArr(DataArrayIdType *famArr); + DataArrayIdType *getFamilyField(); + void setRenumArr(DataArrayIdType *renumArr); void setNameArr(DataArrayAsciiChar *nameArr); - void changeFamilyIdArr(int oldId, int newId); + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); // - void renumberNodesInConn(const int *newNodeNumbersO2N); + void renumberNodesInConn(const mcIdType *newNodeNumbersO2N); // - void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; - void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); // static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp); - static std::vector GetNewFamiliesNumber(int nb, const std::map& families); - static void TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, - std::map& famIdTrad, std::map& newfams); - static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da); - static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds); - static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + static std::vector GetNewFamiliesNumber(mcIdType nb, const std::map& families); + static void TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, + std::map& famIdTrad, std::map& newfams); + static DataArrayIdType *Renumber(const DataArrayIdType *renum, const DataArrayIdType *da); + static MEDCouplingUMesh *Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds); + static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); private: MEDFileUMeshSplitL1(); void assignCommonPart(); - MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const; - DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const; + MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const; + DataArrayIdType *renumIfNeededArr(const DataArrayIdType *da) const; void computeRevNum() const; private: MEDFileUMeshAggregateCompute _m_by_types; - MCAuto _fam; - MCAuto _num; - MCAuto _global_num; + MCAuto _fam; + MCAuto _num; + MCAuto _global_num; MCAuto _names; - mutable MCAuto _rev_num; + mutable MCAuto _rev_num; MEDFileUMeshPermCompute _m; }; @@ -331,7 +331,7 @@ namespace MEDCoupling public: static MEDFileEltStruct4Mesh *New(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs); std::string getGeoTypeName() const { return _geo_type_name; } - MCAuto getConn() const { return _conn; } + MCAuto getConn() const { return _conn; } MCAuto getMeshDef() const { return _common; } const std::vector< MCAuto >& getVars() const { return _vars; } private: @@ -344,7 +344,7 @@ namespace MEDCoupling private: std::string _geo_type_name; int _geo_type; - MCAuto _conn; + MCAuto _conn; MCAuto _common; std::vector< MCAuto > _vars; }; diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 8b1ffc7c6..5a31d4e9e 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -1270,7 +1270,7 @@ std::vector MEDCoupling::ReadFieldsOnSame if(!mmuPtr) throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !"); MCAuto m=mmuPtr->getMeshAtLevel(meshDimRelToMax); - const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax); + const DataArrayIdType *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax); MCAuto m2(m->clone(true)); if(o2n) m2->renumberCells(o2n->begin(),true); @@ -1325,7 +1325,7 @@ namespace MEDCoupling MCAuto::FieldType> ret(ff->getFieldOnMeshAtLevel(type,m)); if(muPtr.isNotNull()) { - const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); + const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); if(num) ret->renumberCells(num->begin()); } @@ -1373,27 +1373,27 @@ namespace MEDCoupling { if(muPtr.isNotNull()) { - const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); + const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); if(num) ret->renumberCells(num->begin()); } } else { - DataArrayInt *pfl(nullptr),*arr2(nullptr); + DataArrayIdType *pfl(nullptr),*arr2(nullptr); MCAuto::ArrayType> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl)); - MCAuto pflSafe(pfl); - MCAuto mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); + MCAuto pflSafe(pfl); + MCAuto mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); MCAuto mzip(static_cast(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2))); - MCAuto arr2Safe(arr2); - MCAuto arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); - MCAuto pflSorted(pflSafe->deepCopy()); pflSorted->sort(true); + MCAuto arr2Safe(arr2); + MCAuto arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); + MCAuto pflSorted(pflSafe->deepCopy()); pflSorted->sort(true); if(!arr3->isEqualWithoutConsideringStr(*pflSorted)) throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !"); if(!arr3->isEqualWithoutConsideringStr(*pflSafe)) { - MCAuto o2n2(pflSafe->checkAndPreparePermutation()); - MCAuto n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples())); + MCAuto o2n2(pflSafe->checkAndPreparePermutation()); + MCAuto n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples())); mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples()); arr->setName(""); ret->setArray(arr); @@ -1557,8 +1557,8 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri { MCAuto mmu(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*mmu); - MCAuto o2n(um->getRenumArrForMEDFileFrmt()); - MCAuto n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); + MCAuto o2n(um->getRenumArrForMEDFileFrmt()); + MCAuto n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); f2->renumberCells(o2n->begin(),false); mmu->setMeshAtLevel(0,const_cast(static_cast(f2->getMesh()))); mmu->setRenumFieldArr(0,n2o); @@ -1630,7 +1630,7 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits MEDCouplingUMesh *m(dynamic_cast(const_cast(f2->getMesh()))); if(!m) throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !"); - MCAuto o2n(m->getRenumArrForMEDFileFrmt()); + MCAuto o2n(m->getRenumArrForMEDFileFrmt()); f2->renumberCells(o2n->begin(),false); m=static_cast(const_cast(f2->getMesh())); MCAuto mread(mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension())); @@ -1640,9 +1640,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP); else mread->setCoords(m->getCoords()); - DataArrayInt *part(NULL); + DataArrayIdType *part(NULL); bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part)); - MCAuto partSafe(part); + MCAuto partSafe(part); if(!b) { std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !"; @@ -1662,9 +1662,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits } else { - DataArrayInt *part(NULL); + DataArrayIdType *part(NULL); bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part)); - MCAuto partSafe(part); + MCAuto partSafe(part); if(!b) { std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !"; @@ -1738,7 +1738,7 @@ void WriteFieldUsingAlreadyWrittenMeshT(const std::string& fileName, const typen MEDCouplingUMesh *m(dynamic_cast(const_cast(f->getMesh()))); if(m) { - MCAuto o2n(m->getRenumArrForMEDFileFrmt()); + MCAuto o2n(m->getRenumArrForMEDFileFrmt()); MCAuto< typename MEDCoupling::Traits::FieldType > f2(f->deepCopy()); f2->renumberCells(o2n->begin(),false); f1ts->setFieldNoProfileSBT(f2); diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index 75fe2242a..e8dc1e0ff 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -1497,7 +1497,7 @@ Cell::Cell(const Cell& ma) { if ( ma._sortedNodeIDs ) { - _sortedNodeIDs = new int[ _nodes.size() ]; + _sortedNodeIDs = new TID[ _nodes.size() ]; std::copy( ma._sortedNodeIDs, ma._sortedNodeIDs + _nodes.size(), _sortedNodeIDs ); } } @@ -1528,7 +1528,7 @@ const TID* Cell::getSortedNodes() const if ( !_sortedNodeIDs ) { size_t l=_nodes.size(); - _sortedNodeIDs = new int[ l ]; + _sortedNodeIDs = new TID[ l ]; for (size_t i=0; i!=l; ++i) _sortedNodeIDs[i]=_nodes[i]->_number; @@ -1548,9 +1548,9 @@ bool Cell::operator< (const Cell& ma) const if ( _nodes.size() == 1 ) return _nodes[0] < ma._nodes[0]; - const int* v1 = getSortedNodes(); - const int* v2 = ma.getSortedNodes(); - for ( const int* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 ) + const TID* v1 = getSortedNodes(); + const TID* v2 = ma.getSortedNodes(); + for ( const TID* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 ) if(*v1 != *v2) return *v1 < *v2; return false; @@ -3195,7 +3195,7 @@ void IntermediateMED::setConnectivity( MEDCoupling::MEDFileUMesh* mesh, // fill connectivity array to take into account order of elements in the sauv file const int nbCellNodes = cells->begin()->_nodes.size(); std::vector< TID > connectivity( cells->size() * nbCellNodes ); - int * nodalConnOfCell; + TID * nodalConnOfCell; for ( elemIt = cells->begin(), elemEnd = cells->end(); elemIt != elemEnd; ++elemIt ) { const Cell& cell = *elemIt; @@ -3237,8 +3237,8 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) { const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim ); - std::vector medGroups; - std::vector > refGroups; + std::vector medGroups; + std::vector > refGroups; for ( size_t i = 0; i < _groups.size(); ++i ) { Group& grp = _groups[i]; @@ -3284,10 +3284,10 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) } } // create a med group - grp._medGroup = DataArrayInt::New(); + grp._medGroup = DataArrayIdType::New(); grp._medGroup->setName( grp._name.c_str() ); grp._medGroup->alloc( cell2order.size(), /*nbOfCompo=*/1 ); - int * idsPtr = grp._medGroup->getPointer(); + TID * idsPtr = grp._medGroup->getPointer(); TCellToOrderMap::iterator cell2orderIt, cell2orderEnd = cell2order.end(); for ( cell2orderIt = cell2order.begin(); cell2orderIt != cell2orderEnd; ++cell2orderIt ) *idsPtr++ = (*cell2orderIt).first->_number - 1; diff --git a/src/MEDLoader/SauvMedConvertor.hxx b/src/MEDLoader/SauvMedConvertor.hxx index 3505e486c..5b09a1c84 100644 --- a/src/MEDLoader/SauvMedConvertor.hxx +++ b/src/MEDLoader/SauvMedConvertor.hxx @@ -51,7 +51,7 @@ namespace SauvUtilities struct IntermediateMED; // ============================================================================== - typedef int TID; // an ID countered from 1 + typedef mcIdType TID; // an ID countered from 1 typedef std::pair Link; // a pair of node numbers typedef INTERP_KERNEL::NormalizedCellType TCellType; @@ -103,8 +103,8 @@ namespace SauvUtilities reference is converted into a copy of the medGroup (issue 0021311) */ - MEDCoupling::DataArrayInt* _medGroup; // result of conversion - std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup + MEDCoupling::DataArrayIdType* _medGroup; // result of conversion + std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup bool empty() const { return _cells.empty() && _groups.empty(); } int size() const; diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 55ed3c393..2d29f5401 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -375,21 +375,21 @@ void SauvWriter::fillFamilySubMeshes() { int dimRelExt = dims[ iDim ]; MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt); - const DataArrayInt * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt); + const DataArrayIdType * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt); if ( !famIds ) continue; - int curFamID = 0; + mcIdType curFamID = 0; SubMesh* curSubMesh = addSubMesh( "", dimRelExt ); // submesh of zero family _famIDs2Sub[0] = curSubMesh; int sub0Index = _subs.size()-1; - const int * famID = famIds->begin(), * famIDEnd = famIds->end(); - for ( int cellID = 0; famID < famIDEnd; ++famID, cellID++ ) + const mcIdType * famID = famIds->begin(), * famIDEnd = famIds->end(); + for ( mcIdType cellID = 0; famID < famIDEnd; ++famID, cellID++ ) { if ( *famID != curFamID ) { curFamID = *famID; - map< int, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first; + map< mcIdType, SubMesh* >::iterator f2s = _famIDs2Sub.insert( make_pair( curFamID, nilSm )).first; if ( !f2s->second ) f2s->second = addSubMesh( "", dimRelExt ); // no names for families curSubMesh = f2s->second; @@ -442,8 +442,8 @@ void SauvWriter::fillGroupSubMeshes() std::size_t k = 0; for ( size_t i = 0; i < famNames.size(); ++i ) { - int famID = _fileMesh->getFamilyId( famNames[i].c_str() ); - map< int, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID ); + mcIdType famID = _fileMesh->getFamilyId( famNames[i].c_str() ); + map< mcIdType, SubMesh* >::iterator i2f = _famIDs2Sub.find( famID ); if ( i2f != _famIDs2Sub.end() ) { famSubMeshes[ k ] = i2f->second; @@ -519,7 +519,7 @@ void SauvWriter::fillProfileSubMeshes() if ( !pfl2sm->second ) { SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles - const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() ); + const DataArrayIdType * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() ); makeProfileIDs( sm, types[iType], pfl ); } } @@ -565,7 +565,7 @@ int SauvWriter::evaluateNbProfileSubMeshes() const void SauvWriter::makeProfileIDs( SubMesh* sm, INTERP_KERNEL::NormalizedCellType type, - const DataArrayInt* profile ) + const DataArrayIdType* profile ) { MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt); @@ -591,7 +591,7 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, else { // profile on cells - vector code(3); + vector code(3); code[0] = type; if ( profile ) // on profile { @@ -603,10 +603,10 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, code[1] = mesh->getNumberOfCellsWithType( type ); code[2] = -1; } - vector idsPerType( 1, profile ); - MCAuto + vector idsPerType( 1, profile ); + MCAuto resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType ); - if (( const DataArrayInt *) resIDs ) + if (( const DataArrayIdType *) resIDs ) { ids.assign( resIDs->begin(), resIDs->end() ); } @@ -787,7 +787,7 @@ void SauvWriter::writeSubMeshes() // indices to transform MED connectivity to GIBI one const int * toMedConn = getGibi2MedQuadraticInterlace( cellType ); - vector< int > cellConn( nbElemNodes ), transformedConn( nbElemNodes ); + vector< mcIdType > cellConn( nbElemNodes ), transformedConn( nbElemNodes ); for ( size_t i = 0; i < nbElems; ++i ) { cellConn.clear(); @@ -1100,7 +1100,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) // (2) for each sub-component (iteration) // write support, number of values and number of components fcount.init(10); - vector< int > vals(3); + vector< mcIdType > vals(3); for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { pair it = iters[iIt]; @@ -1108,7 +1108,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; valsVec=_nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); // believe that there can be only one type in a nodal field, @@ -1132,7 +1132,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) fcount.init(8); *_sauvFile << left; for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) - for ( size_t i = 0; i < compInfo.size(); ++i, fcount++ ) + for ( std::size_t i = 0; i < compInfo.size(); ++i, fcount++ ) *_sauvFile << " " << setw(4) << mapMedToGibi[compInfo[i]]; *_sauvFile << right; fcount.stop(); @@ -1157,7 +1157,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; valsVec = _nodeFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); // believe that there can be only one type in a nodal field, @@ -1218,7 +1218,7 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t i = 0; i < valsVec.size(); ++i ) @@ -1311,7 +1311,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t iType = 0; iType < pfls.size(); ++iType ) diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index 31efd1ab4..27f4b3baa 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -39,7 +39,7 @@ namespace MEDCoupling class MEDFileData; class MEDFileMesh; class MEDFileFieldMultiTS; - class DataArrayInt; + class DataArrayIdType; /*! * \brief Class to write a MEDFileData into a SAUVE format file @@ -83,7 +83,7 @@ namespace MEDCoupling std::map& compMedToGibi ); void makeProfileIDs( SubMesh* sm, INTERP_KERNEL::NormalizedCellType type, - const DataArrayInt* profile ); + const DataArrayIdType* profile ); void writeFileHead(); void writeSubMeshes(); void writeCompoundSubMesh(int iSub); @@ -103,7 +103,7 @@ namespace MEDCoupling std::vector< MCAuto< MEDFileFieldMultiTS > > _cellFields; std::vector _subs; - std::map< int, SubMesh* > _famIDs2Sub; + std::map< mcIdType, SubMesh* > _famIDs2Sub; std::map< std::string, SubMesh* > _profile2Sub; enum { diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index 9f9bc3ffd..7b621869a 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -32,6 +32,9 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDLoader_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) SET (MEDLoader_SWIG_DPYS_FILES MEDLoaderCommon.i diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index dd03b5580..f21b93682 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -666,9 +666,9 @@ namespace MEDCoupling { public: static MEDFileJointCorrespondence *New(); - static MEDFileJointCorrespondence *New(DataArrayInt* correspondence) // nodes + static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence) // nodes ; - static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells + static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type) ; @@ -682,7 +682,7 @@ namespace MEDCoupling INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const; void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type); INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const; - void setCorrespondence(DataArrayInt *corr); + void setCorrespondence(DataArrayIdType *corr); void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const; std::string simpleRepr() const; %extend @@ -691,11 +691,11 @@ namespace MEDCoupling { return MEDFileJointCorrespondence::New(); } - MEDFileJointCorrespondence(DataArrayInt* correspondence) + MEDFileJointCorrespondence(DataArrayIdType* correspondence) { return MEDFileJointCorrespondence::New(correspondence); } - MEDFileJointCorrespondence(DataArrayInt* correspondence, // cells + MEDFileJointCorrespondence(DataArrayIdType* correspondence, // cells INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type) { @@ -707,12 +707,12 @@ namespace MEDCoupling return self->simpleRepr(); } - DataArrayInt *getCorrespondence() const + DataArrayIdType *getCorrespondence() const { - const DataArrayInt *ret(self->getCorrespondence()); + const DataArrayIdType *ret(self->getCorrespondence()); if(ret) ret->incrRef(); - return const_cast(ret); + return const_cast(ret); } } }; @@ -907,12 +907,12 @@ namespace MEDCoupling private: MEDFileEquivalenceData(); public: - void setArray(DataArrayInt *data); + void setArray(DataArrayInt32 *data); %extend { - DataArrayInt *getArray() + DataArrayInt32 *getArray() { - DataArrayInt *ret(self->getArray()); + DataArrayInt32 *ret(self->getArray()); if(ret) ret->incrRef(); return ret; } @@ -932,13 +932,13 @@ namespace MEDCoupling public: void clear(); std::size_t size() const; - void setArray(int meshDimRelToMax, DataArrayInt *da); - void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da); + void setArray(int meshDimRelToMax, DataArrayInt32 *da); + void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da); %extend { - DataArrayInt *getArray(INTERP_KERNEL::NormalizedCellType type) + DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type) { - DataArrayInt *ret(self->getArray(type)); + DataArrayInt32 *ret(self->getArray(type)); if(ret) ret->incrRef(); return ret; } @@ -964,7 +964,7 @@ namespace MEDCoupling void setName(const std::string& name); std::string getDescription() const; void setDescription(const std::string& descr); - void setArray(int meshDimRelToMaxExt, DataArrayInt *da);; + void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);; %extend { MEDFileEquivalenceCell *initCell() @@ -1068,7 +1068,7 @@ namespace MEDCoupling virtual std::vector getFamArrNonEmptyLevelsExt() const; virtual std::vector getNumArrNonEmptyLevelsExt() const; virtual std::vector getNameArrNonEmptyLevelsExt() const; - virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; + virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; virtual MEDFileMesh *cartesianize() const; std::vector getNonEmptyLevels() const; std::vector getNonEmptyLevelsExt() const; @@ -1082,7 +1082,7 @@ namespace MEDCoupling void addFamily(const std::string& familyName, int id); void addFamilyOnGrp(const std::string& grpName, const std::string& famName); virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName); - virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); + virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); void copyFamGrpMapsFrom(const MEDFileMesh& other); void clearGrpMap(); void clearFamMap(); @@ -1091,22 +1091,22 @@ namespace MEDCoupling const std::map >& getGroupInfo() const; std::vector getFamiliesOnGroup(const std::string& name) const; std::vector getFamiliesOnGroups(const std::vector& grps) const; - std::vector getFamiliesIdsOnGroup(const std::string& name) const; + std::vector getFamiliesIdsOnGroup(const std::string& name) const; void setFamiliesOnGroup(const std::string& name, const std::vector& fams); - void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); + void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); std::vector getGroupsOnFamily(const std::string& name) const; void setGroupsOnFamily(const std::string& famName, const std::vector& grps); std::vector getGroupsNames() const; std::vector getFamiliesNames() const; std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const; - std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; - std::vector getGrpNonEmptyLevels(const std::string& grp) const; - std::vector getFamsNonEmptyLevels(const std::vector& fams) const; - std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; - std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; - std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; - std::vector getFamNonEmptyLevels(const std::string& fam) const; - std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; + std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; + std::vector getGrpNonEmptyLevels(const std::string& grp) const; + std::vector getFamsNonEmptyLevels(const std::vector& fams) const; + std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; + std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; + std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; + std::vector getFamNonEmptyLevels(const std::string& fam) const; + std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; std::vector getFamiliesNamesWithFilePointOfView() const; static std::string GetMagicFamilyStr(); void assignFamilyNameWithGroupName(); @@ -1124,7 +1124,7 @@ namespace MEDCoupling void changeFamilyName(const std::string& oldName, const std::string& newName); void changeFamilyId(int oldId, int newId); void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames); - void setFamilyInfo(const std::map& info); + void setFamilyInfo(const std::map& info); void setGroupInfo(const std::map >&info); int getFamilyId(const std::string& name) const; int getMaxAbsFamilyId() const; @@ -1136,9 +1136,9 @@ namespace MEDCoupling virtual int getMaxAbsFamilyIdInArrays() const; virtual int getMaxFamilyIdInArrays() const; virtual int getMinFamilyIdInArrays() const; - DataArrayInt *getAllFamiliesIdsReferenced() const; - DataArrayInt *computeAllFamilyIdsInUse() const; - std::vector getFamiliesIds(const std::vector& famNames) const; + DataArrayIdType *getAllFamiliesIdsReferenced() const; + DataArrayIdType *computeAllFamilyIdsInUse() const; + std::vector getFamiliesIds(const std::vector& famNames) const; std::string getFamilyNameGivenId(int id) const; bool ensureDifferentFamIdsPerLevel(); void normalizeFamIdsTrio(); @@ -1148,20 +1148,20 @@ namespace MEDCoupling virtual std::string advancedRepr() const; // virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const; - virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); - virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); + virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr); + virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr); virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr); - virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr); - virtual void addNodeGroup(const DataArrayInt *ids); - virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids); - virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; - virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; - virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; - virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const; - virtual DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; - virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const; - virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; + virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr); + virtual void addNodeGroup(const DataArrayIdType *ids); + virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids); + virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; + virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; + virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; + virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const; + virtual DataArrayIdType *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; + virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const; + virtual DataArrayIdType *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; int getNumberOfJoints(); MEDFileJoints *getJoints(); void setJoints( MEDFileJoints* joints ); @@ -1206,8 +1206,8 @@ namespace MEDCoupling void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) { - std::vector grps; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",grps); + std::vector grps; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt",grps); self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum); } @@ -1257,34 +1257,34 @@ namespace MEDCoupling PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const { - const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt) { - const DataArrayInt *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const { - const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const { - const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const @@ -1307,8 +1307,8 @@ namespace MEDCoupling PyObject *unPolyze() { - DataArrayInt *ret3=0; - std::vector ret1,ret2; + DataArrayIdType *ret3=0; + std::vector ret1,ret2; bool ret0=self->unPolyze(ret1,ret2,ret3); PyObject *ret=PyTuple_New(4); PyTuple_SetItem(ret,0,SWIG_From_bool(ret0)); @@ -1335,7 +1335,7 @@ namespace MEDCoupling } PyTuple_SetItem(ret,2,retLev1_1); // - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1346,9 +1346,9 @@ namespace MEDCoupling return ret; } - virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const + virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const { - MCAuto ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt)); + MCAuto ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt)); return ret.retn(); } } @@ -1374,7 +1374,7 @@ namespace MEDCoupling MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; + DataArrayIdType *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const; MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const; MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const; @@ -1389,9 +1389,9 @@ namespace MEDCoupling void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m); void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false); void optimizeFamilies(); - DataArrayInt *zipCoords(); - DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayIdType *zipCoords(); + DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const; MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const; MEDFileUMesh *quadraticToLinear(double eps=1e-12) const; @@ -1423,7 +1423,7 @@ namespace MEDCoupling return MEDFileUMesh::New(); } - static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) + static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) { std::vector typesCpp1; convertPyToNewIntArr3(types,typesCpp1); @@ -1437,9 +1437,9 @@ namespace MEDCoupling PyObject *__getstate__() { std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - std::vector< MCAuto > a3; + std::vector< MCAuto > a3; MCAuto a4; self->serialize(a0,a1,a2,a3,a4); PyObject *ret(PyTuple_New(5)); @@ -1454,10 +1454,10 @@ namespace MEDCoupling PyObject *ret3(PyList_New(sz)); for(int i=0;iincrRef(); - PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); } PyTuple_SetItem(ret,3,ret3); DataArrayDouble *ret4(a4); @@ -1476,13 +1476,13 @@ namespace MEDCoupling if(sz!=5) throw INTERP_KERNEL::Exception(MSG); std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - std::vector< MCAuto > a3; + std::vector< MCAuto > a3; MCAuto a4; // PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2)); - int tmp(-1); + mcIdType tmp(-1); fillArrayWithPyListDbl3(a0py,tmp,a0); convertPyToNewIntArr3(a1py,a1); fillStringVector(a2py,a2); @@ -1496,8 +1496,8 @@ namespace MEDCoupling if((DataArrayDouble *)a4) a4->incrRef(); { - std::vector< DataArrayInt * > a3Tmp; - convertFromPyObjVectorOfObj(b0py,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",a3Tmp); + std::vector< DataArrayIdType * > a3Tmp; + convertFromPyObjVectorOfObj(b0py,SWIGTITraits::TI,"DataArrayInt",a3Tmp); std::size_t sz(a3Tmp.size()); a3.resize(sz); for(std::size_t i=0;i bb,bb2; - int sw; + mcIdType sw; const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true)); const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true)); MCAuto ret(self->symmetry3DPlane(centerPtr,vectorPtr)); @@ -1558,20 +1558,20 @@ namespace MEDCoupling PyObject *getAllDistributionOfTypes() const { - std::vector< std::pair > ret(self->getAllDistributionOfTypes()); + std::vector< std::pair > ret(self->getAllDistributionOfTypes()); return convertVecPairIntToPy(ret); } - DataArrayInt *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const + DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->deduceNodeSubPartFromCellSubPart(extractDefCpp); } MEDFileUMesh *extractPart(PyObject *extractDef) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp); } @@ -1615,12 +1615,12 @@ namespace MEDCoupling PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1) { - DataArrayInt *ret0=0,*ret1=0,*ret2=0; + DataArrayIdType *ret0=0,*ret1=0,*ret2=0; self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2); PyObject *ret=PyTuple_New(3); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, 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,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + 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),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1946,18 +1946,18 @@ namespace MEDCoupling { PyObject *getProfile(const std::string& pflName) const { - const DataArrayInt *ret=self->getProfile(pflName); + const DataArrayIdType *ret=self->getProfile(pflName); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getProfileFromId(int pflId) const { - const DataArrayInt *ret=self->getProfileFromId(pflId); + const DataArrayIdType *ret=self->getProfileFromId(pflId); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getLocalizationFromId(int locId) const @@ -2148,12 +2148,12 @@ namespace MEDCoupling std::vector< std::vector > typesF; std::vector< std::vector > pfls; std::vector< std::vector > locs; - std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs); + std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs); int sz=ret.size(); PyObject *ret2=PyList_New(sz); for(int i=0;i >& dadsI=ret[i]; + const std::vector< std::pair >& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; const std::vector& pflsI=pfls[i]; const std::vector& locsI=locs[i]; @@ -2209,7 +2209,7 @@ namespace MEDCoupling MEDFileAnyTypeField1TS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp,mm); } @@ -2234,8 +2234,8 @@ namespace MEDCoupling MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; // void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field); - void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false); void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false); %extend @@ -2343,8 +2343,8 @@ namespace MEDCoupling MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; // void setFieldNoProfileSBT(const MEDCouplingFieldInt *field); - void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); void copyTimeInfoFrom(MEDCouplingFieldInt *mcf); MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const; MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; @@ -2389,9 +2389,9 @@ namespace MEDCoupling return MEDFileField1TS_getFieldWithProfile(self,type,meshDimRelToMax,mesh); } - DataArrayInt *getUndergroundDataArray() const + DataArrayInt32 *getUndergroundDataArray() const { - DataArrayInt *ret=self->getUndergroundDataArray(); + DataArrayInt32 *ret=self->getUndergroundDataArray(); if(ret) ret->incrRef(); return ret; @@ -2415,8 +2415,8 @@ namespace MEDCoupling MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; // void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field); - void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf); MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const; MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; @@ -2621,12 +2621,12 @@ namespace MEDCoupling std::vector< std::vector > typesF; 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); + std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); int sz=ret.size(); PyObject *ret2=PyList_New(sz); for(int i=0;i >& dadsI=ret[i]; + const std::vector< std::pair >& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; const std::vector& pflsI=pfls[i]; const std::vector& locsI=locs[i]; @@ -2689,10 +2689,10 @@ namespace MEDCoupling void eraseTimeStepIds(PyObject *li) { - int sw; + mcIdType sw; int pos1; std::vector pos2; - DataArrayInt *pos3=0; + DataArrayInt32 *pos3=0; DataArrayIntTuple *pos4=0; convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4); switch(sw) @@ -2729,7 +2729,7 @@ namespace MEDCoupling if(elt0 && PyList_Check(elt0)) { int sz=PyList_Size(elt0); - MCAuto da=DataArrayInt::New(); da->alloc(sz,1); + MCAuto da=DataArrayInt32::New(); da->alloc(sz,1); int *pt=da->getPointer(); for(int i=0;i > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp,mm); } @@ -2882,7 +2882,7 @@ namespace MEDCoupling MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; // void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field); - void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; %extend { @@ -2926,11 +2926,11 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 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; } @@ -2977,7 +2977,7 @@ namespace MEDCoupling PyObject *getUndergroundDataArrayExt(int iteration, int order) const { - std::vector< std::pair,std::pair > > elt1Cpp; + std::vector< std::pair,std::pair > > elt1Cpp; DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp); if(elt0) elt0->incrRef(); @@ -3032,7 +3032,7 @@ namespace MEDCoupling static MEDFileIntFieldMultiTS *New(DataArrayByte *db); // void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field); - void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; @@ -3076,17 +3076,17 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const { - DataArrayInt *ret1=0; - DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); + DataArrayIdType *ret1=0; + DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, 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,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - DataArrayInt *getUndergroundDataArray(int iteration, int order) const + DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const { - DataArrayInt *ret=self->getUndergroundDataArray(iteration,order); + DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order); if(ret) ret->incrRef(); return ret; @@ -3103,7 +3103,7 @@ namespace MEDCoupling static MEDFileFloatFieldMultiTS *New(DataArrayByte *db); // void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field); - void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; @@ -3147,11 +3147,11 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, 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; } @@ -3414,7 +3414,7 @@ namespace MEDCoupling MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp,mm); } @@ -3569,7 +3569,7 @@ namespace MEDCoupling void eraseTimeStepIds(PyObject *ids) { - int sw; + mcIdType sw; int pos1; std::vector pos2; DataArrayInt *pos3=0; @@ -3935,7 +3935,7 @@ namespace MEDCoupling public: virtual MEDMeshMultiLev *prepare() const; DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; - DataArrayInt *retrieveGlobalNodeIdsIfAny() const; + DataArrayIdType *retrieveGlobalNodeIdsIfAny() const; protected: ~MEDMeshMultiLev(); public: @@ -3943,52 +3943,52 @@ namespace MEDCoupling { PyObject *retrieveFamilyIdsOnCells() const { - DataArrayInt *famIds(0); + DataArrayIdType *famIds(0); bool isWithoutCopy(false); self->retrieveFamilyIdsOnCells(famIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } PyObject *retrieveNumberIdsOnCells() const { - DataArrayInt *numIds(0); + DataArrayIdType *numIds(0); bool isWithoutCopy(false); self->retrieveNumberIdsOnCells(numIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } PyObject *retrieveFamilyIdsOnNodes() const { - DataArrayInt *famIds(0); + DataArrayIdType *famIds(0); bool isWithoutCopy(false); self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } PyObject *retrieveNumberIdsOnNodes() const { - DataArrayInt *numIds(0); + DataArrayIdType *numIds(0); bool isWithoutCopy(false); self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } @@ -4014,7 +4014,7 @@ namespace MEDCoupling { PyObject *buildVTUArrays() const { - DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0); + DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0); bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces)); PyObject *ret0Py=ncc?Py_True:Py_False; Py_XINCREF(ret0Py); @@ -4022,10 +4022,10 @@ namespace MEDCoupling PyTuple_SetItem(ret,0,ret0Py); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } @@ -4072,7 +4072,7 @@ namespace MEDCoupling PyObject *buildVTUArrays() const { DataArrayDouble *ret0(0); - std::vector ret1; + std::vector ret1; bool ret2; self->buildVTUArrays(ret0,ret1,ret2); std::size_t sz(ret1.size()); diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index b3284e9be..68484f81c 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -264,17 +264,17 @@ void MEDLoaderTest::testMultiMeshRW1() { const char fileName[]="file10.med"; MEDCouplingUMesh *mesh1=build3DMesh_1(); - const int part1[5]={1,2,4,13,15}; + const mcIdType part1[5]={1,2,4,13,15}; MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName("mesh2"); - const int part2[4]={3,4,13,14}; + const mcIdType part2[4]={3,4,13,14}; MEDCouplingUMesh *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true); mesh3->setName("mesh3"); MEDCouplingUMesh *mesh4=MEDCouplingUMesh::New(); mesh4->setName("mesh4"); mesh4->setMeshDimension(3); mesh4->allocateCells(1); - int conn[4]={0,11,1,3}; + mcIdType conn[4]={0,11,1,3}; mesh4->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); mesh4->finishInsertingCells(); mesh4->setCoords(mesh1->getCoords()); @@ -288,7 +288,7 @@ void MEDLoaderTest::testMultiMeshRW1() // MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane); mesh1->setName(mnane); - const int part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; + const mcIdType part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true); mesh6->setName(mnane); mesh5->decrRef(); @@ -352,16 +352,16 @@ void MEDLoaderTest::testFieldProfilRW1() const char fileName[]="file12.med"; MEDCouplingUMesh *mesh1=build3DMesh_1(); bool b; - int newNbOfNodes; - DataArrayInt *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes); da->decrRef(); WriteUMesh(fileName,mesh1,true); - const int part1[5]={1,2,4,13,15}; + const mcIdType part1[5]={1,2,4,13,15}; MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName(mesh1->getName().c_str());//<- important for the test // - int nbOfCells=mesh2->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL(5,nbOfCells); + mcIdType nbOfCells=mesh2->getNumberOfCells(); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),nbOfCells); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setMesh(mesh2); @@ -398,7 +398,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() const char fileName[]="file19.med"; const char fileName2[]="file20.med"; MEDCouplingUMesh *m=build2DMesh_1(); - int nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); WriteUMesh(fileName,m,true); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VFieldOnNodes"); @@ -413,7 +413,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() array->decrRef(); f1->setTime(3.14,2,7); f1->checkConsistencyLight(); - const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7 + const mcIdType arr2[2]={1,4};//node ids are 2,4,5,3,6,7 MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2); (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName().c_str()); WriteField(fileName,f2,false);//<- false important for the test @@ -423,7 +423,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); // - const int arr3[6]={1,3,0,5,2,4}; + const mcIdType arr3[6]={1,3,0,5,2,4}; f2->renumberNodes(arr3); WriteUMesh(fileName2,m,true); WriteField(fileName2,f2,false);//<- false important for the test @@ -460,7 +460,7 @@ void MEDLoaderTest::testFieldNodeProfilRW2() std::copy(arr2,arr2+24,tmp); f1->setTime(3.17,2,7); // - const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4}; + const mcIdType renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4}; f1->renumberNodes(renumArr); f1->checkConsistencyLight(); WriteField(fileName,f1,false);//<- false important for the test @@ -532,7 +532,7 @@ void MEDLoaderTest::testMesh3DSurfShuffleRW() { const char fileName[]="file15.med"; MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - const int renumber1[6]={2,5,1,0,3,4}; + const mcIdType renumber1[6]={2,5,1,0,3,4}; mesh->renumberCells(renumber1,false); mesh->checkConsistencyLight(); WriteUMesh(fileName,mesh,true); @@ -559,7 +559,7 @@ void MEDLoaderTest::testFieldShuffleRW1() f1->setTime(3.14,2,7); f1->checkConsistencyLight(); // - const int renumber1[6]={2,1,5,0,3,4}; + const mcIdType renumber1[6]={2,1,5,0,3,4}; f1->renumberCells(renumber1,false); WriteField(fileName,f1,true); MEDCouplingFieldDouble *f2=dynamic_cast((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7)); @@ -578,11 +578,11 @@ void MEDLoaderTest::testMultiFieldShuffleRW1() const char fileName[]="file17.med"; MEDCouplingUMesh *m=build3DMesh_2(); CPPUNIT_ASSERT_EQUAL(20,(int)m->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(45,m->getNumberOfNodes()); - const int polys[3]={1,4,6}; - std::vector poly2(polys,polys+3); + CPPUNIT_ASSERT_EQUAL(ToIdType(45),m->getNumberOfNodes()); + const mcIdType polys[3]={1,4,6}; + std::vector poly2(polys,polys+3); m->convertToPolyTypes(&poly2[0],&poly2[0]+poly2.size()); - const int renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11}; + const mcIdType renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11}; m->renumberCells(renum,false); m->orientCorrectlyPolyhedrons(); // Writing @@ -631,10 +631,10 @@ void MEDLoaderTest::testWriteUMeshesRW1() MEDCouplingUMesh *m3d=build3DMesh_2(); const double pt[3]={0.,0.,-0.3}; const double vec[3]={0.,0.,1.}; - std::vector nodes; + std::vector nodes; m3d->findNodesOnPlane(pt,vec,1e-12,nodes); MEDCouplingUMesh *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true); - const int renumber[5]={1,2,0,4,3}; + const mcIdType renumber[5]={1,2,0,4,3}; m2d->renumberCells(renumber,false); m2d->setName("ExampleOfMultiDimW"); std::vector meshes; @@ -788,7 +788,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i)); @@ -796,7 +796,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); @@ -812,11 +812,11 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(1)); - CPPUNIT_ASSERT_EQUAL((std::size_t)11,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(11),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(132,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+11,0)); CPPUNIT_ASSERT_EQUAL(16,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+3,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); @@ -835,12 +835,12 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(7,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(6)); - CPPUNIT_ASSERT_EQUAL((std::size_t)36,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(36),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(254,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+36,0)); CPPUNIT_ASSERT_EQUAL(141,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+8,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); @@ -874,7 +874,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -882,7 +882,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -903,7 +903,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -911,7 +911,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -957,7 +957,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -965,7 +965,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -985,7 +985,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -993,7 +993,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -1014,7 +1014,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(538,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(579,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(579),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<514;i++) CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(i)); @@ -1026,7 +1026,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() std::transform(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+12,expectedVals1,diffValue1,std::minus()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12); - CPPUNIT_ASSERT_EQUAL((std::size_t)2768,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2768),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+2768,0)); CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+539,0)); mesh->decrRef(); @@ -1048,7 +1048,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(538,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(579,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(579),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<514;i++) CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,constMesh->getTypeOfCell(i)); @@ -1058,7 +1058,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() std::transform(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+12,expectedVals1,diffValue1,std::minus()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12); - CPPUNIT_ASSERT_EQUAL((std::size_t)2768,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2768),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+2768,0)); CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+539,0)); const double *values=field->getArray()->getPointer(); @@ -1080,12 +1080,12 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(1)); CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(2)); - CPPUNIT_ASSERT_EQUAL((std::size_t)98,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(98),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(725,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+98,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); CPPUNIT_ASSERT_EQUAL(155,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+4,0)); @@ -1096,7 +1096,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(17,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(1)); @@ -1116,7 +1116,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(15)); CPPUNIT_ASSERT_EQUAL(NORM_TRI3,mesh->getTypeOfCell(16)); CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); - CPPUNIT_ASSERT_EQUAL((std::size_t)83,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(83),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(619,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+83,0)); mesh->decrRef(); // @@ -1133,18 +1133,18 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(1,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<3;i++) CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(i)); - CPPUNIT_ASSERT_EQUAL((std::size_t)19,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(117,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+19,0)); mesh->decrRef(); // mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllGeoTypes().size()); mesh->decrRef(); @@ -1153,7 +1153,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1() { double coords[6]={ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 }; - int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; + mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setName("1DMesh_1"); mesh->setMeshDimension(1); @@ -1175,7 +1175,7 @@ MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1() MEDCouplingUMesh *MEDLoaderTest::build2DCurveMesh_1() { double coords[12]={ 0.0,0.0, 0.3,0.3, 0.75,0.75, 1.0,1.0, 1.4,1.4, 1.3,1.3 }; - int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; + mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setName("2DCurveMesh_1"); mesh->setMeshDimension(1); @@ -1196,7 +1196,7 @@ MEDCouplingUMesh *MEDLoaderTest::build2DCurveMesh_1() MEDCouplingUMesh *MEDLoaderTest::build2DMesh_1() { double targetCoords[24]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, -0.05,0.95, 0.2,1.2, 0.45,0.95 }; - int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(6); @@ -1224,7 +1224,7 @@ MEDCouplingUMesh *MEDLoaderTest::build2DMesh_2() -0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, -0.05,0.95, 0.2,1.2, 0.45,0.95 }; - int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -1251,7 +1251,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DSurfMesh_1() -0.3,-0.3,-0.3, 0.2,-0.3,-0.3, 0.7,-0.3,-0.3, -0.3,0.2,-0.3, 0.2,0.2,-0.3, 0.7,0.2,-0.3, -0.3,0.7,-0.3, 0.2,0.7,-0.3, 0.7,0.7,-0.3 ,-0.05,0.95,-0.3, 0.2,1.2,-0.3, 0.45,0.95,-0.3 }; - int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(6); @@ -1285,7 +1285,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_1() 0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3., 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.}; - int conn[354]={ + mcIdType conn[354]={ // 0 0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17, 1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21, @@ -1345,11 +1345,11 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_1() MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2() { MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1(); - int numbers[5]={0,1,2,3,5}; + mcIdType numbers[5]={0,1,2,3,5}; MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false); m3dsurfBase->decrRef(); MEDCouplingUMesh *m1dBase=build1DMesh_1(); - int numbers2[4]={0,1,2,3}; + mcIdType numbers2[4]={0,1,2,3}; MEDCouplingUMesh *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false); m1dBase->decrRef(); m1d->changeSpaceDimension(3); @@ -1365,7 +1365,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2() MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - int nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setMesh(mesh); @@ -1388,7 +1388,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - int nbOfNodes=mesh->getNumberOfNodes(); + mcIdType nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VectorFieldOnNodes"); f1->setMesh(mesh); diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 018317f95..52ff60323 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -58,7 +58,7 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() const int spaceDim = 2; const int nbOfNodes = 6; double coords[nbOfNodes*spaceDim] = {0,0, 1,0, 1,1, 0,1, 2,0, 2,1}; - int conn[8]={0,1,2,3, 1,4,5,2}; + mcIdType conn[8]={0,1,2,3, 1,4,5,2}; MCAuto mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim); mesh2d->allocateCells(2); mesh2d->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); @@ -75,14 +75,14 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() // Create families and groups - MCAuto fam = DataArrayInt::New(); + MCAuto fam = DataArrayIdType::New(); fam->alloc(2,1); - int elemsFams[2] = {-2,-3}; + mcIdType elemsFams[2] = {-2,-3}; std::copy(elemsFams,elemsFams+2,fam->getPointer()); m->setFamilyFieldArr(0,fam); - std::map theFamilies; + std::map theFamilies; theFamilies["FAM_-1"]=-1; theFamilies["FAM_-2"]=-2; theFamilies["FAM_-3"]=-3; @@ -160,7 +160,7 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField() -6.111413346910e-07, -6.111413346910e-07}; - for (int i=0; i < field1d->getNumberOfTuples(); i++) + for (mcIdType i=0; i < field1d->getNumberOfTuples(); i++) { CPPUNIT_ASSERT_DOUBLES_EQUAL( values[i], field1d->getIJ(i, 0), 1e-12 ); } @@ -179,7 +179,7 @@ void SauvLoaderTest::testMed2Sauv() pointeM1D->setCoords( coords ); pointeM1D->setMeshDimension( 2 ); pointeM1D->allocateCells( 3 ); - int conn[]= + mcIdType conn[]= { 0,1,2, 0,1,3, 10,11,12,13 }; @@ -205,8 +205,8 @@ void SauvLoaderTest::testMed2Sauv() }; std::copy(vals,vals+d->getNbOfElems(),d->getPointer()); f1->setArray(d); - MCAuto da=DataArrayInt::New(); - int ids[] = + MCAuto da=DataArrayIdType::New(); + mcIdType ids[] = { 0,2 }; @@ -249,7 +249,7 @@ void SauvLoaderTest::testMed2Sauv() CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe4") != groups.end() ); CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe5") != groups.end() ); CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() ); - CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(16),m->getSizeAtLevel(0)); MCAuto um0 = m->getMeshAtLevel(0); CPPUNIT_ASSERT_EQUAL(12, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 )); CPPUNIT_ASSERT_EQUAL(2, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 )); @@ -328,10 +328,10 @@ void SauvLoaderTest::testCellsWithLingNames() // - Nombre de mailles de type MED_HEXA8 : 24 // - Nombre de mailles de type MED_PENTA6 : 3 MEDFileUMesh* m = static_cast( d2->getMeshes()->getMeshAtPos(0)); - CPPUNIT_ASSERT_EQUAL(6, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); - CPPUNIT_ASSERT_EQUAL(43, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 )); - CPPUNIT_ASSERT_EQUAL(24, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); - CPPUNIT_ASSERT_EQUAL(3, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 )); + CPPUNIT_ASSERT_EQUAL(ToIdType(6), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); + CPPUNIT_ASSERT_EQUAL(ToIdType(43), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 )); + CPPUNIT_ASSERT_EQUAL(ToIdType(24), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); + CPPUNIT_ASSERT_EQUAL(ToIdType(3), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 )); } void SauvLoaderTest::tearDown() @@ -350,7 +350,7 @@ void SauvLoaderTest::tearDown() if (access(fileToRemove[i], F_OK) == 0) #endif #if defined(WIN32) && defined(UNICODE) - _wremove(fileToRemove[i]); + _wremove(fileToRemove[i]); #else remove(fileToRemove[i]); #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx index 7297e48b6..551bb0fa5 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -30,10 +30,10 @@ MEDPARTITIONER::ConnectZone::ConnectZone(): ,_description("") ,_local_domain_number(0) ,_distant_domain_number(0) - ,_node_corresp(0) - ,_face_corresp(0) ,_local_mesh(0) ,_distant_mesh(0) + ,_node_corresp(0) + ,_face_corresp(0) { } @@ -50,11 +50,11 @@ MEDPARTITIONER::ConnectZone::ConnectZone(const ConnectZone & myConnectZone): ,_description(myConnectZone._description) ,_local_domain_number(myConnectZone._local_domain_number) ,_distant_domain_number(myConnectZone._distant_domain_number) + ,_local_mesh(0) + ,_distant_mesh(0) ,_node_corresp(myConnectZone._node_corresp) ,_face_corresp(myConnectZone._face_corresp) ,_entity_corresp(myConnectZone._entity_corresp) - ,_local_mesh(0) - ,_distant_mesh(0) { } @@ -99,17 +99,17 @@ bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(int localEntity, int di return false; } -const int *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const +const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const { return _node_corresp->getIndex(); } -const int *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const +const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const { return _node_corresp->getValues(); } -int MEDPARTITIONER::ConnectZone::getNodeNumber() const +mcIdType MEDPARTITIONER::ConnectZone::getNodeNumber() const { return _node_corresp->getNumberOf(); } @@ -119,17 +119,17 @@ const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getNodeCorresp() co return (const MEDCouplingSkyLineArray *)_node_corresp; } -const int *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const +const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const { return _face_corresp->getIndex(); } -const int *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const +const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const { return _face_corresp->getValues(); } -int MEDPARTITIONER::ConnectZone::getFaceNumber() const +mcIdType MEDPARTITIONER::ConnectZone::getFaceNumber() const { return _face_corresp->getNumberOf(); } @@ -139,8 +139,8 @@ const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getFaceCorresp() co return _face_corresp; } -const int *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity, - int distantEntity) const +const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity, + int distantEntity) const { typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; @@ -152,8 +152,8 @@ const int *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity, return 0; } -const int *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity, - int distantEntity) const +const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity, + int distantEntity) const { typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; @@ -165,8 +165,8 @@ const int *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity, return 0; } -int MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, - int distantEntity) const +mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, + int distantEntity) const { typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; @@ -178,7 +178,7 @@ int MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, return 0; } -int MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity, +mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity, int distantEntity) const { typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; @@ -252,15 +252,15 @@ void MEDPARTITIONER::ConnectZone::setDistantMesh(MEDCouplingUMesh * distantMesh) * the node-node connections * to a MEDCouplingSkyLineArray */ -void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode) +void MEDPARTITIONER::ConnectZone::setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode) { - MCAuto indexArr( DataArrayInt::New() ); - MCAuto valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayIdType::New() ); + MCAuto valueArr( DataArrayIdType::New() ); indexArr->alloc( nbnode+1 ); valueArr->alloc( 2*nbnode ); - int * index = indexArr->getPointer(); - int * value = valueArr->getPointer(); - for (int i=0; igetPointer(); + mcIdType * value = valueArr->getPointer(); + for (mcIdType i=0; i indexArr( DataArrayInt::New() ); - MCAuto valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayIdType::New() ); + MCAuto valueArr( DataArrayIdType::New() ); indexArr->alloc( nbface+1 ); valueArr->alloc( 2*nbface ); - int * index = indexArr->getPointer(); - int * value = valueArr->getPointer(); - for (int i=0; igetPointer(); + mcIdType * value = valueArr->getPointer(); + for (mcIdType i=0; i indexArr( DataArrayInt::New() ); - MCAuto valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayIdType::New() ); + MCAuto valueArr( DataArrayIdType::New() ); indexArr->alloc( nbentity+1 ); valueArr->alloc( 2*nbentity ); - int * index = indexArr->getPointer(); - int * value = valueArr->getPointer(); - for (int i=0; igetPointer(); + mcIdType * value = valueArr->getPointer(); + for (mcIdType i=0; i > getEntities() const; void setName(const std::string& name) ; @@ -79,13 +80,13 @@ namespace MEDPARTITIONER void setLocalMesh(MEDCouplingUMesh * localMesh) ; void setDistantMesh(MEDCouplingUMesh * distantMesh) ; - void setNodeCorresp(const int * nodeCorresp, int nbnode); + void setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode); void setNodeCorresp(MEDCouplingSkyLineArray* array); - void setFaceCorresp(const int * faceCorresp, int nbface); + void setFaceCorresp(const mcIdType * faceCorresp, mcIdType nbface); void setFaceCorresp(MEDCouplingSkyLineArray* array); - void setEntityCorresp(int localEntity, int distantEntity, - const int * entityCorresp, int nbentity); - void setEntityCorresp(int localEntity, int distantEntity, + void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity, + const mcIdType * entityCorresp, mcIdType nbentity); + void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity, MEDCouplingSkyLineArray *array); private : std::string _name; diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 51e7ee7af..09a9f3830 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -43,22 +43,22 @@ namespace MEDPARTITIONER int Graph::nbDomains() const { - std::set domains; + std::set domains; if ( _partition.isNotNull() ) - if ( MEDCoupling::DataArrayInt* array = _partition->getValuesArray() ) + if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() ) { - for ( const int * dom = array->begin(); dom != array->end(); ++dom ) + for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom ) domains.insert( *dom ); } return domains.size(); } - const int *Graph::getPart() const + const mcIdType *Graph::getPart() const { return _partition->getValues(); } - int Graph::nbVertices() const + mcIdType Graph::nbVertices() const { return _graph->getNumberOf(); } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx index 605718bd9..c860416e6 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx @@ -22,6 +22,7 @@ #include "MEDPARTITIONER.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" #include @@ -52,14 +53,14 @@ namespace MEDPARTITIONER virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0; //returns the partitioning - const int *getPart() const; + const mcIdType *getPart() const; //returns the number of graph vertices (which can correspond to the cells in the mesh!) - int nbVertices() const; + mcIdType nbVertices() const; // returns nb of domains in _partition int nbDomains() const; - + const MEDCouplingSkyLineArray *getGraph() const { return (const MEDCouplingSkyLineArray*)_graph; } const MEDCouplingSkyLineArray *getPartition() const { return (const MEDCouplingSkyLineArray*)_partition; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 130ffc701..6977da292 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -105,8 +105,8 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection _create_empty_groups(create_empty_groups), _joint_finder(0) { - std::vector > > new2oldIds(initialCollection.getTopology()->nbDomain()); - std::vector o2nRenumber; + std::vector > > new2oldIds(initialCollection.getTopology()->nbDomain()); + std::vector o2nRenumber; castCellMeshes(initialCollection, new2oldIds, o2nRenumber ); @@ -127,7 +127,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection //nodeMapping contains the mapping between old nodes and new nodes // (iolddomain,ioldnode)->(inewdomain,inewnode) createNodeMapping(initialCollection, nodeMapping); - std::vector > > new2oldFaceIds; + std::vector > > new2oldFaceIds; castFaceMeshes(initialCollection, nodeMapping, new2oldFaceIds); //////////////////// @@ -205,8 +205,8 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection */ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialCollection, - std::vector > >& new2oldIds, - std::vector & o2nRenumber) + std::vector > >& new2oldIds, + std::vector & o2nRenumber) { if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl; @@ -299,10 +299,10 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle _mesh[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshes(meshes); o2nRenumber[inew]=_mesh[inew]->sortCellsInMEDFileFrmt(); bool areNodesMerged; - int nbNodesMerged; + mcIdType nbNodesMerged; if (meshes.size()>1) { - MEDCoupling::DataArrayInt* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged); + MEDCoupling::DataArrayIdType* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged); array->decrRef(); // array is not used in this case } _mesh[inew]->zipCoords(); @@ -435,7 +435,7 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling */ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialCollection, const std::multimap, std::pair >& nodeMapping, - std::vector > >& new2oldIds) + std::vector > >& new2oldIds) { //splitMeshes structure will contain the partition of //the old faces on the new ones @@ -491,7 +491,7 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle { for (int ielem=0; ielemgetNumberOfCells(); ielem++) { - vector nodes; + vector nodes; meshesCastFrom[iold]->getNodeIdsOfCell(ielem,nodes); map faces; @@ -635,7 +635,7 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle void MEDPARTITIONER::MeshCollection::castIntField(std::vector& meshesCastFrom, std::vector& meshesCastTo, - std::vector& arrayFrom, + std::vector& arrayFrom, std::string nameArrayTo) { using std::vector; @@ -721,7 +721,7 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorgetConstPointer(); - int targetSize=targetMesh.getNumberOfCells(); - int sourceSize=sourceMesh.getNumberOfCells(); + mcIdType targetSize=targetMesh.getNumberOfCells(); + mcIdType sourceSize=sourceMesh.getNumberOfCells(); if (MyGlobals::_Verbose>200) std::cout<<"remap vers target de taille "< ccI; + std::vector ccI; std::string str,cle; str=nameArrayTo+"_toArray"; cle=Cle1ToStr(str,inew); - int* toArray; + mcIdType* toArray; const BBTreeOfDim* tree; bool cleantree=false; @@ -755,7 +755,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, { if (MyGlobals::_Is0verbose>100) std::cout << "create " << cle << " size " << targetSize << std::endl; - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); p->alloc(targetSize,1); p->fillWithZero(); toArray=p->getPointer(); @@ -871,7 +871,7 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, throw INTERP_KERNEL::Exception("Error remapDoubleField only on cellFieldDouble"); std::string key=Cle2ToStr("cellFamily_ccI",inew,iold); - std::map::iterator it1; + std::map::iterator it1; it1=_map_dataarray_int.find(key); if (it1==_map_dataarray_int.end()) { @@ -880,12 +880,12 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, return; } //create ccI in remapIntField - MEDCoupling::DataArrayInt *ccI=it1->second; + MEDCoupling::DataArrayIdType *ccI=it1->second; if (MyGlobals::_Verbose>300) std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField " << key << " size " << ccI->getNbOfElems() << std::endl; - int nbcell=this->getMesh()[inew]->getNumberOfCells(); - int nbcomp=fromArray->getNumberOfComponents(); + mcIdType nbcell=this->getMesh()[inew]->getNumberOfCells(); + std::size_t nbcomp=fromArray->getNumberOfComponents(); int nbPtGauss=StrToInt(ExtractFromDescription(descriptionField, "nbPtGauss=")); std::string tag="inewFieldDouble="+IntToStr(inew); @@ -933,8 +933,8 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, else { //replaced by setPartOfValuesAdv if nbPtGauss==1 - int iMax=ccI->getNbOfElems(); - int* pccI=ccI->getPointer(); + mcIdType iMax=ccI->getNbOfElems(); + mcIdType* pccI=ccI->getPointer(); double* pField=field->getPointer(); double* pFrom=fromArray->getPointer(); int itarget, isource, delta=nbPtGauss*nbcomp; @@ -965,13 +965,13 @@ namespace */ //================================================================================ - DataArrayInt* sortCorrespondences( DataArrayInt* ids1, - DataArrayInt* ids2, - int delta, - bool removeEqual = false) + DataArrayIdType* sortCorrespondences( DataArrayIdType* ids1, + DataArrayIdType* ids2, + int delta, + bool removeEqual = false) { // sort - MCAuto< DataArrayInt > renumN2O = ids1->buildPermArrPerLevel(); + MCAuto< DataArrayIdType > renumN2O = ids1->buildPermArrPerLevel(); ids1->renumberInPlaceR( renumN2O->begin() ); ids2->renumberInPlaceR( renumN2O->begin() ); @@ -982,7 +982,7 @@ namespace } if ( delta != 0 ) { - int * id = ids1->getPointer(); + mcIdType * id = ids1->getPointer(); for ( ; id < ids1->end(); ++id ) ++(*id); id = ids2->getPointer(); @@ -991,7 +991,7 @@ namespace } // join - DataArrayInt* ids12 = DataArrayInt::Meld( ids1, ids2 ); // two components + DataArrayIdType* ids12 = DataArrayIdType::Meld( ids1, ids2 ); // two components ids12->rearrange( 1 ); // make one component return ids12; } @@ -1004,12 +1004,12 @@ namespace */ //================================================================================ - void renumber( DataArrayInt* ids, const DataArrayInt* o2nRenumber ) + void renumber( DataArrayIdType* ids, const DataArrayIdType* o2nRenumber ) { if ( !ids || !o2nRenumber ) return; - int * id = ids->getPointer(); - const int * o2n = o2nRenumber->getConstPointer(); + mcIdType * id = ids->getPointer(); + const mcIdType * o2n = o2nRenumber->getConstPointer(); for ( ; id < ids->end(); ++id ) { *id = o2n[ *id ]; @@ -1029,7 +1029,7 @@ namespace //================================================================================ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeMapping, - const std::vector & o2nRenumber, + const std::vector & o2nRenumber, int nbInitialDomains) { if ( !MyGlobals::_Create_Joints || _topology->nbDomain() < 2 ) @@ -1053,7 +1053,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // 1) add node correspondences // ================================== - std::vector< std::vector< std::vector< int > > > nodeCorresp( nb_domains ); + std::vector< std::vector< std::vector< mcIdType > > > nodeCorresp( nb_domains ); for ( int idomain = 0; idomain < nb_domains; ++idomain ) { nodeCorresp[ idomain ].resize( nb_domains ); @@ -1101,7 +1101,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM { for ( int idomainNear = 0; idomainNear < nb_domains; ++idomainNear ) { - std::vector< int > & corresp = nodeCorresp[ idomain ][ idomainNear ]; + std::vector< mcIdType > & corresp = nodeCorresp[ idomain ][ idomainNear ]; if ( corresp.empty() ) continue; @@ -1142,8 +1142,8 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // separate ids of two domains const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getEntityCorresp( 0, 0 ); - const DataArrayInt* ids12 = corrArray->getValuesArray(); - MCAuto ids1, ids2, ids12Sorted; + const DataArrayIdType* ids12 = corrArray->getValuesArray(); + MCAuto ids1, ids2, ids12Sorted; ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 ); ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 ); @@ -1180,13 +1180,13 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM } else // split and sort { - typedef std::pair< std::vector< int >, std::vector< int > > T2Vecs; + typedef std::pair< std::vector< mcIdType >, std::vector< mcIdType > > T2Vecs; T2Vecs idsByType[ INTERP_KERNEL::NORM_MAXTYPE ][ INTERP_KERNEL::NORM_MAXTYPE ]; int t1, t2; - const int nbIds = ids1->getNbOfElems(); - const int * p1 = ids1->begin(), * p2 = ids2->begin(); - for ( int i = 0; i < nbIds; ++i ) + const mcIdType nbIds = ids1->getNbOfElems(); + const mcIdType * p1 = ids1->begin(), * p2 = ids2->begin(); + for ( mcIdType i = 0; i < nbIds; ++i ) { t1 = mesh1->getTypeOfCell( p1[ i ]); t2 = mesh2->getTypeOfCell( p2[ i ]); @@ -1252,8 +1252,8 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // separate ids of two domains const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getNodeCorresp(); - const DataArrayInt *ids12 = corrArray->getValuesArray(); - MCAuto ids1, ids2, ids12Sorted; + const DataArrayIdType *ids12 = corrArray->getValuesArray(); + MCAuto ids1, ids2, ids12Sorted; ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 ); ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 ); @@ -1437,15 +1437,15 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& _group_info.erase( groupName ); // get family IDs array - int* famIDs = 0; + mcIdType* famIDs = 0; int inew = (is2nd ? inew2 : inew1 ); - int totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0; + mcIdType totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0; std::string cle = Cle1ToStr( "faceFamily_toArray", inew ); if ( !_map_dataarray_int.count(cle) ) { if ( totalNbFaces > 0 ) { - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); p->alloc( totalNbFaces, 1 ); p->fillWithZero(); famIDs = p->getPointer(); @@ -1457,8 +1457,8 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& famIDs = _map_dataarray_int.find(cle)->second->getPointer(); } // find a family ID of an existing JOINT group - int familyID = 0; - std::map::iterator name2id = _family_info.find( groupName ); + mcIdType familyID = 0; + std::map::iterator name2id = _family_info.find( groupName ); if ( name2id != _family_info.end() ) familyID = name2id->second; @@ -1473,7 +1473,7 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& if ( familyID == 0 ) // generate a family ID for JOINT group { - std::set< int > familyIDs; + std::set< mcIdType > familyIDs; for ( name2id = _family_info.begin(); name2id != _family_info.end(); ++name2id ) familyIDs.insert( name2id->second ); // find the next free family ID @@ -1748,7 +1748,7 @@ MEDPARTITIONER::MeshCollection::~MeshCollection() if (_face_family_ids[i]!=0) _face_family_ids[i]->decrRef(); - for (std::map::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ ) + for (std::map::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ ) if ((*it).second!=0) (*it).second->decrRef(); @@ -1919,8 +1919,8 @@ void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyL //looking for reverse nodal connectivity i global numbering if (isParallelMode() && !_domain_selector->isMyDomain(0)) { - vector value; - vector index(1,0); + vector value; + vector index(1,0); array = MEDCoupling::MEDCouplingSkyLineArray::New(index,value); return; @@ -1968,21 +1968,21 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup continue; meshDim = _mesh[idomain]->getMeshDimension(); - MEDCoupling::DataArrayInt* index=MEDCoupling::DataArrayInt::New(); - MEDCoupling::DataArrayInt* revConn=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New(); + MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New(); int 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; - int* index_ptr=index->getPointer(); - int* revConnPtr=revConn->getPointer(); + mcIdType* index_ptr=index->getPointer(); + mcIdType* revConnPtr=revConn->getPointer(); for (int i=0; iconvertNodeToGlobal(idomain,i); - int globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]); + mcIdType globalNode=_topology->convertNodeToGlobal(idomain,i); + mcIdType globalCell=_topology->convertCellToGlobal(idomain,revConnPtr[icell]); node2cell.insert(make_pair(globalNode, globalCell)); } } @@ -2065,7 +2065,7 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup if (MyGlobals::_Verbose>50) std::cout << "proc " << MyGlobals::_Rank << " : create skylinearray" << std::endl; //filling up index and value to create skylinearray structure - std::vector index,value; + std::vector index,value; index.push_back(0); int idep=0; @@ -2212,7 +2212,7 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(int nb * * returns a topology based on the new partition */ -MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const int* partition) +MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const mcIdType* partition) { MEDCoupling::MEDCouplingSkyLineArray* array=0; int* edgeweights=0; @@ -2332,13 +2332,13 @@ void MEDPARTITIONER::MeshCollection::prepareFieldDescriptions() } //returns true if inodes of a face are in inodes of a cell -bool isFaceOncell(std::vector< int >& inodesFace, std::vector< int >& inodesCell) +bool isFaceOncell(std::vector< mcIdType >& inodesFace, std::vector< mcIdType >& inodesCell) { int ires=0; int nbok=inodesFace.size(); for (int i=0; igetReverseNodalConnectivity(revNodalCel,revNodalIndxCel); - int *revC=revNodalCel->getPointer(); - int *revIndxC=revNodalIndxCel->getPointer(); + mcIdType *revC=revNodalCel->getPointer(); + mcIdType *revIndxC=revNodalIndxCel->getPointer(); - std::vector< int > faceOnCell; - std::vector< int > faceNotOnCell; - int nbface=mfac->getNumberOfCells(); - for (int iface=0; iface faceOnCell; + std::vector< mcIdType > faceNotOnCell; + mcIdType nbface=mfac->getNumberOfCells(); + for (mcIdType iface=0; iface inodesFace; + std::vector< mcIdType > inodesFace; mfac->getNodeIdsOfCell(iface, inodesFace); int nbnodFace=inodesFace.size(); if ( nbnodFace != mfac->getNumberOfNodesInCell( iface )) @@ -2404,8 +2404,8 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() int nbcell=revIndxC[inod+1]-revIndxC[inod]; for (int j=0; j inodesCell; + mcIdType icel=revC[revIndxC[inod]+j]; + std::vector< mcIdType > inodesCell; mcel->getNodeIdsOfCell(icel, inodesCell); ok=isFaceOncell(inodesFace, inodesCell); if (ok) break; @@ -2443,11 +2443,11 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() std::string key = Cle1ToStr("faceFamily_toArray",inew); if ( getMapDataArrayInt().count( key )) { - MEDCoupling::DataArrayInt * & fam = getMapDataArrayInt()[ key ]; - MEDCoupling::DataArrayInt * famFilter = MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType * & fam = getMapDataArrayInt()[ key ]; + MEDCoupling::DataArrayIdType * famFilter = MEDCoupling::DataArrayIdType::New(); famFilter->alloc(faceOnCell.size(),1); - int* pfamFilter = famFilter->getPointer(); - int* pfam = fam->getPointer(); + mcIdType* pfamFilter = famFilter->getPointer(); + mcIdType* pfam = fam->getPointer(); for ( size_t i=0; idecrRef(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx index c20901c84..06e80d048 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx @@ -82,7 +82,7 @@ namespace MEDPARTITIONER const std::string& ="", int* edgeweights=0, int* verticesweights=0); //creation of a user specified partition - Topology* createPartition(const int* partition); + Topology* createPartition(const mcIdType* partition); //getting mesh dimension int getMeshDimension() const; @@ -100,13 +100,13 @@ namespace MEDPARTITIONER MEDCoupling::MEDCouplingUMesh* getFaceMesh(int idomain); std::vector& getGroupMeshes(int idomain); - std::vector& getCellFamilyIds() { return _cell_family_ids; } - std::vector& getFaceFamilyIds() { return _face_family_ids; } + std::vector& getCellFamilyIds() { return _cell_family_ids; } + std::vector& getFaceFamilyIds() { return _face_family_ids; } - std::map& getMapDataArrayInt() { return _map_dataarray_int; } + std::map& getMapDataArrayInt() { return _map_dataarray_int; } std::map& getMapDataArrayDouble() { return _map_dataarray_double; } - std::map& getFamilyInfo() { return _family_info; } + std::map& getFamilyInfo() { return _family_info; } std::map >& getGroupInfo() { return _group_info; } MEDCoupling::DataArrayDouble* getField(std::string descriptionField, int iold); @@ -141,17 +141,17 @@ namespace MEDPARTITIONER std::multimap,std::pair >& nodeMapping); void castCellMeshes(MeshCollection& initialCollection, - std::vector > >& new2oldIds, - std::vector & o2nRenumber); + std::vector > >& new2oldIds, + std::vector & o2nRenumber); //creates faces on the new collection void castFaceMeshes(MeshCollection& initialCollection, const std::multimap, std::pair >& nodeMapping, - std::vector > >& new2oldIds); + std::vector > >& new2oldIds); //constructing connect zones void buildConnectZones( const NodeMapping& nodeMapping, - const std::vector & o2nRenumber, + const std::vector & o2nRenumber, int nbInitialDomains ); // Find faces common with neighbor domains and put them in groups @@ -160,7 +160,7 @@ namespace MEDPARTITIONER private: void castIntField(std::vector& meshesCastFrom, std::vector& meshesCastTo, - std::vector& arrayFrom, + std::vector& arrayFrom, std::string nameArrayTo); void castAllFields(MeshCollection& initialCollection, @@ -172,7 +172,7 @@ namespace MEDPARTITIONER void remapIntField(int inew, int iold, const MEDCoupling::MEDCouplingUMesh& sourceMesh, const MEDCoupling::MEDCouplingUMesh& targetMesh, - const int* fromArray, + const mcIdType* fromArray, std::string nameArrayTo, const BBTreeOfDim* tree); @@ -207,11 +207,11 @@ namespace MEDPARTITIONER int _i_non_empty_mesh; //family ids storages - std::vector _cell_family_ids; - std::vector _face_family_ids; + std::vector _cell_family_ids; + std::vector _face_family_ids; //DataArrayInt* storages - std::map _map_dataarray_int; + std::map _map_dataarray_int; //DataArrayDouble* storages std::map _map_dataarray_double; @@ -219,7 +219,7 @@ namespace MEDPARTITIONER std::vector _field_descriptions; //group family conversion - std::map _family_info; + std::map _family_info; std::map > _group_info; //list of groups that are not to be split diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index d01d9e068..1f7c80041 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -72,8 +72,8 @@ int MeshCollectionDriver::readSeq(const char* filename, const char* meshname) (_collection->getFaceMesh()).push_back(mfm->getLevelM1Mesh(false)); //reading family ids - MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); - MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); + MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); + MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); (_collection->getCellFamilyIds()).push_back(cellIds); (_collection->getFaceFamilyIds()).push_back(faceIds); @@ -136,13 +136,13 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) { (_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false); //reading families groups - MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); + MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); (_collection->getCellFamilyIds())[idomain]=cellIds; } catch(...) { (_collection->getMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want tests; - MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New(); empty->alloc(0,1); (_collection->getCellFamilyIds())[idomain]=empty; std::cout<<"\nNO Level0Mesh (Cells)\n"; @@ -153,7 +153,7 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) { (_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false); //reading families groups - MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); + MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); (_collection->getFaceFamilyIds())[idomain]=faceIds; if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : WITH Faces\n"; @@ -166,7 +166,7 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) catch(...) { (_collection->getFaceMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want test; - MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New(); (_collection->getFaceFamilyIds())[idomain]=empty; if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : WITHOUT Faces\n"; @@ -368,10 +368,10 @@ MEDCoupling::MEDCouplingFieldDouble* MeshCollectionDriver::getField(std::string r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT)); r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT)); //not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription=")); - int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); + std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); if (nbc==da->getNumberOfComponents()) { - for (int i=0; isetInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"=")); } else diff --git a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx index 561d366ec..6f20908ee 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx @@ -55,10 +55,17 @@ void METISGraph::partGraph(int ndomain, std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::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 //constraints int * vwgt=_cell_weight; int * adjwgt=_edge_weight; @@ -100,13 +107,13 @@ void METISGraph::partGraph(int ndomain, for (int i=0; i index(n+1); - vector value(n); + vector index(n+1); + vector value(n); index[0]=0; for (int i=0; igetLocalDomainNumber() == idomain && cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber()) { - int nb_node= cz[icz]->getNodeNumber(); - const int* node_corresp=cz[icz]->getNodeCorrespValue(); + mcIdType nb_node= cz[icz]->getNodeNumber(); + const mcIdType* node_corresp=cz[icz]->getNodeCorrespValue(); int distant_ip = cz[icz]->getDistantDomainNumber(); - for (int i=0; i< nb_node; i++) + for (mcIdType i=0; i< nb_node; i++) { int local= node_corresp[i*2]; int distant = node_corresp[i*2+1]; @@ -292,7 +292,7 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d _node_loc_to_glob.resize(_nb_domain); _face_loc_to_glob.resize(_nb_domain); - const int* part=graph->getPart(); //all cells for this proc (may be more domains) + const mcIdType* part=graph->getPart(); //all cells for this proc (may be more domains) _nb_total_cells=graph->nbVertices(); //all cells for this proc (may be more domains) if (MyGlobals::_Verbose>300) std::cout << "proc " << MyGlobals::_Rank << " : topology from partition, nbTotalCells " << _nb_total_cells << std::endl; @@ -324,17 +324,17 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d if ( MyGlobals::_Create_Joints && nb_domain > 1 ) { - std::vector< std::vector< std::vector< int > > > cellCorresp( nb_domain ); + std::vector< std::vector< std::vector< mcIdType > > > cellCorresp( nb_domain ); for ( int idomain = 0; idomain < nb_domain; ++idomain ) { cellCorresp[ idomain ].resize( nb_domain ); } const MEDCoupling::MEDCouplingSkyLineArray* skylinegraph = graph->getGraph(); - const int* index = skylinegraph->getIndex(); - const int* value = skylinegraph->getValues(); - const int nbCells = skylinegraph->getNumberOf(); + const mcIdType* index = skylinegraph->getIndex(); + const mcIdType* value = skylinegraph->getValues(); + const mcIdType nbCells = skylinegraph->getNumberOf(); - for ( int iGlob = 0; iGlob < nbCells; ++iGlob ) + for ( mcIdType iGlob = 0; iGlob < nbCells; ++iGlob ) { int iGlobDom = part[ iGlob ]; for ( int i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ ) @@ -358,7 +358,7 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d { for ( int idomainNear = 0; idomainNear < nb_domain; ++idomainNear ) { - std::vector< int > & corresp = cellCorresp[ idomain ][ idomainNear ]; + std::vector< mcIdType > & corresp = cellCorresp[ idomain ][ idomainNear ]; if ( corresp.empty() ) continue; MEDPARTITIONER::ConnectZone* cz = new MEDPARTITIONER::ConnectZone(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx index 8718430a3..5158eb6d8 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx @@ -55,8 +55,15 @@ void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Para //number of graph vertices int n = _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; @@ -99,13 +106,13 @@ void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Para SCOTCH_stratExit(&scotch_strategy); SCOTCH_graphExit(&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; i index(n+1),value(n); + std::vector index(n+1),value(n); index[0]=0; - for (int i=0; i& v) +MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v) { - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); p->alloc(v.size(),1); std::copy(v.begin(),v.end(),p->getPointer()); return p; } -MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v,const int nbComponents) +MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v,const int nbComponents) { - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); if (v.size()%nbComponents!=0) throw INTERP_KERNEL::Exception("Problem size modulo nbComponents != 0"); p->alloc(v.size()/nbComponents,nbComponents); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx index 3b00ab7bf..184098369 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx @@ -77,8 +77,8 @@ namespace MEDPARTITIONER MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description, std::string& fieldName, int& typeField, int& entity, int& DT, int& IT); - MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector& v); - MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector& v, const int nbComponents); + MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector& v); + MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector& v, const int nbComponents); MEDCoupling::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector& v); MEDCoupling::MEDCouplingUMesh *CreateEmptyMEDCouplingUMesh(); diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 1c1b78102..f12bcb281 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -163,7 +163,7 @@ void MEDPARTITIONERTest::tearDown() MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() //only hexa8 { - vector conn; + vector conn; vector coor; for (int k=0; k<=_nk; k++) for (int j=0; j<=_nj; j++) @@ -213,12 +213,12 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(3); - int nbc=conn.size()/8; //nb of cells - int nbv=coor.size()/3; //nb of vertices + mcIdType nbc=conn.size()/8; //nb of cells + mcIdType nbv=coor.size()/3; //nb of vertices mesh->allocateCells(nbc); - for(int i=0; i conn; + vector conn; vector coor; for (int j=0; j<=_nj; j++) for (int i=0; i<=_ni; i++) @@ -286,7 +286,7 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh() mesh->allocateCells(nbc); for(int i=0; iallocateCells(nbc); for(int i=0; igetName().c_str()); - DataArrayInt* FacesFam=DataArrayInt::New(); + DataArrayIdType* FacesFam=DataArrayIdType::New(); FacesFam->alloc(mfm->getSizeAtLevel(-1),1); FacesFam->fillWithValue(-1); - DataArrayInt* CellsFam=DataArrayInt::New(); + DataArrayIdType* CellsFam=DataArrayIdType::New(); CellsFam->alloc(mfm->getSizeAtLevel(0),1); CellsFam->fillWithValue(1); mfm->setFamilyFieldArr(-1,FacesFam); mfm->setFamilyFieldArr(0,CellsFam); - map theFamilies; + map theFamilies; theFamilies["FAMILLE_ZERO"]=0; theFamilies["FamilyFaces"]=-1; theFamilies["FamilyCells"]=1; @@ -1105,7 +1105,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std */ std::vector meshes; - std::vector corr; + std::vector corr; meshes.push_back(cellMesh); refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); meshes.push_back(refusedCellMesh); @@ -1175,7 +1175,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); std::vector meshes; - std::vector corr; + std::vector corr; meshes.push_back(cellMesh); refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); meshes.push_back(refusedCellMesh); @@ -1203,10 +1203,10 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC int nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); - int* pc=corr[1]->getPointer(); + mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - int i1=pc[i]*nbcomp; + mcIdType i1=pc[i]*nbcomp; int i2=i*nbcomp; for (int j = 0; j < nbcomp; j++) { @@ -1263,7 +1263,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); std::vector meshes; - std::vector corr; + std::vector corr; meshes.push_back(cellMesh); refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); meshes.push_back(refusedCellMesh); @@ -1292,10 +1292,10 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG int nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); - int* pc=corr[1]->getPointer(); + mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - int i1=pc[i]*nbcomp*nbptgauss; + mcIdType i1=pc[i]*nbcomp*nbptgauss; int i2=i*nbcomp*nbptgauss; for (int j = 0; j < nbcomp*nbptgauss; j++) { @@ -1336,7 +1336,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() int nbFam1, nbFam2, nbc; { const int nbX = 20, nbY = 15; - vector conn; + vector conn; vector coor; for (int j=0; j<=nbY; j++) for (int i=0; i<=nbX; i++) @@ -1360,7 +1360,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() nbc=conn.size()/4; //nb of cells mesh->allocateCells(nbc); - int* pConn = &conn[0]; + mcIdType* pConn = &conn[0]; for(int i=0; iinsertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn); mesh->finishInsertingCells(); @@ -1374,14 +1374,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() mesh->checkConsistencyLight(); // groups of cells - DataArrayInt* cellsFam=DataArrayInt::New(); + DataArrayIdType* cellsFam=DataArrayIdType::New(); cellsFam->alloc(nbc,1); nbFam1 = nbc/3, nbFam2 = nbc/2; int iE = 0; for ( int i = 0; i < nbFam1; ++i ) cellsFam->getPointer()[ iE++ ] = idFam1; for ( int i = 0; i < nbFam2; ++i ) cellsFam->getPointer()[ iE++ ] = idFam2; for ( ; iE < nbc; ) cellsFam->getPointer()[ iE++ ] = 0; - map theFamilies; + map theFamilies; theFamilies["FAMILLE_ZERO"]=0; theFamilies["Family1" ]=idFam1; theFamilies["Family2" ]=idFam2; @@ -1446,10 +1446,10 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() std::map< int, int > famId2nb; // count total nb of cells in divided families std::map< int, int >::iterator id2nn; { - const std::vector& famIdsVec = new_collection.getCellFamilyIds(); + const std::vector& famIdsVec = new_collection.getCellFamilyIds(); for ( size_t i = 0; i < famIdsVec.size(); ++i ) { - MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i]; + MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i]; for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) { id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first; @@ -1468,10 +1468,10 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // Check that "creates boundary faces option is handled" famId2nb.clear(); - const std::vector& famIdsVec = new_collection.getFaceFamilyIds(); + const std::vector& famIdsVec = new_collection.getFaceFamilyIds(); for ( size_t i = 0; i < famIdsVec.size(); ++i ) { - MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i]; + MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i]; for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) { id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first; @@ -1483,8 +1483,8 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // for each "JOINT_n_p_..." group there must be "JOINT_p_n_..." group // of the same size - std::map& famName2id = new_collection.getFamilyInfo(); - std::map::iterator na2id = famName2id.begin(), na2id2; + std::map& famName2id = new_collection.getFamilyInfo(); + std::map::iterator na2id = famName2id.begin(), na2id2; std::set< int > okFamIds; okFamIds.insert(0); for ( ; na2id != famName2id.end(); ++na2id ) diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx index 094446a65..dab38c868 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx @@ -28,27 +28,27 @@ #include #include -void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) +void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) { - MEDCoupling::MCAuto out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); // typedef boost::adjacency_list > > Graph; + boost::property > > Graph; typedef boost::graph_traits::vertex_descriptor Vertex; typedef boost::graph_traits::vertices_size_type size_type; Graph G(nbCell); - for (int i=0;i::type index_map = boost::get(boost::vertex_index, G); boost::cuthill_mckee_ordering(G, out0->getPointer(), boost::get(boost::vertex_color, G), boost::make_degree_map(G)); - int *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer()); - for(int c=0;c!=nbCell;++c) + mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer()); + for(mcIdType c=0;c!=nbCell;++c) out1Ptr[index_map[out0Ptr[nbCell-c-1]]]=c; out0->reverse(); iperm=out0.retn(); perm=out1.retn(); diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx index f82bab2a7..4a62e4f66 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx @@ -26,7 +26,7 @@ class RENUMBER_EXPORT BOOSTRenumbering:public Renumbering { public: - void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm); + void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm); }; #endif /*BOOSTRENUMBERING_HXX_*/ diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.cxx b/src/RENUMBER/RENUMBER_METISRenumbering.cxx index 3fb90960e..f2593b051 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.cxx @@ -33,13 +33,36 @@ extern "C" #include "RENUMBER_METISRenumbering.hxx" -void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) +#ifdef MEDCOUPLING_USE_64BIT_IDS +#define ID_TYPE_SIZE 64 +#else +#define ID_TYPE_SIZE 32 +#endif + +void METISRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) { - MEDCoupling::MCAuto out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); int num_flag=1; int options=0; - METIS_NodeND(&nbCell,(int*)index_graph,(int*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer()); + +#if ID_TYPE_SIZE == IDXTYPEWIDTH + + METIS_NodeND(&nbCell,(idx_t*)index_graph,(idx_t*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer()); + +#else + + mcIdType indexSize = nbCell + 1, graphSize = index_graph[indexSize]; + std::vector indexVec( index_graph, index_graph + indexSize ); + std::vector graphVec( graph, graph + graphSize ); + std::vector out0Vec( nbCell ), out1Vec( nbCell ); + idx_t nb = static_cast( nbCell ); + METIS_NodeND(&nb,indexVec.data(),graphVec.data(),&num_flag,&options,out0Vec.data(),out1Vec.data()); + std::copy( out0Vec.begin(),out0Vec.end(),out0->getPointer() ); + std::copy( out1Vec.begin(),out1Vec.end(),out1->getPointer() ); + +#endif + iperm=out0.retn(); perm=out1.retn(); } diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.hxx b/src/RENUMBER/RENUMBER_METISRenumbering.hxx index c29dd2419..4fa31399d 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.hxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.hxx @@ -26,7 +26,7 @@ class RENUMBER_EXPORT METISRenumbering:public Renumbering { public: - virtual void renumber(const int *graph, const int *index_graph, int nb_cell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm); + virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nb_cell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm); }; #endif /*METISRENUMBERING_HXX_*/ diff --git a/src/RENUMBER/RENUMBER_Renumbering.hxx b/src/RENUMBER/RENUMBER_Renumbering.hxx index 12e034b49..df2c83d7f 100644 --- a/src/RENUMBER/RENUMBER_Renumbering.hxx +++ b/src/RENUMBER/RENUMBER_Renumbering.hxx @@ -27,13 +27,13 @@ namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; } class RENUMBER_EXPORT Renumbering { public: - virtual void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) = 0; + virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) = 0; virtual ~Renumbering() { } }; diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index 50d78d78e..9a549ea57 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -69,15 +69,15 @@ int main(int argc, char** argv) cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush; // Reading mesh MCAuto workMesh=mc->getMeshAtLevel(0); - std::vector code=workMesh->getDistributionOfTypes(); + //std::vector code=workMesh->getDistributionOfTypes(); cout << "Building the graph : " << flush; - DataArrayInt *neighb=0,*neighbI=0; + DataArrayIdType *neighb=0,*neighbI=0; workMesh->computeNeighborsOfCells(neighb,neighbI); - MCAuto neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; - const int *graph=neighbSafe->begin(); - const int *graph_index=neighbISafe->begin(); + MCAuto neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; + const mcIdType *graph=neighbSafe->begin(); + const mcIdType *graph_index=neighbISafe->begin(); // Compute permutation iperm->new2old perm->old2new - DataArrayInt *iperm(0),*perm(0); + DataArrayIdType *iperm(0),*perm(0); Renumbering *renumb=RenumberingFactory(type_renum); renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm); ipermSafe=iperm; permSafe=perm; @@ -90,10 +90,10 @@ int main(int argc, char** argv) cout << "Reordering connectivity & families and writing : " << flush; workMesh->renumberCells(perm->begin(),false); mc->setMeshAtLevel(0,workMesh); - const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0); + const DataArrayIdType *famField=mc->getFamilyFieldAtLevel(0); if(famField) { - MCAuto famField2=famField->renumber(perm->begin()); + MCAuto famField2=famField->renumber(perm->begin()); mc->setFamilyFieldArr(0,famField2); } mc->write(filename_out,2); diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index 33ea03f6b..0b224d8d5 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -28,6 +28,9 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDRenumber_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) SET (MEDRenumber_SWIG_DPYS_FILES MEDRenumberCommon.i diff --git a/src/RENUMBER_Swig/MEDRenumberImpl.i b/src/RENUMBER_Swig/MEDRenumberImpl.i index 21c5c8e9d..3b116cb84 100644 --- a/src/RENUMBER_Swig/MEDRenumberImpl.i +++ b/src/RENUMBER_Swig/MEDRenumberImpl.i @@ -32,17 +32,17 @@ class Renumbering public: %extend { - virtual PyObject *renumber(const MEDCoupling::DataArrayInt *graph, const MEDCoupling::DataArrayInt *index_graph) + virtual PyObject *renumber(const MEDCoupling::DataArrayIdType *graph, const MEDCoupling::DataArrayIdType *index_graph) { if(!graph || !index_graph) throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is NULL !"); if(!graph->isAllocated() || !index_graph->isAllocated()) throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is not allocated !"); - MEDCoupling::DataArrayInt *out0(0),*out1(0); + MEDCoupling::DataArrayIdType *out0(0),*out1(0); self->renumber(graph->begin(),index_graph->begin(),index_graph->getNumberOfTuples()-1,out0,out1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } }