Salome HOME
Initiating medtool
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
index 901bea448b6d50a975b42dc0ab811b2946e7a387..85d65699b06e1be2b983c81274d64f7b5d6a0b02 100644 (file)
 #define MEDCOUPLING_EXPORT
 #define MEDLOADER_EXPORT
 
+#ifdef WITH_DOCSTRINGS
+%include "MEDLoader_doc.i"
+#endif
+
 %include "MEDCouplingCommon.i"
 
 %{
 #include "MEDLoader.hxx"
+#include "MEDFileJoint.hxx"
 #include "MEDFileMesh.hxx"
 #include "MEDFileField.hxx"
 #include "MEDFileParameter.hxx"
@@ -83,6 +88,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMesh::deepCpy;
 %newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
 %newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
+%newobject ParaMEDMEM::MEDFileMesh::__getitem__;
 %newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
 %newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
 %newobject ParaMEDMEM::MEDFileMesh::getFamilyArr;
@@ -93,6 +99,7 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
 %newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
 %newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
+%newobject ParaMEDMEM::MEDFileData::getJoints;
 %newobject ParaMEDMEM::MEDFileStructuredMesh::getImplicitFaceMesh;
 %newobject ParaMEDMEM::MEDFileUMesh::New;
 %newobject ParaMEDMEM::MEDFileUMesh::LoadPartOf;
@@ -112,7 +119,6 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileUMesh::extractNumberFieldOnGeoType;
 %newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
 %newobject ParaMEDMEM::MEDFileUMesh::buildExtrudedMesh;
-%newobject ParaMEDMEM::MEDFileUMesh::__getitem__;
 %newobject ParaMEDMEM::MEDFileUMesh::linearToQuadratic;
 %newobject ParaMEDMEM::MEDFileUMesh::quadraticToLinear;
 %newobject ParaMEDMEM::MEDFileCMesh::New;
@@ -191,6 +197,21 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
 %newobject ParaMEDMEM::MEDFileParameters::__getitem__;
 
+%newobject ParaMEDMEM::MEDFileJointCorrespondence::New;
+%newobject ParaMEDMEM::MEDFileJointCorrespondence::deepCpy;
+%newobject ParaMEDMEM::MEDFileJointCorrespondence::shallowCpy;
+%newobject ParaMEDMEM::MEDFileJointOneStep::New;
+%newobject ParaMEDMEM::MEDFileJointOneStep::deepCpy;
+%newobject ParaMEDMEM::MEDFileJointOneStep::shallowCpy;
+%newobject ParaMEDMEM::MEDFileJoint::New;
+%newobject ParaMEDMEM::MEDFileJoint::deepCpy;
+%newobject ParaMEDMEM::MEDFileJoint::shallowCpy;
+%newobject ParaMEDMEM::MEDFileJoints::New;
+%newobject ParaMEDMEM::MEDFileJoints::deepCpy;
+%newobject ParaMEDMEM::MEDFileJoints::getJointAtPos;
+%newobject ParaMEDMEM::MEDFileJoints::getJointWithName;
+%newobject ParaMEDMEM::MEDFileJoints::__getitem__;
+
 %newobject ParaMEDMEM::SauvWriter::New;
 %newobject ParaMEDMEM::SauvReader::New;
 %newobject ParaMEDMEM::SauvReader::loadInMEDFileDS;
@@ -219,6 +240,10 @@ using namespace ParaMEDMEM;
 %feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
 %feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
 %feature("unref") MEDFileParameters "$this->decrRef();"
+%feature("unref") MEDFileJointCorrespondence "$this->decrRef();"
+%feature("unref") MEDFileJointOneStep "$this->decrRef();"
+%feature("unref") MEDFileJoint "$this->decrRef();"
+%feature("unref") MEDFileJoints "$this->decrRef();"
 %feature("unref") MEDFileData "$this->decrRef();"
 %feature("unref") SauvReader "$this->decrRef();"
 %feature("unref") SauvWriter "$this->decrRef();"
@@ -476,6 +501,208 @@ namespace ParaMEDMEM
       }
     }
   };
+  class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable
+  {
+  public:
+    static MEDFileJointCorrespondence *New() throw(INTERP_KERNEL::Exception);
+    static MEDFileJointCorrespondence *New(DataArrayInt* correspondence) // nodes
+      throw(INTERP_KERNEL::Exception);
+    static MEDFileJointCorrespondence *New(DataArrayInt* correspondence,  // cells
+                                           INTERP_KERNEL::NormalizedCellType loc_geo_type,
+                                           INTERP_KERNEL::NormalizedCellType rem_geo_type)
+      throw(INTERP_KERNEL::Exception);
+    std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+    MEDFileJointCorrespondence *deepCpy() const;
+    MEDFileJointCorrespondence *shallowCpy() const;
+    void setIsNodal(bool isNodal);
+    bool getIsNodal() const;
+    bool isEqual(const MEDFileJointCorrespondence *other) const;
+    void setLocalGeometryType(INTERP_KERNEL::NormalizedCellType type);
+    INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const;
+    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
+    {
+      MEDFileJointCorrespondence()
+      {
+        return MEDFileJointCorrespondence::New();
+      }
+      MEDFileJointCorrespondence(DataArrayInt* correspondence) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileJointCorrespondence::New(correspondence);
+      }
+      MEDFileJointCorrespondence(DataArrayInt* correspondence,  // cells
+                                 INTERP_KERNEL::NormalizedCellType loc_geo_type,
+                                 INTERP_KERNEL::NormalizedCellType rem_geo_type) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileJointCorrespondence::New(correspondence, loc_geo_type, rem_geo_type);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+    }
+  };
+
+  class MEDFileJointOneStep : public RefCountObject, public MEDFileWritable
+  {
+  public:
+    static MEDFileJointOneStep *New(int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+    static MEDFileJointOneStep *New(const std::string& fileName, const std::string& mName, const std::string& jointName, int number=1) throw(INTERP_KERNEL::Exception);
+    MEDFileJointOneStep *deepCpy() const;
+    MEDFileJointOneStep *shallowCpy() const;
+    bool isEqual(const MEDFileJointOneStep *other) const;
+    void setOrder(int order);
+    int getOrder() const;
+    void setIteration(int it);
+    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
+    {
+      MEDFileJointOneStep()
+      {
+        return MEDFileJointOneStep::New();
+      }
+
+      MEDFileJointOneStep(const std::string& fileName, const std::string& mName, const std::string& jointName, int number) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileJointOneStep::New(fileName,mName,jointName,number);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+    }
+  };
+  class MEDFileJoint : public RefCountObject, public MEDFileWritable
+  {
+  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);
+    MEDFileJoint *deepCpy() const;
+    MEDFileJoint *shallowCpy() const;
+    bool isEqual(const MEDFileJoint *other) const;
+    void setLocalMeshName(const std::string& name);
+    std::string getLocalMeshName() const;
+    void setRemoteMeshName(const std::string& name);
+    std::string getRemoteMeshName() const;
+    void setDescription(const std::string& name);
+    std::string getDescription() const;
+    void setJointName(const std::string& name);
+    std::string getJointName() const;
+    bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
+    void setDomainNumber(const int& number);
+    int getDomainNumber() const;
+    void pushStep(MEDFileJointOneStep* step);
+    int getNumberOfSteps() const;
+    MEDFileJointOneStep *getStepAtPos(int i) const;
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    %extend
+    {
+      MEDFileJoint()
+      {
+        return MEDFileJoint::New();
+      }
+      
+      MEDFileJoint(const std::string& fileName, const std::string& mName, int num) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileJoint::New(fileName,mName,num);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+    }
+  };
+
+  class MEDFileJoints : public RefCountObject, public MEDFileWritable
+  {
+  public:
+    static MEDFileJoints *New() throw(INTERP_KERNEL::Exception);
+    static MEDFileJoints *New(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+    MEDFileJoints *deepCpy() const;
+    std::string simpleRepr() const;
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    std::string getMeshName() const;
+    int getNumberOfJoints() const;
+    std::vector<std::string> getJointsNames() const;
+    bool changeJointNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
+    void resize(int newSize) throw(INTERP_KERNEL::Exception);
+    void pushJoint(MEDFileJoint *joint);
+    void setJointAtPos(int i, MEDFileJoint *joint) throw(INTERP_KERNEL::Exception);
+    void destroyJointAtPos(int i) throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileJoints()
+      {
+        return MEDFileJoints::New();
+      }
+      
+      MEDFileJoints(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileJoints::New(fileName,meshName);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      MEDFileJoint *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        if(PyInt_Check(obj))
+          {
+            MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
+            if(ret)
+              ret->incrRef();
+            return ret;
+          }
+        else if(PyString_Check(obj))
+          {
+            MEDFileJoint *ret=self->getJointWithName(PyString_AsString(obj));
+            if(ret)
+              ret->incrRef();
+            return ret;
+          }
+        else
+          throw INTERP_KERNEL::Exception("MEDFileJoints::__getitem__ : only integer or string with meshname supported !");
+      }
+
+      int __len__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->getNumberOfJoints();
+      }
+
+      MEDFileJoint *getJointAtPos(int i) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileJoint *ret=self->getJointAtPos(i);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+
+      MEDFileJoint *getJointWithName(const std::string& paramName) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileJoint *ret=self->getJointWithName(paramName);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+    }
+  };
 
   class MEDFileMesh : public RefCountObject, public MEDFileWritable
   {
@@ -590,6 +817,9 @@ namespace ParaMEDMEM
     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    int getNumberOfJoints();
+    MEDFileJoints *getJoints();
+    void           setJoints( MEDFileJoints* joints );
     %extend
        {
          std::string __str__() const throw(INTERP_KERNEL::Exception)
@@ -597,6 +827,11 @@ namespace ParaMEDMEM
            return self->simpleRepr();
          }
 
+         MEDCouplingMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+         {
+           return self->getGenMeshAtLevel(meshDimRelToMaxExt,false);
+         }
+
          PyObject *getTime() throw(INTERP_KERNEL::Exception)
          {
            int tmp1,tmp2;
@@ -919,11 +1154,6 @@ namespace ParaMEDMEM
            }
          }
 
-         MEDCouplingUMesh *__getitem__(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
-         {
-           return self->getMeshAtLevel(meshDimRelToMaxExt,false);
-         }
-
          void __setitem__(int meshDimRelToMax, MEDCouplingPointSet *mesh) throw(INTERP_KERNEL::Exception)
          {
            if(!mesh)
@@ -985,10 +1215,10 @@ namespace ParaMEDMEM
            return const_cast<PartDefinition *>(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 ));