X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderCommon.i;h=e1b20cdbd950339e3131266767947d0e6fb1bfac;hb=489dcad0b6acfb2df82eb1eacb196b9dca4965ba;hp=810045d926a6fdd69010a99af1d2b3158edf8f4a;hpb=0fb8ef9bb978b04e475c7f6d9ca5d8bd6f36bcf5;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 810045d92..e1b20cdbd 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -37,6 +37,7 @@ #include "MEDFileParameter.hxx" #include "MEDFileData.hxx" #include "MEDFileEquivalence.hxx" +#include "MEDFileEntities.hxx" #include "MEDFileMeshReadSelector.hxx" #include "MEDFileFieldOverView.hxx" #include "MEDLoaderTypemaps.i" @@ -77,9 +78,9 @@ using namespace MEDCoupling; %newobject ReadUMeshFromFamiliesSwig; %newobject ReadUMeshFromGroupsSwig; +%newobject ReadFieldSwig; %newobject MEDCoupling::ReadUMeshFromFile; %newobject MEDCoupling::ReadMeshFromFile; -%newobject MEDCoupling::ReadField; %newobject MEDCoupling::ReadFieldCell; %newobject MEDCoupling::ReadFieldNode; %newobject MEDCoupling::ReadFieldGauss; @@ -98,6 +99,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr; %newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr; %newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr; +%newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel; %newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced; %newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse; %newobject MEDCoupling::MEDFileMesh::getEquivalences; @@ -140,7 +142,14 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileMeshes::__getitem__; %newobject MEDCoupling::MEDFileMeshes::__iter__; +%newobject MEDCoupling::MEDFileMeshSupports::New; +%newobject MEDCoupling::MEDFileMeshSupports::getSupMeshWithName; + +%newobject MEDCoupling::MEDFileStructureElements::New; + %newobject MEDCoupling::MEDFileFields::New; +%newobject MEDCoupling::MEDFileFields::NewAdv; +%newobject MEDCoupling::MEDFileFields::NewWithDynGT; %newobject MEDCoupling::MEDFileFields::LoadPartOf; %newobject MEDCoupling::MEDFileFields::LoadSpecificEntities; %newobject MEDCoupling::MEDFileFields::deepCopy; @@ -150,6 +159,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName; %newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps; %newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps; +%newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements; %newobject MEDCoupling::MEDFileFields::__iter__; %newobject MEDCoupling::MEDFileFields::extractPart; @@ -183,6 +193,7 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld; %newobject MEDCoupling::MEDFileAnyTypeField1TS::New; +%newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv; %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy; %newobject MEDCoupling::MEDFileAnyTypeField1TS::deepCopy; %newobject MEDCoupling::MEDFileAnyTypeField1TS::extractPart; @@ -211,6 +222,8 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileData::getParams; %newobject MEDCoupling::MEDFileData::Aggregate; +%newobject MEDCoupling::MEDFileEntities::BuildFrom; + %newobject MEDCoupling::MEDFileParameterDouble1TS::New; %newobject MEDCoupling::MEDFileParameterDouble1TS::deepCopy; %newobject MEDCoupling::MEDFileParameterMultiTS::New; @@ -226,12 +239,17 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileJointCorrespondence::New; %newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy; %newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy; +%newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence; %newobject MEDCoupling::MEDFileJointOneStep::New; %newobject MEDCoupling::MEDFileJointOneStep::deepCopy; %newobject MEDCoupling::MEDFileJointOneStep::shallowCpy; +%newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos; +%newobject MEDCoupling::MEDFileJointOneStep::__getitem__; %newobject MEDCoupling::MEDFileJoint::New; %newobject MEDCoupling::MEDFileJoint::deepCopy; %newobject MEDCoupling::MEDFileJoint::shallowCpy; +%newobject MEDCoupling::MEDFileJoint::getStepAtPos; +%newobject MEDCoupling::MEDFileJoint::__getitem__; %newobject MEDCoupling::MEDFileJoints::New; %newobject MEDCoupling::MEDFileJoints::deepCopy; %newobject MEDCoupling::MEDFileJoints::getJointAtPos; @@ -270,6 +288,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();" @@ -299,7 +319,7 @@ using namespace MEDCoupling; namespace MEDCoupling { bool HasXDR(); - std::string MEDFileVersionStr(); + std::string MEDFileVersionStr() throw(INTERP_KERNEL::Exception); std::string MEDFileVersionOfFileStr(const std::string& fileName) throw(INTERP_KERNEL::Exception); void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception); void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception); @@ -323,7 +343,6 @@ namespace MEDCoupling MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - MEDCoupling::MEDCouplingFieldDouble *ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); MEDCoupling::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); MEDCoupling::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); MEDCoupling::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); @@ -350,10 +369,11 @@ namespace MEDCoupling %rename (GetTypesOfField) GetTypesOfFieldSwig; %rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig; %rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig; +%rename (ReadField) ReadFieldSwig; %inline { - PyObject *MEDFileVersionSwig() + PyObject *MEDFileVersionSwig() throw(INTERP_KERNEL::Exception) { int major,minor,release; MEDCoupling::MEDFileVersion(major,minor,release); @@ -364,7 +384,31 @@ namespace MEDCoupling return ret; } - PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) + MEDCoupling::MEDCouplingFieldDouble *ReadFieldSwig(const std::string& fileName) throw(INTERP_KERNEL::Exception) + { + MCAuto ret(MEDCoupling::ReadField(fileName)); + return ret.retn(); + } + + MEDCoupling::MEDCouplingFieldDouble *ReadFieldSwig(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) + { + MCAuto ret(MEDCoupling::ReadField(fileName,fieldName)); + return ret.retn(); + } + + MEDCoupling::MEDCouplingFieldDouble *ReadFieldSwig(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception) + { + MCAuto ret(MEDCoupling::ReadField(fileName,fieldName,iteration,order)); + return ret.retn(); + } + + MEDCoupling::MEDCouplingFieldDouble *ReadFieldSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception) + { + MCAuto ret(MEDCoupling::ReadField(type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order)); + return ret.retn(); + } + + PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) { std::vector< std::pair > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName); PyObject *ret=PyList_New(res.size()); @@ -546,6 +590,34 @@ namespace MEDCoupling MCAuto ret(self->serialize()); return ret.retn(); } + + PyObject *__getstate__() throw(INTERP_KERNEL::Exception) + { + PyObject *ret(PyList_New(0)); + return ret; + } + + void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception) + { + } + + PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception) + { +#ifdef WITH_NUMPY + PyObject *ret(PyTuple_New(1)); + PyObject *ret0(PyDict_New()); + DataArrayByte *retCpp(MEDCoupling_MEDFileWritableStandAlone_serialize(self)); + PyObject *numpyArryObj=SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 ); + {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ... + PyObject *tmp1(PyInt_FromLong(0)); + PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj); + PyTuple_SetItem(ret,0,ret0); + } + return ret; +#else + throw INTERP_KERNEL::Exception("PyWrap of MEDFileData.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !"); +#endif + } } }; @@ -562,12 +634,14 @@ namespace MEDCoupling bool isNodeNameFieldReading() const; bool isCellNumFieldReading() const; bool isNodeNumFieldReading() const; + bool isGlobalNodeNumFieldReading() const; void setCellFamilyFieldReading(bool b); void setNodeFamilyFieldReading(bool b); void setCellNameFieldReading(bool b); void setNodeNameFieldReading(bool b); void setCellNumFieldReading(bool b); void setNodeNumFieldReading(bool b); + void setGlobalNodeNumFieldReading(bool b); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -606,7 +680,6 @@ namespace MEDCoupling void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type); INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const; void setCorrespondence(DataArrayInt *corr) throw(INTERP_KERNEL::Exception); - const DataArrayInt *getCorrespondence() const throw(INTERP_KERNEL::Exception); void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); %extend @@ -630,6 +703,14 @@ namespace MEDCoupling { return self->simpleRepr(); } + + DataArrayInt *getCorrespondence() const throw(INTERP_KERNEL::Exception) + { + const DataArrayInt *ret(self->getCorrespondence()); + if(ret) + ret->incrRef(); + return const_cast(ret); + } } }; @@ -647,7 +728,6 @@ namespace MEDCoupling int getIteration() const; void pushCorrespondence(MEDFileJointCorrespondence* correspondence); int getNumberOfCorrespondences() const; - MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const; void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const throw(INTERP_KERNEL::Exception); std::string simpleRepr() const throw(INTERP_KERNEL::Exception); %extend @@ -666,6 +746,19 @@ namespace MEDCoupling { return self->simpleRepr(); } + + MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const throw(INTERP_KERNEL::Exception) + { + MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i)); + if(ret) + ret->incrRef(); + return ret; + } + + MEDFileJointCorrespondence *__getitem__(int i) const throw(INTERP_KERNEL::Exception) + { + return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i); + } } }; @@ -674,7 +767,7 @@ namespace MEDCoupling public: static MEDFileJoint *New() throw(INTERP_KERNEL::Exception); static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num) throw(INTERP_KERNEL::Exception); - static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum ) throw(INTERP_KERNEL::Exception); + static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) throw(INTERP_KERNEL::Exception); MEDFileJoint *deepCopy() const; MEDFileJoint *shallowCpy() const; bool isEqual(const MEDFileJoint *other) const; @@ -691,7 +784,6 @@ namespace MEDCoupling int getDomainNumber() const; void pushStep(MEDFileJointOneStep* step); int getNumberOfSteps() const; - MEDFileJointOneStep *getStepAtPos(int i) const; std::string simpleRepr() const; %extend { @@ -705,10 +797,28 @@ namespace MEDCoupling return MEDFileJoint::New(fileName,mName,num); } + MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) throw(INTERP_KERNEL::Exception) + { + return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum); + } + std::string __str__() const throw(INTERP_KERNEL::Exception) { return self->simpleRepr(); } + + MEDFileJointOneStep *getStepAtPos(int i) const throw(INTERP_KERNEL::Exception) + { + MEDFileJointOneStep *ret(self->getStepAtPos(i)); + if(ret) + ret->incrRef(); + return ret; + } + + MEDFileJointOneStep *__getitem__(int i) throw(INTERP_KERNEL::Exception) + { + return MEDCoupling_MEDFileJoint_getStepAtPos(self,i); + } } }; @@ -1040,6 +1150,7 @@ namespace MEDCoupling virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception); virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception); virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception); + virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) throw(INTERP_KERNEL::Exception); virtual void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception); virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception); virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); @@ -1055,6 +1166,8 @@ namespace MEDCoupling void setJoints( MEDFileJoints* joints ); void initializeEquivalences(); void killEquivalences(); + bool presenceOfStructureElements() const throw(INTERP_KERNEL::Exception); + void killStructureElements() throw(INTERP_KERNEL::Exception); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -1231,6 +1344,12 @@ namespace MEDCoupling if(ret) ret->incrRef(); return ret; } + + virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt)); + return ret.retn(); + } } }; @@ -1587,6 +1706,12 @@ namespace MEDCoupling { return MEDFileCMesh::New(db); } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileCMesh"); + } PyObject *getMesh() const throw(INTERP_KERNEL::Exception) { @@ -1627,6 +1752,12 @@ namespace MEDCoupling { return MEDFileCurveLinearMesh::New(db); } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileCurveLinearMesh"); + } PyObject *getMesh() const throw(INTERP_KERNEL::Exception) { @@ -1711,6 +1842,8 @@ namespace MEDCoupling void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception); void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception); void cartesianizeMe() throw(INTERP_KERNEL::Exception); + bool presenceOfStructureElements() const throw(INTERP_KERNEL::Exception); + void killStructureElements() throw(INTERP_KERNEL::Exception); %extend { MEDFileMeshes() @@ -1728,6 +1861,12 @@ namespace MEDCoupling return MEDFileMeshes::New(db); } + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileMeshes"); + } + std::string __str__() const throw(INTERP_KERNEL::Exception) { return self->simpleRepr(); @@ -1836,6 +1975,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) @@ -1927,12 +2067,35 @@ namespace MEDCoupling } }; + class MEDFileEntities + { + public: + %extend + { + static MEDFileEntities *BuildFrom(PyObject *entities) throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > inp; + std::vector< std::pair > inp0(convertTimePairIdsFromPy(entities)); + { + std::size_t sz(inp0.size()); + inp.resize(sz); + for(std::size_t i=0;i((TypeOfField)inp0[i].first,(INTERP_KERNEL::NormalizedCellType)inp0[i].second); + } + return MEDFileEntities::BuildFrom(&inp); + } + } + private: + MEDFileEntities(); + }; + class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritableStandAlone { public: static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileAnyTypeField1TS *NewAdv(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll, const MEDFileEntities *entities) throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); @@ -2134,6 +2297,12 @@ namespace MEDCoupling return MEDFileField1TS::New(); } + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileField1TS"); + } + void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception) { const DataArrayDouble *arr=0; @@ -2273,6 +2442,12 @@ namespace MEDCoupling return MEDFileIntField1TS::New(db); } + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileIntField1TS"); + } + std::string __str__() const throw(INTERP_KERNEL::Exception) { return self->simpleRepr(); @@ -2517,7 +2692,7 @@ namespace MEDCoupling std::vector pos2; DataArrayInt *pos3=0; DataArrayIntTuple *pos4=0; - convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4); + convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4); switch(sw) { case 1: @@ -2694,6 +2869,7 @@ namespace MEDCoupling static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception); static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception); static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); + static MEDFileFieldMultiTS *New(DataArrayByte *db) throw(INTERP_KERNEL::Exception); // MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); @@ -2721,6 +2897,17 @@ namespace MEDCoupling { return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll); } + + MEDFileFieldMultiTS(DataArrayByte *db) throw(INTERP_KERNEL::Exception) + { + return MEDFileFieldMultiTS::New(db); + } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileFieldMultiTS"); + } static MEDFileFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) { @@ -2877,7 +3064,13 @@ namespace MEDCoupling { return MEDFileIntFieldMultiTS::New(db); } - + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileIntFieldMultiTS"); + } + static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true) { std::vector > tmp(convertTimePairIdsFromPy(entities)); @@ -2915,6 +3108,32 @@ namespace MEDCoupling } } }; + + class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone + { + 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 + { + 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 { @@ -2922,7 +3141,9 @@ namespace MEDCoupling static MEDFileFields *New() throw(INTERP_KERNEL::Exception); 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 *NewAdv(const std::string& fileName, bool loadAll, const MEDFileEntities *entities) 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); @@ -2940,6 +3161,12 @@ namespace MEDCoupling MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception); MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception); MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception); + bool presenceOfStructureElements() const throw(INTERP_KERNEL::Exception); + void aggregate(const MEDFileFields& other) throw(INTERP_KERNEL::Exception); + 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 @@ -2958,12 +3185,35 @@ namespace MEDCoupling { return MEDFileFields::New(db); } + + MEDFileFields(const std::string& fileName, bool loadAll, const MEDFileEntities *entities) throw(INTERP_KERNEL::Exception) + { + return MEDFileFields::NewAdv(fileName,loadAll,entities); + } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileFields"); + } std::string __str__() const throw(INTERP_KERNEL::Exception) { return self->simpleRepr(); } + + MEDFileFields *partOfThisOnStructureElements() const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->partOfThisOnStructureElements()); + return ret.retn(); + } + MEDFileFields *partOfThisLyingOnSpecifiedMeshSEName(const std::string& meshName, const std::string& seName) const throw(INTERP_KERNEL::Exception) + { + MCAuto ret(self->partOfThisLyingOnSpecifiedMeshSEName(meshName,seName)); + return ret.retn(); + } + static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true) throw(INTERP_KERNEL::Exception) { std::vector > tmp(convertTimePairIdsFromPy(entities)); @@ -2977,6 +3227,13 @@ namespace MEDCoupling return MEDFileFields::LoadSpecificEntities(fileName,entitiesCpp,loadAll); } + PyObject *getMeshSENames() const throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > ps; + self->getMeshSENames(ps); + return convertVectPairStToPy(ps); + } + PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception) { bool ret1; @@ -3262,7 +3519,7 @@ namespace MEDCoupling std::vector pos2; DataArrayInt *pos3=0; DataArrayIntTuple *pos4=0; - convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4); + convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4); switch(sw) { case 1: @@ -3430,6 +3687,12 @@ namespace MEDCoupling { return MEDFileParameters::New(db); } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileParameters"); + } std::string __str__() const throw(INTERP_KERNEL::Exception) { @@ -3507,6 +3770,9 @@ namespace MEDCoupling // bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName) throw(INTERP_KERNEL::Exception); bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception); + void dealWithStructureElements() throw(INTERP_KERNEL::Exception); + std::string getHeader() const throw(INTERP_KERNEL::Exception); + void setHeader(const std::string& header) throw(INTERP_KERNEL::Exception); // %extend { @@ -3567,6 +3833,12 @@ namespace MEDCoupling MCAuto ret(MEDFileData::Aggregate(mfdsCpp)); return ret.retn(); } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileData"); + } } };