]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
MEDFileParameters are also pickelized
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 3 Nov 2016 09:31:05 +0000 (10:31 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 3 Nov 2016 09:31:05 +0000 (10:31 +0100)
src/MEDLoader/Swig/MEDLoader.i
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest3.py

index 55482c4a6152c8ea6c3a31ef2d784291b653ea5e..7add2d533890d2d68827860152f3bb48767d9d5a 100644 (file)
@@ -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
 %}
index c7542ef96fb2135ab7de33194ef8e1594f820467..8950a3f784214474b66faf62ec81b73f20599ea7 100644 (file)
@@ -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)
       {
index a6f7022579a5bbdc68f5128e07e568479f6ba3c2..020e8ced32ca40d6e705ee58f1f041c4a2867ebe 100644 (file)
@@ -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