Index: issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 3127)
+++ issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 3128)
@@ -1,33 +1,15 @@
-/*!\file InterpFromMeshToMesh2d.c
- * \brief: data interpolation from a list of (x,y,values) into mesh grids
- 
-	InterpFromMeshToMesh2d.c
-
-	usage:
-	data_mesh=InterpFromMeshToMesh2d(index,x,y,data,x_mesh,y_mesh);
-	
-	where:
-
-		input:
-		x,y: coordinates of matrix data
-		data - matrix holding the data to be interpolated onto the mesh.
-		x_mesh,y_mesh: coordinates of the mesh grids onto which we interpolate.
-		
-		output: 
-		data_mesh:  vector of mesh interpolated data.
-
-*/
-	
+/*\file InterpFromMeshToMesh2d.c
+ *\brief: bamg module.
+ */
 #include "./InterpFromMeshToMesh2d.h"
 
-void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) {
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
 
 	/*input: */
-	double* index_data=NULL;
-	int     index_data_rows;
+	double* index=NULL;
 
 	double* x_data=NULL;
 	int     x_data_rows;
-	
+
 	double* y_data=NULL;
 	int     y_data_rows;
@@ -37,9 +19,9 @@
 	int     data_cols;
 
-	double* x_prime=NULL;
-	double* y_prime=NULL;
-	
-	int     x_prime_rows;
-	int     y_prime_rows;
+	double* x_interp=NULL;
+	double* y_interp=NULL;
+
+	int     x_interp_rows;
+	int     y_interp_rows;
 
 	double default_value;
@@ -48,8 +30,9 @@
 	int nods_data;
 	int nels_data;
-	int nods_prime;
+	int nods_interp;
+	int verbose=0;
 
 	/* output: */
-	Vec  data_prime=NULL;
+	double* data_interp=NULL;
 
 	/*Boot module: */
@@ -60,30 +43,32 @@
 
 	/*Input datasets: */
-	FetchData(&index_data,&index_data_rows,NULL,INDEXHANDLE);
+	if (verbose) printf("Fetching inputs\n");
+	FetchData(&index,&nels_data,NULL,INDEXHANDLE);
 	FetchData(&x_data,&x_data_rows,NULL,XHANDLE);
 	FetchData(&y_data,&y_data_rows,NULL,YHANDLE);
 	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
-	FetchData(&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE);
-	FetchData(&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE);
+	FetchData(&x_interp,&x_interp_rows,NULL,XINTERPHANDLE);
+	FetchData(&y_interp,&y_interp_rows,NULL,YINTERPHANDLE);
 	FetchData(&default_value,DEFAULTHANDLE);
 
 	/*some checks*/
+	if (verbose) printf("Checking inputs\n");
 	if (x_data_rows!=y_data_rows){
 		throw ErrorException(__FUNCT__,"vectors x and y should have the same length!");
 	}
-	if (x_prime_rows!=y_prime_rows){
-		throw ErrorException(__FUNCT__,"vectors x_prime and y_prime should have the same length!");
+	if (x_interp_rows!=y_interp_rows){
+		throw ErrorException(__FUNCT__,"vectors x_interp and y_interp should have the same length!");
 	}
-	
+
 	/*get number of elements and number of nodes in the data*/
-	nels_data=index_data_rows;
 	nods_data=x_data_rows;
-	nods_prime=x_prime_rows;
+	nods_interp=x_interp_rows;
 
 	/* Run core computations: */
-	InterpFromMeshToMesh2dx(&data_prime,index_data,x_data,y_data,nods_data,nels_data,data,data_rows,x_prime,y_prime,nods_prime,default_value);
+	if (verbose) printf("Call core\n");
+	InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,nods_data,nels_data,data,data_rows,data_cols,x_interp,y_interp,nods_interp,default_value);
 
 	/*Write data: */
-	WriteData(DATAPRIME,data_prime);
+	WriteData(DATAINTERP,data_interp,nods_interp,data_cols);
 
 	/*end module: */
@@ -93,5 +78,5 @@
 void InterpFromMeshToMesh2dUsage(void)
 {
-	_printf_("INTERPFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point\n");
+	_printf_("INTERFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point\n");
 	_printf_("\n");
 	_printf_("   This function is a multi-threaded mex file that interpolates a field\n");
@@ -99,12 +84,12 @@
 	_printf_("\n");
 	_printf_("   Usage:\n");
-	_printf_("      data_prime=InterpFromMeshToMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n");
+	_printf_("      data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,default_value);\n");
 	_printf_("\n");
 	_printf_("      index: index of the mesh where data is defined\n");
 	_printf_("      x,y: coordinates of the nodes where data is defined\n");
-	_printf_("      data: matrix holding the data to be interpolated onto the mesh.\n");
-	_printf_("      x_prime,y_prime: coordinates of the points onto which we interpolate.\n");
+	_printf_("      data: matrix holding the data to be interpolated onto the mesh. (one column per field)\n");
+	_printf_("      x_interp,y_interp: coordinates of the points onto which we interpolate.\n");
 	_printf_("      default_value: default value if no data is found (holes).\n");
-	_printf_("      data_prime: vector of mesh interpolated data.\n");
+	_printf_("      data_interp: vector of mesh interpolated data.\n");
 	_printf_("\n");
 	_printf_("   Example:\n");
Index: issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
===================================================================
--- issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 3127)
+++ issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 3128)
@@ -3,6 +3,6 @@
  */
 
-#ifndef _INTERPFROMMESH2D_H
-#define _INTERPFROMMESH2D_H
+#ifndef _INTERPFROMMESHTOMESH2d_H
+#define _INTERPFROMMESHTOMESH2d_H
 
 /* local prototypes: */
@@ -14,7 +14,4 @@
 #define __FUNCT__  "InterpFromMeshToMesh2d"
 
-#undef CLEANUP
-#define CLEANUP InterpFromMeshToMesh2dLocalCleanup();
-
 
 /* serial input macros: */
@@ -23,10 +20,10 @@
 #define YHANDLE prhs[2]
 #define DATAHANDLE prhs[3]
-#define XPRIMEHANDLE prhs[4]
-#define YPRIMEHANDLE prhs[5]
+#define XINTERPHANDLE prhs[4]
+#define YINTERPHANDLE prhs[5]
 #define DEFAULTHANDLE prhs[6]
 
 /* serial output macros: */
-#define DATAPRIME (mxArray**)&plhs[0]
+#define DATAINTERP (mxArray**)&plhs[0]
 
 /* serial arg counts: */
@@ -36,3 +33,3 @@
 #define NRHS  7
 
-#endif  /* _INTERPFROMMESHTOMESH2D_H */
+#endif
Index: issm/trunk/src/mex/Makefile.am
===================================================================
--- issm/trunk/src/mex/Makefile.am	(revision 3127)
+++ issm/trunk/src/mex/Makefile.am	(revision 3128)
@@ -85,6 +85,5 @@
 
 Bamg_SOURCES = Bamg/Bamg.cpp\
-			   Bamg/Bamg.h
-
+					Bamg/Bamg.h
 
 ComputePressure_SOURCES = ComputePressure/ComputePressure.cpp\
