Index: /issm/trunk-jpl/src/py/modules/Test/Makefile
===================================================================
--- /issm/trunk-jpl/src/py/modules/Test/Makefile	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/Test/Makefile	(revision 11975)
@@ -0,0 +1,18 @@
+all: Test2.so
+
+Write.o: Write.cpp 
+	g++  -I$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/include/python3.2  \
+	-I$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy \
+	-DNPY_NO_DEPRECATED_API -c -o Write.o Write.cpp  	
+
+Test2.o: Test2.cpp 
+	g++  -I$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/include/python3.2  \
+	-I$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy \
+	-DNPY_NO_DEPRECATED_API  -c -o Test2.o Test2.cpp 
+	
+
+Test2.so: Test2.o Write.o
+	g++  -dynamiclib -o Test2.so  Write.o Test2.o  -L$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/lib  -lpython3.2    
+
+clean:
+	rm Test2.so Test2.o Write.o
Index: /issm/trunk-jpl/src/py/modules/Test/Makefile.bak
===================================================================
--- /issm/trunk-jpl/src/py/modules/Test/Makefile.bak	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/Test/Makefile.bak	(revision 11975)
@@ -0,0 +1,11 @@
+all: Test2.so
+
+
+Test2.o: Test2.cpp 
+	g++  -I$(ISSM_TIER)/externalpackages/boost/install/include  -I$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/include/python3.2 -c -o Test2.o Test2.cpp
+
+Test2.so: Test2.o
+	g++  -dynamiclib -o Test2.so  Test2.o -L$(ISSM_TIER)/externalpackages/boost/install/lib -lboost_python -L$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/lib -L$(ISSM_TIER)/externalpackages/python/install/Python.framework/Versions/3.2/lib/python3.2/config -lpython3.2    
+
+clean:
+	rm Test2.so Test2.o
Index: /issm/trunk-jpl/src/py/modules/Test/Test2.cpp
===================================================================
--- /issm/trunk-jpl/src/py/modules/Test/Test2.cpp	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/Test/Test2.cpp	(revision 11975)
@@ -0,0 +1,151 @@
+
+#include <Python.h>
+#define PY_ARRAY_UNIQUE_SYMBOL myname
+#include "arrayobject.h"
+
+void Write(PyObject* tuple, int index);
+
+static PyObject* test_func(PyObject* self,PyObject* args){  //{{{
+	
+	/*inputs: */
+	char* filename=NULL;
+	double area;
+	int   order;
+
+	/*outputs: */
+	npy_intp dim=10;
+	PyObject* array=NULL;
+	double* buffer=NULL;
+
+	/*Recover inputs: */
+	if (!PyArg_ParseTuple(args, "sdi", &filename,&area,&order)) return NULL;
+	
+	/*Build array: */
+	buffer=(double*)calloc(dim,sizeof(double));
+	array=PyArray_SimpleNewFromData(1,&dim,NPY_DOUBLE,buffer);
+
+	
+	/*return: */
+	return Py_BuildValue("Os", array,filename);
+	
+}
+//}}}
+static PyObject* test2_func(PyObject* self,PyObject* args){  //{{{
+	
+	/*inputs: */
+	PyObject* string=NULL;
+	PyObject* string_bytes;
+	const char* filename=NULL;
+
+	PyObject* value;
+	double area;
+
+	PyObject* other;
+	int   order;
+
+	/*outputs: */
+	npy_intp dim=10;
+	PyObject* array=NULL;
+	double* buffer=NULL;
+	PyObject* tuple=NULL;
+
+	
+	if (!(string=PyTuple_GetItem(args, 0))) return NULL;
+	PyUnicode_FSConverter(string,&string_bytes);
+	filename=PyBytes_AS_STRING(string_bytes);
+	
+	
+	if (!(value=PyTuple_GetItem(args, 1))) return NULL;
+	area=PyFloat_AsDouble(value);
+	
+	if (!(other=PyTuple_GetItem(args, 2))) return NULL;
+	order=(int)PyLong_AsLong(other);
+
+	printf("%s %g %i\n",filename,area,order);
+
+
+
+	tuple = PyTuple_New(2);
+	if (!tuple) return NULL;
+	
+	/*Build array: */
+	buffer=(double*)calloc(dim,sizeof(double));
+	array=PyArray_SimpleNewFromData(1,&dim,NPY_DOUBLE,buffer);
+
+
+	PyTuple_SetItem(tuple, 0, PyUnicode_FromString(filename));
+	PyTuple_SetItem(tuple, 1, array);
+
+	
+	/*return: */
+	return tuple;
+	
+}
+//}}}
+static PyObject* test3_func(PyObject* self,PyObject* args){  //{{{
+	
+	/*inputs: */
+	PyObject* string=NULL;
+	PyObject* string_bytes;
+	const char* filename=NULL;
+
+	PyObject* value;
+	double area;
+
+	PyObject* other;
+	int   order;
+
+	/*outputs: */
+	PyObject* tuple=NULL;
+
+	
+	if (!(string=PyTuple_GetItem(args, 0))) return NULL;
+	PyUnicode_FSConverter(string,&string_bytes);
+	filename=PyBytes_AS_STRING(string_bytes);
+	
+	
+	if (!(value=PyTuple_GetItem(args, 1))) return NULL;
+	area=PyFloat_AsDouble(value);
+	
+	if (!(other=PyTuple_GetItem(args, 2))) return NULL;
+	order=(int)PyLong_AsLong(other);
+
+	printf("%s %g %i\n",filename,area,order);
+
+
+	tuple = PyTuple_New(2);
+	if (!tuple) return NULL;
+	
+	
+	PyTuple_SetItem(tuple, 0, PyUnicode_FromString(filename));
+	Write(tuple,1);
+
+	
+	/*return: */
+	return tuple;
+	
+}
+//}}}
+/*Python wrapping: {{{*/
+static PyMethodDef Test2_funcs[] = {
+	{"test", (PyCFunction)test_func, METH_VARARGS, ""},
+	{"test2", (PyCFunction)test2_func, METH_VARARGS, ""},
+	{"test3", (PyCFunction)test3_func, METH_VARARGS, ""},
+	{NULL,NULL,0,NULL}
+};
+
+static struct PyModuleDef Test2module= {
+	PyModuleDef_HEAD_INIT,
+	"Test2",   /* name of module */
+	NULL, /* module documentation, may be NULL */
+	-1,       /* size of per-interpreter state of the module,
+				 or -1 if the module keeps state in global variables. */
+	Test2_funcs
+};
+
+PyMODINIT_FUNC PyInit_Test2(void){
+
+	import_array();
+	return PyModule_Create(&Test2module);
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/py/modules/Test/Write.cpp
===================================================================
--- /issm/trunk-jpl/src/py/modules/Test/Write.cpp	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/Test/Write.cpp	(revision 11975)
@@ -0,0 +1,19 @@
+
+#include "Python.h"
+#define PY_ARRAY_UNIQUE_SYMBOL myname
+#define NO_IMPORT
+#include "arrayobject.h"
+
+void Write(PyObject* tuple, int index){
+
+	npy_intp dim=10;
+	PyObject* array=NULL;
+	double* buffer=NULL;
+
+	/*Build array: */
+	buffer=(double*)calloc(dim,sizeof(double));
+	array=PyArray_SimpleNewFromData(1,&dim,NPY_DOUBLE,buffer);
+
+	PyTuple_SetItem(tuple, index, array);
+	
+}
Index: /issm/trunk-jpl/src/py/modules/Test/test.py
===================================================================
--- /issm/trunk-jpl/src/py/modules/Test/test.py	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/Test/test.py	(revision 11975)
@@ -0,0 +1,7 @@
+from Test2 import *
+from numpy import *
+
+a=array([1.0,2.0]);
+
+[a,b]=test3('../Exp/Square.exp',10.0,1);
+print(b)
Index: /issm/trunk-jpl/src/py/modules/TriMesh2/Makefile
===================================================================
--- /issm/trunk-jpl/src/py/modules/TriMesh2/Makefile	(revision 11974)
+++ /issm/trunk-jpl/src/py/modules/TriMesh2/Makefile	(revision 11975)
@@ -1,7 +1,7 @@
-all: TriMesh.so
+all: Mesh.so
 
 
-TriMesh.o: TriMesh.cpp 
-	g++  -DNPY_NO_DEPRECATED_API -c -o TriMesh.o TriMesh.cpp  \
+Mesh.o: Mesh.cpp 
+	g++  -DNPY_NO_DEPRECATED_API -c -o Mesh.o Mesh.cpp  \
 	-I$(ISSM_TIER)/externalpackages/boost/install/include     \
 	-I$(ISSM_TIER)/externalpackages/python/install/include \
@@ -9,7 +9,7 @@
 	
 
-TriMesh.so: TriMesh.o
-	g++  -dynamiclib -o TriMesh.so  TriMesh.o -L$(ISSM_TIER)/externalpackages/boost/install/lib -lboost_python -L$(ISSM_TIER)/externalpackages/python/install/lib -lpython3.2    
+Mesh.so: Mesh.o
+	g++  -dynamiclib -o Mesh.so  Mesh.o -L$(ISSM_TIER)/externalpackages/boost/install/lib -lboost_python -L$(ISSM_TIER)/externalpackages/python/install/lib -lpython3.2    
 
 clean:
-	rm TriMesh.so TriMesh.o
+	rm Mesh.so Mesh.o
Index: /issm/trunk-jpl/src/py/modules/TriMesh2/Mesh.cpp
===================================================================
--- /issm/trunk-jpl/src/py/modules/TriMesh2/Mesh.cpp	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/TriMesh2/Mesh.cpp	(revision 11975)
@@ -0,0 +1,33 @@
+#include <stdio.h>
+using namespace std; 
+
+#include <boost/python.hpp>
+#include <boost/python/module.hpp>
+#include <boost/python/def.hpp>
+#include <numpy/arrayobject.h>
+
+using namespace boost::python;
+
+PyObject* Mesh(boost::python::numeric::array dummy){
+
+
+	PyArrayObject* array= NULL;
+	//double* serial_mat=(double*)malloc(10*sizeof(double));
+	npy_intp dim=10;
+
+	        
+	//array=PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE,serial_mat);
+	printf("ok1\n");
+	array=(PyArrayObject*)PyArray_SimpleNew(1, &dim, NPY_DOUBLE);
+	printf("ok2\n");
+	printf("ok3\n");
+	printf("ok4\n");
+	printf("ok5\n");
+	return (PyObject*)array;
+}
+
+
+BOOST_PYTHON_MODULE(Mesh){
+	boost::python::numeric::array::set_module_and_type( "numpy", "ndarray");
+	def("Mesh",Mesh);
+}
Index: /issm/trunk-jpl/src/py/modules/TriMesh2/TriMesh.cpp.bak3
===================================================================
--- /issm/trunk-jpl/src/py/modules/TriMesh2/TriMesh.cpp.bak3	(revision 11975)
+++ /issm/trunk-jpl/src/py/modules/TriMesh2/TriMesh.cpp.bak3	(revision 11975)
@@ -0,0 +1,41 @@
+#include <stdio.h>
+using namespace std; 
+
+#include <boost/python.hpp>
+#include <boost/python/module.hpp>
+#include <boost/python/def.hpp>
+#include <numpy/arrayobject.h>
+
+using namespace boost::python;
+
+void mesh(boost::python::numeric::array array){
+//void mesh(boost::python::object array){
+
+	int i;
+	double* b=NULL;
+	int nd,M,N;
+	int* dims=NULL;
+	PyArrayObject* a = (PyArrayObject*)array.ptr();
+	b=(double*)PyArray_DATA(a);
+	nd=PyArray_NDIM(a);
+	dims=(int*)PyArray_DIMS(a); 
+	M=dims[0];
+
+	printf("nd: %i M: %i\n",nd,M);
+	for(i=0;i<M;i++){
+		printf("%g\n",b[i]);
+	}
+
+	
+}
+
+
+#include <boost/python/module.hpp>
+#include <boost/python/def.hpp>
+using namespace boost::python;
+
+BOOST_PYTHON_MODULE(TriMesh){
+	boost::python::numeric::array::set_module_and_type( "numpy", "ndarray");
+	//boost::python::numeric::array::set_module_and_type( "numpy", "array");
+	def("mesh",mesh);
+}
Index: /issm/trunk-jpl/src/py/modules/TriMesh2/test.py
===================================================================
--- /issm/trunk-jpl/src/py/modules/TriMesh2/test.py	(revision 11974)
+++ /issm/trunk-jpl/src/py/modules/TriMesh2/test.py	(revision 11975)
@@ -1,5 +1,6 @@
-from TriMesh import *
+from Mesh import *
 from numpy import *
+
 a=array([1.0,2.0]);
 
-mesh(a)
+b=Mesh(a)
