X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderCommon.i;h=3efbfad259a6cc4c4f597338e81f23105b5688dd;hb=47da75a11690a8e0c5253b8263c244437064e8b5;hp=7145ba888fc74d77d5d8645c4539ae48db244b72;hpb=8763c12d01e33d6845dd53be65b001514d00bd42;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 7145ba888..3efbfad25 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -93,7 +93,9 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr; %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced; %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse; +%newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh; %newobject ParaMEDMEM::MEDFileUMesh::New; +%newobject ParaMEDMEM::MEDFileUMesh::LoadPartOf; %newobject ParaMEDMEM::MEDFileUMesh::getCoords; %newobject ParaMEDMEM::MEDFileUMesh::getGroup; %newobject ParaMEDMEM::MEDFileUMesh::getGroups; @@ -492,6 +494,9 @@ namespace ParaMEDMEM void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); + virtual bool hasImplicitPart() const throw(INTERP_KERNEL::Exception); + virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception); + virtual void releaseImplicitPartIfAny() const throw(INTERP_KERNEL::Exception); 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); @@ -779,6 +784,17 @@ namespace ParaMEDMEM { return MEDFileUMesh::New(); } + + static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception) + { + std::vector typesCpp1; + convertPyToNewIntArr3(types,typesCpp1); + std::size_t sz(typesCpp1.size()); + std::vector typesCpp2(sz); + for(std::size_t ii=0;iigetImplicitFaceMesh()); + if(ret) + ret->incrRef(); + return ret; + } + } }; class MEDFileCMesh : public MEDFileStructuredMesh @@ -1026,7 +1053,7 @@ namespace ParaMEDMEM { if(PyInt_Check(obj)) { - MEDFileMesh *ret=self->getMeshAtPos((int)PyInt_AS_LONG(obj)); + MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes())); if(ret) ret->incrRef(); return ret; @@ -1226,6 +1253,7 @@ namespace ParaMEDMEM void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); + void unloadArraysWithoutDataLoss() 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); @@ -1642,6 +1670,7 @@ namespace ParaMEDMEM void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); + void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception); // virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception); MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception); @@ -1808,12 +1837,8 @@ namespace ParaMEDMEM { Py_ssize_t strt=2,stp=2,step=2; PySliceObject *oC=reinterpret_cast(elts); - if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0) - { - self->eraseTimeStepIds2(strt,stp,step); - } - else - throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !"); + GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !"); + self->eraseTimeStepIds2(strt,stp,step); } else { @@ -1878,10 +1903,8 @@ namespace ParaMEDMEM { Py_ssize_t strt=2,stp=2,step=2; PySliceObject *oC=reinterpret_cast(elt0); - if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0) - return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0); - else - throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !"); + GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !"); + return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0); } else return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0); @@ -2226,6 +2249,7 @@ namespace ParaMEDMEM void loadArrays() throw(INTERP_KERNEL::Exception); void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception); void unloadArrays() throw(INTERP_KERNEL::Exception); + void unloadArraysWithoutDataLoss() throw(INTERP_KERNEL::Exception); void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); int getNumberOfFields() const; std::vector getFieldsNames() const throw(INTERP_KERNEL::Exception); @@ -2239,6 +2263,7 @@ namespace ParaMEDMEM MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception); MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception); void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception); + bool removeFieldsWithoutAnyTimeStep() throw(INTERP_KERNEL::Exception); %extend { MEDFileFields() @@ -2374,10 +2399,8 @@ namespace ParaMEDMEM { Py_ssize_t strt=2,stp=2,step=2; PySliceObject *oC=reinterpret_cast(elts); - if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0) - self->destroyFieldsAtPos2(strt,stp,step); - else - throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !"); + GetIndicesOfSlice(oC,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !"); + self->destroyFieldsAtPos2(strt,stp,step); } else { @@ -2494,6 +2517,7 @@ namespace ParaMEDMEM double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception); int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception); int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception); + int getNumberOfTS() const throw(INTERP_KERNEL::Exception); %extend { MEDFileParameterMultiTS() @@ -2564,7 +2588,7 @@ namespace ParaMEDMEM { if(elt0 && PyInt_Check(elt0)) {//fmts[3] - int pos=PyInt_AS_LONG(elt0); + int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS()); return pos; } else if(elt0 && PyTuple_Check(elt0)) @@ -2708,7 +2732,7 @@ namespace ParaMEDMEM { if(PyInt_Check(obj)) { - MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj)); + MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams())); if(ret) ret->incrRef(); return ret; @@ -2989,17 +3013,17 @@ namespace ParaMEDMEM { PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception) { - bool isInternal; + bool isInternal; std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal)); std::size_t sz(objs.size()); - PyObject *ret(PyTuple_New(2)); + PyObject *ret(PyTuple_New(2)); PyObject *ret0=PyList_New(sz); for(std::size_t i=0;i ret1; - bool ret2; + bool ret2; self->buildVTUArrays(ret0,ret1,ret2); std::size_t sz(ret1.size()); PyObject *ret=PyTuple_New(3); @@ -3025,9 +3049,9 @@ namespace ParaMEDMEM for(std::size_t i=0;i