Index: /issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp	(revision 24111)
+++ /issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp	(revision 24112)
@@ -10,5 +10,5 @@
 
 #include "./javascriptio.h"
-#include <cstring> 
+#include <cstring>
 
 /*Primitive data types*/
@@ -24,5 +24,5 @@
 /*FUNCTION FetchData(int* pinteger,int integer){{{*/
 void FetchData(int* pinteger,int integer){
-	
+
 	*pinteger = integer;
 }
@@ -30,5 +30,5 @@
 /*FUNCTION FetchData(double* pscalar,double scalar){{{*/
 void FetchData(double* pscalar,double scalar){
-	
+
 	*pscalar = scalar;
 }
@@ -38,7 +38,7 @@
 
 	double* vector=NULL;
-	
+
 	vector=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(vector,vectorin,nods);
-	
+
 	*pvector=vector;
 }
@@ -48,7 +48,7 @@
 
 	double* vector=NULL;
-	
+
 	vector=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(vector,vectorin,nods);
-	
+
 	*pvector=vector;
 	*pnods=nods;
@@ -60,5 +60,5 @@
 	double*  outmatrix=NULL;
 	int      outmatrix_rows,outmatrix_cols;
-	
+
 	if(M == 0 || N == 0){
 		/*Nothing to pick up. Just initialize matrix pointer to NULL: */
@@ -67,8 +67,8 @@
 		outmatrix=NULL;
 	}
-    else if (pmatrix && matrixin){ 
+    else if (pmatrix && matrixin){
 		outmatrix_rows=M;
 		outmatrix_cols=N;
-		outmatrix=xNew<IssmPDouble>(M*N); 
+		outmatrix=xNew<IssmPDouble>(M*N);
 		for(int i=0;i<M*N;i++)outmatrix[i]=(IssmPDouble)matrixin[i];
 	}
@@ -92,8 +92,8 @@
 		outmatrix=NULL;
 	}
-    else if (pmatrix && matrixin){ 
+    else if (pmatrix && matrixin){
 		outmatrix_rows=M;
 		outmatrix_cols=N;
-		outmatrix=xNew<IssmPDouble>(M*N); xMemCpy<IssmPDouble>(outmatrix,matrixin,M*N); 
+		outmatrix=xNew<IssmPDouble>(M*N); xMemCpy<IssmPDouble>(outmatrix,matrixin,M*N);
 	}
 
@@ -116,8 +116,8 @@
 		outmatrix=NULL;
 	}
-    else if (pmatrix && matrixin){ 
+    else if (pmatrix && matrixin){
 		outmatrix_rows=M;
 		outmatrix_cols=N;
-		outmatrix=xNew<int>(M*N); xMemCpy<int>(outmatrix,matrixin,M*N); 
+		outmatrix=xNew<int>(M*N); xMemCpy<int>(outmatrix,matrixin,M*N);
 	}
 
@@ -141,5 +141,5 @@
 
 	if (nods){
-			
+
 		contouri=new Contour<double>();
 		contouri->nods=nods;
@@ -149,5 +149,5 @@
 		contours->AddObject(contouri);
 	}
-	
+
 	*pcontours=contours;
 }
@@ -193,5 +193,5 @@
 /*}}}*/
 /*FUNCTION FetchData(BamgOpts** pbamgopts, double anisomax, double cutoff, double coeff, double errg, double gradation, int Hessiantype, int maxnbv, double maxsubdiv, int Metrictype, int nbjacobi, int nbsmooth, double omega, double power, int verbose, int Crack, int KeepVertices, int splitcorners, double hmin, double hmax, int* hminVerticesSize, double* hminVertices, int* hmaxVerticesSize, double* hmaxVertices, int* hVerticesSize, double* hVertices, int* metricSize, double* metric, int* fieldSize, double* field, int* errSize, double* err){{{*/
-void FetchData(BamgOpts** pbamgopts, double anisomax, double coeff, double cutoff, double errg, double gradation, int Hessiantype, int maxnbv, double maxsubdiv, int Metrictype, int nbjacobi, int nbsmooth, double omega, double power, int verbose, int Crack, int KeepVertices, int splitcorners, double hmin, double hmax, int* hminVerticesSize, double* hminVertices, int* hmaxVerticesSize, double* hmaxVertices, int* hVerticesSize, double* hVertices, int* metricSize, double* metric, int* fieldSize, double* field, int* errSize, double* err){
+void FetchData(BamgOpts** pbamgopts, double anisomax, double coeff, double cutoff, double errg, double gradation, int Hessiantype, int maxnbv, double maxsubdiv, int Metrictype, int nbjacobi, int nbsmooth, double omega, double power, int verbose, int Crack, int KeepVertices, int splitcorners, double hmin, double hmax, int* hminVerticesSize, double* hminVertices, int* hmaxVerticesSize, double* hmaxVertices, int* hVerticesLength, double* hVertices, int* metricSize, double* metric, int* fieldSize, double* field, int* errSize, double* err){
 
 	BamgOpts *bamgopts      = new BamgOpts();
@@ -217,5 +217,5 @@
     bamgopts->KeepVertices	= KeepVertices;
     bamgopts->splitcorners	= splitcorners;
-        
+
     /*Metric related*/
     bamgopts->hmin	        = hmin;
@@ -223,9 +223,9 @@
 	FetchData(&bamgopts->hminVertices, &bamgopts->hminVerticesSize[0], &bamgopts->hminVerticesSize[1], hminVertices, hminVerticesSize[0], hminVerticesSize[1]);
 	FetchData(&bamgopts->hmaxVertices, &bamgopts->hmaxVerticesSize[0], &bamgopts->hmaxVerticesSize[1], hmaxVertices, hmaxVerticesSize[0], hmaxVerticesSize[1]);
-	FetchData(&bamgopts->hVertices, &bamgopts->hVerticesSize[0], &bamgopts->hVerticesSize[1], hVertices, hVerticesSize[0], hVerticesSize[1]);
+	FetchData(&bamgopts->hVertices, &bamgopts->hVerticesLength, hVertices, hVerticesLength);
 	FetchData(&bamgopts->field, &bamgopts->fieldSize[0], &bamgopts->fieldSize[1], field, fieldSize[0], fieldSize[1]);
 	FetchData(&bamgopts->metric, &bamgopts->metricSize[0], &bamgopts->metricSize[1], metric, metricSize[0], metricSize[1]);
 	FetchData(&bamgopts->err, &bamgopts->errSize[0], &bamgopts->errSize[1], err, errSize[0], errSize[1]);
-    
+
 	/*Additional checks*/
 	bamgopts->Check();
@@ -240,5 +240,5 @@
 	/*Initialize output*/
 	Options* options=new Options();
-	
+
 	/*check and parse the name  */
 	GenericOption<double> *odouble = new GenericOption<double>();
Index: /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp	(revision 24111)
+++ /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp	(revision 24112)
@@ -10,5 +10,5 @@
 
 #include "./matlabio.h"
-#include <cstring> 
+#include <cstring>
 
 /*Primitive data types*/
@@ -24,8 +24,8 @@
 		outmatrix=NULL;
 	}
-	else if( mxIsClass(dataref,"double") || 
-				mxIsClass(dataref,"single") || 
-				mxIsClass(dataref,"int16") || 
-				mxIsClass(dataref,"int8") || 
+	else if( mxIsClass(dataref,"double") ||
+				mxIsClass(dataref,"single") ||
+				mxIsClass(dataref,"int16") ||
+				mxIsClass(dataref,"int8") ||
 				mxIsClass(dataref,"uint8")){
 		/*Check dataref is not pointing to NaN: */
@@ -67,8 +67,8 @@
 		outmatrix=NULL;
 	}
-	else if( mxIsClass(dataref,"double") || 
-				mxIsClass(dataref,"single") || 
-				mxIsClass(dataref,"int16") || 
-				mxIsClass(dataref,"int8") || 
+	else if( mxIsClass(dataref,"double") ||
+				mxIsClass(dataref,"single") ||
+				mxIsClass(dataref,"int16") ||
+				mxIsClass(dataref,"int8") ||
 				mxIsClass(dataref,"uint8")){
 
@@ -393,5 +393,5 @@
 	FetchData(&bamgopts->hminVertices,&bamgopts->hminVerticesSize[0],&bamgopts->hminVerticesSize[1],mxGetField(dataref,0,"hminVertices"));
 	FetchData(&bamgopts->hmaxVertices,&bamgopts->hmaxVerticesSize[0],&bamgopts->hmaxVerticesSize[1],mxGetField(dataref,0,"hmaxVertices"));
-	FetchData(&bamgopts->hVertices,&bamgopts->hVerticesSize[0],&bamgopts->hVerticesSize[1],mxGetField(dataref,0,"hVertices"));
+	FetchData(&bamgopts->hVertices,&bamgopts->hVerticesLength,mxGetField(dataref,0,"hVertices"));
 	FetchData(&bamgopts->metric,&bamgopts->metricSize[0],&bamgopts->metricSize[1],mxGetField(dataref,0,"metric"));
 	FetchData(&bamgopts->field,&bamgopts->fieldSize[0],&bamgopts->fieldSize[1],mxGetField(dataref,0,"field"));
Index: /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 24111)
+++ /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 24112)
@@ -19,11 +19,11 @@
 void FetchData(double* pscalar,PyObject* py_float){
 
-	double dscalar;
+   double dscalar;
 
 	/*return internal value: */
-	#if _PYTHON_MAJOR_ == 3
-	if (PyFloat_Check(py_float))
-		dscalar=PyFloat_AsDouble(py_float);
-	else if (PyLong_Check(py_float))
+   #if _PYTHON_MAJOR_ == 3
+   if (PyFloat_Check(py_float))
+      dscalar=PyFloat_AsDouble(py_float);
+   else if (PyLong_Check(py_float))
 		dscalar=(double)PyLong_AsLong(py_float);
 	else if (PyBool_Check(py_float))
@@ -34,5 +34,5 @@
 		FetchData(&dscalar,PyList_GetItem(py_float,(Py_ssize_t)0));
 	else
-		_error_("unrecognized float type in input!");
+		_error_("unrecognized float type py3 in input!");
 
 	#else
@@ -50,5 +50,5 @@
 		FetchData(&dscalar,PyList_GetItem(py_float,(Py_ssize_t)0));
 	else
-		_error_("unrecognized float type in input!");
+		_error_("unrecognized float type in py2 input!");
 	#endif
 	/*output: */
@@ -64,5 +64,5 @@
 	#if _PYTHON_MAJOR_ == 3
 	if  (PyFloat_Check(py_float))
-	 fscalar=PyFloat_AsDouble(py_float);
+      fscalar=PyFloat_AsDouble(py_float);
 	else if (PyLong_Check(py_float))
 		fscalar=(float)PyLong_AsLong(py_float);
@@ -142,5 +142,5 @@
 	/*return internal value: */
 	#if _PYTHON_MAJOR_ == 3
-	if      (PyBool_Check(py_boolean))
+	if (PyBool_Check(py_boolean))
 		bscalar=(bool)PyLong_AsLong(py_boolean);
 	else if (PyLong_Check(py_boolean))
@@ -192,8 +192,8 @@
 	PyObject* py_matrix2=NULL;
 
-	if     (PyArray_Check((PyArrayObject*)py_matrix)) {
+	if (PyArray_Check((PyArrayObject*)py_matrix)) {
 		/*retrieve dimensions: */
 		ndim=PyArray_NDIM((const PyArrayObject*)py_matrix);
-		if      (ndim==2) {
+		if (ndim==2) {
 			dims=PyArray_DIMS((PyArrayObject*)py_matrix);
 			M=dims[0]; N=dims[1];
@@ -212,5 +212,5 @@
 			}
 
-			if      (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) {
+			if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) {
 				/*retrieve internal value: */
 				dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix);
@@ -218,25 +218,5 @@
 				/*copy matrix: */
 				matrix=xNew<double>(M*N);
-//				if (PyArray_ISCONTIGUOUS((PyArrayObject*)py_matrix)) {
-					memcpy(matrix,dmatrix,(M*N)*sizeof(double));
-//				}
-
-//				else {
-//					int j,k,ipt=0;
-//					int mstride,nstride;
-//					mstride=(int)PyArray_STRIDE((PyArrayObject*)py_matrix,0)/PyArray_ITEMSIZE((PyArrayObject*)py_matrix);
-//					if (ndim > 1)
-//						nstride=(int)PyArray_STRIDE((PyArrayObject*)py_matrix,1)/PyArray_ITEMSIZE((PyArrayObject*)py_matrix);
-//					else
-//						nstride=1;
-//					for (i=0; i<M; i++) {
-//						k=i*mstride;
-//						for (j=0; j<N; j++) {
-//							matrix[ipt++]=dmatrix[k];
-//							k+=nstride;
-//						}
-//					}
-//				}
-
+				memcpy(matrix,dmatrix,(M*N)*sizeof(double));
 			}
 
@@ -264,4 +244,41 @@
 			//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
 		}
+		else
+			matrix=NULL;
+	}
+	else if (PyList_Check(py_matrix)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_matrix);
+		N=1
+
+		if (M) {
+			matrix=xNew<double>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_matrix, index);
+				if ((int)PyList_Size(item)>1)
+					_error_("2D lists are not suported");
+				FetchData(&(matrix[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+		else
+			matrix=NULL;
+	}
+	else if (PyTuple_Check(py_matrix)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_matrix);
+		N=1
+		if (M) {
+			matrix=xNew<double>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_matrix, index);
+				if ((int)PyTuple_Size(item)>1)
+					_error_("2D tuple are not suported");
+				FetchData(&(matrix[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
 		else
 			matrix=NULL;
@@ -356,4 +373,39 @@
 			matrix=NULL;
 	}
+	else if (PyList_Check(py_matrix)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_matrix);
+		N=1
+		if (M) {
+			matrix=xNew<int>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_matrix, index);
+				if ((int)PyList_Size(item)>1)
+					_error_("2D lists are not suported");
+				FetchData(&(matrix[index]),item);
+			}
+		}
+		else
+			matrix=NULL;
+	}
+	else if (PyTuple_Check(py_matrix)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_matrix);
+		N=1
+		if (M) {
+			matrix=xNew<int>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_matrix, index);
+				if ((int)PyTuple_Size(item)>1)
+					_error_("2D tuple are not suported");
+				FetchData(&(matrix[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+		else
+			matrix=NULL;
+	}
 
 	else {
@@ -443,4 +495,41 @@
 			matrix=NULL;
 	}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+
+	else if (PyList_Check(py_matrix)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_matrix);
+		N=1;
+		if (M) {
+			matrix=xNew<bool>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_matrix, index);
+				if ((int)PyList_Size(item)>1)
+					_error_("2D lists are not suported");
+				FetchData(&(matrix[index]),item);
+			}
+		}
+		else
+			matrix=NULL;
+	}
+	else if (PyTuple_Check(py_matrix)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_matrix);
+		N=1
+		if (M) {
+			matrix=xNew<bool>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_matrix, index);
+				if ((int)PyTuple_Size(item)>1)
+					_error_("2D tuples are not suported");
+				FetchData(&(matrix[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+		else
+			matrix=NULL;
+	}
 
 	else {
@@ -534,4 +623,35 @@
 			vector=NULL;
 	}
+	else if (PyList_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_vector);
+
+		if (M) {
+			vector=xNew<double>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		else
+			vector=NULL;
+	}
+	else if (PyTuple_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_vector);
+
+		if (M) {
+			vector=xNew<double>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+		else
+			vector=NULL;
+	}
 
 	else {
@@ -620,4 +740,37 @@
 			vector=NULL;
 	}
+	else if (PyList_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_vector);
+
+		if (M) {
+			vector=xNew<float>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		else
+			vector=NULL;
+	}
+
+	else if (PyTuple_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_vector);
+
+		if (M) {
+			vector=xNew<float>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+		else
+			vector=NULL;
+	}
+
 	else{
 		M=1;
@@ -707,4 +860,37 @@
 	}
 
+	else if (PyList_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_vector);
+
+		if (M) {
+			vector=xNew<int>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		else
+			vector=NULL;
+	}
+
+	else if (PyTuple_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_vector);
+
+		if (M) {
+			vector=xNew<int>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
+		else
+			vector=NULL;
+	}
+
 	else {
 		M=1;
@@ -790,4 +976,35 @@
 				delete(py_vector2);
 		}
+		else
+			vector=NULL;
+	}
+	else if (PyList_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyList_Size(py_vector);
+		if (M) {
+			vector=xNew<bool>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyList_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		else
+			vector=NULL;
+	}
+
+	else if (PyTuple_Check(py_vector)) {
+		/*retrieve dimensions: */
+		M=(int)PyTuple_Size(py_vector);
+
+		if (M) {
+			vector=xNew<bool>(M);
+			for (int index = 0; index < M; index++) {
+				PyObject *item;
+				item = PyTuple_GetItem(py_vector, index);
+				FetchData(&(vector[index]),item);
+			}
+		}
+		//if (py_matrix2) delete(py_matrix2); Not doing this for now, seems to  be creating a segfault!
 		else
 			vector=NULL;
@@ -876,5 +1093,5 @@
 	FetchData(&bamgopts->hminVertices,&bamgopts->hminVerticesSize[0],&bamgopts->hminVerticesSize[1],PyDict_GetItemString(py_dict,"hminVertices"));
 	FetchData(&bamgopts->hmaxVertices,&bamgopts->hmaxVerticesSize[0],&bamgopts->hmaxVerticesSize[1],PyDict_GetItemString(py_dict,"hmaxVertices"));
-	FetchData(&bamgopts->hVertices,&bamgopts->hVerticesSize[0],&bamgopts->hVerticesSize[1],PyDict_GetItemString(py_dict,"hVertices"));
+	FetchData(&bamgopts->hVertices,&bamgopts->hVerticesLength,PyDict_GetItemString(py_dict,"hVertices"));
 	FetchData(&bamgopts->metric,&bamgopts->metricSize[0],&bamgopts->metricSize[1],PyDict_GetItemString(py_dict,"metric"));
 	FetchData(&bamgopts->field,&bamgopts->fieldSize[0],&bamgopts->fieldSize[1],PyDict_GetItemString(py_dict,"field"));
