Index: /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 14233)
+++ /issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp	(revision 14234)
@@ -148,5 +148,5 @@
 
 			else
-				_error_("unrecognized float pyarray type in input!");
+				_error_("unrecognized double pyarray type in input!");
 		}
 		else
@@ -225,5 +225,5 @@
 
 			else
-				_error_("unrecognized long pyarray type in input!");
+				_error_("unrecognized int pyarray type in input!");
 		}
 		else
@@ -244,4 +244,81 @@
 }
 /*}}}*/
+/*FUNCTION FetchData(bool** pmatrix,int* pM, int* pN, PyObject* py_matrix){{{*/
+void FetchData(bool** pmatrix,int* pM,int *pN,PyObject* py_matrix){
+
+	/*output: */
+	bool* bmatrix=NULL;
+	bool* matrix=NULL;
+	int M,N;
+	int ndim;
+	npy_intp*  dims=NULL;
+
+	/*intermediary:*/
+	double* dmatrix=NULL;
+	long* lmatrix=NULL;
+	int i;
+
+	if     (PyArray_Check((PyArrayObject*)py_matrix)) {
+		/*retrieve dimensions: */
+		ndim=PyArray_NDIM((const PyArrayObject*)py_matrix);
+		if      (ndim==2) {
+			dims=PyArray_DIMS((PyArrayObject*)py_matrix);
+			M=dims[0]; N=dims[1];
+		}
+		else if (ndim==1) {
+			dims=PyArray_DIMS((PyArrayObject*)py_matrix);
+			M=dims[0]; N=1;
+		}
+		else
+			_error_("expecting an MxN matrix or M vector in input!");
+
+		if (M && N) {
+			if      (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_DOUBLE) {
+				/*retrieve internal value: */
+				dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix);
+
+				/*transform into bool matrix: */
+				matrix=xNew<bool>(M*N);
+				for(i=0;i<M*N;i++)matrix[i]=(bool)dmatrix[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_INT64) {
+				/*retrieve internal value: */
+				lmatrix=(long*)PyArray_DATA((PyArrayObject*)py_matrix);
+
+				/*transform into bool matrix: */
+				matrix=xNew<bool>(M*N);
+				for(i=0;i<M*N;i++)matrix[i]=(bool)lmatrix[i];
+			}
+
+			else if (PyArray_TYPE((PyArrayObject*)py_matrix) == NPY_BOOL) {
+				/*retrieve internal value: */
+				bmatrix=(bool*)PyArray_DATA((PyArrayObject*)py_matrix);
+
+				/*copy matrix: */
+				matrix=xNew<bool>(M*N);
+				memcpy(matrix,bmatrix,(M*N)*sizeof(bool));
+			}
+
+			else
+				_error_("unrecognized bool pyarray type in input!");
+		}
+		else
+			matrix=NULL;
+	}
+
+	else {
+		M=1;
+		N=1;
+		matrix=xNew<bool>(M*N);
+		FetchData(&(matrix[0]),py_matrix);
+	}
+
+	/*output: */
+	if(pM)*pM=M;
+	if(pN)*pN=N;
+	if(pmatrix)*pmatrix=matrix;
+}
+/*}}}*/
 /*FUNCTION FetchData(double** pvector,int* pM, PyObject* py_vector){{{*/
 void FetchData(double** pvector,int* pM,PyObject* py_vector){
@@ -294,5 +371,5 @@
 
 		else
-			_error_("unrecognized vector type in input!");
+			_error_("unrecognized double pyarray type in input!");
 	}
 	else
@@ -354,8 +431,68 @@
 
 		else
-		 _error_("unrecognized vector type in input!");
+		 _error_("unrecognized int pyarray type in input!");
 	}
 	else
 	 vector=NULL;
+
+	/*output: */
+	if(pM)*pM=M;
+	if(pvector)*pvector=vector;
+}
+/*}}}*/
+/*FUNCTION FetchData(bool** pvector,int* pM, PyObject* py_vector){{{*/
+void FetchData(bool** pvector,int* pM,PyObject* py_vector){
+
+	/*output: */
+	bool* bvector=NULL;
+	bool* vector=NULL;
+	int M;
+	int ndim;
+	npy_intp*  dims=NULL;
+
+	/*intermediary:*/
+	double* dvector=NULL;
+	long* lvector=NULL;
+	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;
 
 	/*output: */
Index: /issm/trunk-jpl/src/wrappers/python/io/WritePythonData.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/python/io/WritePythonData.cpp	(revision 14233)
+++ /issm/trunk-jpl/src/wrappers/python/io/WritePythonData.cpp	(revision 14234)
@@ -209,4 +209,39 @@
 }
 /*}}}*/
+/*FUNCTION WriteData(PyObject* py_tuple,int index,SeqMat<bool>* matrix){{{*/
+void WriteData(PyObject* py_tuple,int index,SeqMat<bool>* matrix){
+
+	int M,N;
+	bool* buffer=NULL;
+	npy_intp dims[2]={0,0};
+	PyObject* array=NULL;
+
+	matrix->GetSize(&M,&N);
+	buffer=matrix->ToSerial();
+
+	dims[0]=(npy_intp)M;
+	dims[1]=(npy_intp)N;
+	array=PyArray_SimpleNewFromData(2,dims,NPY_BOOL,buffer);
+
+	PyTuple_SetItem(py_tuple, index, array);
+
+}/*}}}*/
+/*FUNCTION WriteData(PyObject* py_tuple,int index,SeqVec<bool>* vector){{{*/
+void WriteData(PyObject* py_tuple,int index,SeqVec<bool>* vector){
+
+	int M;
+	bool* buffer=NULL;
+	npy_intp dim=10;
+	PyObject* array=NULL;
+
+	vector->GetSize(&M);
+	buffer=vector->ToMPISerial();
+
+	dim=(npy_intp)M;
+	array=PyArray_SimpleNewFromData(1,&dim,NPY_BOOL,buffer);
+
+	PyTuple_SetItem(py_tuple, index, array);
+}
+/*}}}*/
 /*FUNCTION WriteData(PyObject* py_tuple,int index,RiftStruct* riftstruct){{{*/
 void WriteData(PyObject* py_tuple,int index,RiftStruct* riftstruct){
@@ -288,2 +323,18 @@
 }
 /*}}}*/
+/*FUNCTION PyArrayFromCopiedData(int dimi,int dimj,bool* data){{{*/
+PyObject* PyArrayFromCopiedData(int dimi,int dimj,bool* data){
+
+	bool* pydata;
+	npy_intp pydims[2]={0,0};
+
+	/*  note that PyArray_SimpleNewFromData does not copy the data, so that when the original
+		 object (e.g. bamggeom,bamgmesh) is deleted, the data is gone.  */
+
+	pydims[0]=(npy_intp)dimi;
+	pydims[1]=(npy_intp)dimj;
+	pydata=xNew<bool>(dimi*dimj);
+	memcpy(pydata,data,dimi*dimj*sizeof(bool));
+	return PyArray_SimpleNewFromData(2,pydims,NPY_BOOL,pydata);
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/wrappers/python/io/pythonio.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/python/io/pythonio.h	(revision 14233)
+++ /issm/trunk-jpl/src/wrappers/python/io/pythonio.h	(revision 14234)
@@ -27,12 +27,16 @@
 void WriteData(PyObject* py_tuple,int index, SeqMat<int>* matrix);
 void WriteData(PyObject* py_tuple,int index, SeqVec<int>* vector);
+void WriteData(PyObject* py_tuple,int index, SeqMat<bool>* matrix);
+void WriteData(PyObject* py_tuple,int index, SeqVec<bool>* vector);
 void WriteData(PyObject* py_tuple,int index, BamgGeom* bamggeom);
 void WriteData(PyObject* py_tuple,int index, BamgMesh* bamgmesh);
 void WriteData(PyObject* py_tuple,int index, RiftStruct* riftstruct);
 
-void FetchData(int** pvector,int* pM,PyObject* py_ref);
-void FetchData(double** pvector,int* pM,PyObject* py_ref);
 void FetchData(double** pmatrix,int* pM,int *pN,PyObject* py_array);
 void FetchData(int** pmatrix,int* pM,int *pN,PyObject* py_matrix);
+void FetchData(bool** pmatrix,int* pM,int *pN,PyObject* py_matrix);
+void FetchData(double** pvector,int* pM,PyObject* py_ref);
+void FetchData(int** pvector,int* pM,PyObject* py_ref);
+void FetchData(bool** pvector,int* pM,PyObject* py_ref);
 void FetchData(char** pstring,PyObject* py_unicode);
 void FetchData(double* pscalar,PyObject* py_float);
@@ -51,4 +55,5 @@
 PyObject* PyArrayFromCopiedData(int dimi,int dimj,double* data);
 PyObject* PyArrayFromCopiedData(int dimi,int dimj,int* data);
+PyObject* PyArrayFromCopiedData(int dimi,int dimj,bool* data);
 
 #endif	/* _IO_H_ */
