Index: issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp
===================================================================
--- issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 14235)
+++ issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 14236)
@@ -336,43 +336,61 @@
 	int i;
 
-	/*retrieve dimensions: */
-	ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
-	if(ndim!=1)_error_("expecting an Mx1 vector in input!");
-	dims=PyArray_DIMS((PyArrayObject*)py_vector);
-	M=dims[0]; 
-
-	if (M) {
-		if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
-			/*retrieve internal value: */
-			dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*copy vector: */
-			vector=xNew<double>(M);
-			memcpy(vector,dvector,(M)*sizeof(double));
-		}
-
-		else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) {
-			/*retrieve internal value: */
-			lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into double vector: */
-			vector=xNew<double>(M);
-			for(i=0;i<M;i++)vector[i]=(double)lvector[i];
-		}
-
-		else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) {
-			/*retrieve internal value: */
-			bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into double vector: */
-			vector=xNew<double>(M);
-			for(i=0;i<M;i++)vector[i]=(double)bvector[i];
-		}
-
-		else
-			_error_("unrecognized double pyarray type in input!");
-	}
-	else
-		vector=NULL;
+	if     (PyArray_Check((PyArrayObject*)py_vector)) {
+		/*retrieve dimensions: */
+		ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
+		if      (ndim==1) {
+			dims=PyArray_DIMS((PyArrayObject*)py_vector);
+			M=dims[0]; 
+		}
+		else if (ndim==2) {
+			dims=PyArray_DIMS((PyArrayObject*)py_vector);
+			if (dims[1]==1)
+				M=dims[0]; 
+			else
+				_error_("expecting an Mx1 matrix or M vector in input!");
+		}
+		else
+			_error_("expecting an Mx1 matrix or M vector in input!");
+
+		if (M) {
+			if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
+				/*retrieve internal value: */
+				dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*copy vector: */
+				vector=xNew<double>(M);
+				memcpy(vector,dvector,(M)*sizeof(double));
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) {
+				/*retrieve internal value: */
+				lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into double vector: */
+				vector=xNew<double>(M);
+				for(i=0;i<M;i++)vector[i]=(double)lvector[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) {
+				/*retrieve internal value: */
+				bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into double vector: */
+				vector=xNew<double>(M);
+				for(i=0;i<M;i++)vector[i]=(double)bvector[i];
+			}
+
+			else
+				_error_("unrecognized double pyarray type in input!");
+		}
+		else
+			vector=NULL;
+	}
+
+	else {
+		M=1;
+		vector=xNew<double>(M);
+		FetchData(&(vector[0]),py_vector);
+	}
 
 	/*output: */
@@ -396,43 +414,61 @@
 	int i;
 
-	/*retrieve dimensions: */
-	ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
-	if(ndim!=1)_error_("expecting an Mx1 vector in input!");
-	dims=PyArray_DIMS((PyArrayObject*)py_vector);
-	M=dims[0]; 
-
-	if (M) {
-		if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
-			/*retrieve internal value: */
-			dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into int vector: */
-			vector=xNew<int>(M);
-			for(i=0;i<M;i++)vector[i]=(int)lvector[i];
-		}
-
-		else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) {
-			/*retrieve internal value: */
-			lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into int vector: */
-			vector=xNew<int>(M);
-			for(i=0;i<M;i++)vector[i]=(int)lvector[i];
-		}
-
-		else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) {
-			/*retrieve internal value: */
-			bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into int vector: */
-			vector=xNew<int>(M);
-			for(i=0;i<M;i++)vector[i]=(int)bvector[i];
-		}
-
-		else
-		 _error_("unrecognized int pyarray type in input!");
-	}
-	else
-	 vector=NULL;
+	if     (PyArray_Check((PyArrayObject*)py_vector)) {
+		/*retrieve dimensions: */
+		ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
+		if      (ndim==1) {
+			dims=PyArray_DIMS((PyArrayObject*)py_vector);
+			M=dims[0]; 
+		}
+		else if (ndim==2) {
+			dims=PyArray_DIMS((PyArrayObject*)py_vector);
+			if (dims[1]==1)
+				M=dims[0]; 
+			else
+				_error_("expecting an Mx1 matrix or M vector in input!");
+		}
+		else
+			_error_("expecting an Mx1 matrix or M vector in input!");
+
+		if (M) {
+			if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
+				/*retrieve internal value: */
+				dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into int vector: */
+				vector=xNew<int>(M);
+				for(i=0;i<M;i++)vector[i]=(int)lvector[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) {
+				/*retrieve internal value: */
+				lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into int vector: */
+				vector=xNew<int>(M);
+				for(i=0;i<M;i++)vector[i]=(int)lvector[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) {
+				/*retrieve internal value: */
+				bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into int vector: */
+				vector=xNew<int>(M);
+				for(i=0;i<M;i++)vector[i]=(int)bvector[i];
+			}
+
+			else
+			 _error_("unrecognized int pyarray type in input!");
+		}
+		else
+			vector=NULL;
+	}
+
+	else {
+		M=1;
+		vector=xNew<int>(M);
+		FetchData(&(vector[0]),py_vector);
+	}
 
 	/*output: */
@@ -456,43 +492,61 @@
 	int i;
 
-	/*retrieve dimensions: */
-	ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
-	if(ndim!=1)_error_("expecting an Mx1 vector in input!");
-	dims=PyArray_DIMS((PyArrayObject*)py_vector);
-	M=dims[0]; 
-
-	if (M) {
-		if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
-			/*retrieve internal value: */
-			dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into bool vector: */
-			vector=xNew<bool>(M);
-			for(i=0;i<M;i++)vector[i]=(bool)dvector[i];
-		}
-
-		else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) {
-			/*retrieve internal value: */
-			lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*transform into bool vector: */
-			vector=xNew<bool>(M);
-			for(i=0;i<M;i++)vector[i]=(bool)lvector[i];
-		}
-
-		else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) {
-			/*retrieve internal value: */
-			bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector);
-
-			/*copy vector: */
-			vector=xNew<bool>(M);
-			memcpy(vector,bvector,(M)*sizeof(bool));
-		}
-
-		else
-			_error_("unrecognized bool pyarray type in input!");
-	}
-	else
-		vector=NULL;
+	if     (PyArray_Check((PyArrayObject*)py_vector)) {
+		/*retrieve dimensions: */
+		ndim=PyArray_NDIM((const PyArrayObject*)py_vector);
+		if      (ndim==1) {
+			dims=PyArray_DIMS((PyArrayObject*)py_vector);
+			M=dims[0]; 
+		}
+		else if (ndim==2) {
+			dims=PyArray_DIMS((PyArrayObject*)py_vector);
+			if (dims[1]==1)
+				M=dims[0]; 
+			else
+				_error_("expecting an Mx1 matrix or M vector in input!");
+		}
+		else
+			_error_("expecting an Mx1 matrix or M vector in input!");
+
+		if (M) {
+			if      (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_DOUBLE) {
+				/*retrieve internal value: */
+				dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into bool vector: */
+				vector=xNew<bool>(M);
+				for(i=0;i<M;i++)vector[i]=(bool)dvector[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_INT64) {
+				/*retrieve internal value: */
+				lvector=(long*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*transform into bool vector: */
+				vector=xNew<bool>(M);
+				for(i=0;i<M;i++)vector[i]=(bool)lvector[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_vector) == NPY_BOOL) {
+				/*retrieve internal value: */
+				bvector=(bool*)PyArray_DATA((PyArrayObject*)py_vector);
+
+				/*copy vector: */
+				vector=xNew<bool>(M);
+				memcpy(vector,bvector,(M)*sizeof(bool));
+			}
+
+			else
+				_error_("unrecognized bool pyarray type in input!");
+		}
+		else
+			vector=NULL;
+	}
+
+	else {
+		M=1;
+		vector=xNew<bool>(M);
+		FetchData(&(vector[0]),py_vector);
+	}
 
 	/*output: */
