From 7126a380f58b740a46752e59318913032e951e35 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 10 Feb 2017 16:03:42 +0100 Subject: [PATCH] Structure element inside Gauss Points management --- src/MEDLoader/MEDFileBlowStrEltUp.hxx | 2 +- src/MEDLoader/MEDFileEntities.cxx | 4 + src/MEDLoader/MEDFileEntities.hxx | 1 + src/MEDLoader/MEDFileField.cxx | 138 ++++++++++++++++++---- src/MEDLoader/MEDFileField.hxx | 51 +++++++- src/MEDLoader/MEDFileStructureElement.cxx | 5 + src/MEDLoader/MEDFileStructureElement.hxx | 1 + src/MEDLoader/Swig/MEDLoaderCommon.i | 23 ++++ 8 files changed, 198 insertions(+), 27 deletions(-) diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.hxx b/src/MEDLoader/MEDFileBlowStrEltUp.hxx index b237e83d8..2f5743996 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.hxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.hxx @@ -36,8 +36,8 @@ namespace MEDCoupling public: MEDFileBlowStrEltUp(const MEDFileFields *fsOnlyOnSE, const MEDFileMeshes *ms, const MEDFileStructureElements *ses); static void DealWithSE(MEDFileFields *fs, MEDFileMeshes *ms, const MEDFileStructureElements *ses); - private: void generate(MEDFileMeshes *msOut, MEDFileFields *allZeOutFields); + private: 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/MEDFileEntities.cxx b/src/MEDLoader/MEDFileEntities.cxx index 2429e1e82..79190c99c 100644 --- a/src/MEDLoader/MEDFileEntities.cxx +++ b/src/MEDLoader/MEDFileEntities.cxx @@ -90,3 +90,7 @@ const MEDFileStructureElement *MEDFileAllStaticEntitiesPlusDyn::getWithGT(int id return _se->getWithGT(idGT); } +const MEDFileUMesh *MEDFileAllStaticEntitiesPlusDyn::getSupMeshWithName(const std::string& name) const +{ + return _se->getSupMeshWithName(name); +} diff --git a/src/MEDLoader/MEDFileEntities.hxx b/src/MEDLoader/MEDFileEntities.hxx index c2a0bf99d..dd2307824 100644 --- a/src/MEDLoader/MEDFileEntities.hxx +++ b/src/MEDLoader/MEDFileEntities.hxx @@ -66,6 +66,7 @@ namespace MEDCoupling std::vector getDynGTAvail() const; bool areAllStaticTypesPresent() const; const MEDFileStructureElement *getWithGT(int idGT) const; + const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; private: MCConstAuto _se; }; diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 70b65d123..ae6b1b763 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -24,6 +24,7 @@ #include "MEDLoaderTraits.hxx" #include "MEDFileSafeCaller.txx" #include "MEDFileFieldOverView.hxx" +#include "MEDFileBlowStrEltUp.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" @@ -48,14 +49,78 @@ template class MEDFileField1TSTemplateWithoutSDA; const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64"; const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32"; +MEDFileGTKeeper::~MEDFileGTKeeper() +{ +} + +MEDFileGTKeeper *MEDFileGTKeeperSta::deepCopy() const +{ + return new MEDFileGTKeeperSta(_geo_type); +} + +INTERP_KERNEL::NormalizedCellType MEDFileGTKeeperSta::getGeoType() const +{ + return _geo_type; +} + +std::string MEDFileGTKeeperSta::getRepr() const +{ + return INTERP_KERNEL::CellModel::GetCellModel(_geo_type).getRepr(); +} + +bool MEDFileGTKeeperSta::isEqual(const MEDFileGTKeeper *other) const +{ + const MEDFileGTKeeperSta *otherC(dynamic_cast(other)); + if(!otherC) + return false; + return _geo_type==otherC->_geo_type; +} + +MEDFileGTKeeperDyn::MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se):_mesh(mesh),_section(section),_se(se) +{ + if(mesh) + mesh->incrRef(); + if(section) + section->incrRef(); + if(se) + se->incrRef(); + if(_mesh.isNull() || _section.isNull() || _se.isNull()) + throw INTERP_KERNEL::Exception("MEDFileGTKeeperDyn constructor : null pointer not allowed !"); +} + +MEDFileGTKeeper *MEDFileGTKeeperDyn::deepCopy() const +{ + return new MEDFileGTKeeperDyn(_mesh,_section,_se); +} + +INTERP_KERNEL::NormalizedCellType MEDFileGTKeeperDyn::getGeoType() const +{ + throw INTERP_KERNEL::Exception("MEDFileGTKeeperDyn::getGeoType : not valid !"); +} + +std::string MEDFileGTKeeperDyn::getRepr() const +{ + std::ostringstream oss; + oss << _se->getDynGT(); + return oss.str(); +} + +bool MEDFileGTKeeperDyn::isEqual(const MEDFileGTKeeper *other) const +{ + const MEDFileGTKeeperDyn *otherC(dynamic_cast(other)); + if(!otherC) + return false; + return this==otherC; +} + MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const std::string& locName) { return new MEDFileFieldLoc(fid,locName); } -MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, int id) +MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, int id, const MEDFileEntities *entities) { - return new MEDFileFieldLoc(fid,id); + return new MEDFileFieldLoc(fid,id,entities); } MEDFileFieldLoc *MEDFileFieldLoc::New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w) @@ -71,8 +136,8 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const std::string& locName):_name( INTERP_KERNEL::AutoPtr geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); - _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype))); - const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type)); + _gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)))); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _nb_node_per_cell=cm.getNumberOfNodes(); _ref_coo.resize(_dim*_nb_node_per_cell); _gs_coo.resize(_dim*_nb_gauss_pt); @@ -80,7 +145,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const std::string& locName):_name( MEDlocalizationRd(fid,locName.c_str(),MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]); } -MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id) +MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *entities) { med_geometry_type geotype; med_geometry_type sectiongeotype; @@ -90,9 +155,30 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id) INTERP_KERNEL::AutoPtr sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); MEDlocalizationInfo(fid,id+1,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); _name=locName; - _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype))); - const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type)); - _nb_node_per_cell=cm.getNumberOfNodes(); + std::string sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE)); + if(sectionName.empty()) + { + _gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)))); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); + _nb_node_per_cell=cm.getNumberOfNodes(); + } + else + { + const MEDFileAllStaticEntitiesPlusDyn *entities2(dynamic_cast(entities)); + if(!entities2) + { + std::ostringstream oss; oss << "MEDFileFieldLoc cstr : for loc \"" << _name << "\" presence of non static type ! Expect entities !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + const MEDFileStructureElement *se(entities2->getWithGT(geotype)); + const MEDFileUMesh *um(entities2->getSupMeshWithName(se->getMeshName())); + const MEDFileUMesh *section(entities2->getSupMeshWithName(sectionName)); + _gt=new MEDFileGTKeeperDyn(um,section,se); + { + int dummy; + MEDFILESAFECALLERWR0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&_nb_node_per_cell)); + } + } _ref_coo.resize(_dim*_nb_node_per_cell); _gs_coo.resize(_dim*_nb_gauss_pt); _w.resize(_nb_gauss_pt); @@ -100,15 +186,19 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id) } MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, - const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w):_name(locName),_geo_type(geoType),_ref_coo(refCoo),_gs_coo(gsCoo), - _w(w) + 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 INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type)); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _dim=cm.getDimension(); _nb_node_per_cell=cm.getNumberOfNodes(); _nb_gauss_pt=_w.size(); } + +MEDFileFieldLoc::MEDFileFieldLoc(const MEDFileFieldLoc& other):_dim(other._dim),_nb_gauss_pt(other._nb_gauss_pt),_gt(other._gt->deepCopy()),_nb_node_per_cell(other._nb_node_per_cell),_name(other._name),_ref_coo(other._ref_coo),_gs_coo(other._gs_coo),_w(other._w) +{ +} + MEDFileFieldLoc *MEDFileFieldLoc::deepCopy() const { return new MEDFileFieldLoc(*this); @@ -128,7 +218,7 @@ void MEDFileFieldLoc::simpleRepr(std::ostream& oss) const { static const char OFF7[]="\n "; oss << "\"" << _name << "\"" << OFF7; - oss << "GeoType=" << INTERP_KERNEL::CellModel::GetCellModel(_geo_type).getRepr() << OFF7; + oss << "GeoType=" << _gt->getRepr() << OFF7; oss << "Dimension=" << _dim << OFF7; oss << "Number of Gauss points=" << _nb_gauss_pt << OFF7; oss << "Number of nodes per cell=" << _nb_node_per_cell << OFF7; @@ -152,7 +242,7 @@ bool MEDFileFieldLoc::isEqual(const MEDFileFieldLoc& other, double eps) const return false; if(_nb_node_per_cell!=other._nb_node_per_cell) return false; - if(_geo_type!=other._geo_type) + if(!_gt->isEqual(other._gt)) return false; if(!MEDCouplingGaussLocalization::AreAlmostEqual(_ref_coo,other._ref_coo,eps)) return false; @@ -166,13 +256,13 @@ bool MEDFileFieldLoc::isEqual(const MEDFileFieldLoc& other, double eps) const void MEDFileFieldLoc::writeLL(med_idt fid) const { - MEDlocalizationWr(fid,_name.c_str(),typmai3[(int)_geo_type],_dim,&_ref_coo[0],MED_FULL_INTERLACE,_nb_gauss_pt,&_gs_coo[0],&_w[0],MED_NO_INTERPOLATION,MED_NO_MESH_SUPPORT); + MEDlocalizationWr(fid,_name.c_str(),typmai3[(int)getGeoType()],_dim,&_ref_coo[0],MED_FULL_INTERLACE,_nb_gauss_pt,&_gs_coo[0],&_w[0],MED_NO_INTERPOLATION,MED_NO_MESH_SUPPORT); } std::string MEDFileFieldLoc::repr() const { std::ostringstream oss; oss.precision(15); - const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(_geo_type)); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); oss << "Localization \"" << _name << "\" :\n" << " - Geometric Type : " << cm.getRepr(); oss << "\n - Dimension : " << _dim << "\n - Number of gauss points : "; oss << _nb_gauss_pt << "\n - Number of nodes in cell : " << _nb_node_per_cell; @@ -3093,7 +3183,7 @@ void MEDFileFieldGlobs::loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& re _locs[i]=MEDFileFieldLoc::New(fid,locs[i].c_str()); } -void MEDFileFieldGlobs::loadAllGlobals(med_idt fid) +void MEDFileFieldGlobs::loadAllGlobals(med_idt fid, const MEDFileEntities *entities) { int nProfil=MEDnProfile(fid); for(int i=0;iloadGlobals(fid,*this); } -void MEDFileFieldGlobsReal::loadAllGlobals(med_idt fid) +void MEDFileFieldGlobsReal::loadAllGlobals(med_idt fid, const MEDFileEntities *entities) { - contentNotNull()->loadAllGlobals(fid); + contentNotNull()->loadAllGlobals(fid,entities); } void MEDFileFieldGlobsReal::writeGlobals(med_idt fid, const MEDFileWritable& opt) const @@ -10766,7 +10856,7 @@ try:MEDFileFieldGlobsReal(fid) } } } - loadAllGlobals(fid); + loadAllGlobals(fid,entities); } catch(INTERP_KERNEL::Exception& e) { @@ -11292,6 +11382,14 @@ void MEDFileFields::getMeshSENames(std::vector< std::pairgetMeshSENames(ps); } +void MEDFileFields::blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses) +{ + MCAuto fsSEOnly(partOfThisOnStructureElements()); + killStructureElements(); + MEDFileBlowStrEltUp bu(fsSEOnly,ms,ses); + bu.generate(ms,this); +} + MCAuto MEDFileFields::partOfThisOnStructureElements() const { MCAuto ret(deepCopy()); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 51a04df7d..4513b45ef 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -51,6 +51,43 @@ namespace MEDCoupling class MEDCouplingFieldDouble; class MEDFileMesh; + class MEDFileGTKeeper + { + public: + virtual MEDFileGTKeeper *deepCopy() const = 0; + virtual INTERP_KERNEL::NormalizedCellType getGeoType() const = 0; + virtual std::string getRepr() const = 0; + virtual bool isEqual(const MEDFileGTKeeper *other) const = 0; + virtual ~MEDFileGTKeeper(); + }; + + class MEDFileGTKeeperSta : public MEDFileGTKeeper + { + public: + MEDFileGTKeeperSta(INTERP_KERNEL::NormalizedCellType gt):_geo_type(gt) { } + MEDFileGTKeeper *deepCopy() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + std::string getRepr() const; + bool isEqual(const MEDFileGTKeeper *other) const; + private: + INTERP_KERNEL::NormalizedCellType _geo_type; + }; + + + class MEDFileGTKeeperDyn : public MEDFileGTKeeper + { + public: + MEDFileGTKeeperDyn(const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileStructureElement *se); + MEDFileGTKeeper *deepCopy() const; + INTERP_KERNEL::NormalizedCellType getGeoType() const; + std::string getRepr() const; + bool isEqual(const MEDFileGTKeeper *other) const; + private: + MCConstAuto _mesh; + MCConstAuto _section; + MCConstAuto _se; + }; + class MEDFileFieldLoc : public RefCountObject { public: @@ -58,7 +95,7 @@ namespace MEDCoupling MEDLOADER_EXPORT std::string getName() const { return _name; } MEDLOADER_EXPORT void setName(const std::string& name); static MEDFileFieldLoc *New(med_idt fid, const std::string& locName); - static MEDFileFieldLoc *New(med_idt fid, int id); + static MEDFileFieldLoc *New(med_idt fid, int i, const MEDFileEntities *entities); static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; @@ -73,18 +110,19 @@ namespace MEDCoupling MEDLOADER_EXPORT const std::vector& getRefCoords() const { return _ref_coo; } MEDLOADER_EXPORT const std::vector& getGaussCoords() const { return _gs_coo; } MEDLOADER_EXPORT const std::vector& getGaussWeights() const { return _w; } - MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; } + MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _gt->getGeoType(); } MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const; private: + MEDFileFieldLoc(const MEDFileFieldLoc& other); MEDFileFieldLoc(med_idt fid, const std::string& locName); - MEDFileFieldLoc(med_idt fid, int id); + MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *entities); MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); private: int _dim; int _nb_gauss_pt; + INTERP_KERNEL::AutoCppPtr _gt; int _nb_node_per_cell; std::string _name; - INTERP_KERNEL::NormalizedCellType _geo_type; std::vector _ref_coo; std::vector _gs_coo; std::vector _w; @@ -393,7 +431,7 @@ namespace MEDCoupling void loadProfileInFile(med_idt fid, int id, const std::string& pflName); void loadProfileInFile(med_idt fid, int id); void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real); - void loadAllGlobals(med_idt fid); + void loadAllGlobals(med_idt fid, const MEDFileEntities *entities); void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; std::vector getPfls() const; std::vector getLocs() const; @@ -464,7 +502,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName); MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id); MEDLOADER_EXPORT void loadGlobals(med_idt fid); - MEDLOADER_EXPORT void loadAllGlobals(med_idt fid); + MEDLOADER_EXPORT void loadAllGlobals(med_idt fid, const MEDFileEntities *entities=0); MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const; MEDLOADER_EXPORT std::vector getPfls() const; MEDLOADER_EXPORT std::vector getLocs() const; @@ -1265,6 +1303,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void keepOnlyStructureElements(); MEDLOADER_EXPORT void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName); MEDLOADER_EXPORT void getMeshSENames(std::vector< std::pair >& ps) const; + MEDLOADER_EXPORT void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses); MEDLOADER_EXPORT MCAuto partOfThisOnStructureElements() const; MEDLOADER_EXPORT MCAuto partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const; MEDLOADER_EXPORT void aggregate(const MEDFileFields& other); diff --git a/src/MEDLoader/MEDFileStructureElement.cxx b/src/MEDLoader/MEDFileStructureElement.cxx index c8b2e1729..0eb37f489 100644 --- a/src/MEDLoader/MEDFileStructureElement.cxx +++ b/src/MEDLoader/MEDFileStructureElement.cxx @@ -403,3 +403,8 @@ const MEDFileSEVarAtt *MEDFileStructureElements::getVarAttOf(const std::string & const MEDFileStructureElement *se(getSEWithName(seName)); return se->getVarAtt(varName); } + +const MEDFileUMesh *MEDFileStructureElements::getSupMeshWithName(const std::string& name) const +{ + return _sup->getSupMeshWithName(name); +} diff --git a/src/MEDLoader/MEDFileStructureElement.hxx b/src/MEDLoader/MEDFileStructureElement.hxx index 083ab5aef..64e1025c2 100644 --- a/src/MEDLoader/MEDFileStructureElement.hxx +++ b/src/MEDLoader/MEDFileStructureElement.hxx @@ -125,6 +125,7 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon MEDLOADER_EXPORT const MEDFileStructureElement *getSEWithName(const std::string& seName) const; MEDLOADER_EXPORT std::vector getVarAttsOf(const std::string& seName) const; MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const; + MEDLOADER_EXPORT const MEDFileUMesh *getSupMeshWithName(const std::string& name) const; public: std::vector getDirectChildrenWithNull() const; std::size_t getHeapMemorySizeWithoutChildren() const; diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 40ebad0fb..26863381a 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -140,7 +140,12 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileMeshes::__getitem__; %newobject MEDCoupling::MEDFileMeshes::__iter__; +%newobject MEDCoupling::MEDFileMeshSupports::New; + +%newobject MEDCoupling::MEDFileStructureElements::New; + %newobject MEDCoupling::MEDFileFields::New; +%newobject MEDCoupling::MEDFileFields::NewWithDynGT; %newobject MEDCoupling::MEDFileFields::LoadPartOf; %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities; %newobject MEDCoupling::MEDFileFields::deepCopy; @@ -271,6 +276,8 @@ using namespace MEDCoupling; %feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();" %feature("unref") MEDFileFieldMultiTS "$this->decrRef();" %feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();" +%feature("unref") MEDFileMeshSupports "$this->decrRef();" +%feature("unref") MEDFileStructureElements "$this->decrRef();" %feature("unref") MEDFileFields "$this->decrRef();" %feature("unref") MEDFileParameter1TS "$this->decrRef();" %feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();" @@ -2996,6 +3003,20 @@ namespace MEDCoupling } } }; + + class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone + { + public: + static MEDFileMeshSupports *New(const std::string& fileName) throw(INTERP_KERNEL::Exception); + }; + + class MEDFileStructureElements : public RefCountObject, public MEDFileWritableStandAlone + { + public: + static MEDFileStructureElements *New(const std::string& fileName, const MEDFileMeshSupports *ms) throw(INTERP_KERNEL::Exception); + private: + MEDFileStructureElements(); + }; class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone { @@ -3004,6 +3025,7 @@ namespace MEDCoupling static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); static MEDFileFields *New(DataArrayByte *db) throw(INTERP_KERNEL::Exception); static MEDFileFields *LoadPartOf(const std::string& fileName, bool loadAll=true, const MEDFileMeshes *ms=0) throw(INTERP_KERNEL::Exception); + static MEDFileFields *NewWithDynGT(const std::string& fileName, const MEDFileStructureElements *se, bool loadAll=true) throw(INTERP_KERNEL::Exception); MEDFileFields *deepCopy() const throw(INTERP_KERNEL::Exception); MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); @@ -3026,6 +3048,7 @@ namespace MEDCoupling void killStructureElements() throw(INTERP_KERNEL::Exception); void keepOnlyStructureElements() throw(INTERP_KERNEL::Exception); void keepOnlyOnMeshSE(const std::string& meshName, const std::string& seName) throw(INTERP_KERNEL::Exception); + void blowUpSE(MEDFileMeshes *ms, const MEDFileStructureElements *ses) throw(INTERP_KERNEL::Exception); void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception); bool removeFieldsWithoutAnyTimeStep() throw(INTERP_KERNEL::Exception); %extend -- 2.39.2