]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
On the road
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 3 May 2017 12:44:03 +0000 (14:44 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 3 May 2017 12:44:03 +0000 (14:44 +0200)
src/MEDCoupling_Swig/MEDCoupling.i
src/MEDCoupling_Swig/MEDCouplingFinalize.i
src/MEDCoupling_Swig/MEDCouplingMemArray.i
src/MEDCoupling_Swig/MEDCouplingRemapper.i
src/MEDLoader/Swig/MEDLoader.i
src/RENUMBER_Swig/MEDRenumber.i

index 1b97cd31ddecc4f935aac4aebd82a20cf2a8869a..1342d2aacf442d6e1be96ddf32f475acdd1e1562 100644 (file)
@@ -80,6 +80,9 @@ def MEDCouplingDataArrayIntIpow(self,*args):
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDCoupling
     return _MEDCoupling.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDCoupling
+    return _MEDCoupling.DataArrayFloat____new___(cls,args)
 def MEDCouplingDataArrayFloatIadd(self,*args):
     import _MEDCoupling
     return _MEDCoupling.DataArrayFloat____iadd___(self, self, *args)
index 467597ee4b45903925490e77c2cd3ca9fd43a468..384c448e170d77880621630532334bc1b89eeb76 100644 (file)
@@ -36,11 +36,13 @@ DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow
 
 DataArrayByte.__new__=classmethod(MEDCouplingDataArrayBytenew)
 
+DataArrayFloat.__new__=MEDCouplingDataArrayFloatnew
 DataArrayFloat.__iadd__=MEDCouplingDataArrayFloatIadd
 DataArrayFloat.__isub__=MEDCouplingDataArrayFloatIsub
 DataArrayFloat.__imul__=MEDCouplingDataArrayFloatImul
 DataArrayFloat.__idiv__=MEDCouplingDataArrayFloatIdiv
 
+MEDCouplingFieldDouble.__new__=classmethod(MEDCouplingFieldDoublenew)
 MEDCouplingFieldDouble.__iadd__=MEDCouplingFieldDoubleIadd
 MEDCouplingFieldDouble.__isub__=MEDCouplingFieldDoubleIsub
 MEDCouplingFieldDouble.__imul__=MEDCouplingFieldDoubleImul
@@ -68,7 +70,6 @@ MEDCouplingCurveLinearMesh.__new__=classmethod(MEDCouplingCurveLinearMeshnew)
 MEDCouplingCMesh.__new__=classmethod(MEDCouplingCMeshnew)
 MEDCouplingIMesh.__new__=classmethod(MEDCouplingIMeshnew)
 MEDCouplingMappedExtrudedMesh.__new__=classmethod(MEDCouplingExtrudedMeshnew)
-MEDCouplingFieldDouble.__new__=classmethod(MEDCouplingFieldDoublenew)
 
 del INTERPKERNELExceptionReduce
 del MEDCouplingDataArrayDoublenew
@@ -88,6 +89,7 @@ del MEDCouplingDataArrayIntImul
 del MEDCouplingDataArrayIntIdiv
 del MEDCouplingDataArrayIntImod
 del MEDCouplingDataArrayBytenew
+del MEDCouplingDataArrayFloatnew
 del MEDCouplingDataArrayFloatIadd
 del MEDCouplingDataArrayFloatIsub
 del MEDCouplingDataArrayFloatImul
index fcad0d7c05813ee536a197367992526f80b5696c..f7b62cdd524dea10121048e05cc773e3190675f8 100644 (file)
@@ -697,7 +697,7 @@ namespace MEDCoupling
       {
         return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
       }
-      
+
       DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
       {
         return self->iterator();
@@ -776,7 +776,31 @@ namespace MEDCoupling
         return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
       }
 #endif
+
+      // serialization
+      static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+      {
+        return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
+      }
       
+      PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
+      {
+#ifdef WITH_NUMPY
+        if(!self->isAllocated())
+          throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
+        PyObject *ret(PyTuple_New(1));
+        PyObject *ret0(PyDict_New());
+        PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
+        {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
+          PyObject *tmp1(PyInt_FromLong(0));
+          PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
+          PyTuple_SetItem(ret,0,ret0);
+        }
+        return ret;
+#else
+        throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
+#endif
+      }
     }
   };
 
index 71d4ad564979dee7bdc569c9d8e894caee794996..7bbd61cd7c97a2f1fd28234ee057f518ea5f2513 100644 (file)
@@ -142,6 +142,9 @@ def MEDCouplingFieldDoubleIpow(self,*args):
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDCouplingRemapper
     return _MEDCouplingRemapper.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDCouplingRemapper
+    return _MEDCouplingRemapper.DataArrayFloat____new___(cls,args)
 def MEDCouplingDataArrayFloatIadd(self,*args):
     import _MEDCouplingRemapper
     return _MEDCouplingRemapper.DataArrayFloat____iadd___(self, self, *args)
index c00b24538e2f14024247c0130b34e186c317ee97..250022c4ecf3a1a80fb2cbf07b37f09e07c0f979 100644 (file)
@@ -60,6 +60,9 @@ def MEDCouplingFieldDoubleIpow(self,*args):
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDLoader
     return _MEDLoader.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDLoader
+    return _MEDLoader.DataArrayFloat____new___(cls,args)
 def MEDCouplingDataArrayFloatIadd(self,*args):
     import _MEDLoader
     return _MEDLoader.DataArrayFloat____iadd___(self, self, *args)
index 54ab2c996b0a86528c2bc0fc4a81c5187aaef6ae..82667ea270ac7bfea828e4116de28e4be6dbaba5 100644 (file)
@@ -62,6 +62,9 @@ def MEDCouplingDataArrayIntIpow(self,*args):
 def MEDCouplingDataArrayBytenew(cls,*args):
     import _MEDRenumber
     return _MEDRenumber.DataArrayByte____new___(cls,args)
+def MEDCouplingDataArrayFloatnew(cls,*args):
+    import _MEDRenumber
+    return _MEDRenumber.DataArrayFloat____new___(cls,args)
 def MEDCouplingDataArrayFloatIadd(self,*args):
     import _MEDRenumber
     return _MEDRenumber.DataArrayFloat____iadd___(self, self, *args)