Salome HOME
[EDF23738] : implementation in structure elements (SE) context of case of multiple...
[tools/medcoupling.git] / src / MEDLoader / Swig / MEDLoaderCommon.i
index 24f3aedaeafd06f618109f41dbc19e7dedaf4524..d53d6d623fa5ae57a2da8d282c891bfc26cd0231 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2017-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -42,6 +42,8 @@
 #include "MEDLoaderTypemaps.i"
 #include "SauvReader.hxx"
 #include "SauvWriter.hxx"
+#include "MeshFormatReader.hxx"
+#include "MeshFormatWriter.hxx"
 
 using namespace MEDCoupling;
 %}
@@ -183,6 +185,7 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
 %newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
 %newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
+%newobject MEDCoupling::MEDFileFieldMultiTS::Aggregate;
 
 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::New;
 %newobject MEDCoupling::MEDFileInt32FieldMultiTS::field;
@@ -309,6 +312,7 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::SauvReader::New;
 %newobject MEDCoupling::SauvReader::loadInMEDFileDS;
 
+
 %newobject MEDCoupling::MEDFileMeshStruct::New;
 %newobject MEDCoupling::MEDMeshMultiLev::prepare;
 %newobject MEDCoupling::MEDMeshMultiLev::buildDataArray;
@@ -316,6 +320,10 @@ using namespace MEDCoupling;
 %newobject MEDCoupling::MEDFileFastCellSupportComparator::New;
 %newobject MEDCoupling::MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport;
 
+%newobject MEDCoupling::MeshFormatReader::loadInMEDFileDS;
+%newobject MEDCoupling::MeshFormatReader::MeshFormatReader;
+%newobject MEDCoupling::MeshFormatWriter::MeshFormatWriter;
+
 %feature("unref") MEDFileMesh "$this->decrRef();"
 %feature("unref") MEDFileUMesh "$this->decrRef();"
 %feature("unref") MEDFileCMesh "$this->decrRef();"
@@ -672,6 +680,8 @@ namespace MEDCoupling
   public:
     MEDFileMeshReadSelector();
     MEDFileMeshReadSelector(unsigned int code);
+    mcIdType getNumberOfCoordsLoadSessions();
+    void setNumberOfCoordsLoadSessions(mcIdType newNbOfCoordsLoadSessions);
     unsigned int getCode() const;
     void setCode(unsigned int newCode);
     bool isCellFamilyFieldReading() const;
@@ -1429,6 +1439,7 @@ namespace MEDCoupling
     MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const;
     MEDCouplingUMesh *getLevelM3Mesh(bool renum=false) const;
     void forceComputationOfParts() const;
+    void computeRevNum() const;
     //
     void setFamilyNameAttachedOnId(int id, const std::string& newFamName);
     void setCoords(DataArrayDouble *coords);
@@ -1778,6 +1789,8 @@ namespace MEDCoupling
     static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
     static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
     void setMesh(MEDCouplingCurveLinearMesh *m);
+    int getSpaceDimension() const;
+    int getMeshDimension() const;
     %extend
        {
          MEDFileCurveLinearMesh()
@@ -3025,6 +3038,17 @@ namespace MEDCoupling
     MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
     %extend
        {
+         static MEDFileAnyTypeFieldMultiTS *Aggregate(PyObject *fmtssPy, PyObject *dtsPy)
+         {
+            std::vector<const MEDFileAnyTypeFieldMultiTS *> fmtss;
+            convertFromPyObjVectorOfObj<const MEDFileAnyTypeFieldMultiTS *>(fmtssPy,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",fmtss);
+            std::vector< std::vector< std::pair<mcIdType,mcIdType> > > dts2;
+            convertPyToVectorVectorPairInt(dtsPy,dts2);
+            std::vector< std::vector< std::pair<int,mcIdType> > > dts(MEDVectorVectorMIIterator(0,dts2),MEDVectorVectorMIIterator(dts2.size(),dts2));
+            MCAuto<MEDFileAnyTypeFieldMultiTS> ret = MEDFileFieldMultiTS::Aggregate(fmtss,dts);
+            return ret.retn();
+         }
+
          MEDFileFieldMultiTS()
          {
            return MEDFileFieldMultiTS::New();
@@ -4323,6 +4347,32 @@ namespace MEDCoupling
       }
     }
   };
+  
+  class MeshFormatReader
+  {
+  public:
+    MeshFormatReader(const std::string& meshFileName, const std::vector<std::string>& fieldFileName);
+    MeshFormatReader();
+    MEDFileData* loadInMedFileDS();
+    void setMeshName(const std::string& theMeshName);
+    std::string getMeshName() const;
+    void setFile(const std::string& theFileName);
+    void setFieldFileNames(const std::vector<std::string>& theFieldFileNames);
+    std::vector<std::string> getFieldFileNames() const;
+  };
+  class MeshFormatWriter
+  {
+  public:
+    MeshFormatWriter(const std::string& meshFileName, const std::vector<std::string>& fieldFileNames);
+    MeshFormatWriter();
+    void setMeshFileName(const std::string& meshFileName);
+    std::string getMeshFileName() const;
+    void setFieldFileNames(const std::vector<std::string>& fieldFileNames);
+    std::vector<std::string> getFieldFileNames() const;
+    void setMEDFileDS(MEDCoupling::MEDFileData* mfd);
+    void write();
+  };
+  
 }
 
 %pythoncode %{