From bcfc571de250bd2996c35fe2ddd850f82170aaac Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 13 Dec 2013 07:26:31 +0000 Subject: [PATCH] Nicer constructors of SauvReader and SauvWriter. --- src/MEDLoader/Swig/MEDLoaderCommon.i | 14 ++++++++++++++ src/MEDLoader/Swig/SauvLoaderTest.py | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index d142dd119..9ee9521c1 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -2819,6 +2819,13 @@ namespace ParaMEDMEM public: static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception); MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception); + %extend + { + SauvReader(const char *fileName) throw(INTERP_KERNEL::Exception) + { + return SauvReader::New(fileName); + } + } }; class SauvWriter : public RefCountObject @@ -2829,6 +2836,13 @@ namespace ParaMEDMEM void write(const char* fileName) throw(INTERP_KERNEL::Exception); void setCpyGrpIfOnASingleFamilyStatus(bool status) throw(INTERP_KERNEL::Exception); bool getCpyGrpIfOnASingleFamilyStatus() const throw(INTERP_KERNEL::Exception); + %extend + { + SauvWriter() throw(INTERP_KERNEL::Exception) + { + return SauvWriter::New(); + } + } }; /////////////// diff --git a/src/MEDLoader/Swig/SauvLoaderTest.py b/src/MEDLoader/Swig/SauvLoaderTest.py index 8cd667ffd..c122256e9 100644 --- a/src/MEDLoader/Swig/SauvLoaderTest.py +++ b/src/MEDLoader/Swig/SauvLoaderTest.py @@ -34,7 +34,7 @@ class SauvLoaderTest(unittest.TestCase): # read SAUV and write MED medFile = "SauvLoaderTest.med" - sr=SauvReader.New(sauvFile); + sr=SauvReader(sauvFile); d2=sr.loadInMEDFileDS(); d2.write(medFile,0); @@ -95,7 +95,7 @@ class SauvLoaderTest(unittest.TestCase): # write pointeMed to SAUV sauvFile = "SauvLoaderTest.sauv" - sw=SauvWriter.New(); + sw=SauvWriter(); sw.setMEDFileDS(pointeMed); sw.write(sauvFile); -- 2.39.2