X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderCommon.i;h=bdec8bc8982fd6fb71c18f0b7da739a571e4651c;hb=b79f750df5fc807078f4efbf89d88587a88f7548;hp=ab758d651954dfeac509cfce2eeea2b3ba80affc;hpb=4baccec0014292a4a7da71839d9088c6ef970d31;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index ab758d651..bdec8bc89 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -32,6 +32,7 @@ #include "MEDFileParameter.hxx" #include "MEDFileData.hxx" #include "MEDFileMeshReadSelector.hxx" +#include "MEDFileFieldOverView.hxx" #include "MEDLoaderTypemaps.i" #include "SauvReader.hxx" #include "SauvWriter.hxx" @@ -63,6 +64,11 @@ using namespace ParaMEDMEM; $result=convertMEDFileField1TS($1,$owner); } +%typemap(out) ParaMEDMEM::MEDMeshMultiLev* +{ + $result=convertMEDMeshMultiLev($1,$owner); +} + %newobject MEDLoader::ReadUMeshFromFamilies; %newobject MEDLoader::ReadUMeshFromGroups; %newobject MEDLoader::ReadUMeshFromFile; @@ -97,6 +103,7 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh; %newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh; %newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh; +%newobject ParaMEDMEM::MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh; %newobject ParaMEDMEM::MEDFileUMesh::zipCoords; %newobject ParaMEDMEM::MEDFileCMesh::New; %newobject ParaMEDMEM::MEDFileCurveLinearMesh::New; @@ -174,6 +181,11 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::SauvReader::New; %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS; +%newobject ParaMEDMEM::MEDFileMeshStruct::New; +%newobject ParaMEDMEM::MEDMeshMultiLev::buildDataArray; +%newobject ParaMEDMEM::MEDFileFastCellSupportComparator::New; +%newobject ParaMEDMEM::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport; + %feature("unref") MEDFileMesh "$this->decrRef();" %feature("unref") MEDFileUMesh "$this->decrRef();" %feature("unref") MEDFileCMesh "$this->decrRef();" @@ -195,6 +207,12 @@ using namespace ParaMEDMEM; %feature("unref") MEDFileData "$this->decrRef();" %feature("unref") SauvReader "$this->decrRef();" %feature("unref") SauvWriter "$this->decrRef();" +%feature("unref") MEDFileFastCellSupportComparator "$this->decrRef();" +%feature("unref") MEDMeshMultiLev "$this->decrRef();" +%feature("unref") MEDUMeshMultiLev "$this->decrRef();" +%feature("unref") MEDCMeshMultiLev "$this->decrRef();" +%feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();" +%feature("unref") MEDFileMeshStruct "$this->decrRef();" class MEDLoader { @@ -437,12 +455,12 @@ namespace ParaMEDMEM virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception); virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception); void setName(const char *name); - const char *getName(); + std::string getName(); const char *getUnivName() const; bool getUnivNameWrStatus() const; void setUnivNameWrStatus(bool newStatus); void setDescription(const char *name); - const char *getDescription() const; + std::string getDescription() const; void setOrder(int order); int getOrder() const; void setIteration(int it); @@ -456,6 +474,7 @@ namespace ParaMEDMEM virtual std::vector getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); virtual std::vector getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); + virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevels() const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); @@ -767,6 +786,28 @@ namespace ParaMEDMEM PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); return ret; } + + MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception) + { + MEDCoupling1GTUMesh *ret(self->getDirectUndergroundSingleGeoTypeMesh(gt)); + if(ret) + ret->incrRef(); + return ret; + } + + PyObject *getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception) + { + std::vector tmp(self->getDirectUndergroundSingleGeoTypeMeshes(meshDimRelToMax)); + std::size_t sz(tmp.size()); + PyObject *ret=PyList_New(sz); + for(std::size_t i=0;iincrRef(); + PyList_SetItem(ret,i,convertMesh(tmp[i], SWIG_POINTER_OWN | 0 )); + } + return ret; + } } }; @@ -849,7 +890,7 @@ namespace ParaMEDMEM static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception); MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); - const char *getName() const throw(INTERP_KERNEL::Exception); + std::string getName() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception); %extend @@ -988,7 +1029,7 @@ namespace ParaMEDMEM class MEDFileFieldLoc : public RefCountObject { public: - const std::string& getName() const; + std::string getName() const; int getDimension() const; int getNumberOfGaussPoints() const; int getNumberOfPointsInCells() const; @@ -1135,7 +1176,7 @@ namespace ParaMEDMEM void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); - void releaseArrays() throw(INTERP_KERNEL::Exception); + void unloadArrays() throw(INTERP_KERNEL::Exception); int getDimension() const throw(INTERP_KERNEL::Exception); int getIteration() const throw(INTERP_KERNEL::Exception); int getOrder() const throw(INTERP_KERNEL::Exception); @@ -1143,6 +1184,8 @@ namespace ParaMEDMEM void setName(const char *name) throw(INTERP_KERNEL::Exception); std::string getMeshName() throw(INTERP_KERNEL::Exception); void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception); + int getMeshIteration() const throw(INTERP_KERNEL::Exception); + int getMeshOrder() const throw(INTERP_KERNEL::Exception); int getNumberOfComponents() const throw(INTERP_KERNEL::Exception); bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception); void setInfo(const std::vector& infos) throw(INTERP_KERNEL::Exception); @@ -1253,6 +1296,16 @@ namespace ParaMEDMEM PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 )); return retPy; } + + PyObject *splitDiscretizations() const throw(INTERP_KERNEL::Exception) + { + std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitDiscretizations(); + std::size_t sz=ret.size(); + PyObject *retPy=PyList_New(sz); + for(std::size_t i=0;i > ret=self->splitDiscretizations(); + std::size_t sz=ret.size(); + PyObject *retPy=PyList_New(sz); + for(std::size_t i=0;i tmp; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp); self->pushBackTimeSteps(tmp); } + + static PyObject *MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector vectFMTS; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS); + std::vector< std::vector > ret=MEDFileAnyTypeFieldMultiTS::SplitIntoCommonTimeSeries(vectFMTS); + std::size_t sz=ret.size(); + PyObject *retPy=PyList_New(sz); + for(std::size_t i=0;iincrRef(); + PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 )); + } + PyList_SetItem(retPy,i,ret1Py); + } + return retPy; + } + + static PyObject *MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(PyObject *li, const MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception) + { + std::vector vectFMTS; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",vectFMTS); + std::vector< std::vector > ret=MEDFileAnyTypeFieldMultiTS::SplitPerCommonSupport(vectFMTS,mesh); + std::size_t sz=ret.size(); + PyObject *retPy=PyList_New(sz); + for(std::size_t i=0;iincrRef(); + PyList_SetItem(ret1Py,j,convertMEDFileFieldMultiTS(elt,SWIG_POINTER_OWN | 0 )); + } + PyList_SetItem(retPy,i,ret1Py); + } + return retPy; + } } }; @@ -2058,7 +2167,7 @@ namespace ParaMEDMEM MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception); void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); - void releaseArrays() throw(INTERP_KERNEL::Exception); + void unloadArrays() throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); int getNumberOfFields() const; std::vector getFieldsNames() const throw(INTERP_KERNEL::Exception); @@ -2254,9 +2363,9 @@ namespace ParaMEDMEM { public: void setDescription(const char *name); - const char *getDescription() const; + std::string getDescription() const; void setTimeUnit(const char *unit); - const char *getTimeUnit() const; + std::string getTimeUnit() const; }; class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo @@ -2269,7 +2378,7 @@ namespace ParaMEDMEM virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception); virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception); void setName(const char *name) throw(INTERP_KERNEL::Exception); - const char *getName() const throw(INTERP_KERNEL::Exception); + std::string getName() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); %extend { @@ -2318,7 +2427,7 @@ namespace ParaMEDMEM static MEDFileParameterMultiTS *New(); static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception); static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception); - const char *getName() const; + std::string getName() const; void setName(const char *name); MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception); void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception); @@ -2672,5 +2781,112 @@ namespace ParaMEDMEM void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception); void write(const char* fileName) throw(INTERP_KERNEL::Exception); }; + + /////////////// + + class MEDFileMeshStruct; + + class MEDFileField1TSStructItem + { + public: + static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt); + }; + + class MEDFileMeshStruct : public RefCountObject + { + public: + static MEDFileMeshStruct *New(const MEDFileMesh *mesh); + private: + ~MEDFileMeshStruct(); + }; + + class MEDMeshMultiLev : public RefCountObject + { + public: + DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const throw(INTERP_KERNEL::Exception); + private: + ~MEDMeshMultiLev(); + }; + + class MEDUMeshMultiLev : public MEDMeshMultiLev + { + private: + ~MEDUMeshMultiLev(); + public: + %extend + { + PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception) + { + DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0); + self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces); + PyObject *ret=PyTuple_New(6); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_ParaMEDMEM__DataArrayByte, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } + } + }; + + class MEDStructuredMeshMultiLev : public MEDMeshMultiLev + { + private: + ~MEDStructuredMeshMultiLev(); + }; + class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev + { + private: + ~MEDCMeshMultiLev(); + public: + %extend + { + PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception) + { + std::vector< DataArrayDouble * > objs(self->buildVTUArrays()); + std::size_t sz(objs.size()); + PyObject *ret=PyList_New(sz); + for(std::size_t i=0;i& nodeStrct) const throw(INTERP_KERNEL::Exception) + { + DataArrayDouble *ret0(0); + std::vector ret1; + self->buildVTUArrays(ret0,ret1); + std::size_t sz(ret1.size()); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 )); + PyObject *ret1Py=PyList_New(sz); + for(std::size_t i=0;i