From: Anthony Geay Date: Thu, 3 Nov 2016 09:31:05 +0000 (+0100) Subject: MEDFileParameters are also pickelized X-Git-Tag: V8_2_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=37796a7b9f2a915fcd5400384bd7552ad79ff3d8;p=tools%2Fmedcoupling.git MEDFileParameters are also pickelized --- diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index 55482c4a6..7add2d533 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -168,6 +168,9 @@ def MEDCouplingMEDFileIntField1TSnew(cls,*args): def MEDCouplingMEDFileIntFieldMultiTSnew(cls,*args): import _MEDLoader return _MEDLoader.MEDFileIntFieldMultiTS____new___(cls,args) +def MEDCouplingMEDFileParametersnew(cls,*args): + import _MEDLoader + return _MEDLoader.MEDFileParameters____new___(cls,args) %} %include "MEDCouplingFinalize.i" @@ -193,4 +196,6 @@ MEDFileIntField1TS.__new__=classmethod(MEDCouplingMEDFileIntField1TSnew) del MEDCouplingMEDFileIntField1TSnew MEDFileIntFieldMultiTS.__new__=classmethod(MEDCouplingMEDFileIntFieldMultiTSnew) del MEDCouplingMEDFileIntFieldMultiTSnew +MEDFileParameters.__new__=classmethod(MEDCouplingMEDFileParametersnew) +del MEDCouplingMEDFileParametersnew %} diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index c7542ef96..8950a3f78 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -3512,6 +3512,12 @@ namespace MEDCoupling { return MEDFileParameters::New(db); } + + // serialization + static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception) + { + return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileParameters"); + } std::string __str__() const throw(INTERP_KERNEL::Exception) { diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index a6f702257..020e8ced3 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -5901,6 +5901,15 @@ class MEDLoaderTest3(unittest.TestCase): f1ts6=cPickle.loads(st) self.assertTrue(isinstance(f1ts6,MEDFileIntField1TS)) self.assertTrue(f1ts6.field(ms4[0]).isEqual((fs4[0][0]).field(ms4[0]),1e-12,1e-12)) + # MEDFileParameters + self.testParameters1()# generates Pyfile56.med + params=MEDFileParameters("Pyfile56.med") + st=cPickle.dumps(params,cPickle.HIGHEST_PROTOCOL) + params7=cPickle.loads(st) + self.assertEqual(len(params),len(params7)) + for i in xrange(len(params)): + self.assertTrue(params[i].isEqual(params7[i],1e-12)[0]) + pass pass pass