From 45378be07ee609dfc7a00d1f0c23f07f72f383cd Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 13 Feb 2017 13:36:11 +0100 Subject: [PATCH] [EDF7075] Field on Gauss points lying on structure element are now managed into the MEDReader --- .../Bases/InterpKernelAutoPtr.hxx | 6 + src/MEDLoader/MEDFileBlowStrEltUp.cxx | 537 +++++++++++++++++- src/MEDLoader/MEDFileBlowStrEltUp.hxx | 3 +- src/MEDLoader/MEDFileField.cxx | 90 ++- src/MEDLoader/MEDFileField.hxx | 15 +- src/MEDLoader/MEDFileFieldVisitor.hxx | 54 ++ src/MEDLoader/MEDFileMeshLL.cxx | 4 +- src/MEDLoader/MEDFileMeshSupport.cxx | 9 + src/MEDLoader/MEDFileMeshSupport.hxx | 1 + src/MEDLoader/Swig/MEDLoaderCommon.i | 14 + 10 files changed, 719 insertions(+), 14 deletions(-) create mode 100644 src/MEDLoader/MEDFileFieldVisitor.hxx diff --git a/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx b/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx index 7dcec2b96..ea984a760 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelAutoPtr.hxx @@ -29,6 +29,8 @@ namespace INTERP_KERNEL public: AutoPtr(T *ptr=0):_ptr(ptr) { } ~AutoPtr() { destroyPtr(); } + bool isNull() const { return _ptr==0; } + bool isNotNull() const { return !isNull(); } AutoPtr &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; } T *operator->() { return _ptr ; } const T *operator->() const { return _ptr; } @@ -48,6 +50,8 @@ namespace INTERP_KERNEL public: AutoCppPtr(T *ptr=0):_ptr(ptr) { } ~AutoCppPtr() { destroyPtr(); } + bool isNull() const { return _ptr==0; } + bool isNotNull() const { return !isNull(); } AutoCppPtr &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; } T *operator->() { return _ptr ; } const T *operator->() const { return _ptr; } @@ -67,6 +71,8 @@ namespace INTERP_KERNEL public: AutoCPtr(T *ptr=0):_ptr(ptr) { } ~AutoCPtr() { destroyPtr(); } + bool isNull() const { return _ptr==0; } + bool isNotNull() const { return !isNull(); } AutoCPtr &operator=(T *ptr) { if(_ptr!=ptr) { destroyPtr(); _ptr=ptr; } return *this; } T *operator->() { return _ptr ; } const T *operator->() const { return _ptr; } diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index fcd9e51fa..973f2b8ed 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -20,6 +20,8 @@ #include "MEDFileBlowStrEltUp.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDFileFieldVisitor.hxx" +#include "MCAuto.txx" using namespace MEDCoupling; @@ -264,11 +266,16 @@ void MEDFileBlowStrEltUp::generate(MEDFileMeshes *msOut, MEDFileFields *allZeOut MEDFileUMesh *umesh(dynamic_cast(mesh)); if(!umesh) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::generateMeshes : Blow up of Stru Elt not managed yet for unstructured meshes !"); - MCAuto mOut; - MCAuto fsOut1; - MCAuto zeStr(dealWithSEInMesh(ps[0].second,umesh,mOut,fsOut1)); - msOut->pushMesh(mOut); - dealWithSEInFields(ps[0].second,*elt,zeStr,fsOut1,allZeOutFields); + // + MCAuto classicalSEFields(splitFieldsPerLoc(*elt,umesh,msOut,allZeOutFields)); + if(classicalSEFields.isNotNull()) + { + MCAuto mOut; + MCAuto fsOut1; + MCAuto zeStr(dealWithSEInMesh(ps[0].second,umesh,mOut,fsOut1)); + msOut->pushMesh(mOut); + dealWithSEInFields(ps[0].second,classicalSEFields,zeStr,fsOut1,allZeOutFields); + } } } @@ -294,4 +301,524 @@ void MEDFileBlowStrEltUp::DealWithSE(MEDFileFields *fs, MEDFileMeshes *ms, const fs->killStructureElements(); MEDFileBlowStrEltUp bu(fsSEOnly,ms,ses); bu.generate(ms,fs); + fs->killStructureElementsInGlobs(); +} + +// + +class FieldWalker2 +{ +public: + FieldWalker2(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); + std::string getLoc() const { return _loc; } + std::string getPfl() const { return _pfl; } + bool isClassic() const { return _is_classic; } + bool operator!=(const FieldWalker2& other) const; + bool operator==(const FieldWalker2& other) const; +private: + std::string _loc; + std::string _pfl; + bool _is_classic; +}; + +class LocInfo +{ +public: + LocInfo() { } + LocInfo(const std::vector& fw); + bool operator==(const LocInfo& other) const { return _locs==other._locs && _pfl==other._pfl; } + void push(const std::string& loc, const std::string& pfl) { checkUniqueLoc(loc); _locs.push_back(loc); _pfl.push_back(pfl); } + MCAuto generateNonClassicalData(int zePos, const MEDFileUMesh *mesh, const MEDFileFieldGlobsReal *globs) const; +private: + void checkUniqueLoc(const std::string& loc) const; + static MCAuto BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs); + static MCAuto BuildMeshFromStructure(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs); +public: + static const char ANGLE_DE_VRILLE[]; +private: + std::vector _locs; + std::vector _pfl; +}; + +const char LocInfo::ANGLE_DE_VRILLE[]="ANGLE DE VRILLE"; + +LocInfo::LocInfo(const std::vector& fw) +{ + std::size_t sz(fw.size()); + _locs.resize(sz); _pfl.resize(sz); + for(std::size_t i=0;i LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) +{ + MCAuto conn(zeStr->getConn()); + conn=conn->deepCopy(); conn->rearrange(1); + MCAuto geoMesh; + { + MCAuto umesh(MEDCoupling1SGTUMesh::New("",gt)); + umesh->setCoords(mesh->getCoords()); + umesh->setNodalConnectivity(conn); + geoMesh=umesh->buildUnstructured(); + } + // + MCConstAuto angleVrille; + if(!pfl.empty()) + { + const DataArrayInt *pflArr(globs->getProfile(pfl)); + geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true); + angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); + } + else + angleVrille.takeRef(angleDeVrille); + // + MCAuto fakeF(MEDCouplingFieldDouble::New(ON_GAUSS_PT)); + fakeF->setMesh(geoMesh); + int nbg(loc.getGaussWeights().size()); + fakeF->setGaussLocalizationOnType(gt,loc.getRefCoords(),loc.getGaussCoords(),loc.getGaussWeights()); + MCAuto ptsForLoc(fakeF->getLocalizationOfDiscr()); + // + MCAuto dir(geoMesh->buildDirectionVectorField()); + MCAuto rot(dir->getArray()->fromCartToSpher()); + int nbCells(geoMesh->getNumberOfCells()),nbCompo(ptsForLoc->getNumberOfComponents()); + MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); + int nbSecPts(secPts->getNumberOfTuples()); + { + const int TAB[3]={2,0,1}; + std::vector v(TAB,TAB+3); + secPts=secPts->keepSelectedComponents(v); + } + const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.}; + double AX1[3]; AX1[2]=0.; + std::vector< MCAuto > arrs(nbCells*nbg); + for(int j=0;j p(secPts->deepCopy()); + double ang0(rot->getIJ(j,2)); + DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer()); + AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ + double ang1(M_PI/2.-rot->getIJ(j,1)); + DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer()); + DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,angleVrille->getIJ(j,0),nbSecPts,p->begin(),p->getPointer()); + for(int l=0;l p2(p->deepCopy()); + for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k); + arrs[j*nbg+l]=p2; + } + } + std::vector arrs2(VecAutoToVecOfCstPt(arrs)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); + return resu; +} + +MCAuto LocInfo::BuildMeshFromStructure(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs) +{ + static const char MSG1[]="BuildMeshFromStructure : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !"; + const std::vector< MCAuto >& vars(zeStr->getVars()); + if(vars.size()!=1) + throw INTERP_KERNEL::Exception(MSG1); + MCAuto zeArr(vars[0]); + if(zeArr.isNull()) + throw INTERP_KERNEL::Exception(MSG1); + MCAuto zeArr2(DynamicCast(zeArr)); + if(zeArr2.isNull()) + throw INTERP_KERNEL::Exception(MSG1); + if(zeArr2->getName()!=ANGLE_DE_VRILLE) + throw INTERP_KERNEL::Exception(MSG1); + return BuildMeshFromAngleVrille(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs); +} + +MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileUMesh *mesh, const MEDFileFieldGlobsReal *globs) const +{ + static const char MSG1[]="LocInfo::generateNonClassicalData : no spec for GAUSS on StructureElement with more than one cell !"; + std::size_t sz(_locs.size()); + std::vector< MCAuto > arrs(sz); + for(std::size_t i=0;igetLocalization(_locs[i])); + const MEDFileGTKeeper *gtk(loc.getUndergroundGTKeeper()); + const MEDFileGTKeeperDyn *gtk2(dynamic_cast(gtk)); + if(!gtk2) + throw INTERP_KERNEL::Exception("LocInfo::generateNonClassicalData : internal error !"); + const MEDFileUMesh *meshLoc(gtk2->getMesh()),*section(gtk2->getSection()); + const MEDFileStructureElement *se(gtk2->getSE()); + INTERP_KERNEL::NormalizedCellType gt; + { + std::vector nel(meshLoc->getNonEmptyLevels()); + if(nel.size()!=1) + throw INTERP_KERNEL::Exception(MSG1); + if(nel[0]!=0) + throw INTERP_KERNEL::Exception(MSG1); + MCAuto um(meshLoc->getMeshAtLevel(0)); + if(um->getNumberOfCells()!=1) + throw INTERP_KERNEL::Exception(MSG1); + gt=um->getTypeOfCell(0); + std::vector v; + um->getNodeIdsOfCell(0,v); + std::size_t sz2(v.size()); + for(std::size_t j=0;j >& strs(mesh->getAccessOfUndergroundEltStrs()); + MCAuto zeStr; + for(std::vector< MCAuto >::const_iterator it=strs.begin();it!=strs.end();it++) + { + if((*it)->getGeoTypeName()==se->getName()) + { + zeStr=*it; + break; + } + } + if(zeStr.isNull()) + { + std::ostringstream oss; oss << "LocInfo::generateNonClassicalData : : no geo type with name " << se->getName() << " in " << mesh->getName() << " !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + arrs[i]=BuildMeshFromStructure(gt,_pfl[i],loc,zeStr,mesh,section,globs); + } + std::vector arrs2(VecAutoToVecOfCstPt(arrs)); + MCAuto resu(DataArrayDouble::Aggregate(arrs2)); + MCAuto ret(MEDFileUMesh::New()); + ret->setCoords(resu); + std::ostringstream meshName; meshName << mesh->getName() << "_on_" << sz << "_sections" << "_" << zePos; + ret->setName(meshName.str()); + return ret; +} + +FieldWalker2::FieldWalker2(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) +{ + _loc=pmptpd->getLocalization(); + _pfl=pmptpd->getProfile(); + _is_classic=pmptpd->getType()!=ON_GAUSS_PT; +} + +bool FieldWalker2::operator!=(const FieldWalker2& other) const +{ + bool ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic); + return !ret; +} + +bool FieldWalker2::operator==(const FieldWalker2& other) const +{ + bool ret(_loc==other._loc && _pfl==other._pfl && _is_classic==other._is_classic); + return ret; +} + +class FieldWalker1 +{ +public: + FieldWalker1(const MEDFileAnyTypeField1TSWithoutSDA *ts):_ts(ts),_pm_pt(0),_nb_mesh(0) { } + void newMeshEntry(const MEDFileFieldPerMesh *fpm); + void endMeshEntry(const MEDFileFieldPerMesh *fpm) { } + void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); + void checkOK(const FieldWalker1& other) const; + bool isClassical() const; + std::vector getNonClassicalData() const { return _fw; } +private: + const MEDFileAnyTypeField1TSWithoutSDA *_ts; + const MEDFileFieldPerMeshPerTypeDyn *_pm_pt; + std::vector _fw; + int _nb_mesh; +}; + +void FieldWalker1::newMeshEntry(const MEDFileFieldPerMesh *fpm) +{ + if(_nb_mesh++==1) + throw INTERP_KERNEL::Exception("FieldWalker1::newMeshEntry : multi mesh not supported !"); +} + +void FieldWalker1::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) +{ + if(_pm_pt) + throw INTERP_KERNEL::Exception("FieldWalker1::newPerMeshPerTypeEntry : multi SE loc not managed yet !"); + const MEDFileFieldPerMeshPerTypeDyn *pmpt2(dynamic_cast(pmpt)); + if(!pmpt2) + throw INTERP_KERNEL::Exception("newPerMeshPerTypeEntry : internal error !"); + _pm_pt=pmpt2; +} + +void FieldWalker1::endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *) +{ + isClassical(); +} + +void FieldWalker1::newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) +{ + _fw.push_back(FieldWalker2(pmptpd)); +} + +void FieldWalker1::checkOK(const FieldWalker1& other) const +{ + std::size_t sz(_fw.size()); + if(other._fw.size()!=sz) + throw INTERP_KERNEL::Exception("checkOK : not OK because size are not the same !"); + for(std::size_t i=0;i::const_iterator it=_fw.begin();it!=_fw.end();it++) + { + if((*it).isClassic()) + ic++; + else + inc++; + } + if(ic!=0 && inc!=0) + throw INTERP_KERNEL::Exception("FieldWalker1::endPerMeshPerTypeEntry : mix is not allowed yet !"); + return inc==0; +} + +class FieldWalker +{ +public: + FieldWalker(const MEDFileAnyTypeFieldMultiTSWithoutSDA *f):_f(f) { } + void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); + void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); + void newMeshEntry(const MEDFileFieldPerMesh *fpm); + void endMeshEntry(const MEDFileFieldPerMesh *fpm); + void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); +public: + bool isEmpty() const; + bool isClassical() const; + const MEDFileAnyTypeFieldMultiTSWithoutSDA *field() const { return _f; } + std::vector getNonClassicalData() const { return _fw_prev->getNonClassicalData(); } +private: + const MEDFileAnyTypeFieldMultiTSWithoutSDA *_f; + mutable INTERP_KERNEL::AutoCppPtr _fw; + mutable INTERP_KERNEL::AutoCppPtr _fw_prev; +}; + +bool FieldWalker::isEmpty() const +{ + return _fw_prev.isNull(); +} + +bool FieldWalker::isClassical() const +{ + return _fw_prev->isClassical(); +} + +void FieldWalker::newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) +{ + _fw=new FieldWalker1(ts); +} + +void FieldWalker::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) +{ + if(_fw_prev.isNull()) + _fw_prev=new FieldWalker1(*_fw); + else + _fw_prev->checkOK(*_fw); + _fw=0; +} + +void FieldWalker::newMeshEntry(const MEDFileFieldPerMesh *fpm) +{ + _fw->newMeshEntry(fpm); +} + +void FieldWalker::endMeshEntry(const MEDFileFieldPerMesh *fpm) +{ + _fw->endMeshEntry(fpm); +} + +void FieldWalker::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) +{ + _fw->newPerMeshPerTypeEntry(pmpt); +} + +void FieldWalker::endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) +{ + _fw->endPerMeshPerTypeEntry(pmpt); +} + +void FieldWalker::newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) +{ + _fw->newPerMeshPerTypePerDisc(pmptpd); +} + +// this class splits fields into same +class LocSpliter : public MEDFileFieldVisitor +{ +public: + LocSpliter(const MEDFileFieldGlobsReal *globs):_globs(globs),_fw(0) { } + MCAuto getClassical() const { return _classical; } + void generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto >& outFields, std::vector< MCAuto >& outMeshes) const; +private: + void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field); + void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field); + // + void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); + void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts); + // + void newMeshEntry(const MEDFileFieldPerMesh *fpm); + void endMeshEntry(const MEDFileFieldPerMesh *fpm); + // + void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt); + // + void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); +private: + const MEDFileFieldGlobsReal *_globs; + std::vector< LocInfo > _locs; + std::vector< MCAuto > _fields_on_locs;//size of _locs== size of _fields_on_locs + MCAuto _classical; +private: + mutable INTERP_KERNEL::AutoCppPtr _fw; +}; + +void LocSpliter::newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) +{ + _fw=new FieldWalker(field); +} + +void LocSpliter::endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) +{ + if(_fw->isEmpty()) + return ; + MCAuto f(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(const_cast(field))); + if(_fw->isClassical()) + { + if(_classical.isNull()) + { + _classical=MEDFileFields::New(); + _classical->shallowCpyGlobs(*_globs); + } + _classical->pushField(f); + } + else + { + std::vector fw2(_fw->getNonClassicalData()); + LocInfo elt(fw2); + std::vector< LocInfo >::iterator it(std::find(_locs.begin(),_locs.end(),elt)); + if(it==_locs.end()) + { + _locs.push_back(elt); + MCAuto zeF(MEDFileFields::New()); + zeF->shallowCpyGlobs(*_globs); + zeF->pushField(f); + _fields_on_locs.push_back(zeF); + } + else + { + MCAuto zeF(_fields_on_locs[std::distance(_locs.begin(),it)]); + zeF->pushField(f); + } + } +} + +void LocSpliter::generateNonClassicalData(const MEDFileUMesh *mesh, std::vector< MCAuto >& outFields, std::vector< MCAuto >& outMeshes) const +{ + int i(0); + for(std::vector::const_iterator it=_locs.begin();it!=_locs.end();it++,i++) + { + MCAuto m((*it).generateNonClassicalData(i,mesh,_globs)); + outMeshes.push_back(m); + MCAuto mcm(MEDCouplingUMesh::Build0DMeshFromCoords(m->getCoords())); + mcm->setName(m->getName()); + MCAuto fs(_fields_on_locs[i]); + MCAuto outFs(MEDFileFields::New()); + for(int j=0;jgetNumberOfFields();j++) + { + MCAuto fmtsNC(fs->getFieldAtPos(j)); + MCAuto fmts(DynamicCastSafe(fmtsNC)); + MCAuto outFmts(MEDFileFieldMultiTS::New()); + for(int k=0;kgetNumberOfTS();k++) + { + MCAuto outF1t(MEDFileField1TS::New()); + MCAuto f1ts(fmts->getTimeStepAtPos(k)); + int t2,t3; + double t1(f1ts->getTime(t2,t3)); + MCAuto mcf(MEDCouplingFieldDouble::New(ON_NODES)); + mcf->setArray(f1ts->getUndergroundDataArray()); + mcf->setTime(t1,t2,t3); + mcf->setName(f1ts->getName()); + mcf->setMesh(mcm); + outF1t->setFieldNoProfileSBT(mcf); + outFmts->pushBackTimeStep(outF1t); + } + outFs->pushField(outFmts); + } + outFields.push_back(outFs); + } +} + +void LocSpliter::newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) +{ + _fw->newTimeStepEntry(ts); +} + +void LocSpliter::endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) +{ + _fw->endTimeStepEntry(ts); +} + +void LocSpliter::newMeshEntry(const MEDFileFieldPerMesh *fpm) +{ + _fw->newMeshEntry(fpm); +} + +void LocSpliter::endMeshEntry(const MEDFileFieldPerMesh *fpm) +{ + _fw->endMeshEntry(fpm); +} + +void LocSpliter::newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) +{ + _fw->newPerMeshPerTypeEntry(pmpt); +} + +void LocSpliter::endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) +{ + _fw->endPerMeshPerTypeEntry(pmpt); +} + +void LocSpliter::newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) +{ + _fw->newPerMeshPerTypePerDisc(pmptpd); +} + +MCAuto MEDFileBlowStrEltUp::splitFieldsPerLoc(const MEDFileFields *fields, const MEDFileUMesh *mesh, MEDFileMeshes *msOut, MEDFileFields *allZeOutFields) +{ + LocSpliter ls(fields); + fields->accept(ls); + std::vector< MCAuto > outFields; + std::vector< MCAuto > outMeshes; + ls.generateNonClassicalData(mesh,outFields,outMeshes); + for(std::vector< MCAuto >::iterator it=outFields.begin();it!=outFields.end();it++) + { + for(int j=0;j<(*it)->getNumberOfFields();j++) + { + MCAuto fmts((*it)->getFieldAtPos(j)); + allZeOutFields->pushField(fmts); + } + } + for(std::vector< MCAuto >::iterator it=outMeshes.begin();it!=outMeshes.end();it++) + msOut->pushMesh(*it); + return ls.getClassical(); } diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.hxx b/src/MEDLoader/MEDFileBlowStrEltUp.hxx index 2f5743996..1363548de 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.hxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.hxx @@ -35,9 +35,10 @@ namespace MEDCoupling { public: MEDFileBlowStrEltUp(const MEDFileFields *fsOnlyOnSE, const MEDFileMeshes *ms, const MEDFileStructureElements *ses); - static void DealWithSE(MEDFileFields *fs, MEDFileMeshes *ms, const MEDFileStructureElements *ses); void generate(MEDFileMeshes *msOut, MEDFileFields *allZeOutFields); + static void DealWithSE(MEDFileFields *fs, MEDFileMeshes *ms, const MEDFileStructureElements *ses); private: + MCAuto splitFieldsPerLoc(const MEDFileFields *fields, const MEDFileUMesh *mesh, MEDFileMeshes *msOut, MEDFileFields *allZeOutFields); MCAuto dealWithSEInMesh(const std::string& seName, MEDFileUMesh *mesh, MCAuto& mOut, MCAuto& fsOut) const; MCAuto dealWithMEDBALLInMesh(const MEDFileUMesh *mesh, MCAuto& mOut, MCAuto& fsOut) const; void dealWithSEInFields(const std::string& seName, const MEDFileFields *fs, const MEDFileEltStruct4Mesh *zeStr, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const; diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index ae6b1b763..b0a9eb651 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -25,6 +25,7 @@ #include "MEDFileSafeCaller.txx" #include "MEDFileFieldOverView.hxx" #include "MEDFileBlowStrEltUp.hxx" +#include "MEDFileFieldVisitor.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" @@ -204,6 +205,15 @@ MEDFileFieldLoc *MEDFileFieldLoc::deepCopy() const return new MEDFileFieldLoc(*this); } +bool MEDFileFieldLoc::isOnStructureElement() const +{ + const MEDFileGTKeeper *gt(_gt); + if(!gt) + throw INTERP_KERNEL::Exception("MEDFileFieldLoc::isOnStructureElement : null pointer !"); + const MEDFileGTKeeperDyn *gt2(dynamic_cast(gt)); + return gt2!=NULL; +} + std::size_t MEDFileFieldLoc::getHeapMemorySizeWithoutChildren() const { return (_ref_coo.capacity()+_gs_coo.capacity()+_w.capacity())*sizeof(double)+_name.capacity(); @@ -1139,14 +1149,23 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO //////////////////////////////////// MEDFileFieldPerMeshPerTypeCommon::~MEDFileFieldPerMeshPerTypeCommon() - { - } +{ +} void MEDFileFieldPerMeshPerTypeCommon::setFather(MEDFileFieldPerMesh *father) { _father=father; } +void MEDFileFieldPerMeshPerTypeCommon::accept(MEDFileFieldVisitor& visitor) const +{ + for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + if((*it).isNotNull()) + { + visitor.newPerMeshPerTypePerDisc(*it); + } +} + void MEDFileFieldPerMeshPerTypeCommon::deepCopyElements() { std::size_t i=0; @@ -2631,6 +2650,17 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c return 0; } +void MEDFileFieldPerMesh::accept(MEDFileFieldVisitor& visitor) const +{ + for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + if((*it).isNotNull()) + { + visitor.newPerMeshPerTypeEntry(*it); + (*it)->accept(visitor); + visitor.endPerMeshPerTypeEntry(*it); + } +} + void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { int globalSz=0; @@ -3512,6 +3542,19 @@ void MEDFileFieldGlobs::killLocalizationIds(const std::vector& locIds) _locs=newLocs; } +void MEDFileFieldGlobs::killStructureElementsInGlobs() +{ + std::vector< MCAuto > newLocs; + for(std::vector< MCAuto >::iterator it=_locs.begin();it!=_locs.end();it++) + { + if((*it).isNull()) + continue; + if(!(*it)->isOnStructureElement()) + newLocs.push_back(*it); + } + _locs=newLocs; +} + std::vector MEDFileFieldGlobs::getPfls() const { int sz=_pfls.size(); @@ -3697,6 +3740,11 @@ void MEDFileFieldGlobsReal::resetContent() _globals=MEDFileFieldGlobs::New(); } +void MEDFileFieldGlobsReal::killStructureElementsInGlobs() +{ + contentNotNull()->killStructureElementsInGlobs(); +} + MEDFileFieldGlobsReal::~MEDFileFieldGlobsReal() { } @@ -4274,6 +4322,17 @@ void MEDFileAnyTypeField1TSWithoutSDA::deepCpyLeavesFrom(const MEDFileAnyTypeFie } } +void MEDFileAnyTypeField1TSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const +{ + for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) + if((*it).isNotNull()) + { + visitor.newMeshEntry(*it); + (*it)->accept(visitor); + visitor.endMeshEntry(*it); + } +} + /*! * Prints a string describing \a this field into a stream. This string is outputted * by \c print Python command. @@ -7923,6 +7982,17 @@ bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std return ret; } +void MEDFileAnyTypeFieldMultiTSWithoutSDA::accept(MEDFileFieldVisitor& visitor) const +{ + for(std::vector< MCAuto >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++) + if((*it).isNotNull()) + { + visitor.newTimeStepEntry(*it); + (*it)->accept(visitor); + visitor.endTimeStepEntry(*it); + } +} + void MEDFileAnyTypeFieldMultiTSWithoutSDA::simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const { std::string startLine(bkOffset,' '); @@ -11156,6 +11226,17 @@ MEDFileFields *MEDFileFields::extractPart(const std::map >::const_iterator it=_fields.begin();it!=_fields.end();it++) + if((*it).isNotNull()) + { + visitor.newFieldEntry(*it); + (*it)->accept(visitor); + visitor.endFieldEntry(*it); + } +} + MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const { if(i<0 || i>=(int)_fields.size()) @@ -11384,10 +11465,7 @@ void MEDFileFields::getMeshSENames(std::vector< std::pair fsSEOnly(partOfThisOnStructureElements()); - killStructureElements(); - MEDFileBlowStrEltUp bu(fsSEOnly,ms,ses); - bu.generate(ms,this); + MEDFileBlowStrEltUp::DealWithSE(this,ms,ses); } MCAuto MEDFileFields::partOfThisOnStructureElements() const diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 4513b45ef..c929c534e 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -50,6 +50,7 @@ namespace MEDCoupling class MEDCouplingMesh; class MEDCouplingFieldDouble; class MEDFileMesh; + class MEDFileFieldVisitor; class MEDFileGTKeeper { @@ -82,6 +83,9 @@ namespace MEDCoupling INTERP_KERNEL::NormalizedCellType getGeoType() const; std::string getRepr() const; bool isEqual(const MEDFileGTKeeper *other) const; + const MEDFileUMesh *getMesh() const { return _mesh; } + const MEDFileUMesh *getSection() const { return _section; } + const MEDFileStructureElement *getSE() const { return _se; } private: MCConstAuto _mesh; MCConstAuto _section; @@ -100,6 +104,8 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; MEDFileFieldLoc *deepCopy() const; + bool isOnStructureElement() const; + const MEDFileGTKeeper *getUndergroundGTKeeper() const { return _gt; } MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; } MEDLOADER_EXPORT void writeLL(med_idt fid) const; MEDLOADER_EXPORT std::string repr() const; @@ -265,6 +271,7 @@ namespace MEDCoupling static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType); MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { } void setFather(MEDFileFieldPerMesh *father); + void accept(MEDFileFieldVisitor& visitor) const; public: virtual ~MEDFileFieldPerMeshPerTypeCommon(); virtual void getDimension(int& dim) const = 0; @@ -348,6 +355,7 @@ namespace MEDCoupling 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; + void accept(MEDFileFieldVisitor& visitor) const; void getDimension(int& dim) const; bool isUniqueLevel(int& dim) const; double getTime() const; @@ -457,6 +465,7 @@ namespace MEDCoupling DataArrayInt *getProfileFromId(int pflId); void killProfileIds(const std::vector& pflIds); void killLocalizationIds(const std::vector& locIds); + void killStructureElementsInGlobs(); // void appendProfile(DataArrayInt *pfl); void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); @@ -483,6 +492,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; MEDLOADER_EXPORT void simpleReprGlobs(std::ostream& oss) const; MEDLOADER_EXPORT void resetContent(); + MEDLOADER_EXPORT void killStructureElementsInGlobs(); MEDLOADER_EXPORT void shallowCpyGlobs(const MEDFileFieldGlobsReal& other); MEDLOADER_EXPORT void deepCpyGlobs(const MEDFileFieldGlobsReal& other); MEDLOADER_EXPORT void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other); @@ -600,6 +610,7 @@ namespace MEDCoupling 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 const std::vector& getInfo() const; @@ -986,6 +997,7 @@ namespace MEDCoupling 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 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; MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); @@ -1065,7 +1077,6 @@ namespace MEDCoupling MEDFileAnyTypeFieldMultiTS(med_idt fid, bool loadAll, const MEDFileMeshes *ms); MEDFileAnyTypeFieldMultiTS(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities=0); MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent); - static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c); static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid); static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, bool loadAll, const MEDFileMeshes *ms); static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fieldName, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); @@ -1074,6 +1085,7 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true); MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(med_idt fid, const std::string& fieldName, bool loadAll=true); + MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c); MEDLOADER_EXPORT void loadArrays(); MEDLOADER_EXPORT void loadArraysIfNecessary(); MEDLOADER_EXPORT void unloadArrays(); @@ -1313,6 +1325,7 @@ namespace MEDCoupling 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 void accept(MEDFileFieldVisitor& visitor) const; public: MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; public: diff --git a/src/MEDLoader/MEDFileFieldVisitor.hxx b/src/MEDLoader/MEDFileFieldVisitor.hxx new file mode 100644 index 000000000..9ad13e9f6 --- /dev/null +++ b/src/MEDLoader/MEDFileFieldVisitor.hxx @@ -0,0 +1,54 @@ +// Copyright (C) 2007-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#ifndef __MEDFILEFIELDVISITOR_HXX__ +#define __MEDFILEFIELDVISITOR_HXX__ + +#include "MEDLoaderDefines.hxx" +#include "MEDFileField.hxx" + +namespace MEDCoupling +{ + class MEDFileFieldPerMesh; + class MEDFileAnyTypeField1TSWithoutSDA; + class MEDFileAnyTypeFieldMultiTSWithoutSDA; + class MEDFileFieldPerMeshPerTypeCommon; + class MEDFileFieldPerMeshPerTypePerDisc; + + class MEDFileFieldVisitor + { + public: + virtual void newFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) = 0; + virtual void endFieldEntry(const MEDFileAnyTypeFieldMultiTSWithoutSDA *field) = 0; + // + virtual void newTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) = 0; + virtual void endTimeStepEntry(const MEDFileAnyTypeField1TSWithoutSDA *ts) = 0; + // + virtual void newMeshEntry(const MEDFileFieldPerMesh *fpm) = 0; + virtual void endMeshEntry(const MEDFileFieldPerMesh *fpm) = 0; + // + virtual void newPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) = 0; + virtual void endPerMeshPerTypeEntry(const MEDFileFieldPerMeshPerTypeCommon *pmpt) = 0; + // + virtual void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd) = 0; + }; +} + +#endif diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 337ea7d17..65d4e4c4c 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -2092,8 +2092,10 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa 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); + _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())); + _conn->applyLin(1,-1); + _conn->rearrange(nbEntities); _common=MEDFileUMeshPerTypeCommon::New(); _common->loadCommonPart(fid,mName.c_str(),dt,it,nCells,geoType,MED_STRUCT_ELEMENT,mrs); std::vector vns(mse->getVarAttsOf(_geo_type_name)); diff --git a/src/MEDLoader/MEDFileMeshSupport.cxx b/src/MEDLoader/MEDFileMeshSupport.cxx index 9f8daa813..d70600c85 100644 --- a/src/MEDLoader/MEDFileMeshSupport.cxx +++ b/src/MEDLoader/MEDFileMeshSupport.cxx @@ -90,6 +90,15 @@ void MEDFileMeshSupports::writeLL(med_idt fid) const (*it)->writeLL(fid); } +std::vector MEDFileMeshSupports::getSupMeshNames() const +{ + std::vector ret; + for(std::vector< MCAuto >::const_iterator it=_supports.begin();it!=_supports.end();it++) + if((*it).isNotNull()) + ret.push_back((*it)->getName()); + return ret; +} + const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& name) const { std::vector mns; diff --git a/src/MEDLoader/MEDFileMeshSupport.hxx b/src/MEDLoader/MEDFileMeshSupport.hxx index b47d69b8c..8e8e38e48 100644 --- a/src/MEDLoader/MEDFileMeshSupport.hxx +++ b/src/MEDLoader/MEDFileMeshSupport.hxx @@ -39,6 +39,7 @@ namespace MEDCoupling std::vector getDirectChildrenWithNull() const; std::size_t getHeapMemorySizeWithoutChildren() const; void writeLL(med_idt fid) const; + std::vector getSupMeshNames() const; const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; int getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const; private: diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 26863381a..de7f087a4 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -141,6 +141,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileMeshes::__iter__; %newobject MEDCoupling::MEDFileMeshSupports::New; +%newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName; %newobject MEDCoupling::MEDFileStructureElements::New; @@ -1894,6 +1895,7 @@ namespace MEDCoupling void changeLocName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception); int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception); int getLocalizationId(const std::string& loc) const throw(INTERP_KERNEL::Exception); + void killStructureElementsInGlobs() throw(INTERP_KERNEL::Exception); %extend { PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception) @@ -3008,6 +3010,18 @@ namespace MEDCoupling { public: static MEDFileMeshSupports *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); + std::vector getSupMeshNames() const throw(INTERP_KERNEL::Exception); + %extend + { + MEDFileUMesh *getSupMeshWithName(const std::string& name) const throw(INTERP_KERNEL::Exception) + { + const MEDFileUMesh *ret(self->getSupMeshWithName(name)); + MEDFileUMesh *ret2(const_cast(ret)); + if(ret2) + ret2->incrRef(); + return ret2; + } + } }; class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone -- 2.39.2