X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileMeshLL.cxx;h=7e12d9406b535caffca5a5e828fc065c819ee3b2;hb=1123dccd6613b2e8abba35182759d5c4a11ecc8d;hp=79ea1141a59ee6dcff2c41fcd3086f77aca057fb;hpb=e8b950373b69ffb996e9ecf5878b426494a635c2;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 79ea1141a..7e12d9406 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2014 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -50,7 +50,7 @@ std::vector MEDFileMeshL2::getDirectChildren() const return std::vector(); } -int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1) +int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const std::string& mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1) { med_mesh_type type_maillage; char maillage_description[MED_COMMENT_SIZE+1]; @@ -94,7 +94,7 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM: case MED_STRUCTURED_MESH: { med_grid_type gt; - MEDmeshGridTypeRd(fid,mname,>); + MEDmeshGridTypeRd(fid,mname.c_str(),>); switch(gt) { case MED_CARTESIAN_GRID: @@ -113,12 +113,12 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM: } med_int numdt,numit; med_float dtt; - MEDmeshComputationStepInfo(fid,mname,1,&numdt,&numit,&dtt); + MEDmeshComputationStepInfo(fid,mname.c_str(),1,&numdt,&numit,&dtt); dt=numdt; it=numit; return ret; } -double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nstep, int dt, int it) +double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it) { bool found=false; med_int numdt,numit; @@ -126,7 +126,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste std::vector< std::pair > p(nstep); for(int i=0;i(numdt,numit); found=(numdt==dt) && (numit==numit); } @@ -141,7 +141,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste return dtt; } -std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim) +std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim) { med_mesh_type type_maillage; med_int spaceDim; @@ -164,7 +164,7 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, case MED_STRUCTURED_MESH: { med_grid_type gt; - MEDmeshGridTypeRd(fid,mName,>); + MEDmeshGridTypeRd(fid,mName.c_str(),>); switch(gt) { case MED_CARTESIAN_GRID: @@ -191,22 +191,22 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, return infosOnComp; } -void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const char *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); + int nfam=MEDnFamily(fid,meshName.c_str()); for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; INTERP_KERNEL::AutoPtr attdes=new char[MED_COMMENT_SIZE*natt+1]; INTERP_KERNEL::AutoPtr gro=new char[MED_LNAME_SIZE*ngro+1]; - MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro); + MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro); std::string famName=MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE); fams[famName]=numfam; for(int j=0;j& 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) { for(std::map::const_iterator it=fams.begin();it!=fams.end();it++) { @@ -234,7 +234,7 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const char *mname, const s MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE-1,groName+i*MED_LNAME_SIZE,tooLongStrPol); INTERP_KERNEL::AutoPtr famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); - int ret=MEDfamilyCr(fid,mname,famName,(*it).second,ngro,groName); + int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second,ngro,groName); ret++; } } @@ -243,13 +243,13 @@ MEDFileUMeshL2::MEDFileUMeshL2() { } -void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { - _name.set(mName); + _name.set(mName.c_str()); int nstep; int Mdim; ParaMEDMEM::MEDCouplingMeshType meshType; - std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName,meshType,nstep,Mdim); + std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim); if(meshType!=UNSTRUCTURED) throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected an unstructured one whereas in file it is not an unstructured !"); _time=CheckMeshTimeStep(fid,mName,nstep,dt,it); @@ -259,55 +259,55 @@ void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in loadCoords(fid,mId,infosOnComp,mName,dt,it); } -void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { _per_type_mesh.resize(1); _per_type_mesh[0].clear(); for(int j=0;j& infosOnComp, const char *mName, int dt, int it) +void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector& infosOnComp, const std::string& mName, int dt, int it) { int spaceDim=infosOnComp.size(); med_bool changement,transformation; - int nCoords=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation); + int nCoords=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation); _coords=DataArrayDouble::New(); _coords->alloc(nCoords,spaceDim); double *coordsPtr=_coords->getPointer(); - MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,coordsPtr); - if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) + 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); - MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()); + MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()); } else _fam_coords=0; - if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>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); - MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()); + MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()); } else _num_coords=0; - if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0) + if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0) { _name_coords=DataArrayAsciiChar::New(); _name_coords->alloc(nCoords+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end - MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer()); + MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer()); _name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end } else _name_coords=0; for(int i=0;isetInfoOnComponent(i,infosOnComp[i].c_str()); + _coords->setInfoOnComponent(i,infosOnComp[i]); } void MEDFileUMeshL2::sortTypes() @@ -343,15 +343,15 @@ void MEDFileUMeshL2::sortTypes() _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev); } -void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords) +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) { if(!coords) return ; - MEDmeshNodeCoordinateWr(fid,mname,dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer()); + MEDmeshNodeCoordinateWr(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer()); if(famCoords) - MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer()); + MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer()); if(numCoords) - MEDmeshEntityNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer()); + MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer()); if(nameCoords) { if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -360,7 +360,7 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDmeshEntityNameWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer()); + MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer()); } } @@ -392,13 +392,13 @@ MEDFileCMeshL2::MEDFileCMeshL2() { } -void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it) +void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it) { - _name.set(mName); + _name.set(mName.c_str()); int nstep; int Mdim; ParaMEDMEM::MEDCouplingMeshType meshType; - std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName,meshType,nstep,Mdim); + std::vector infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim); if(meshType!=CARTESIAN) throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected a structured one whereas in file it is not a structured !"); _time=CheckMeshTimeStep(fid,mName,nstep,dt,it); @@ -406,7 +406,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in _order=it; // med_grid_type gridtype; - MEDmeshGridTypeRd(fid,mName,&gridtype); + MEDmeshGridTypeRd(fid,mName.c_str(),&gridtype); if(gridtype!=MED_CARTESIAN_GRID) throw INTERP_KERNEL::Exception("Invalid structured mesh ! Expected cartesian mesh type !"); _cmesh=MEDCouplingCMesh::New(); @@ -414,11 +414,11 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in { med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf); + int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf); MEDCouplingAutoRefCountObjectPtr da=DataArrayDouble::New(); da->alloc(nbOfElt,1); - da->setInfoOnComponent(0,infosOnComp[i].c_str()); - MEDmeshGridIndexCoordinateRd(fid,mName,dt,it,i+1,da->getPointer()); + da->setInfoOnComponent(0,infosOnComp[i]); + MEDmeshGridIndexCoordinateRd(fid,mName.c_str(),dt,it,i+1,da->getPointer()); _cmesh->setCoordsAt(i,da); } } @@ -442,9 +442,9 @@ MEDFileCLMeshL2::MEDFileCLMeshL2() { } -void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it) +void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it) { - _name.set(mName); + _name.set(mName.c_str()); int nstep; int Mdim; ParaMEDMEM::MEDCouplingMeshType meshType; @@ -457,14 +457,14 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, i // _clmesh=MEDCouplingCurveLinearMesh::New(); INTERP_KERNEL::AutoPtr stGrid=new int[Mdim]; - MEDmeshGridStructRd(fid,mName,dt,it,stGrid); + MEDmeshGridStructRd(fid,mName.c_str(),dt,it,stGrid); _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbNodes=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf); + int nbNodes=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf); MEDCouplingAutoRefCountObjectPtr da=DataArrayDouble::New(); da->alloc(nbNodes,infosOnComp.size()); da->setInfoOnComponents(infosOnComp); - MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,da->getPointer()); + MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer()); _clmesh->setCoords(da); } @@ -514,7 +514,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):RefCo { } -MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id):_m(this) +MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this) { const std::vector< MEDCouplingAutoRefCountObjectPtr >& v=l2.getLev(id); if(v.empty()) @@ -535,13 +535,25 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *m { for(int i=0;igetFam(); - _fam=DataArrayInt::Aggregate(fams); + if(sz!=1) + _fam=DataArrayInt::Aggregate(fams); + else + { + fams[0]->incrRef(); + _fam=const_cast(fams[0]); + } } if(l2.isNumDefinedOnLev(id)) { for(int i=0;igetNum(); - _num=DataArrayInt::Aggregate(nums); + if(sz!=1) + _num=DataArrayInt::Aggregate(nums); + else + { + nums[0]->incrRef(); + _num=const_cast(nums[0]); + } computeRevNum(); } if(l2.isNamesDefinedOnLev(id)) @@ -552,6 +564,13 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *m } } +MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m):_m(this) +{ + std::vector< const MEDCoupling1GTUMesh * > v(1); + v[0]=m; + assignParts(v); +} + MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m):_m(this) { assignMesh(m,true); @@ -562,6 +581,11 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld):_m( assignMesh(m,newOrOld); } +void MEDFileUMeshSplitL1::setName(const std::string& name) +{ + _m_by_types.setName(name); +} + std::size_t MEDFileUMeshSplitL1::getHeapMemorySizeWithoutChildren() const { return 0; @@ -691,8 +715,24 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) m->incrRef(); _m_by_types.assignUMesh(m); } + assignCommonPart(); +} + +void MEDFileUMeshSplitL1::forceComputationOfParts() const +{ + _m_by_types.forceComputationOfPartsFromUMesh(); +} + +void MEDFileUMeshSplitL1::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts) +{ + _m_by_types.assignParts(mParts); + assignCommonPart(); +} + +void MEDFileUMeshSplitL1::assignCommonPart() +{ _fam=DataArrayInt::New(); - _fam->alloc(m->getNumberOfCells(),1); + _fam->alloc(_m_by_types.getSize(),1); _fam->fillWithValue(0); } @@ -747,6 +787,11 @@ DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int return da.retn(); } +std::vector MEDFileUMeshSplitL1::getGeoTypes() const +{ + return _m_by_types.getGeoTypes(); +} + MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const { MEDCouplingAutoRefCountObjectPtr tmp; @@ -757,6 +802,26 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const return tmp.retn(); } +DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +{ + const DataArrayInt *fam(_fam); + if(!fam) + return 0; + int start(0),stop(0); + _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); + return fam->selectByTupleId2(start,stop,1); +} + +DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +{ + const DataArrayInt *num(_num); + if(!num) + return 0; + int start(0),stop(0); + _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); + return num->selectByTupleId2(start,stop,1); +} + DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() { if((DataArrayInt *)_fam) @@ -812,7 +877,7 @@ void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector ms(_m_by_types.getParts()); int start=0; @@ -956,6 +1021,25 @@ MEDFileUMeshAggregateCompute::MEDFileUMeshAggregateCompute():_mp_time(0),_m_time { } +void MEDFileUMeshAggregateCompute::setName(const std::string& name) +{ + if(_m_time>=_mp_time) + { + MEDCouplingUMesh *um(_m); + if(um) + um->setName(name); + } + if(_mp_time>=_m_time) + { + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::iterator it=_m_parts.begin();it!=_m_parts.end();it++) + { + MEDCoupling1GTUMesh *tmp(*it); + if(tmp) + tmp->setName(name); + } + } +} + void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts) { std::size_t sz(mParts.size()); @@ -991,6 +1075,20 @@ MEDCouplingUMesh *MEDFileUMeshAggregateCompute::getUmesh() const return _m; } +std::vector MEDFileUMeshAggregateCompute::getGeoTypes() const +{ + if(_mp_time>=_m_time) + { + std::size_t sz(_m_parts.size()); + std::vector ret(sz); + for(std::size_t i=0;igetCellModelEnum(); + return ret; + } + else + return _m->getAllGeoTypesSorted(); +} + std::vector MEDFileUMeshAggregateCompute::getPartsWithoutComputation() const { if(_mp_time<_m_time) @@ -1026,6 +1124,27 @@ MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::getPartWithoutComputation(INT throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !"); } +void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const +{ + start=0; stop=0; + std::vector v(getPartsWithoutComputation()); + std::size_t sz(v.size()); + for(std::size_t i=0;igetCellModelEnum()==gt) + { + stop=start+v[i]->getNumberOfCells(); + return; + } + else + start+=v[i]->getNumberOfCells(); + } + } + throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !"); +} + void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const { const MEDCouplingUMesh *m(_m); @@ -1037,7 +1156,7 @@ void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const _m_parts.resize(sz); for(std::size_t i=0;i