Salome HOME
AMR 2
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingDataArrayTypemaps.i
index 01df00d9c92d0844e51f7511e74e98eab22231b5..5eb5af871494bf13376a01a1ff992d4f8c93a766 100644 (file)
@@ -624,6 +624,19 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL
     }
 }
 
+static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
+{
+  PyObject *ret=PyList_New(arr.size());
+  for(std::size_t i=0;i<arr.size();i++)
+    {
+      PyObject *t=PyTuple_New(2);
+      PyTuple_SetItem(t,0,PyInt_FromLong(arr[i].first));
+      PyTuple_SetItem(t,1,PyInt_FromLong(arr[i].second));
+      PyList_SetItem(ret,i,t);
+    }
+  return ret;
+}
+
 static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
 {
   const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !";