X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FSwig%2FMEDLoaderCommon.i;h=d53d6d623fa5ae57a2da8d282c891bfc26cd0231;hb=e95ee11e7df126315ffd11c2518b648a6915ad51;hp=b1176fe839668922a3566577aad67271553fe1fe;hpb=4f627963e2f8e90b80c9dc6a06cd97079a90b025;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index b1176fe83..d53d6d623 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -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();" @@ -1431,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); @@ -3029,6 +3038,17 @@ namespace MEDCoupling MEDFileInt32FieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; %extend { + static MEDFileAnyTypeFieldMultiTS *Aggregate(PyObject *fmtssPy, PyObject *dtsPy) + { + std::vector fmtss; + convertFromPyObjVectorOfObj(fmtssPy,SWIGTYPE_p_MEDCoupling__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",fmtss); + std::vector< std::vector< std::pair > > dts2; + convertPyToVectorVectorPairInt(dtsPy,dts2); + std::vector< std::vector< std::pair > > dts(MEDVectorVectorMIIterator(0,dts2),MEDVectorVectorMIIterator(dts2.size(),dts2)); + MCAuto ret = MEDFileFieldMultiTS::Aggregate(fmtss,dts); + return ret.retn(); + } + MEDFileFieldMultiTS() { return MEDFileFieldMultiTS::New(); @@ -4327,6 +4347,32 @@ namespace MEDCoupling } } }; + + class MeshFormatReader + { + public: + MeshFormatReader(const std::string& meshFileName, const std::vector& 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& theFieldFileNames); + std::vector getFieldFileNames() const; + }; + class MeshFormatWriter + { + public: + MeshFormatWriter(const std::string& meshFileName, const std::vector& fieldFileNames); + MeshFormatWriter(); + void setMeshFileName(const std::string& meshFileName); + std::string getMeshFileName() const; + void setFieldFileNames(const std::vector& fieldFileNames); + std::vector getFieldFileNames() const; + void setMEDFileDS(MEDCoupling::MEDFileData* mfd); + void write(); + }; + } %pythoncode %{