From: Anthony Geay Date: Wed, 18 Mar 2015 13:53:55 +0000 (+0100) Subject: Last cleanup before commit into master. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fagy%2FPyPickelingOfMCObj;p=tools%2Fmedcoupling.git Last cleanup before commit into master. --- diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 9c476226b..d6450452e 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -20,15 +20,6 @@ %include "MEDCouplingCommon.i" %pythoncode %{ -def INTERPKERNELExceptionReduceFunct(a,b): - ret=InterpKernelException.__new__(a) - ret.__init__(*b) - return ret -def INTERPKERNELExceptionReduce(self): - return INTERPKERNELExceptionReduceFunct,(InterpKernelException,(self.what(),)) -def INTERPKERNELExceptionnew(cls,*args): - import _MEDCoupling - return _MEDCoupling.InterpKernelException____new___(cls,args) def ParaMEDMEMDataArrayDoublenew(cls,*args): import _MEDCoupling return _MEDCoupling.DataArrayDouble____new___(cls,args) @@ -47,6 +38,9 @@ def ParaMEDMEMDataArrayDoubleIdiv(self,*args): def ParaMEDMEMDataArrayDoubleIpow(self,*args): import _MEDCoupling return _MEDCoupling.DataArrayDouble____ipow___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): + import _MEDCoupling + return _MEDCoupling.MEDCouplingFieldDouble____new___(cls,args) def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args): import _MEDCoupling return _MEDCoupling.MEDCouplingFieldDouble____iadd___(self, self, *args) @@ -137,9 +131,6 @@ def ParaMEDMEMMEDCouplingIMeshnew(cls,*args): def ParaMEDMEMMEDCouplingExtrudedMeshnew(cls,*args): import _MEDCoupling return _MEDCoupling.MEDCouplingExtrudedMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): - import _MEDCoupling - return _MEDCoupling.MEDCouplingFieldDouble____new___(cls,args) %} %include "MEDCouplingFinalize.i" diff --git a/src/MEDCoupling_Swig/MEDCouplingFinalize.i b/src/MEDCoupling_Swig/MEDCouplingFinalize.i index 2b0e4379e..393dec9c8 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFinalize.i +++ b/src/MEDCoupling_Swig/MEDCouplingFinalize.i @@ -18,7 +18,6 @@ // %pythoncode %{ -#InterpKernelException.__new__=classmethod(INTERPKERNELExceptionnew) InterpKernelException.__reduce__=INTERPKERNELExceptionReduce DataArrayDouble.__new__=classmethod(ParaMEDMEMDataArrayDoublenew) DataArrayDouble.__iadd__=ParaMEDMEMDataArrayDoubleIadd @@ -64,7 +63,6 @@ MEDCouplingIMesh.__new__=classmethod(ParaMEDMEMMEDCouplingIMeshnew) MEDCouplingExtrudedMesh.__new__=classmethod(ParaMEDMEMMEDCouplingExtrudedMeshnew) MEDCouplingFieldDouble.__new__=classmethod(ParaMEDMEMMEDCouplingFieldDoublenew) -#del INTERPKERNELExceptionnew del INTERPKERNELExceptionReduce del ParaMEDMEMDataArrayDoublenew del ParaMEDMEMDataArrayDoubleIadd diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index 141d45a36..48003ef55 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -32,52 +32,6 @@ namespace INTERP_KERNEL { return std::string(self->what()); } - - PyObject *__getnewargs__() - { - PyObject *ret(PyTuple_New(1)); - PyTuple_SetItem(ret,0,PyString_FromString(self->what())); - return ret; - } - - static PyObject *___new___(PyObject *cls, PyObject *what) - { - PyObject *excep(PyImport_ImportModule("exceptions"));//new - PyObject *excepDict(PyModule_GetDict(excep));//borrowed - PyObject *obj(PyDict_GetItemString(excepDict,"Exception"));//borrowed - PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__")); - // - PyObject *tmp0(PyTuple_New(1)); - PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls); - PyObject *instance(PyObject_CallObject(selfMeth,tmp0)); - Py_DECREF(tmp0); - Py_DECREF(selfMeth); - if(instance && PyTuple_Check(what) && PyTuple_Size(what)==2) - { - PyObject *initMeth(PyObject_GetAttrString(instance,"__init__")); - //PyObject *elt(PyString_FromString(what.c_str())); - PyObject *what2(PyTuple_GetItem(what,0)); - PyObject *uniqueElt(PyTuple_New(1)); - PyTuple_SetItem(uniqueElt,0,what2); Py_XINCREF(what2); - PyObject *tmp2(PyObject_CallObject(initMeth,uniqueElt)); - Py_DECREF(uniqueElt); - Py_XDECREF(tmp2); - Py_DECREF(initMeth); - } - Py_XDECREF(excep); - return instance; - } - - PyObject *__getstate__() const - { - PyObject *ret(PyTuple_New(1)); - PyTuple_SetItem(ret,0,PyString_FromString(self->what())); - return ret; - } - - void __setstate__(PyObject *inp) - { - } } }; } @@ -203,3 +157,12 @@ namespace ParaMEDMEM return std::string(script); } } + +%pythoncode %{ +def INTERPKERNELExceptionReduceFunct(a,b): + ret=InterpKernelException.__new__(a) + ret.__init__(*b) + return ret +def INTERPKERNELExceptionReduce(self): + return INTERPKERNELExceptionReduceFunct,(InterpKernelException,(self.what(),)) +%} diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapper.i b/src/MEDCoupling_Swig/MEDCouplingRemapper.i index 09881b239..135958b88 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapper.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapper.i @@ -121,6 +121,9 @@ def ParaMEDMEMDataArrayDoubleIdiv(self,*args): def ParaMEDMEMDataArrayDoubleIpow(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayDouble____ipow___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.MEDCouplingFieldDouble____new___(cls,args) def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingFieldDouble____iadd___(self, self, *args) @@ -214,9 +217,6 @@ def ParaMEDMEMMEDCouplingIMeshnew(cls,*args): def ParaMEDMEMMEDCouplingExtrudedMeshnew(cls,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.MEDCouplingExtrudedMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): - import _MEDCouplingRemapper - return _MEDCouplingRemapper.MEDCouplingFieldDouble____new___(cls,args) %} %include "MEDCouplingFinalize.i" diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index baa712d4f..ab8d676ed 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -39,6 +39,24 @@ def ParaMEDMEMDataArrayDoubleIdiv(self,*args): def ParaMEDMEMDataArrayDoubleIpow(self,*args): import _MEDLoader return _MEDLoader.DataArrayDouble____ipow___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): + import _MEDLoader + return _MEDLoader.MEDCouplingFieldDouble____new___(cls,args) +def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args): + import _MEDLoader + return _MEDLoader.MEDCouplingFieldDouble____iadd___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoubleIsub(self,*args): + import _MEDLoader + return _MEDLoader.MEDCouplingFieldDouble____isub___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoubleImul(self,*args): + import _MEDLoader + return _MEDLoader.MEDCouplingFieldDouble____imul___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoubleIdiv(self,*args): + import _MEDLoader + return _MEDLoader.MEDCouplingFieldDouble____idiv___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoubleIpow(self,*args): + import _MEDLoader + return _MEDLoader.MEDCouplingFieldDouble____ipow___(self, self, *args) def ParaMEDMEMDataArrayIntnew(cls,*args): import _MEDLoader return _MEDLoader.DataArrayInt____new___(cls,args) @@ -114,9 +132,6 @@ def ParaMEDMEMMEDCouplingIMeshnew(cls,*args): def ParaMEDMEMMEDCouplingExtrudedMeshnew(cls,*args): import _MEDLoader return _MEDLoader.MEDCouplingExtrudedMesh____new___(cls,args) -def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): - import _MEDLoader - return _MEDLoader.MEDCouplingFieldDouble____new___(cls,args) %} %include "MEDCouplingFinalize.i" diff --git a/src/ParaMEDMEM_Swig/ParaMEDMEM.i b/src/ParaMEDMEM_Swig/ParaMEDMEM.i index 37bcb85e8..38f4c4751 100644 --- a/src/ParaMEDMEM_Swig/ParaMEDMEM.i +++ b/src/ParaMEDMEM_Swig/ParaMEDMEM.i @@ -289,6 +289,9 @@ def ParaMEDMEMDataArrayDoubleTupleImul(self,*args): def ParaMEDMEMDataArrayDoubleTupleIdiv(self,*args): import _ParaMEDMEM return _ParaMEDMEM.DataArrayDoubleTuple____idiv___(self, self, *args) +def ParaMEDMEMMEDCouplingFieldDoublenew(cls,*args): + import _ParaMEDMEM + return _ParaMEDMEM.MEDCouplingFieldDouble____new___(cls,args) def ParaMEDMEMMEDCouplingFieldDoubleIadd(self,*args): import _ParaMEDMEM return _ParaMEDMEM.MEDCouplingFieldDouble____iadd___(self, self, *args) diff --git a/src/RENUMBER_Swig/MEDRenumber.i b/src/RENUMBER_Swig/MEDRenumber.i index 994a527c1..9ba28d274 100644 --- a/src/RENUMBER_Swig/MEDRenumber.i +++ b/src/RENUMBER_Swig/MEDRenumber.i @@ -90,6 +90,7 @@ def ParaMEDMEMDataArrayIntTupleImod(self,*args): %pythoncode %{ +InterpKernelException.__reduce__=INTERPKERNELExceptionReduce DataArrayDouble.__new__=classmethod(ParaMEDMEMDataArrayDoublenew) DataArrayDouble.__iadd__=ParaMEDMEMDataArrayDoubleIadd DataArrayDouble.__isub__=ParaMEDMEMDataArrayDoubleIsub @@ -116,6 +117,7 @@ DataArrayIntTuple.__imul__=ParaMEDMEMDataArrayIntTupleImul DataArrayIntTuple.__idiv__=ParaMEDMEMDataArrayIntTupleIdiv DataArrayIntTuple.__imod__=ParaMEDMEMDataArrayIntTupleImod +del INTERPKERNELExceptionReduce del ParaMEDMEMDataArrayDoublenew del ParaMEDMEMDataArrayDoubleIadd del ParaMEDMEMDataArrayDoubleIsub