From: Anthony Geay Date: Thu, 16 Jun 2016 14:41:41 +0000 (+0200) Subject: Correction of bug in pywrap of DataArrayInt.splitByValueRange X-Git-Tag: V8_1_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f047da10cd4246780225bcfb959dd6b3cff03e25;p=tools%2Fmedcoupling.git Correction of bug in pywrap of DataArrayInt.splitByValueRange --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py index 761813c32..9794aa4c1 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py @@ -1778,6 +1778,12 @@ class MEDCouplingBasicsTest3(unittest.TestCase): # d.setIJ(6,0,9); self.assertRaises(InterpKernelException,d.splitByValueRange,val2); + # non regression test in python wrapping + rg=DataArrayInt([0,10,29,56,75,102,121,148,167,194,213,240,259,286,305,332,351,378,397,424,443,470,489,516]) + a,b,c=DataArrayInt([75]).splitByValueRange(rg) + assert(a.isEqual(DataArrayInt([4]))) + assert(b.isEqual(DataArrayInt([0]))) + assert(c.isEqual(DataArrayInt([4]))) pass def testUMeshSplitProfilePerType1(self): diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 5eefcbf47..81516f01c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -3094,8 +3094,7 @@ namespace MEDCoupling if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); - self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2); + self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2); } PyObject *ret = PyList_New(3); PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));