From: ageay Date: Mon, 13 Dec 2010 12:56:28 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: MEDPartitioner_first_compilable_version~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1617988fd95d4d20b1b4f9b79ec31739029c1c51;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 359004de5..6d97b8f31 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -5461,6 +5461,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): m=MEDCouplingDataForTest.build3DTargetMesh_1(); m.rotate([0.,0.,0.],[0.3,0.6,1.2],0.37) m.rotate([0.,0.,0.],[0.3,6,1.2],0.37) + self.assertRaises(Exception,m.rotate,[0.,0.,0.],(0.3,6,"1.2"),0.37) self.assertRaises(Exception,m.rotate,[0.,"0.",0.],[0.3,0.6,1.2],0.37) self.assertRaises(Exception,m.rotate,[0.,0.,0.],[0.3,'0.6',1.2],0.37) m2=m.buildPartOfMySelf([2,5],True) diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 7f25b5732..04254c96d 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -280,6 +280,34 @@ static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KER } return tmp; } + else if(PyTuple_Check(pyLi)) + { + *size=PyTuple_Size(pyLi); + double *tmp=new double[*size]; + for(int i=0;i<*size;i++) + { + PyObject *o=PyTuple_GetItem(pyLi,i); + if(PyFloat_Check(o)) + { + double val=PyFloat_AS_DOUBLE(o); + tmp[i]=val; + } + else if(PyInt_Check(o)) + { + long val0=PyInt_AS_LONG(o); + double val=val0; + tmp[i]=val; + } + else + { + delete [] tmp; + const char msg[]="convertPyToNewDblArr2 : tuple must contain floats/integers only"; + PyErr_SetString(PyExc_TypeError,msg); + throw INTERP_KERNEL::Exception(msg); + } + } + return tmp; + } else { const char msg[]="convertPyToNewIntArr : not a list";