X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderCommon.i;h=45f7ef9e8fc4f2db31ed28149bd10b67670beb03;hb=865eac01b8bdd7a4494afd632f23ac6a1fcc0c88;hp=36fdbadb8028095de3889417ddf1a786d112d79b;hpb=c919614a8ddc026f0a8da85025a83a7b0ff40242;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 36fdbadb8..45f7ef9e8 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -36,6 +36,7 @@ #include "MEDFileField.hxx" #include "MEDFileParameter.hxx" #include "MEDFileData.hxx" +#include "MEDFileEquivalence.hxx" #include "MEDFileMeshReadSelector.hxx" #include "MEDFileFieldOverView.hxx" #include "MEDLoaderTypemaps.i" @@ -99,6 +100,8 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr; %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced; %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse; +%newobject ParaMEDMEM::MEDFileMesh::getEquivalences; +%newobject ParaMEDMEM::MEDFileMesh::cartesianize; %newobject ParaMEDMEM::MEDFileData::getJoints; %newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh; %newobject ParaMEDMEM::MEDFileUMesh::New; @@ -211,6 +214,15 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::MEDFileJoints::getJointAtPos; %newobject ParaMEDMEM::MEDFileJoints::getJointWithName; %newobject ParaMEDMEM::MEDFileJoints::__getitem__; +%newobject ParaMEDMEM::MEDFileEquivalences::getEquivalence; +%newobject ParaMEDMEM::MEDFileEquivalences::getEquivalenceWithName; +%newobject ParaMEDMEM::MEDFileEquivalences::appendEmptyEquivalenceWithName; +%newobject ParaMEDMEM::MEDFileEquivalencePair::initCell; +%newobject ParaMEDMEM::MEDFileEquivalencePair::initNode; +%newobject ParaMEDMEM::MEDFileEquivalencePair::getCell; +%newobject ParaMEDMEM::MEDFileEquivalencePair::getNode; +%newobject ParaMEDMEM::MEDFileEquivalenceData::getArray; +%newobject ParaMEDMEM::MEDFileEquivalenceCell::getArray; %newobject ParaMEDMEM::SauvWriter::New; %newobject ParaMEDMEM::SauvReader::New; @@ -244,6 +256,12 @@ using namespace ParaMEDMEM; %feature("unref") MEDFileJointOneStep "$this->decrRef();" %feature("unref") MEDFileJoint "$this->decrRef();" %feature("unref") MEDFileJoints "$this->decrRef();" +%feature("unref") MEDFileEquivalences "$this->decrRef();" +%feature("unref") MEDFileEquivalencePair "$this->decrRef();" +%feature("unref") MEDFileEquivalenceBase "$this->decrRef();" +%feature("unref") MEDFileEquivalenceData "$this->decrRef();" +%feature("unref") MEDFileEquivalenceCell "$this->decrRef();" +%feature("unref") MEDFileEquivalenceNode "$this->decrRef();" %feature("unref") MEDFileData "$this->decrRef();" %feature("unref") SauvReader "$this->decrRef();" %feature("unref") SauvWriter "$this->decrRef();" @@ -501,6 +519,7 @@ namespace ParaMEDMEM } } }; + class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable { public: @@ -584,6 +603,7 @@ namespace ParaMEDMEM } } }; + class MEDFileJoint : public RefCountObject, public MEDFileWritable { public: @@ -703,6 +723,141 @@ namespace ParaMEDMEM } } }; + + class MEDFileEquivalenceBase : public RefCountObject + { + private: + MEDFileEquivalenceBase(); + }; + + class MEDFileEquivalenceData : public MEDFileEquivalenceBase + { + private: + MEDFileEquivalenceData(); + public: + void setArray(DataArrayInt *data); + %extend + { + DataArrayInt *getArray() + { + DataArrayInt *ret(self->getArray()); + if(ret) ret->incrRef(); + return ret; + } + } + }; + + class MEDFileEquivalenceNode : public MEDFileEquivalenceData + { + private: + MEDFileEquivalenceNode(); + }; + + class MEDFileEquivalenceCell : public MEDFileEquivalenceBase + { + private: + MEDFileEquivalenceCell(); + public: + void clear(); + std::size_t size() const; + void setArray(int meshDimRelToMax, DataArrayInt *da) throw(INTERP_KERNEL::Exception); + void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) throw(INTERP_KERNEL::Exception); + %extend + { + DataArrayInt *getArray(INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception) + { + DataArrayInt *ret(self->getArray(type)); + if(ret) ret->incrRef(); + return ret; + } + + PyObject *getTypes() const throw(INTERP_KERNEL::Exception) + { + std::vector result(self->getTypes()); + std::vector::const_iterator iL=result.begin(); + PyObject *res=PyList_New(result.size()); + for(int i=0;iL!=result.end(); i++, iL++) + PyList_SetItem(res,i,PyInt_FromLong(*iL)); + return res; + } + } + }; + + class MEDFileEquivalencePair : public RefCountObject + { + private: + MEDFileEquivalencePair(); + public: + std::string getName() const; + void setName(const std::string& name); + std::string getDescription() const; + void setDescription(const std::string& descr); + void setArray(int meshDimRelToMaxExt, DataArrayInt *da);; + %extend + { + MEDFileEquivalenceCell *initCell() + { + MEDFileEquivalenceCell *ret(self->initCell()); + if(ret) ret->incrRef(); + return ret; + } + + MEDFileEquivalenceNode *initNode() + { + MEDFileEquivalenceNode *ret(self->initNode()); + if(ret) ret->incrRef(); + return ret; + } + + MEDFileEquivalenceCell *getCell() + { + MEDFileEquivalenceCell *ret(self->getCell()); + if(ret) ret->incrRef(); + return ret; + } + + MEDFileEquivalenceNode *getNode() + { + MEDFileEquivalenceNode *ret(self->getNode()); + if(ret) ret->incrRef(); + return ret; + } + } + }; + + class MEDFileEquivalences : public RefCountObject + { + private: + MEDFileEquivalences(); + public: + int size() const; + std::vector getEquivalenceNames() const throw(INTERP_KERNEL::Exception); + void killEquivalenceWithName(const std::string& name) throw(INTERP_KERNEL::Exception); + void killEquivalenceAt(int i) throw(INTERP_KERNEL::Exception); + void clear(); + %extend + { + MEDFileEquivalencePair *getEquivalence(int i) throw(INTERP_KERNEL::Exception) + { + MEDFileEquivalencePair *ret(self->getEquivalence(i)); + if(ret) ret->incrRef(); + return ret; + } + MEDFileEquivalencePair *getEquivalenceWithName(const std::string& name) throw(INTERP_KERNEL::Exception) + { + MEDFileEquivalencePair *ret(self->getEquivalenceWithName(name)); + if(ret) ret->incrRef(); + return ret; + } + + MEDFileEquivalencePair *appendEmptyEquivalenceWithName(const std::string& name) throw(INTERP_KERNEL::Exception) + { + MEDFileEquivalencePair *ret(self->appendEmptyEquivalenceWithName(name)); + if(ret) ret->incrRef(); + return ret; + } + } + }; class MEDFileMesh : public RefCountObject, public MEDFileWritable { @@ -729,15 +884,19 @@ namespace ParaMEDMEM double getTimeValue() const; void setTimeUnit(const std::string& unit); std::string getTimeUnit() const; + void setAxType(MEDCouplingAxisType at); + MEDCouplingAxisType getAxType() const; virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception); virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) 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 int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) 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); virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception); + virtual MEDFileMesh *cartesianize() const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevels() const throw(INTERP_KERNEL::Exception); std::vector getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception); void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); @@ -767,6 +926,8 @@ namespace ParaMEDMEM void setGroupsOnFamily(const std::string& famName, const std::vector& grps) throw(INTERP_KERNEL::Exception); std::vector getGroupsNames() const throw(INTERP_KERNEL::Exception); std::vector getFamiliesNames() const throw(INTERP_KERNEL::Exception); + std::vector getFamiliesNamesWithFilePointOfView() const throw(INTERP_KERNEL::Exception); + static std::string GetMagicFamilyStr(); void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception); std::vector removeEmptyGroups() throw(INTERP_KERNEL::Exception); void removeGroup(const std::string& name) throw(INTERP_KERNEL::Exception); @@ -819,7 +980,9 @@ namespace ParaMEDMEM virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const throw(INTERP_KERNEL::Exception); int getNumberOfJoints(); MEDFileJoints *getJoints(); - void setJoints( MEDFileJoints* joints ); + void setJoints( MEDFileJoints* joints ); + void initializeEquivalences(); + void killEquivalences(); %extend { std::string __str__() const throw(INTERP_KERNEL::Exception) @@ -989,6 +1152,13 @@ namespace ParaMEDMEM PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); return ret; } + + MEDFileEquivalences *getEquivalences() throw(INTERP_KERNEL::Exception) + { + MEDFileEquivalences *ret(self->getEquivalences()); + if(ret) ret->incrRef(); + return ret; + } } }; @@ -1215,10 +1385,10 @@ namespace ParaMEDMEM return const_cast(ret); } - PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception) + PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception) { DataArrayInt *ret0=0,*ret1=0,*ret2=0; - self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2); + self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); @@ -1344,6 +1514,7 @@ namespace ParaMEDMEM std::string getName() const throw(INTERP_KERNEL::Exception); void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception); void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception); + void cartesianizeMe() throw(INTERP_KERNEL::Exception); %extend { MEDFileMeshMultiTS() @@ -1407,6 +1578,7 @@ namespace ParaMEDMEM void pushMesh(MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception); void setMeshAtPos(int i, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception); void destroyMeshAtPos(int i) throw(INTERP_KERNEL::Exception); + void cartesianizeMe() throw(INTERP_KERNEL::Exception); %extend { MEDFileMeshes()