Index: /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 2291)
+++ /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 2291)
@@ -0,0 +1,74 @@
+/*\file InterpFromMeshToGrid.c
+ *\brief: compute diff between observed and modeled velocity
+ */
+
+#include "./InterpFromMeshToGrid.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
+
+	/*input datasets: */
+	double* index=NULL;
+	int     nel;
+	double* x=NULL;
+	int     nods;
+	double* y=NULL;
+	double* meshdata=NULL;
+	double  cornereast;
+	double  cornernorth;
+	double  xposting;
+	double  yposting;
+	int     nlines,ncols;
+	double  default_value;
+
+	/* output datasets: */
+	double* griddata=NULL;
+	double* x_m=NULL;
+	double* y_m=NULL;
+
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromMeshToGridUsage);
+
+	/*Input datasets: */
+	FetchData((void**)&index,&nel,NULL,INDEX,"Matrix","Mat");
+	FetchData((void**)&x,&nods,NULL,X,"Matrix","Mat");
+	FetchData((void**)&y,NULL,NULL,Y,"Matrix","Mat");
+	FetchData((void**)&meshdata,NULL,NULL,MESHDATA,"Matrix","Mat");
+	FetchData((void**)&cornereast,NULL,NULL,CORNEREAST,"Scalar",NULL);
+	FetchData((void**)&cornernorth,NULL,NULL,CORNERNORTH,"Scalar",NULL);
+	FetchData((void**)&xposting,NULL,NULL,XPOSTING,"Scalar",NULL);
+	FetchData((void**)&yposting,NULL,NULL,YPOSTING,"Scalar",NULL);
+	FetchData((void**)&nlines,NULL,NULL,NLINES,"Integer",NULL);
+	FetchData((void**)&ncols,NULL,NULL,NCOLS,"Integer",NULL);
+	FetchData((void**)&default_value,NULL,NULL,DEFAULTVALUE,"Scalar",NULL);
+
+	/*Call core of computation: */
+	InterpFromMeshToGridx(&x_m,&y_m,&griddata,index,x,y,nods,nel,meshdata,cornereast,cornernorth,xposting,yposting,nlines,ncols,default_value);
+
+	/*Write results: */
+	WriteData(XM,x_m,ncols+1,NULL,"Vector","Vec");
+	WriteData(YM,y_m,nlines+1,NULL,"Vector","Vec");
+	WriteData(GRIDDATA,griddata,nlines,ncols,"Matrix","Mat");
+
+	/*Free ressources: */
+	//let matlab do this.
+	
+	/*end module: */
+	MODULEEND();
+}
+
+void InterpFromMeshToGridUsage(void)
+{
+	_printf_("   usage:\n");
+	_printf_("   [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,cornereast,cornernorth,xposting,yposting,nlines,ncols,default_value)\n");
+	_printf_("\n");
+	_printf_("   where:\n");
+	_printf_("\n");
+	_printf_("   index,x,y: delaunay triangulation defining the mesh.\n");
+	_printf_("   meshdata: vertex values of data to be interpolated.\n");
+	_printf_("   cornereast,cornernorth,posting,nlines,ncols: parameters that define the grid\n");
+	_printf_("   default_value: value of points located out of the mesh.\n");
+}
Index: /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 2291)
+++ /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 2291)
@@ -0,0 +1,42 @@
+
+/*
+	InterpFromMeshToGrid.h
+*/
+
+
+#ifndef _INTERPFROMMESHTOGRID_H
+#define _INTERPFROMMESHTOGRID_H
+
+/* local prototypes: */
+void InterpFromMeshToGridUsage(void);
+
+#include "../../c/issm.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMeshToGrid"
+
+/* serial input macros: */
+#define INDEX (mxArray*)prhs[0]
+#define X (mxArray*)prhs[1]
+#define Y (mxArray*)prhs[2]
+#define MESHDATA (mxArray*)prhs[3]
+#define CORNEREAST (mxArray*)prhs[4]
+#define CORNERNORTH (mxArray*)prhs[5]
+#define XPOSTING (mxArray*)prhs[6]
+#define YPOSTING (mxArray*)prhs[7]
+#define NLINES (mxArray*)prhs[8]
+#define NCOLS (mxArray*)prhs[9]
+#define DEFAULTVALUE (mxArray*)prhs[10]
+
+/* serial output macros: */
+#define XM (mxArray**)&plhs[0]
+#define YM (mxArray**)&plhs[1]
+#define GRIDDATA (mxArray**)&plhs[2]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  3
+#undef NRHS
+#define NRHS  11
+
+#endif  /* _INTERPFROMMESHTOGRID_H*/
