From: abn Date: Tue, 12 Jan 2021 09:36:37 +0000 (+0100) Subject: MEDFileMesh: adding direct constructor in SWIG Python X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a05508ad0ef962d719a09c96c1bd30930391c2e5;p=tools%2Fmedcoupling.git MEDFileMesh: adding direct constructor in SWIG Python + careful, only MEDFileMesh.New() remains covariant. --- diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index b1176fe83..ef088314b 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -1216,6 +1216,15 @@ namespace MEDCoupling void killStructureElements(); %extend { + MEDFileMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) + { + return MEDFileMesh::New(fileName, mrs); + } + MEDFileMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) + { + return MEDFileMesh::New(fileName, mName, dt, it, mrs); + } + std::string __str__() const { return self->simpleRepr(); diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 009862118..a2cd5f0c7 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -464,7 +464,7 @@ class MEDLoaderTest3(unittest.TestCase): @WriteInTmpDir def testMEDField1(self): TestMultiFieldShuffleRW1(self) - mm=MEDFileMesh.New("Pyfile17.med") + mm=MEDFileMesh("Pyfile17.med") # Also testing direct constructor here mm.write("Pyfile17_bis.med",2) ff=MEDFileFieldMultiTS("Pyfile17.med") tsExpected=[[1,2],[3,4],[5,6]] @@ -3531,7 +3531,7 @@ class MEDLoaderTest3(unittest.TestCase): # mm.write(fname,2) ## - mm=MEDFileMesh.New(fname,"mesh",-1,-1,MEDFileMeshReadSelector()) + mm=MEDFileMesh(fname,"mesh",-1,-1,MEDFileMeshReadSelector()) # Also testing direct constructor here b4_ref_heap_mem=mm.getHeapMemorySize() mm.getMeshAtLevel(0)## please let this line : force to move 1GTUMesh -> UMesh mm.getMeshAtLevel(-1)## please let this line : force to move 1GTUMesh -> UMesh