]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Correction of bug in pywrap of DataArrayInt.splitByValueRange
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 16 Jun 2016 14:41:41 +0000 (16:41 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 16 Jun 2016 14:41:41 +0000 (16:41 +0200)
src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py
src/MEDCoupling_Swig/MEDCouplingMemArray.i

index 761813c321e5911c8f8838dab9bb3b817f75febb..9794aa4c185f5df0ca68a935494fd6da1afd0768 100644 (file)
@@ -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):
index 5eefcbf47d16823b858e9a9376afcda3371b2aca..81516f01c36f1251c0aa42de7769bcd6cabbbb1f 100644 (file)
@@ -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 ));