Index: /issm/trunk/src/mex/InterpFromGridToGrid/InterpFromGrid.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromGridToGrid/InterpFromGrid.cpp	(revision 2288)
+++ /issm/trunk/src/mex/InterpFromGridToGrid/InterpFromGrid.cpp	(revision 2288)
@@ -0,0 +1,83 @@
+/*!\file InterpFromGrid.c
+ * \brief: data interpolation from a list of (x,y,values) into mesh grids
+ 
+	InterpFromGrid.c
+
+	usage:
+	data_mesh=InterpFromGrid(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.
+
+*/
+	
+#include "./InterpFromGrid.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) {
+
+	int i,j;
+
+	/*input: */
+	double* x=NULL;
+	double* y=NULL;
+
+	int     x_rows;
+	int     y_rows;
+
+	double* data=NULL; 
+	int     data_rows,data_cols;
+
+	double* x_mesh=NULL;
+	double* y_mesh=NULL;
+	
+	int     x_mesh_rows;
+	int     y_mesh_rows;
+
+	double default_value;
+
+	/* output: */
+	Vec  data_mesh=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromGridUsage);
+
+	/*Input datasets: */
+	FetchData((void**)&x,&x_rows,NULL,XHANDLE,"Matrix","Mat");
+	FetchData((void**)&y,&y_rows,NULL,YHANDLE,"Matrix","Mat");
+	FetchData((void**)&data,&data_rows,&data_cols,DATAHANDLE,"Matrix","Mat");
+	FetchData((void**)&x_mesh,&x_mesh_rows,NULL,XMESHHANDLE,"Matrix","Mat");
+	FetchData((void**)&y_mesh,&y_mesh_rows,NULL,YMESHHANDLE,"Matrix","Mat");
+	FetchData((void**)&default_value,NULL,NULL,DEFAULTHANDLE,"Scalar",NULL);
+
+	/* Run core computations: */
+	InterpFromGridx( &data_mesh, x, x_rows,  y, y_rows, data, data_rows,data_cols, x_mesh, y_mesh, x_mesh_rows,default_value);
+
+	/*Write data: */
+	WriteData(DATAMESH,data_mesh,0,0,"Vector",NULL);
+
+	/*end module: */
+	MODULEEND();
+}
+
+void InterpFromGridUsage(void)
+{
+	_printf_("   usage:\n");
+	_printf_("   data_mesh=InterpFromGrid(x,y,data,x_mesh,y_mesh,defult_value);\n\n");
+	_printf_("   where:\n");
+	_printf_("      x,y: coordinates of matrix data\n");
+	_printf_("      data - matrix holding the data to be interpolated onto the mesh.\n");
+	_printf_("      x_mesh,y_mesh: coordinates of the mesh grids onto which we interpolate.\n");
+	_printf_("      default_value: default value if no interpolation is found.\n");
+	_printf_("      data_mesh:  vector of mesh interpolated data.\n");
+	_printf_("\n");
+}
Index: /issm/trunk/src/mex/InterpFromGridToGrid/InterpFromGrid.h
===================================================================
--- /issm/trunk/src/mex/InterpFromGridToGrid/InterpFromGrid.h	(revision 2288)
+++ /issm/trunk/src/mex/InterpFromGridToGrid/InterpFromGrid.h	(revision 2288)
@@ -0,0 +1,37 @@
+/*!\file InterpFromGrid.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _InterpFromGrid_H
+#define _InterpFromGrid_H
+
+/* local prototypes: */
+void InterpFromGridUsage(void);
+
+#include "../../c/issm.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromGrid"
+
+#undef CLEANUP
+#define CLEANUP InterpFromGridLocalCleanup();
+
+
+/* serial input macros: */
+#define XHANDLE prhs[0]
+#define YHANDLE prhs[1]
+#define DATAHANDLE prhs[2]
+#define XMESHHANDLE prhs[3]
+#define YMESHHANDLE prhs[4]
+#define DEFAULTHANDLE prhs[5]
+
+/* serial output macros: */
+#define DATAMESH (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  6
+
+#endif  /* _INTERPFROMGRId_H */
Index: /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMesh2d.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMesh2d.cpp	(revision 2288)
+++ /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMesh2d.cpp	(revision 2288)
@@ -0,0 +1,105 @@
+/*!\file InterpFromMesh2d.c
+ * \brief: data interpolation from a list of (x,y,values) into mesh grids
+ 
+	InterpFromMesh2d.c
+
+	usage:
+	data_mesh=InterpFromMesh2d(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.
+
+*/
+	
+#include "./InterpFromMesh2d.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) {
+
+	/*input: */
+	double* index_data=NULL;
+	int     index_data_rows;
+
+	double* x_data=NULL;
+	int     x_data_rows;
+	
+	double* y_data=NULL;
+	int     y_data_rows;
+
+	double* data=NULL; 
+	int     data_rows;
+	int     data_cols;
+
+	double* x_prime=NULL;
+	double* y_prime=NULL;
+	
+	int     x_prime_rows;
+	int     y_prime_rows;
+
+	double default_value;
+
+	/*Intermediary*/
+	int nods_data;
+	int nels_data;
+	int nods_prime;
+
+	/* output: */
+	Vec  data_prime=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromMesh2dUsage);
+
+	/*Input datasets: */
+	FetchData((void**)&index_data,&index_data_rows,NULL,INDEXHANDLE,"Matrix","Mat");
+	FetchData((void**)&x_data,&x_data_rows,NULL,XHANDLE,"Matrix","Mat");
+	FetchData((void**)&y_data,&y_data_rows,NULL,YHANDLE,"Matrix","Mat");
+	FetchData((void**)&data,&data_rows,&data_cols,DATAHANDLE,"Matrix","Mat");
+	FetchData((void**)&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE,"Matrix","Mat");
+	FetchData((void**)&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE,"Matrix","Mat");
+	FetchData((void**)&default_value,NULL,NULL,DEFAULTHANDLE,"Scalar",NULL);
+
+	/*some checks*/
+	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!");
+	}
+	
+	/*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;
+
+	/* Run core computations: */
+	InterpFromMesh2dx(&data_prime,index_data,x_data,y_data,nods_data,nels_data,data,data_rows,x_prime,y_prime,nods_prime,default_value);
+
+	/*Write data: */
+	WriteData(DATAPRIME,data_prime,0,0,"Vector",NULL);
+
+	/*end module: */
+	MODULEEND();
+}
+
+void InterpFromMesh2dUsage(void)
+{
+	_printf_("   usage:\n");
+	_printf_("      data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n\n");
+	_printf_("   where:\n");
+	_printf_("      x,y: coordinates of the nodes where data is defined\n");
+	_printf_("      index: index of the mesh where data is defined\n");
+	_printf_("      data - vector holding the data to be interpolated onto the points.\n");
+	_printf_("      x_prime,y_prime: coordinates of the mesh grids onto which we interpolate.\n");
+	_printf_("      default_value - default value if no interpolation is found.\n");
+	_printf_("      data_prime:  vector of prime interpolated data.\n");
+	_printf_("\n");
+}
Index: /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMesh2d.h
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMesh2d.h	(revision 2288)
+++ /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMesh2d.h	(revision 2288)
@@ -0,0 +1,38 @@
+/*!\file InterpFromMesh2d.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _INTERPFROMMESH2D_H
+#define _INTERPFROMMESH2D_H
+
+/* local prototypes: */
+void InterpFromMesh2dUsage(void);
+
+#include "../../c/issm.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMesh2d"
+
+#undef CLEANUP
+#define CLEANUP InterpFromMesh2dLocalCleanup();
+
+
+/* serial input macros: */
+#define INDEXHANDLE prhs[0]
+#define XHANDLE prhs[1]
+#define YHANDLE prhs[2]
+#define DATAHANDLE prhs[3]
+#define XPRIMEHANDLE prhs[4]
+#define YPRIMEHANDLE prhs[5]
+#define DEFAULTHANDLE prhs[6]
+
+/* serial output macros: */
+#define DATAPRIME (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  7
+
+#endif  /* _INTERPFROMMESH2D_H */
Index: /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMesh3d.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMesh3d.cpp	(revision 2288)
+++ /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMesh3d.cpp	(revision 2288)
@@ -0,0 +1,110 @@
+/*!\file InterpFromMesh3d.c
+ * \brief: data interpolation from a list of (x,y,values) into mesh grids
+ 
+	InterpFromMesh3d.c
+
+	usage:
+	data_mesh=InterpFromMesh3d(index,x,y,z,data,x_mesh,y_mesh,z_mesh);
+	
+	where:
+
+		input:
+		x,y,z: coordinates of matrix data
+		data - matrix holding the data to be interpolated onto the mesh.
+		x_mesh,y_mesh,z_mesh: coordinates of the mesh grids onto which we interpolate.
+		
+		output: 
+		data_mesh:  vector of mesh interpolated data.
+
+*/
+	
+#include "./InterpFromMesh3d.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) {
+
+	/*input: */
+	double* index_data=NULL;
+	int     index_data_rows;
+
+	double* x_data=NULL;
+	double* y_data=NULL;
+	double* z_data=NULL;
+
+	int     x_data_rows;
+	int     y_data_rows;
+	int     z_data_rows;
+
+	double* data=NULL; 
+	int     data_rows;
+	int     data_cols;
+
+	double* x_prime=NULL;
+	double* y_prime=NULL;
+	double* z_prime=NULL;
+	
+	int     x_prime_rows;
+	int     y_prime_rows;
+	int     z_prime_rows;
+
+	double  default_value;
+
+	/*Intermediary*/
+	int nods_data;
+	int nels_data;
+	int nods_prime;
+
+	/* output: */
+	Vec  data_prime=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromMesh3dUsage);
+
+	/*Input datasets: */
+	FetchData((void**)&index_data,&index_data_rows,NULL,INDEXHANDLE,"Matrix","Mat");
+	FetchData((void**)&x_data,&x_data_rows,NULL,XHANDLE,"Matrix","Mat");
+	FetchData((void**)&y_data,&y_data_rows,NULL,YHANDLE,"Matrix","Mat");
+	FetchData((void**)&z_data,&z_data_rows,NULL,ZHANDLE,"Matrix","Mat");
+	FetchData((void**)&data,&data_rows,&data_cols,DATAHANDLE,"Matrix","Mat");
+	FetchData((void**)&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE,"Matrix","Mat");
+	FetchData((void**)&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE,"Matrix","Mat");
+	FetchData((void**)&z_prime,&z_prime_rows,NULL,ZPRIMEHANDLE,"Matrix","Mat");
+	FetchData((void**)&default_value,NULL,NULL,DEFAULTHANDLE,"Scalar",NULL);
+
+	/*some checks*/
+	if (x_data_rows!=y_data_rows || x_data_rows!=z_data_rows){
+		throw ErrorException(__FUNCT__,"vectors x, y and z should have the same length!");
+	}
+	if (x_prime_rows!=y_prime_rows || x_prime_rows!=z_prime_rows){
+		throw ErrorException(__FUNCT__,"vectors x_prime, y_prime and z_prime 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;
+
+	/* Run core computations: */
+	InterpFromMesh3dx(&data_prime,index_data,x_data,y_data,z_data,nods_data,nels_data,data,data_rows,x_prime,y_prime,z_prime,nods_prime,default_value);
+
+	/*Write data: */
+	WriteData(DATAPRIME,data_prime,0,0,"Vector",NULL);
+
+	/*end module: */
+	MODULEEND();
+}
+
+void InterpFromMesh3dUsage(void)
+{
+	_printf_("   usage:\n");
+	_printf_("      data_prime=InterpFromMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);\n\n");
+	_printf_("   where:\n");
+	_printf_("      x,y,z: coordinates of the nodes where data is defined\n");
+	_printf_("      index: index of the mesh where data is defined\n");
+	_printf_("      data - vector holding the data to be interpolated onto the points.\n");
+	_printf_("      x_prime,y_prime,z_prime: coordinates of the mesh grids onto which we interpolate.\n");
+	_printf_("      default_value - default value if no interpolation is found.\n");
+	_printf_("      data_prime:  vector of prime interpolated data.\n");
+	_printf_("\n");
+}
Index: /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMesh3d.h
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMesh3d.h	(revision 2288)
+++ /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMesh3d.h	(revision 2288)
@@ -0,0 +1,40 @@
+/*!\file InterpFromMesh3d.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _INTERPFROMMESH3D_H
+#define _INTERPFROMMESH3D_H
+
+/* local prototypes: */
+void InterpFromMesh3dUsage(void);
+
+#include "../../c/issm.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMesh3d"
+
+#undef CLEANUP
+#define CLEANUP InterpFromMesh3dLocalCleanup();
+
+
+/* serial input macros: */
+#define INDEXHANDLE prhs[0]
+#define XHANDLE prhs[1]
+#define YHANDLE prhs[2]
+#define ZHANDLE prhs[3]
+#define DATAHANDLE prhs[4]
+#define XPRIMEHANDLE prhs[5]
+#define YPRIMEHANDLE prhs[6]
+#define ZPRIMEHANDLE prhs[7]
+#define DEFAULTHANDLE prhs[8]
+
+/* serial output macros: */
+#define DATAPRIME (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  9
+
+#endif  /* _INTERPFROMMESH3D_H */
Index: /issm/trunk/src/mex/Makefile.am
===================================================================
--- /issm/trunk/src/mex/Makefile.am	(revision 2287)
+++ /issm/trunk/src/mex/Makefile.am	(revision 2288)
@@ -19,7 +19,8 @@
 				GriddataMeshToGrid\
 				HoleFiller \
-				InterpFromGrid \
-				InterpFromMesh2d \
-				InterpFromMesh3d \
+				InterpFromGridToMesh \
+				InterpFromMeshToMesh2d \
+				InterpFromMeshToMesh3d \
+				InterpFromMeshToGrid \
 				MassFlux\
 				Mergesolutionfromftog\
@@ -126,12 +127,15 @@
 			  HoleFiller/HoleFiller.h
 
-InterpFromGrid_SOURCES = InterpFromGrid/InterpFromGrid.cpp\
-			  InterpFromGrid/InterpFromGrid.h
-
-InterpFromMesh2d_SOURCES = InterpFromMesh2d/InterpFromMesh2d.cpp\
-							InterpFromMesh2d/InterpFromMesh2d.h
-
-InterpFromMesh3d_SOURCES = InterpFromMesh3d/InterpFromMesh3d.cpp\
-									InterpFromMesh3d/InterpFromMesh3d.h
+InterpFromGridToMesh_SOURCES = InterpFromGridToMesh/InterpFromGridToMesh.cpp\
+			  InterpFromGridToMesh/InterpFromGridToMesh.h
+
+InterpFromMeshToMesh2d_SOURCES = InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp\
+							InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
+
+InterpFromMeshToMesh3d_SOURCES = InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp\
+									InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h
+
+InterpFromMeshToGrid_SOURCES = InterpFromMeshToGrid/InterpFromMeshToGrid.cpp\
+									InterpFromMeshToGrid/InterpFromMeshToGrid.h
 
 Mergesolutionfromftog_SOURCES = Mergesolutionfromftog/Mergesolutionfromftog.cpp\
