From: ageay Date: Tue, 9 Apr 2013 15:34:44 +0000 (+0000) Subject: Extend operator __iadd__ of MEDCouplingFieldDouble X-Git-Tag: V6_main_FINAL~171 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ed07f1eda9be1100b159ba3d80165df018a2a9a9;p=tools%2Fmedcoupling.git Extend operator __iadd__ of MEDCouplingFieldDouble --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 085f33abb..0f0f21e9b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -12152,6 +12152,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): f+=f2 f.checkCoherency() self.assertTrue(f.getArray().isEqual(DataArrayDouble([(2,9),(5,14),(8,19),(11,24),(14,29)]),1e-12)) + f+=[0.1,0.2] + f.checkCoherency() + self.assertTrue(f.getArray().isEqual(DataArrayDouble([(2.1,9.2),(5.1,14.2),(8.1,19.2),(11.1,24.2),(14.1,29.2)]),1e-12)) pass def setUp(self): diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 03d6671a9..7349f9d8b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -3738,9 +3738,7 @@ namespace ParaMEDMEM if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); MEDCouplingAutoRefCountObjectPtr aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size()); - MEDCouplingAutoRefCountObjectPtr ret2=self->clone(false); - ret2->setArray(aaa); - *self+=*ret2; + self->getArray()->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; }