]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
*** empty log message ***
authorageay <ageay>
Mon, 13 Dec 2010 12:56:28 +0000 (12:56 +0000)
committerageay <ageay>
Mon, 13 Dec 2010 12:56:28 +0000 (12:56 +0000)
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/MEDCouplingTypemaps.i

index 359004de575bf1c8765009d0e73f79d51d3b3150..6d97b8f31f2cd52989bf9dfb0f04e747723bd3e9 100644 (file)
@@ -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)
index 7f25b57329fd73eb46505087ec4151a3c60b128e..04254c96d0b77a54fc2e4b9dbe7e793c6b4231ed 100644 (file)
@@ -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";