self.checkConsistencyLight()
d=(self.getTypeOfField(),self.getTimeDiscretization())
return MEDCouplingStdReduceFunct,(MEDCouplingFieldFloat,(d,(self.__getstate__()),))
-
+def MEDCouplingFTReduceFunct(cls,params):
+ a,b=params
+ ret=object.__new__(cls)
+ ret.__init__(*a)
+ return ret
+
+def MEDCouplingFieldTemplateReduce(self):
+ ret = MEDCouplingFieldDouble(self)
+ nbTuples = self.getNumberOfTuplesExpected()
+ arr = DataArrayDouble(nbTuples) ; arr[:] = 0.
+ ret.setArray(arr)
+ return MEDCouplingFTReduceFunct,(MEDCouplingFieldTemplate,((ret,),()))
#
# Forwarding DataArrayInt functions to MEDCouplingUMesh:
#
void **wronc=(void **)wron;
PyObject *weakRefOnOwner=reinterpret_cast<PyObject *>(wronc[0]);
PyObject *obj=PyWeakref_GetObject(weakRefOnOwner);
+ int64_t *offset=reinterpret_cast<int64_t*>(wronc[2]);
if(obj!=Py_None)
{
Py_XINCREF(obj);
{
typedef void (*MyDeallocator)(void *,void *);
MyDeallocator deall=(MyDeallocator)wronc[1];
- int64_t *offset=reinterpret_cast<int64_t*>(wronc[2]);
deall(pt,offset);
- delete offset;
Py_XDECREF(weakRefOnOwner);
}
+ delete offset;
delete [] wronc;
}
#endif
MEDCouplingFieldDouble.__rfloordiv__=MEDCouplingFieldDouble.__rdiv__
MEDCouplingFieldDouble.__ifloordiv__=MEDCouplingFieldDoubleIdiv
+MEDCouplingFieldTemplate.__reduce__=MEDCouplingFieldTemplateReduce
+
MEDCouplingFieldInt.__reduce__=MEDCouplingFieldIntReduce
MEDCouplingFieldFloat.__reduce__=MEDCouplingFieldFloatReduce
del MEDCouplingFieldDoubleReduce
del MEDCouplingFieldFloatReduce
del MEDCouplingFieldIntReduce
+del MEDCouplingFieldTemplateReduce
del MEDCouplingDataArrayDoubleIadd
del MEDCouplingDataArrayDoubleIsub
del MEDCouplingDataArrayDoubleImul
f2=pickle.loads(st)
self.assertTrue(f2.isEqual(f,1e-16,1e-16))
self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16))
+ ###
+ ft=MEDCouplingFieldTemplate(f)
+ ft2=pickle.loads(pickle.dumps(ft,pickle.HIGHEST_PROTOCOL))
+ self.assertTrue(ft2.isEqual(ft,1e-16))
pass
@unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
f2=pickle.loads(st)
self.assertTrue(f2.isEqual(f,1e-16,1e-16))
self.assertTrue(f2.getMesh().isEqual(f.getMesh(),1e-16))
+ ###
+ ft=MEDCouplingFieldTemplate(f)
+ ft2=pickle.loads(pickle.dumps(ft,pickle.HIGHEST_PROTOCOL))
+ self.assertTrue(ft2.isEqual(ft,1e-16))
pass
def test13(self):