Index: /issm/trunk-jpl/src/modules/BamgConvertMesh/BamgConvertMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/BamgConvertMesh/BamgConvertMesh.cpp	(revision 12600)
+++ /issm/trunk-jpl/src/modules/BamgConvertMesh/BamgConvertMesh.cpp	(revision 12601)
@@ -4,25 +4,17 @@
 #include "./BamgConvertMesh.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=NULL;
-	int     index_rows;
-	double* x=NULL;
-	int     x_cols;
-	double* y=NULL;
-	int     y_rows;
-	int     y_cols;
+	int    *index      = NULL;
+	double *x          = NULL;
+	double *y          = NULL;
+	int     nods,nels,test1,test2;
 
 	/*Output*/
-	BamgMesh* bamgmesh=NULL;
-	BamgGeom* bamggeom=NULL;
-	mxArray* bamgmesh_mat=NULL;
-	mxArray* bamggeom_mat=NULL;
-
-	/*Intermediary*/
-	int nods;
-	int nels;
-	int verbose=0;
+	BamgMesh *bamgmesh     = NULL;
+	BamgGeom *bamggeom     = NULL;
+	mxArray  *bamgmesh_mat = NULL;
+	mxArray  *bamggeom_mat = NULL;
 
 	/*Boot module: */
@@ -37,28 +29,15 @@
 
 	/*Input datasets: */
-	if (verbose) _printLine_("Fetching inputs");
-	FetchData(&index,&nels,&index_rows,INDEXHANDLE);
-	FetchData(&x,&nods,&x_cols,XHANDLE);
-	FetchData(&y,&y_rows,&y_cols,YHANDLE);
+	FetchData(&index,&nels,&test1,INDEXHANDLE);
+	FetchData(&x,&nods,XHANDLE);
+	FetchData(&y,&test2,YHANDLE);
 
 	/*Check inputs*/
-	if (nels<0){
-		_error2_("Number of elements must be positive, check index number of lines");
-	}
-	if (nods<0){
-		_error2_("Number of nods must be positive, check x and y sizes");
-	}
-	if (index_rows!=3){
-		_error2_("index should have 3 columns");
-	}
-	if (y_rows!=nods){
-		_error2_("x and y do not have the same length");
-	}
-	if (x_cols>1 || y_cols>1){
-		_error2_("x and y should have only one column");
-	}
+	if(nels<0) _error2_("Number of elements must be positive, check index number of lines");
+	if(nods<0) _error2_("Number of nods must be positive, check x and y sizes");
+	if(test1!=3) _error2_("index should have 3 columns");
+	if(test2!=nods) _error2_("x and y do not have the same length");
 
 	/* Run core computations: */
-	if (verbose) _printLine_("Call core");
 	BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels);
 
@@ -75,6 +54,5 @@
 }
 
-void BamgConvertMeshUsage(void)
-{
+void BamgConvertMeshUsage(void){
 	_pprintString_("BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom");
 	_pprintLine_("");
Index: /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 12600)
+++ /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 12601)
@@ -7,28 +7,17 @@
 WRAPPER(InterpFromMeshToMesh2d){
 
-	/*input: */
-	double* index=NULL;
-	int     index_cols;
-	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_interp=NULL;
-	int     x_interp_rows;
-	double* y_interp=NULL;
-	int     y_interp_rows;
-	char*   contourname=NULL;
-	double* default_values=NULL;
-	int     num_default_values=0;
-	DataSet *contours = NULL;
-
-	/*Intermediary*/
-	int nels_data;
-
-	/* output: */
-	double* data_interp=NULL;
+	/*Intermediaties*/
+	int     *index              = NULL;
+	double  *x_data             = NULL;
+	double  *y_data             = NULL;
+	double  *data               = NULL;
+	int      nods_data,nels_data;
+	int      M_data,N_data;
+	double  *x_interp           = NULL;
+	double  *y_interp           = NULL;
+	int      N_interp;
+	Options *options   = NULL;
+	double  *data_interp = NULL;
+	int      test1,test2,test;
 
 	/*Boot module: */
@@ -43,46 +32,23 @@
 	#endif
 	/*check on input arguments: */
-	if((nrhs!=6) & (nrhs!=8)){
+	if(nrhs<NRHS){
 		InterpFromMeshToMesh2dUsage();
 		_error2_("InterpFromMeshToMesh2dUsage usage error");
 	}
 
-	/*Input datasets: */
-	FetchData(&index,&nels_data,&index_cols,INDEX);
-	FetchData(&x_data,&x_data_rows,NULL,X);
-	FetchData(&y_data,&y_data_rows,NULL,Y);
-	FetchData(&data,&data_rows,&data_cols,DATA);
-	FetchData(&x_interp,&x_interp_rows,XINTERP);
-	FetchData(&y_interp,&y_interp_rows,YINTERP);
+	/*Fetch inputs: */
+	FetchData(&index,&nels_data,&test,INDEX); if(test!=3) _error2_("index should have 3 columns");
+	FetchData(&x_data,&nods_data,X);          if(nods_data<3) _error2_("there should be at least three points");
+	FetchData(&y_data,&test,Y);               if(test!=nods_data) _error2_("vectors x and y should have the same length");
+	FetchData(&data,&M_data,&N_data,DATA);    if(M_data*N_data<1) _error2_("data is empty");
+	FetchData(&x_interp,&N_interp,XINTERP);   if(N_interp<1) _error2_("no interpolation requested");
+	FetchData(&y_interp,&test,YINTERP);       if(test!=N_interp) _error2_("vectors x_interp and y_interp should have the same length");
+	FetchData(&options,NRHS,nrhs,prhs);
 
-	/*Figure out contours and default values: */
-	if(nrhs==8){
-		FetchData(&default_values,&num_default_values,DEFAULT);
-		FetchData(&contourname,CONTOURNAME);
-		contours=DomainOutlineRead(contourname);
-	}
-	else{
-		num_default_values=0;
-		default_values=NULL;
-		contours=new DataSet();
-	}
-
-
-	/*some checks*/
-	if (x_data_rows!=y_data_rows){
-		_error2_("vectors x and y should have the same length!");
-	}
-	if (x_interp_rows!=y_interp_rows){
-		_error2_("vectors x_interp and y_interp should have the same length!");
-	}
-	if (index_cols!=3){
-		_error2_("index should have 3 columns (input provided has " << index_cols << " columns)");
-	}
-
-	/* Run core computations: */
-	InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,x_data_rows,nels_data,data,data_rows,data_cols,x_interp,y_interp,x_interp_rows,default_values,num_default_values,contours);
+	/*Run core computations*/
+	InterpFromMeshToMesh2dx(&data_interp,index,x_data,y_data,nods_data,nels_data,data,M_data,N_data,x_interp,y_interp,N_interp,options);
 
 	/*Write data: */
-	WriteData(DATAINTERP,data_interp,x_interp_rows,data_cols);
+	WriteData(DATAINTERP,data_interp,N_interp,N_data);
 
 	/*end module: */
@@ -90,30 +56,27 @@
 }
 
-void InterpFromMeshToMesh2dUsage(void)//{{{1
-
-{
+void InterpFromMeshToMesh2dUsage(void){ /*{{{*/
 	_pprintLine_("INTERFROMMESHTOMESH2D - interpolation from a 2d triangular mesh onto a list of point");
 	_pprintLine_("");
 	_pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
-	_pprintLine_("   defined on a triangular mesh onto a list of point");
+	_pprintLine_("   defined on a Delaunay triangulation onto a list of point");
 	_pprintLine_("");
 	_pprintLine_("   Usage:");
 	_pprintLine_("         data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp);");
-	_pprintLine_("      or data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,default_value,contourname);");
+	_pprintLine_("      or data_interp=InterpFromMeshToMesh2d(index,x,y,data,x_interp,y_interp,OPTIONS);");
 	_pprintLine_("");
-	_pprintLine_("      index: index of the mesh where data is defined");
-	_pprintLine_("      x,y: coordinates of the nodes where data is defined");
-	_pprintLine_("      data: matrix holding the data to be interpolated onto the mesh. (one column per field)");
-	_pprintLine_("      x_interp,y_interp: coordinates of the points onto which we interpolate.");
-	_pprintLine_("      if default_value and contourname not specified: linear interpolation will happen on all x_interp,y_interp.");
-	_pprintLine_("      if (default_value,contourname) specified: linear interpolation will happen on all x_interp,y_interp inside the contour, default value will be adopted on the rest of the mesh.");
-	_pprintLine_("      note that default_value is either a scalar, or a vector of size  length(x_interp)");
-	_pprintLine_("      data_interp: vector of mesh interpolated data.");
+	_pprintLine_("      index             : index of the mesh where data is defined");
+	_pprintLine_("      x,y               : coordinates of the nodes where data is defined");
+	_pprintLine_("      data              : matrix holding the data to be interpolated onto the mesh. (one column per field)");
+	_pprintLine_("      x_interp,y_interp : coordinates of the points onto which we interpolate.");
+	_pprintLine_("      data_interp       : vector of mesh interpolated data.");
+	_pprintLine_("      Available options :");
+	_pprintLine_("         - 'default' : default value if point is outsite of triangulation (instead of linear interolation)");
 	_pprintLine_("");
 	_pprintLine_("   Example:");
 	_pprintLine_("      load('temperature.mat');");
 	_pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y);");
-	_pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y,253,'Contour.exp');");
+	_pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh2d(index,x,y,temperature,md.mesh.x,md.mesh.y,'default',253);");
 	_pprintLine_("");
 }
-//}}}
+/*}}}*/
Index: /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 12600)
+++ /issm/trunk-jpl/src/modules/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 12601)
@@ -12,5 +12,8 @@
 #endif
 
-/*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/
+/* local prototypes: */
+void InterpFromMeshToMesh2dUsage(void);
+
+/*If python: this macro needs to come before header files inclusion*/
 #ifdef _HAVE_PYTHON_
 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
@@ -28,4 +31,7 @@
 #include "../../c/EnumDefinitions/EnumDefinitions.h"
 
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMeshToMesh2d"
+
 #ifdef _HAVE_MATLAB_MODULES_
 /* serial input macros: */
@@ -36,6 +42,4 @@
 #define XINTERP prhs[4]
 #define YINTERP prhs[5]
-#define DEFAULT prhs[6]
-#define CONTOURNAME prhs[7]
 
 /* serial output macros: */
@@ -51,12 +55,8 @@
 #define XINTERP PyTuple_GetItem(args,4)
 #define YINTERP PyTuple_GetItem(args,5)
-#define DEFAULT PyTuple_GetItem(args,6)
-#define CONTOURNAME PyTuple_GetItem(args,7)
+
 /* serial output macros: */
 #define DATAINTERP output,0
 #endif
-
-#undef __FUNCT__ 
-#define __FUNCT__  "InterpFromMeshToMesh2d"
 
 /* serial arg counts: */
@@ -64,8 +64,5 @@
 #define NLHS  1
 #undef NRHS
-#define NRHS  6 //can be 8 though
-
-/* local prototypes: */
-void InterpFromMeshToMesh2dUsage(void);
+#define NRHS  6
 
 #endif
Index: /issm/trunk-jpl/src/modules/TriaSearch/TriaSearch.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/TriaSearch/TriaSearch.cpp	(revision 12600)
+++ /issm/trunk-jpl/src/modules/TriaSearch/TriaSearch.cpp	(revision 12601)
@@ -9,5 +9,5 @@
 
 	/*input: */
-	double* index=NULL;
+	int*    index=NULL;
 	int     nel;
 	int     dummy;
@@ -37,8 +37,4 @@
 	FetchData(&y0,&numberofnodes,Y0HANDLE);
 
-	/* Echo: {{{1*/
-	//_printLine_("(x0,y0)=(" << x0 << "," << y0 << ")");
-	/*}}}*/
-
 	/* Run core computations: */
 	TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes);
@@ -54,6 +50,5 @@
 }
 
-void TriaSearchUsage(void)
-{
+void TriaSearchUsage(void){
 	_pprintLine_("TriaSearch- find triangle holding a point (x0,y0) in a mesh");
 	_pprintLine_("");
