Index: /issm/trunk-jpl/src/wrappers/AverageFilter/AverageFilter.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/AverageFilter/AverageFilter.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/AverageFilter/AverageFilter.cpp	(revision 13651)
@@ -0,0 +1,56 @@
+/*!\file:  AverageFilter.cpp
+ * \brief fill holes in matlab velocity array
+	this matlab module is an adaptation of a routine written by Robber 
+	Crippen.  The original routine was designed for the SRTM mission at JPL, 
+	and can be found in the current directory, under the name 
+	AverageFilterCrippen.  It fills void holes in an image, using an interpolation 
+	algorithm, and optionnally a smoothing algorithm. 
+	This matlab module extends the Crippen routine to be used in Matlab, 
+	using double arrays found in the workspace, and loaded directly into memory.
+*/
+
+#include "./AverageFilter.h"
+
+void AverageFilterUsage(void){/*{{{*/
+	_printLine_("   AverageFilter usage:");
+	_printLine_("   [image_out]=AverageFilter(image_in,pixels);\n");
+	_printLine_("   where:");
+	_printLine_("      image_in in double format");
+	_printLine_("      pixels: characteristic size of smoothing");
+	_printLine_("      image_out in double format");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(AverageFilter){
+
+	int i,j;
+
+	/* required input: */
+	double* imagein=NULL;
+	int     imagein_rows,imagein_cols;
+	int     smooth;
+
+
+	/* output: */
+	mxArray* pfield=NULL;
+	double* imageout=NULL;
+	int     imageout_rows,imageout_cols;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&AverageFilterUsage);
+
+	/*Fetch data: */
+	FetchData(&imagein,&imagein_rows,&imagein_cols,IMAGEIN);
+	FetchData(&smooth,SMOOTH);
+	
+	/*Run core hole filler routine: */
+	AverageFilterx( &imageout,imagein,imagein_rows,imagein_cols,smooth);
+
+	/* output: */
+	WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/AverageFilter/AverageFilter.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/AverageFilter/AverageFilter.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/AverageFilter/AverageFilter.h	(revision 13651)
@@ -0,0 +1,50 @@
+/*
+	AverageFilter.h
+*/
+
+#ifndef _AVERAGEFILTER_H
+#define _AVERAGEFILTER_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "AverageFilter"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define IMAGEIN prhs[0]
+#define SMOOTH  prhs[1]
+/* serial output macros: */
+#define IMAGEOUT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define IMAGEIN PyTuple_GetItem(args,0)
+#define SMOOTH  PyTuple_GetItem(args,1)
+/* serial output macros: */
+#define IMAGEOUT output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  2
+
+#endif  /* _AVERAGEFILTER_H */
Index: /issm/trunk-jpl/src/wrappers/BamgConvertMesh/BamgConvertMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/BamgConvertMesh/BamgConvertMesh.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/BamgConvertMesh/BamgConvertMesh.cpp	(revision 13651)
@@ -0,0 +1,61 @@
+/*\file BamgConvertMesh.c
+ *\brief: bamg module.
+ */
+#include "./BamgConvertMesh.h"
+
+void BamgConvertMeshUsage(void){/*{{{*/
+	_pprintString_("BAMGCONVERTMESH - convert [x y index] to a bamg geom and mesh geom");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [bamggeom bamgmesh]=BamgConvertMesh(index,x,y);");
+	_pprintLine_("      index: index of the mesh");
+	_pprintLine_("      x,y: coordinates of the nodes");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(BamgConvertMesh){
+
+	/*input: */
+	int    *index      = NULL;
+	double *x          = NULL;
+	double *y          = NULL;
+	int     nods,nels,test1,test2;
+
+	/*Output*/
+	BamgMesh *bamgmesh = NULL;
+	BamgGeom *bamggeom = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CHECKARGUMENTS(NLHS,NRHS,&BamgConvertMeshUsage);
+
+	/*Initialize Bamg outputs*/
+	bamggeom=new BamgGeom();
+	bamgmesh=new BamgMesh();
+
+	/*Input datasets: */
+	FetchData(&index,&nels,&test1,INDEXHANDLE);
+	FetchData(&x,&nods,XHANDLE);
+	FetchData(&y,&test2,YHANDLE);
+
+	/*Check inputs*/
+	if(nels<0) _error_("Number of elements must be positive, check index number of lines");
+	if(nods<0) _error_("Number of nods must be positive, check x and y sizes");
+	if(test1!=3) _error_("index should have 3 columns");
+	if(test2!=nods) _error_("x and y do not have the same length");
+
+	/* Run core computations: */
+	BamgConvertMeshx(bamgmesh,bamggeom,index,x,y,nods,nels);
+
+	/*Generate output Matlab Structures*/
+	WriteData(BAMGGEOMOUT,bamggeom);
+	WriteData(BAMGMESHOUT,bamgmesh);
+
+	/*Clean up*/
+	delete bamggeom;
+	delete bamgmesh;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/BamgConvertMesh/BamgConvertMesh.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/BamgConvertMesh/BamgConvertMesh.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/BamgConvertMesh/BamgConvertMesh.h	(revision 13651)
@@ -0,0 +1,55 @@
+/*!\file BamgConvertMesh.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _BAMGCONVERTMESH_H
+#define _BAMGCONVERTMESH_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "BamgConvertMesh"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define INDEXHANDLE prhs[0]
+#define XHANDLE     prhs[1]
+#define YHANDLE     prhs[2]
+/* serial output macros: */
+#define BAMGMESHOUT    (mxArray**)&plhs[0]
+#define BAMGGEOMOUT    (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEXHANDLE PyTuple_GetItem(args,0)
+#define XHANDLE     PyTuple_GetItem(args,1)
+#define YHANDLE     PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define BAMGMESHOUT    output,0
+#define BAMGGEOMOUT    output,1
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  2
+#undef NRHS
+#define NRHS  3
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.cpp	(revision 13651)
@@ -0,0 +1,51 @@
+/*\file BamgMesher.c
+ *\brief: mesher that uses the bamg library
+ */
+#include "./BamgMesher.h"
+
+void BamgMesherUsage(void){/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: [bamgmesh,bamggeom]=" << __FUNCT__ << "(bamgmesh,bamggeom,bamgoptions);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(BamgMesher){
+
+	/*Intermediary*/
+	BamgOpts *bamgopts=NULL;
+	BamgMesh *bamgmesh_in=NULL;
+	BamgGeom *bamggeom_in=NULL;
+	BamgMesh *bamgmesh_out=NULL;
+	BamgGeom *bamggeom_out=NULL;
+
+	/*Boot module*/
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CHECKARGUMENTS(NLHS,NRHS,&BamgMesherUsage);
+
+	/*Initialize outputs*/
+	bamggeom_out=new BamgGeom();
+	bamgmesh_out=new BamgMesh();
+
+	/*Fetch inputs: */
+	FetchData(&bamgopts,BAMGOPTIONS);
+	FetchData(&bamggeom_in,BAMGGEOMIN);
+	FetchData(&bamgmesh_in,BAMGMESHIN);
+
+	/*Call x layer*/
+	Bamgx(bamgmesh_out,bamggeom_out,bamgmesh_in,bamggeom_in,bamgopts);
+
+	/*Generate output Matlab Structures*/
+	WriteData(BAMGGEOMOUT,bamggeom_out);
+	WriteData(BAMGMESHOUT,bamgmesh_out);
+
+	/*Free ressources: */
+	delete bamgopts;
+	delete bamggeom_in;
+	delete bamggeom_out;
+	delete bamgmesh_in;
+	delete bamgmesh_out;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/BamgMesher/BamgMesher.h	(revision 13651)
@@ -0,0 +1,54 @@
+/*
+	BamgMesher.h
+*/
+
+#ifndef _BAMG_MESHER_H_
+#define _BAMG_MESHER_H_
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "BamgMesher"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define BAMGMESHIN  prhs[0]
+#define BAMGGEOMIN  prhs[1]
+#define BAMGOPTIONS prhs[2]
+/* serial output macros: */
+#define BAMGMESHOUT (mxArray**)&plhs[0]
+#define BAMGGEOMOUT (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define BAMGMESHIN  PyTuple_GetItem(args,0)
+#define BAMGGEOMIN  PyTuple_GetItem(args,1)
+#define BAMGOPTIONS PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define BAMGMESHOUT output,0
+#define BAMGGEOMOUT output,1
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  2
+#undef NRHS
+#define NRHS  3
+
+#endif  /* _BAMG_MESHER_H_ */
Index: /issm/trunk-jpl/src/wrappers/BamgTriangulate/BamgTriangulate.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/BamgTriangulate/BamgTriangulate.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/BamgTriangulate/BamgTriangulate.cpp	(revision 13651)
@@ -0,0 +1,56 @@
+/*\file BamgTriangulate.c
+ *\brief: bamg module.
+ */
+#include "./BamgTriangulate.h"
+
+void BamgTriangulateUsage(void){/*{{{*/
+	_pprintString_("BAMGTRIANGULATE - Delaunay Triangulation of a list of points");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      index=BamgTriangulate(x,y);");
+	_pprintLine_("      index: index of the triangulation");
+	_pprintLine_("      x,y: coordinates of the nodes");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(BamgTriangulate){
+
+	/*input: */
+	double* x=NULL;
+	double* y=NULL;
+	int     x_cols;
+	int     y_rows,y_cols;
+	int nods;
+
+	/*Output*/
+	int* index=NULL;
+	int  nels;
+
+	/*Intermediary*/
+	int verbose=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&BamgTriangulateUsage);
+
+	/*Input datasets: */
+	if (verbose) _printLine_("Fetching inputs");
+	FetchData(&x,&nods,&x_cols,XHANDLE);
+	FetchData(&y,&y_rows,&y_cols,YHANDLE);
+
+	/*Check inputs*/
+	if(y_rows!=nods)         _error_("x and y do not have the same length");
+	if(x_cols>1 || y_cols>1) _error_("x and y should have only one column");
+	if(nods<3)               _error_("At least 3 points are required");
+
+	/* Run core computations: */
+	if (verbose) _printLine_("Call core");
+	BamgTriangulatex(&index,&nels,x,y,nods);
+
+	/*Write output*/
+	WriteData(INDEX,index,nels,3);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/BamgTriangulate/BamgTriangulate.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/BamgTriangulate/BamgTriangulate.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/BamgTriangulate/BamgTriangulate.h	(revision 13651)
@@ -0,0 +1,52 @@
+/*!\file BamgTriangulate.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _BAMGTRIANGULATE_H
+#define _BAMGTRIANGULATE_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "BamgTriangulate"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define XHANDLE prhs[0]
+#define YHANDLE prhs[1]
+
+/* serial output macros: */
+#define INDEX (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define XHANDLE PyTuple_GetItem(args,0)
+#define YHANDLE PyTuple_GetItem(args,1)
+
+/* serial output macros: */
+#define INDEX output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  2
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/Chaco/Chaco.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Chaco/Chaco.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Chaco/Chaco.cpp	(revision 13651)
@@ -0,0 +1,135 @@
+/*\file Chaco.c
+ *\brief:  Chaco partitioner mex module
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./Chaco.h"
+
+void ChacoUsage(void){/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("Usage: [assgn] = Chaco(A,vwgts,ewgts,x,y,z,options,nparts,goal);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Chaco){
+   
+	int i;
+	int nterms;
+
+	/*Inputs: */
+	int     nvtxs;               /* number of vertices in graph           */
+	int    *start;               /* start of edge list for each vertex    */
+	int    *adjacency;           /* edge list data                        */
+	int    *vwgts       = NULL;  /* weights for all vertices              */
+	int     nedges;
+	float  *ewgts       = NULL;  /* weights for all edges                 */
+	float  *x           = NULL;
+	float  *y           = NULL;
+	float  *z           = NULL;  /* coordinates for inertial method       */
+	double  options[10] = {1,1,0,0,1,1,50,0,.001,7654321}; /* architecture and partitioning options */
+	double *in_options  = NULL;
+	int    *nparts      = NULL;   /* number of parts options               */
+	int     npart;
+	double *goal        = NULL;   /* desired set sizes                     */
+
+	/*intermediary pointers: */
+	mwIndex *mwstart, *mwadjacency;
+	double  *doublepointer;
+
+	/*output: */
+   short  *assignment       = NULL; /* set number of each vtx (length nvtxs+1)                */
+   double *doubleassignment = NULL; /*holds assignment, in double format, to return to matlab */
+
+	#ifndef _HAVE_CHACO_ //only works if dakota library has been compiled in.
+	_error_("Chaco not available! Cannot carry out Chaco partitioning!");
+	#endif
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ChacoUsage);
+
+	/*Fetch adjacency matrix: */
+	nvtxs = mxGetN(A_IN);
+	mwstart = mxGetJc(A_IN);
+	start=xNew<int>((nvtxs+1));
+	for (i=0; i<nvtxs+1;i++)start[i]=(int)mwstart[i];
+
+	mwadjacency = mxGetIr(A_IN);
+	adjacency = xNew<int>(mxGetNzmax(A_IN));
+	for (i=0; i<mxGetNzmax(A_IN); i++) adjacency[i]= (int)mwadjacency[i];
+
+	nedges = start[nvtxs];
+	if(!mxIsEmpty(EWGTS_IN)){
+		ewgts = xNewZeroInit<float>(nedges);
+		doublepointer=mxGetPr(A_IN);
+		for (i = 0; i < nedges; i++)ewgts[i] = (float)doublepointer[i];
+	}
+	else ewgts=NULL;
+
+	/*Fetch rest of data: */
+	FetchData(&vwgts,&nterms,VWGTS_IN); 
+	FetchData(&x,&nterms,X_IN); 
+	FetchData(&y,&nterms,Y_IN); 
+	FetchData(&z,&nterms,Z_IN); 
+	FetchData(&in_options,&nterms,OPTNS_IN); 
+	for (i=0;i<(nterms<10?nterms:10);i++) options[i]=in_options[i]; //copy in_options into default options
+	FetchData(&npart,NPARTS_IN); 
+	nparts=xNew<int>(1); nparts[0]=npart; //weird Chacox interface ain't it?
+	FetchData(&goal,&nterms,GOAL_IN); 
+	
+	/*Some debugging print: {{{*/
+	#ifdef _DEBUG_
+	_printLine_("nvtxs: " << nvtxs);
+	_printString_("options: [");
+	for(i=0;i<10;i++)_printString_(options[i] << "|");
+	_printLine_("]");
+	_printLine_("start: ");
+	for (i=0; i<nvtxs+1;i++)_printString_(start[i] << " ");
+	_printLine_("");
+	_printLine_("adjacency: ");
+	for (i=0; i<mxGetNzmax(A_IN);i++)_printString_("" <<adjacency[i]<< " ");i++)
+	_printLine_("");
+	_printLine_("nedges: " << nedges << " " << ewgts);
+	if(ewgts) for (i = 0; i < nedges; i++)_printString_(ewgts[i] << " ");
+	_printLine_("");
+	_printLine_("vwgts:");
+	for (i = 0; i < nvtxs; i++)_printString_(vwgts[i] << " ");
+	_printLine_("");
+	_printLine_("nparts: " << nparts[0]);
+	_printLine_("goal: " << goal);
+	#endif
+	/*}}}*/
+	
+	/*Allocate output: */
+	assignment = xNewZeroInit<short>(nvtxs);
+	
+    /*Call core: */
+	Chacox(nvtxs, start, adjacency, vwgts, ewgts, x, y, z, assignment, options, nparts, goal);
+
+    /*Output data: */
+	doubleassignment=xNew<double>(nvtxs);
+	for(i=0;i<nvtxs;i++) doubleassignment[i]=(double)assignment[i];
+	WriteData(ASSGN_OUT,doubleassignment,nvtxs);
+
+	/*Free ressources:*/
+	xDelete<short>(assignment); 
+	xDelete<double>(goal);
+	xDelete<int>(nparts);
+	xDelete<float>(z);
+	xDelete<float>(y);
+	xDelete<float>(x);
+	xDelete<float>(ewgts);
+	xDelete<int>(vwgts);
+	xDelete<int>(adjacency);
+	xDelete<int>(start);
+	xDelete<double>(doubleassignment);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Chaco/Chaco.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Chaco/Chaco.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Chaco/Chaco.h	(revision 13651)
@@ -0,0 +1,68 @@
+/*!\file:  Chaco.h
+ * \brief header file for Chaco module.
+ */ 
+
+#ifndef _CHACO_H
+#define _CHACO_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*headers*/
+#include <stdio.h>
+#include <string.h>    /*  strcasecmp  */
+#include <time.h>      /*  clock,time,difftime  */
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Chaco"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define A_IN      prhs[0]
+#define VWGTS_IN  prhs[1]
+#define EWGTS_IN  prhs[2]
+#define X_IN      prhs[3]
+#define Y_IN      prhs[4]
+#define Z_IN      prhs[5]
+#define OPTNS_IN  prhs[6]
+#define NPARTS_IN prhs[7]
+#define GOAL_IN   prhs[8]
+/* serial output macros: */
+#define ASSGN_OUT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define A_IN      PyTuple_GetItem(args,0)
+#define VWGTS_IN  PyTuple_GetItem(args,1)
+#define EWGTS_IN  PyTuple_GetItem(args,2)
+#define X_IN      PyTuple_GetItem(args,3)
+#define Y_IN      PyTuple_GetItem(args,4)
+#define Z_IN      PyTuple_GetItem(args,5)
+#define OPTNS_IN  PyTuple_GetItem(args,6)
+#define NPARTS_IN PyTuple_GetItem(args,7)
+#define GOAL_IN   PyTuple_GetItem(args,8)
+/* serial output macros: */
+#define ASSGN_OUT output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  9
+
+#endif  /* _CHACO_H */
Index: /issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.cpp	(revision 13651)
@@ -0,0 +1,89 @@
+/*! \file  ContourtoMesh
+    \brief: takes an  contour file, and figures out which nodes or elements from the mesh  
+    are inside this contour. 
+*/
+	
+#include "./ContourToMesh.h"
+
+void ContourToMeshUsage(void){/*{{{*/
+	_printLine_("CONTOURTOMESH - Flag the elements or nodes inside a contour");
+	_printLine_("");
+	_printLine_("      Usage: ");
+	_printLine_("         [in_nod,in_elem]=ContourToMesh(index,x,y,contourname,interptype,edgevalue)\n");
+	_printLine_("");
+	_printLine_("         index,x,y: mesh triangulation.");
+	_printLine_("         contourname: name of .exp file containing the contours.");
+	_printLine_("         interptype: string definining type of interpolation ('element', or 'node').");
+	_printLine_("         edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.");
+	_printLine_("         in_nod: vector of flags (0 or 1), of size nods if interptype is set to 'node' or 'element and node', ");
+	_printLine_("            or of size 0 otherwise.");
+	_printLine_("         in_elem: vector of flags (0 or 1), of size nel if interptype is set to 'element' or 'element and node', ");
+	_printLine_("            or of size 0 otherwise.");
+	_printLine_("");
+	_printLine_("      Example: ");
+	_printLine_("         in_nod=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','node',1)");
+	_printLine_("         in_elements=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element',0)");
+	_printLine_("         [in_nodes,in_elements]=ContourToMesh(md.elements,md.x,md.y,'Contour.exp','element and node',0)");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(ContourToMesh){
+
+	/* required input: */
+	int      edgevalue;
+	double  *index       = NULL;
+	int      nel;
+	double  *x           = NULL;
+	int      nods;
+	double  *y           = NULL;
+	char    *interptype  = NULL;
+	DataSet *contours    = NULL;
+
+	/* output: */
+	SeqVec<double> *in_nod  = NULL;
+	SeqVec<double> *in_elem = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on output arguments on the matlab side: */
+	#ifdef _HAVE_MATLAB_MODULES_
+	if(nlhs!=1 && nlhs!=2){
+		ContourToMeshUsage();
+		_error_("usage. See above");
+	}
+	#endif
+	/*check on input arguments: */
+	if(nrhs!=NRHS){
+		ContourToMeshUsage();
+		_error_("usage. See above");
+	}
+
+	/*Fetch inputs: */
+	FetchData(&index,&nel,NULL,INDEX);
+	FetchData(&x,&nods,NULL,X);
+	FetchData(&y,NULL,NULL,Y);
+	FetchData(&edgevalue,EDGEVALUE);
+	FetchData(&contours,CONTOUR);
+	FetchData(&interptype,INTERPTYPE);
+
+	/*Run interpolation routine: */
+	ContourToMeshx( &in_nod,&in_elem,index,x,y,contours,interptype,nel,nods,edgevalue);
+
+	/* output: */
+	if (strcmp(interptype,"node")==0){
+		WriteData(PLHS0,in_nod);
+		WriteData(PLHS1);
+	}
+	else if (strcmp(interptype,"element")==0){
+		WriteData(PLHS0,in_elem);
+		WriteData(PLHS1);
+	}
+	else if (strcmp(interptype,"element and node")==0){
+		WriteData(PLHS0,in_nod);
+		WriteData(PLHS1,in_elem);
+	}
+	else _error_("wrong interpolation type");
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.h	(revision 13651)
@@ -0,0 +1,66 @@
+/*
+	ContourToMesh.h
+*/
+
+#ifndef _CONTOURTOMESH_H
+#define _CONTOURTOMESH_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/toolkits/toolkits.h"
+#include "../../c/include/include.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
+
+#undef __FUNCT__
+#define __FUNCT__ "ContourToMesh"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define INDEX       prhs[0]
+#define X           prhs[1]
+#define Y           prhs[2]
+#define CONTOUR     prhs[3]
+#define INTERPTYPE  prhs[4]
+#define EDGEVALUE   prhs[5]
+/* serial output macros: */
+#define PLHS0 (mxArray**)&plhs[0]
+#define PLHS1 (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEX       PyTuple_GetItem(args,0)
+#define X           PyTuple_GetItem(args,1)
+#define Y           PyTuple_GetItem(args,2)
+#define CONTOUR     PyTuple_GetItem(args,3)
+#define INTERPTYPE  PyTuple_GetItem(args,4)
+#define EDGEVALUE   PyTuple_GetItem(args,5)
+/* serial output macros: */
+#define PLHS0 output,0
+#define PLHS1 output,1
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  2
+#undef NRHS
+#define NRHS 6
+
+#endif  /* _CONTOURTOMESH_H */
+
Index: /issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.cpp	(revision 13651)
@@ -0,0 +1,49 @@
+/*! \file  ContourtoNodes
+    \brief: takes a  contour file, and figures out which nodes  (x,y list)
+*/
+	
+#include "./ContourToNodes.h"
+
+void ContourToNodesUsage(void){/*{{{*/
+	_printLine_("   usage:");
+	_printLine_("   [flags]=ContourToNodes(x,y,contourname,edgevalue);\n");
+	_printLine_("   where:");
+	_printLine_("      x,y: list of nodes.");
+	_printLine_("      contourname: name of .exp file containing the contours, or resulting structure from call to expread.");
+	_printLine_("      edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.");
+	_printLine_("      flags: vector of flags (0 or 1), of size nods.");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(ContourToNodes){
+
+	/* input: */
+	int      edgevalue,nods;
+	double  *x           = NULL;
+	double  *y           = NULL;
+	char    *contourname = NULL;
+	DataSet *contours    = NULL;
+
+	/* output: */
+	SeqVec<double> *flags = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CHECKARGUMENTS(NLHS,NRHS,&ContourToNodesUsage);
+	
+	/*Fetch inputs: */
+	FetchData(&x,&nods,NULL,XHANDLE);
+	FetchData(&y,NULL,NULL,YHANDLE);
+	FetchData(&edgevalue,EDGEVALUE);
+	FetchData(&contours,CONTOUR);
+
+	/*Run x layer */
+	ContourToNodesx(&flags,x,y,nods,contours,edgevalue);
+
+	/* output: */
+	WriteData(FLAGS,flags);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.h	(revision 13651)
@@ -0,0 +1,57 @@
+/*
+	ContourToNodes.h
+*/
+
+#ifndef _CONTOURTONODES_H
+#define _CONTOURTONODES_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__
+#define __FUNCT__ "ContourToNodes"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* input macros: */
+#define XHANDLE   prhs[0]
+#define YHANDLE   prhs[1]
+#define CONTOUR   prhs[2]
+#define EDGEVALUE prhs[3]
+
+/* serial output macros: */
+#define FLAGS (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* input macros: */
+#define XHANDLE   PyTuple_GetItem(args,0)
+#define YHANDLE   PyTuple_GetItem(args,1)
+#define CONTOUR   PyTuple_GetItem(args,2)
+#define EDGEVALUE PyTuple_GetItem(args,3)
+
+/* serial output macros: */
+#define FLAGS output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS 1
+#undef NRHS
+#define NRHS 4
+
+#endif  /* _CONTOURTONODES_H */
+
Index: /issm/trunk-jpl/src/wrappers/ElementConnectivity/ElementConnectivity.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/ElementConnectivity/ElementConnectivity.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/ElementConnectivity/ElementConnectivity.cpp	(revision 13651)
@@ -0,0 +1,41 @@
+/*\file ElementConnectivity.c
+ *\brief: build element connectivity using node connectivity and elements. 
+ */
+
+#include "./ElementConnectivity.h"
+
+void ElementConnectivityUsage(void) {/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: elementconnectivity = " << __FUNCT__ << "(elements, nodeconnectivity);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(ElementConnectivity){
+
+	/*inputs: */
+	double* elements=NULL;
+	double* nodeconnectivity=NULL;
+	int     nel,nods;
+	int     width;
+
+	/*outputs: */
+	double* elementconnectivity=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments: */
+	CHECKARGUMENTS(NLHS,NRHS,&ElementConnectivityUsage);
+        
+	/*Input datasets: */
+	FetchData(&elements,&nel,NULL,ELEMENTS);
+	FetchData(&nodeconnectivity,&nods,&width,NODECONNECTIVITY);
+
+	/*!Generate internal degree of freedom numbers: */
+	ElementConnectivityx(&elementconnectivity, elements,nel, nodeconnectivity, nods, width);
+
+	/*write output datasets: */
+	WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/ElementConnectivity/ElementConnectivity.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/ElementConnectivity/ElementConnectivity.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/ElementConnectivity/ElementConnectivity.h	(revision 13651)
@@ -0,0 +1,55 @@
+/*
+	ElementConnectivity.h
+*/
+
+#ifndef _ELEMENTCONNECTIVITY_H
+#define _ELEMENTCONNECTIVITY_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/toolkits/toolkits.h"
+#include "../../c/include/include.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "ElementConnectivity"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define ELEMENTS         prhs[0]
+#define NODECONNECTIVITY prhs[1]
+/* serial output macros: */
+#define ELEMENTCONNECTIVITY (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define ELEMENTS         PyTuple_GetItem(args,0)
+#define NODECONNECTIVITY PyTuple_GetItem(args,1)
+/* serial output macros: */
+#define ELEMENTCONNECTIVITY output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  2
+
+#endif  /* _ELEMENTCONNECTIVITY_H */
Index: /issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.cpp	(revision 13651)
@@ -0,0 +1,34 @@
+/*\file EnumToString.c
+ *\brief:convert enum (int) to string
+ */
+
+#include "./EnumToString.h"
+
+void EnumToStringUsage(void){/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: " << __FUNCT__ << "string = EnumToString(enum);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(EnumToString){
+
+	char    *name    = NULL;
+	int      enum_in;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments: */
+	CHECKARGUMENTS(NLHS,NRHS,&EnumToStringUsage);
+
+	/*Fetch inputs: */
+	FetchData(&enum_in,ENUMIN);
+
+	/*Run core function: */
+	EnumToStringx(&name,enum_in);
+
+	/* output: */
+	WriteData(NAME,name);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/EnumToString/EnumToString.h	(revision 13651)
@@ -0,0 +1,49 @@
+/*!\file:  EnumToString.h
+ * \brief header file for EnumToString module.
+ */ 
+
+#ifndef _ENUMTOSTRING_H
+#define _ENUMTOSTRING_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "EnumToString"
+ 
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define ENUMIN (mxArray*)prhs[0]
+/* serial output macros: */
+#define NAME (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define ENUMIN PyTuple_GetItem(args,0)
+/* serial output macros: */
+#define NAME output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  1
+
+#endif  /* _TEST_H */
Index: /issm/trunk-jpl/src/wrappers/Exp2Kml/Exp2Kml.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Exp2Kml/Exp2Kml.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Exp2Kml/Exp2Kml.cpp	(revision 13651)
@@ -0,0 +1,96 @@
+/*\file Exp2Kml.c
+ *\brief: exp to kml file conversion mex module.
+ */
+#include "./Exp2Kml.h"
+
+void Exp2KmlUsage(void){/*{{{*/
+	_pprintLine_("Exp2Kml - exp to kml file conversion module:");
+	_pprintLine_("");
+	_pprintLine_("   This module converts a file from exp to kml format.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [ret]=Exp2Kml(filexp,filkml,sgn,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      filexp      file name of exp file to be read (char)");
+	_pprintLine_("      filkml      file name of kml file to be written (char)");
+	_pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
+	_pprintLine_("");
+	_pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
+	_pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
+	_pprintLine_("      holes       flag for treatment of multiple profiles (char, optional, 'yes' for holes))");
+	_pprintLine_("");
+	_pprintLine_("      ret         return code (non-zero for warning)");
+	_pprintLine_("");
+	_pprintLine_("   Examples:");
+	_pprintLine_("      [ret]=Exp2Kml('file.exp','file.kml', 1);");
+	_pprintLine_("      [ret]=Exp2Kml('file.exp','file.kml', 1,'central_meridian',45,'standard_parallel',70,'holes','yes');");
+	_pprintLine_("      [ret]=Exp2Kml('file.exp','file.kml',-1,'central_meridian', 0,'standard_parallel',71,'holes','yes');");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Exp2Kml){
+
+	int i,verbose=1;
+
+	/*input: */
+	char    *filexp=NULL,*filkml=NULL;
+	int     sgn;
+
+	Options* options=NULL;
+	char     *choles=NULL;
+	bool     holes=false;
+	double   cm=0.,sp=0.;
+
+	/* output: */
+	int     iret=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		Exp2KmlUsage(); _error_("Exp2Kml usage error");
+	}
+	if (nrhs < NRHS) {
+		Exp2KmlUsage(); _error_("Exp2Kml usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&filexp,EXP_IN);
+	FetchData(&filkml,KML_IN);
+	FetchData(&sgn,SGN_IN);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	options->Get(&choles,"holes",(char*)"no");
+	if (!strncmp(choles,"y",1) || !strncmp(choles,"on",2)) holes=true;
+
+	/*  defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified  */
+	if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
+		options->Get(&cm,"central_meridian");
+		if (verbose) _printLine_("  cm=" << cm);
+		options->Get(&sp,"standard_parallel");
+		if (verbose) _printLine_("  sp=" << sp);
+	}
+
+	/*some checks*/
+	if (sgn !=+1 && sgn !=-1) _error_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
+	if (fabs(cm)      > 180.) _error_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
+	if (sp < 0. || sp >  90.) _error_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
+
+	/* Run core computations: */
+	if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
+		iret=Exp2Kmlx(filexp,filkml,sgn,cm,sp,holes);
+	else
+		iret=Exp2Kmlx(filexp,filkml,sgn,holes);
+
+	/*Write data: */
+	WriteData(RET_OUT,iret);
+
+	/*Clean-up*/
+	xDelete<char>(choles);
+	xDelete<char>(filkml);
+	xDelete<char>(filexp);
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Exp2Kml/Exp2Kml.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Exp2Kml/Exp2Kml.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Exp2Kml/Exp2Kml.h	(revision 13651)
@@ -0,0 +1,53 @@
+/*!\file Exp2Kml.h
+ * \brief: prototype for exp to kml file conversion mex module.
+ */
+
+#ifndef _EXP2KML_H
+#define _EXP2KML_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Exp2Kml"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define EXP_IN prhs[0]
+#define KML_IN prhs[1]
+#define SGN_IN prhs[2]
+/* serial output macros: */
+#define RET_OUT    (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define EXP_IN PyTuple_GetItem(args,0)
+#define KML_IN PyTuple_GetItem(args,1)
+#define SGN_IN PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define RET_OUT    output,0
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  3
+#undef NLHS
+#define NLHS  1
+
+#endif
+
Index: /issm/trunk-jpl/src/wrappers/HoleFiller/HoleFiller.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/HoleFiller/HoleFiller.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/HoleFiller/HoleFiller.cpp	(revision 13651)
@@ -0,0 +1,63 @@
+/*!\file:  HoleFiller.cpp
+ * \brief fill holes in matlab velocity array
+	this matlab module is an adaptation of a routine written by Robber 
+	Crippen.  The original routine was designed for the SRTM mission at JPL, 
+	and can be found in the current directory, under the name 
+	HoleFillerCrippen.  It fills void holes in an image, using an interpolation 
+	algorithm, and optionnally a smoothing algorithm. 
+	This matlab module extends the Crippen routine to be used in Matlab, 
+	using double arrays found in the workspace, and loaded directly into memory.
+*/
+
+#include "./HoleFiller.h"
+
+void HoleFillerUsage(void){/*{{{*/
+	_printLine_("   HoleFiller usage:");
+	_printLine_("   [image_out]=HoleFiller(image_in,smooth);\n");
+	_printLine_("   where:");
+	_printLine_("      image_in in double format");
+	_printLine_("      smooth: 1 to smooth with a box filer, 0 to leave data raw");
+	_printLine_("      image_out in double format");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(HoleFiller){
+
+	int i,j;
+
+	/* required input: */
+	double* imagein=NULL;
+	int     imagein_rows,imagein_cols;
+	int     smooth_flag;
+	int     smooth;
+
+
+	/* output: */
+	mxArray* pfield=NULL;
+	double* imageout=NULL;
+	int     imageout_rows,imageout_cols;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&HoleFillerUsage);
+
+	/*Fetch data: */
+	FetchData(&imagein,&imagein_rows,&imagein_cols,IMAGEIN);
+	FetchData(&smooth_flag,SMOOTH);
+	
+	/*Get smooth flag setup: */
+	if (smooth_flag==0)
+		smooth=1;
+	else
+		smooth=0;
+
+	/*Run core hole filler routine: */
+	HoleFillerx( &imageout,imagein,imagein_rows,imagein_cols,smooth);
+
+	/* output: */
+	WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/HoleFiller/HoleFiller.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/HoleFiller/HoleFiller.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/HoleFiller/HoleFiller.h	(revision 13651)
@@ -0,0 +1,50 @@
+/*
+	HoleFiller.h
+*/
+
+#ifndef _HOLEFILLER_H
+#define _HOLEFILLER_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "HoleFiller"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define IMAGEIN prhs[0]
+#define SMOOTH  prhs[1]
+/* serial output macros: */
+#define IMAGEOUT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define IMAGEIN PyTuple_GetItem(args,0)
+#define SMOOTH  PyTuple_GetItem(args,1)
+/* serial output macros: */
+#define IMAGEOUT output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  2
+
+#endif  /* _HOLEFILLER_H */
Index: /issm/trunk-jpl/src/wrappers/InternalFront/InternalFront.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/InternalFront/InternalFront.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InternalFront/InternalFront.cpp	(revision 13651)
@@ -0,0 +1,98 @@
+/*\file InternalFront.c
+ *\brief: build pressureload
+ */
+
+#include "./InternalFront.h"
+
+void InternalFrontUsage(void) {/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: icefront = " << __FUNCT__ << "(md);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(InternalFront){
+
+	bool*   elementonwater=NULL;
+	int*    elements=NULL;
+	int*    connectivity=NULL;
+	int*    elementconnectivity=NULL;
+	int*    front=NULL;
+	double* front2=NULL;
+	bool    found;
+	int     numberofelements,numberofsegments;
+	int     N,M;
+	int     i,j,ii,jj,id;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InternalFrontUsage);
+
+	/*Fetch required fields*/
+	FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
+	if(numberofelements<=0) _error_("No elements found in the model");
+	FetchData(&elements,&M,&N,mxGetAssignedField(MODEL,0,"elements"));
+	if(M!=numberofelements || N!=3) _error_("Field 'elements' should be of size [md.numberofelements 3]");
+	FetchData(&elementonwater,&M,&N,mxGetAssignedField(MODEL,0,"elementonwater"));
+	if(M!=numberofelements || N!=1) _error_("Field 'elementonwater' should be of size [md.numberofelements 1]");
+	FetchData(&elementconnectivity,&M,&N,mxGetAssignedField(MODEL,0,"elementconnectivity"));
+	if(M!=numberofelements || N!=3) _error_("Field 'elementconnectivity' should be of size [md.numberofelements 3]");
+
+	/*Allocate and initialize all variables*/
+	numberofsegments=0;
+	front=xNew<int>(3*numberofelements*4);
+
+	/*Loop over all elements on water*/
+	for(i=0;i<numberofelements;i++){
+
+		/*Skip if on water*/
+		if(!elementonwater[i]) continue;
+
+		/*Loop over all three adjacent elements*/
+		for(j=0;j<3;j++){
+
+			/*Skip if adjacent element does not exist or is on water*/
+			id=elementconnectivity[i*3+j];
+			if(id==0) continue;
+			if(elementonwater[id-1]) continue;
+
+			/*We have an ice front to add here, let's go!*/
+			for(ii=0;ii<3;ii++){
+
+				found=false;
+				for(jj=0;jj<3;jj++){
+					if(elements[(id-1)*3+ii]==elements[i*3+jj]){
+						found=true;
+						break;
+					}
+				}
+
+				/*OK, we just found the node of id, which is not in i. We have the segment*/
+				if(!found){
+					front[numberofsegments*4+0]=elements[(id-1)*3+(ii+1)%3];
+					front[numberofsegments*4+1]=elements[(id-1)*3+(ii+2)%3];
+					front[numberofsegments*4+2]=id;
+					front[numberofsegments*4+3]=IceEnum;
+					numberofsegments+=1;
+					break;
+				}
+			}
+
+			/*In debugging mode, check that the segment has been found*/
+			_assert_(!found);
+		}
+	}
+
+	/*Now that we know how many segments there is we can allocate the final matrix*/
+	if(numberofsegments){
+		front2=xNew<double>(4*numberofsegments);
+		for(i=0;i<4*numberofsegments;i++) front2[i]=(double)front[i];
+	}
+	xDelete<int>(front);
+
+	/*write output datasets: */
+	WriteData(FRONT,front2,numberofsegments,4);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/InternalFront/InternalFront.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/InternalFront/InternalFront.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InternalFront/InternalFront.h	(revision 13651)
@@ -0,0 +1,47 @@
+/*
+	InternalFront.h
+*/
+
+#ifndef _INTERNALFRONT_H
+#define _INTERNALFRONT_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InternalFront"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define MODEL prhs[0]
+/* serial output macros: */
+#define FRONT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define MODEL PyTuple_GetItem(args,0)
+/* serial output macros: */
+#define FRONT output,0]
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  1
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 13651)
@@ -0,0 +1,77 @@
+/*!\file InterpFromGridToMesh.c
+ * \brief: data interpolation from a list of (x,y,values) into mesh vertices
+*/
+	
+#include "./InterpFromGridToMesh.h"
+
+void InterpFromGridToMeshUsage(void){/*{{{*/
+	_pprintLine_("INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points");
+	_pprintLine_("");
+	_pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
+	_pprintLine_("   defined on a grid onto a list of points");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);");
+	_pprintLine_("");
+	_pprintLine_("      data: matrix holding the data to be interpolated onto the mesh.");
+	_pprintLine_("      x,y: coordinates of matrix data. (x and y must be in increasing order)");
+	_pprintLine_("      x_mesh,y_mesh: coordinates of the points onto which we interpolate.");
+	_pprintLine_("      default_value: default value if no data is found (holes).");
+	_pprintLine_("      data_mesh: vector of mesh interpolated data.");
+	_pprintLine_("");
+	_pprintLine_("   Example:");
+	_pprintLine_("      load('velocities.mat');");
+	_pprintLine_("      md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(InterpFromGridToMesh){
+
+	int i,j;
+
+	/*input: */
+	double *x = NULL;
+	double *y = NULL;
+	int     x_rows,y_rows;
+	double *data  = NULL;
+	int     data_rows,data_cols;
+	double *x_mesh = NULL;
+	double *y_mesh = NULL;
+	int     x_mesh_rows,y_mesh_rows;
+	double  default_value;
+	int     interpolationenum;
+
+	/* output: */
+	SeqVec<double>*  data_mesh=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if((nlhs!=NLHS) || (nrhs!=6 && nrhs!=7)){
+		InterpFromGridToMeshUsage();
+		_error_("usage. See above");
+	}
+
+	/*Input datasets: */
+	FetchData(&x,&x_rows,NULL,XHANDLE);
+	FetchData(&y,&y_rows,NULL,YHANDLE);
+	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
+	FetchData(&x_mesh,&x_mesh_rows,NULL,XMESHHANDLE);
+	FetchData(&y_mesh,&y_mesh_rows,NULL,YMESHHANDLE);
+	FetchData(&default_value,DEFAULTHANDLE);
+
+	/* Run core computations: */
+	if(nrhs==7){
+		FetchData(&interpolationenum,INTERPENUM);
+		InterpFromGridToMeshx(&data_mesh, x, x_rows,  y, y_rows, data, data_rows,data_cols, x_mesh, y_mesh, x_mesh_rows,default_value,interpolationenum);
+	}
+	else{
+		InterpFromGridToMeshx(&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);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromGridToMesh/InterpFromGridToMesh.h	(revision 13651)
@@ -0,0 +1,60 @@
+/*!\file InterpFromGridToMesh.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _InterpFromGridToMesh_H
+#define _InterpFromGridToMesh_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromGridToMesh"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* 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]
+#define INTERPENUM    prhs[6]
+/* serial output macros: */
+#define DATAMESH (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define XHANDLE       PyTuple_GetItem(args,0)
+#define YHANDLE       PyTuple_GetItem(args,1)
+#define DATAHANDLE    PyTuple_GetItem(args,2)
+#define XMESHHANDLE   PyTuple_GetItem(args,3)
+#define YMESHHANDLE   PyTuple_GetItem(args,4)
+#define DEFAULTHANDLE PyTuple_GetItem(args,5)
+#define INTERPENUM    PyTuple_GetItem(args,6)
+/* serial output macros: */
+#define DATAMESH output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  6
+
+#endif  /* _INTERPFROMGRIDTOMESH_H */
Index: /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 13651)
@@ -0,0 +1,151 @@
+/*!\file InterpFromMesh2d.c
+ * \brief: data interpolation from a list of (x,y,values) into mesh vertices
+*/
+	
+#include "./InterpFromMesh2d.h"
+
+void InterpFromMesh2dUsage(void){/*{{{*/
+	_pprintLine_("   usage:");
+	_pprintLine_("         data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime);\n");
+	_pprintLine_("      or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value);\n");
+	_pprintLine_("      or data_prime=InterpFromMesh2d(index,x,y,data,x_prime,y_prime,default_value,contourname);\n");
+	_pprintLine_("   where:");
+	_pprintLine_("      x,y: coordinates of the nodes where data is defined");
+	_pprintLine_("      index: index of the mesh where data is defined");
+	_pprintLine_("      data - vector holding the data to be interpolated onto the points.");
+	_pprintLine_("      x_prime,y_prime: coordinates of the mesh vertices onto which we interpolate.");
+	_pprintLine_("      default_value: a scalar or vector of size length(x_prime).");
+	_pprintLine_("      contourname: 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_("      data_prime:  vector of prime interpolated data.");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(InterpFromMesh2d){
+
+	/*input: */
+	double* index_data=NULL;
+	int     index_data_rows;
+	int     dummy;
+
+	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_values=NULL;
+	int     num_default_values=0;
+
+	/*contours*/
+	int i;
+	mxArray *matlabstructure = NULL;
+	Contour<double> **contours=NULL;
+	int numcontours;
+	Contour<double> *contouri=NULL;
+
+	/*Intermediary*/
+	int nods_data;
+	int nels_data;
+	int nods_prime;
+
+	/* output: */
+	SeqVec<double> *data_prime = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if(nlhs!=NLHS){
+		InterpFromMesh2dUsage();
+		_error_("InterpFromMeshToMesh2dUsage usage error");
+	}
+	if((nrhs!=6) && (nrhs!=7) && (nrhs!=8)){
+		InterpFromMesh2dUsage();
+		_error_("InterpFromMeshToMesh2dUsage usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&index_data,&index_data_rows,&dummy,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);
+
+	if(nrhs>=7){
+		/*default values: */
+		FetchData(&default_values,&num_default_values,DEFAULTHANDLE);
+	}
+	else{
+		default_values=NULL;
+		num_default_values=0;
+	}
+
+	if(nrhs>=8){
+		
+		/*Call expread on filename to build a contour array in the matlab workspace: */
+		mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread");
+
+		/*contours: */
+		numcontours=mxGetNumberOfElements(matlabstructure);
+		contours=xNew<Contour<double> *>(numcontours);
+		for(i=0;i<numcontours;i++){
+			//allocate
+			contouri=xNew<Contour<double> >(1);
+			//retrieve dimension of this contour.
+			contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
+			//set pointers.
+			contouri->x=mxGetPr(mxGetField(matlabstructure,i,"x"));
+			contouri->y=mxGetPr(mxGetField(matlabstructure,i,"y"));
+			*(contours+i)=contouri;
+		}
+
+		/* Debugging of contours :{{{1*/
+		/*for(i=0;i<numcontours;i++){
+		  _printLine_("\nContour echo: contour number  " << i+1 << " / " << numcontours);
+		  contouri=*(contours+i);
+		  _printLine_("   Number of vertices " << contouri->nods);
+		  for (j=0;j<contouri->nods;j++){
+		  _printLine_("   " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f");
+		  }
+		  }*/
+		/*}}}*/
+	}
+	else{
+		numcontours=0;
+		contours=NULL;
+	}
+
+
+	/*some checks*/
+	if (x_data_rows!=y_data_rows){
+		_error_("vectors x and y should have the same length!");
+	}
+	if (x_prime_rows!=y_prime_rows){
+		_error_("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_values,num_default_values,contours,numcontours);
+
+	/*Write data: */
+	WriteData(DATAPRIME,data_prime);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.h	(revision 13651)
@@ -0,0 +1,60 @@
+/*!\file InterpFromMesh2d.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _INTERPFROMMESH2D_H
+#define _INTERPFROMMESH2D_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMesh2d"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* 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]
+#define FILENAME      prhs[7]
+/* serial output macros: */
+#define DATAPRIME (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEXHANDLE   PyTuple_GetItem(args,0)
+#define XHANDLE       PyTuple_GetItem(args,1)
+#define YHANDLE       PyTuple_GetItem(args,2)
+#define DATAHANDLE    PyTuple_GetItem(args,3)
+#define XPRIMEHANDLE  PyTuple_GetItem(args,4)
+#define YPRIMEHANDLE  PyTuple_GetItem(args,5)
+#define DEFAULTHANDLE PyTuple_GetItem(args,6)
+#define FILENAME      PyTuple_GetItem(args,7)
+/* serial output macros: */
+#define DATAPRIME output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+
+#endif  /* _INTERPFROMMESH2D_H */
Index: /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 13651)
@@ -0,0 +1,77 @@
+/*\file InterpFromMeshToGrid.c
+ *\brief: compute diff between observed and modeled velocity
+ */
+
+#include "./InterpFromMeshToGrid.h"
+
+void InterpFromMeshToGridUsage(void){/*{{{*/
+	_pprintLine_("INTERPFROMMESHTOGRID - interpolation of a data defined on a mesh onto a grid");
+	_pprintLine_("");
+	_pprintLine_("   This function is a multi-threaded mex file that interpolates a field");
+	_pprintLine_("   defined on a triangular mesh onto a regular grid");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)");
+	_pprintLine_("");
+	_pprintLine_("      index,x,y: delaunay triangulation defining the mesh.");
+	_pprintLine_("      meshdata: vertex values of data to be interpolated.");
+	_pprintLine_("      xmin,ymax,posting,nlines,ncols: parameters that define the grid");
+	_pprintLine_("      default_value: value of points located out of the mesh.");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(InterpFromMeshToGrid){
+
+	/*input datasets: */
+	double* index=NULL;
+	int     nel;
+	double* x=NULL;
+	int     nods;
+	double* y=NULL;
+	double* meshdata=NULL;
+	int     meshdata_length;
+	double  xmin;
+	double  ymax;
+	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(&index,&nel,NULL,INDEX);
+	FetchData(&x,&nods,NULL,X);
+	FetchData(&y,NULL,NULL,Y);
+	FetchData(&meshdata,&meshdata_length,NULL,MESHDATA);
+	FetchData(&xmin,XMIN);
+	FetchData(&ymax,YMAX);
+	FetchData(&xposting,XPOSTING);
+	FetchData(&yposting,YPOSTING);
+	FetchData(&nlines,NLINES);
+	FetchData(&ncols,NCOLS);
+	FetchData(&default_value,DEFAULTVALUE);
+
+	/*Call core of computation: */
+	InterpFromMeshToGridx(&x_m,&y_m,&griddata,index,x,y,nods,nel,meshdata,meshdata_length,xmin,ymax,xposting,yposting,nlines,ncols,default_value);
+
+	/*Write results: */
+	WriteData(XM,x_m,ncols);
+	WriteData(YM,y_m,nlines);
+	WriteData(GRIDDATA,griddata,nlines,ncols);
+
+	/*Free ressources: */
+	//let matlab do this.
+	
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 13651)
@@ -0,0 +1,72 @@
+/*
+	InterpFromMeshToGrid.h
+*/
+
+#ifndef _INTERPFROMMESHTOGRID_H
+#define _INTERPFROMMESHTOGRID_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMeshToGrid"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define INDEX        prhs[0]
+#define X            prhs[1]
+#define Y            prhs[2]
+#define MESHDATA     prhs[3]
+#define XMIN         prhs[4]
+#define YMAX         prhs[5]
+#define XPOSTING     prhs[6]
+#define YPOSTING     prhs[7]
+#define NLINES       prhs[8]
+#define NCOLS        prhs[9]
+#define DEFAULTVALUE prhs[10]
+/* serial output macros: */
+#define XM (mxArray**)&plhs[0]
+#define YM (mxArray**)&plhs[1]
+#define GRIDDATA (mxArray**)&plhs[2]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEX        PyTuple_GetItem(args,0)
+#define X            PyTuple_GetItem(args,1)
+#define Y            PyTuple_GetItem(args,2)
+#define MESHDATA     PyTuple_GetItem(args,3)
+#define XMIN         PyTuple_GetItem(args,4)
+#define YMAX         PyTuple_GetItem(args,5)
+#define XPOSTING     PyTuple_GetItem(args,6)
+#define YPOSTING     PyTuple_GetItem(args,7)
+#define NLINES       PyTuple_GetItem(args,8)
+#define NCOLS        PyTuple_GetItem(args,9)
+#define DEFAULTVALUE PyTuple_GetItem(args,10)
+/* serial output macros: */
+#define XM output,0
+#define YM output,1
+#define GRIDDATA output,2
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  3
+#undef NRHS
+#define NRHS  11
+
+#endif  /* _INTERPFROMMESHTOGRID_H*/
Index: /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 13651)
@@ -0,0 +1,79 @@
+/*\file InterpFromMeshToMesh2d.c
+ *\brief: bamg module.
+ */
+#include "./InterpFromMeshToMesh2d.h"
+
+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 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,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_("      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,'default',253);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(InterpFromMeshToMesh2d){
+
+	/*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: */
+	MODULEBOOT();
+
+	/*checks on output arguments on the matlab side: */
+	#ifdef _HAVE_MATLAB_MODULES_
+	if(nlhs!=NLHS){
+		InterpFromMeshToMesh2dUsage();
+		_error_("InterpFromMeshToMesh2dUsage usage error");
+	}
+	#endif
+	/*check on input arguments: */
+	if(nrhs<NRHS){
+		InterpFromMeshToMesh2dUsage();
+		_error_("InterpFromMeshToMesh2dUsage usage error");
+	}
+
+	/*Fetch inputs: */
+	FetchData(&index,&nels_data,&test,INDEX); if(test!=3) _error_("index should have 3 columns");
+	FetchData(&x_data,&nods_data,X);          if(nods_data<3) _error_("there should be at least three points");
+	FetchData(&y_data,&test,Y);               if(test!=nods_data) _error_("vectors x and y should have the same length");
+	FetchData(&data,&M_data,&N_data,DATA);    if(M_data*N_data<1) _error_("data is empty");
+	FetchData(&x_interp,&N_interp,XINTERP);   if(N_interp<1) _error_("no interpolation requested");
+	FetchData(&y_interp,&test,YINTERP);       if(test!=N_interp) _error_("vectors x_interp and y_interp should have the same length");
+	FetchData(&options,NRHS,nrhs,ARGUMENTS);
+
+	/*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,N_interp,N_data);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 13651)
@@ -0,0 +1,65 @@
+/*!\file InterpFromMeshToMesh2d.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _INTERPFROMMESHTOMESH2d_H
+#define _INTERPFROMMESHTOMESH2d_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/toolkits/toolkits.h"
+#include "../../c/include/include.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMeshToMesh2d"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define INDEX     prhs[0]
+#define X         prhs[1]
+#define Y         prhs[2]
+#define DATA      prhs[3]
+#define XINTERP   prhs[4]
+#define YINTERP   prhs[5]
+#define ARGUMENTS prhs 
+/* serial output macros: */
+#define DATAINTERP (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEX          PyTuple_GetItem(args,0)
+#define X              PyTuple_GetItem(args,1)
+#define Y              PyTuple_GetItem(args,2)
+#define DATA           PyTuple_GetItem(args,3)
+#define XINTERP        PyTuple_GetItem(args,4)
+#define YINTERP        PyTuple_GetItem(args,5)
+#define ARGUMENTS args
+/* serial output macros: */
+#define DATAINTERP output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  6
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 13651)
@@ -0,0 +1,101 @@
+/*!\file InterpFromMeshToMesh3d.c
+ * \brief: data interpolation from a list of (x,y,values) into mesh vertices
+*/
+	
+#include "./InterpFromMeshToMesh3d.h"
+
+void InterpFromMeshToMesh3dUsage(void){/*{{{*/
+	_pprintLine_("INTERPFROMMESHTOMESH3D - interpolation from a 3d hexahedron 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_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      data_prime=InterpFromMeshToMesh3d(index,x,y,z,data,x_prime,y_prime,z_prime,default_value);");
+	_pprintLine_("");
+	_pprintLine_("      index: index of the mesh where data is defined");
+	_pprintLine_("      x,y,z: coordinates of the nodes where data is defined");
+	_pprintLine_("      data: matrix holding the data to be interpolated onto the mesh.");
+	_pprintLine_("      x_prime,y_prime,z_prime: coordinates of the points onto which we interpolate.");
+	_pprintLine_("      default_value: default value if no data is found (holes).");
+	_pprintLine_("      data_prime: vector of mesh interpolated data.");
+	_pprintLine_("");
+	_pprintLine_("   Example:");
+	_pprintLine_("      load('temperature.mat');");
+	_pprintLine_("      md.initialization.temperature=InterpFromMeshToMesh3d(index,x,y,z,temperature,md.mesh.x,md.mesh.y,md.mesh.z,253);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(InterpFromMeshToMesh3d){
+
+	/*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: */
+	SeqVec<double>*  data_prime=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InterpFromMeshToMesh3dUsage);
+
+	/*Input datasets: */
+	FetchData(&index_data,&index_data_rows,NULL,INDEXHANDLE);
+	FetchData(&x_data,&x_data_rows,NULL,XHANDLE);
+	FetchData(&y_data,&y_data_rows,NULL,YHANDLE);
+	FetchData(&z_data,&z_data_rows,NULL,ZHANDLE);
+	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
+	FetchData(&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE);
+	FetchData(&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE);
+	FetchData(&z_prime,&z_prime_rows,NULL,ZPRIMEHANDLE);
+	FetchData(&default_value,DEFAULTHANDLE);
+
+	/*some checks*/
+	if (x_data_rows!=y_data_rows || x_data_rows!=z_data_rows){
+		_error_("vectors x, y and z should have the same length!");
+	}
+	if (x_prime_rows!=y_prime_rows || x_prime_rows!=z_prime_rows){
+		_error_("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: */
+	InterpFromMeshToMesh3dx(&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);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h	(revision 13651)
@@ -0,0 +1,64 @@
+/*!\file InterpFromMeshToMesh3d.h
+ * \brief: prototype for Data Interpolation mex module.
+ */
+
+#ifndef _INTERPFROMMESH3D_H
+#define _INTERPFROMMESH3D_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "InterpFromMeshToMesh3d"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* 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]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEXHANDLE   PyTuple_GetItem(args,0)
+#define XHANDLE       PyTuple_GetItem(args,1)
+#define YHANDLE       PyTuple_GetItem(args,2)
+#define ZHANDLE       PyTuple_GetItem(args,3)
+#define DATAHANDLE    PyTuple_GetItem(args,4)
+#define XPRIMEHANDLE  PyTuple_GetItem(args,5)
+#define YPRIMEHANDLE  PyTuple_GetItem(args,6)
+#define ZPRIMEHANDLE  PyTuple_GetItem(args,7)
+#define DEFAULTHANDLE PyTuple_GetItem(args,8)
+/* serial output macros: */
+#define DATAPRIME output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  9
+
+#endif  /* _INTERPFROMMESHTOMESH3D_H */
Index: /issm/trunk-jpl/src/wrappers/KMLFileRead/KMLFileRead.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/KMLFileRead/KMLFileRead.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/KMLFileRead/KMLFileRead.cpp	(revision 13651)
@@ -0,0 +1,127 @@
+/*\file KMLFileRead.c
+ *\brief: KML file reader module.
+ */
+#include "./KMLFileRead.h"
+
+void KMLFileReadUsage(void){/*{{{*/
+	_pprintLine_("KMLFileRead - KML file reader module:");
+	_pprintLine_("");
+	_pprintLine_("   This module reads a KML file.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [ierror]=KMLFileRead(kmlfile,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      kmlfile      file name of kml file to be read (char)");
+	_pprintLine_("");
+	_pprintLine_("      echo         echo command (char, optional, 'off'/'on')");
+	_pprintLine_("      deepecho     deep echo command (char, optional, 'off'/'on')");
+	_pprintLine_("      write        write command (char, optional, 'off'/'stdout'/kmlfile)");
+	_pprintLine_("");
+	_pprintLine_("      ierror       return code (non-zero for error)");
+	_pprintLine_("");
+	_pprintLine_("   Examples:");
+	_pprintLine_("      [ierror]=KMLFileRead('file.kml','deepecho','on');");
+	_pprintLine_("      [ierror]=KMLFileRead('filin.kml','echo','on','write','filout.kml');");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(KMLFileRead){
+
+	int i,j,nnodes=0,verbose=1;
+	KML_Object* kobj;
+
+	/*input: */
+	char*   name=NULL;
+	char*   notes=NULL;
+	const mxArray* notesi;
+	mwIndex        nindex;
+	int*    elem=NULL;
+	int     melem=0,nelem=0;
+	int*    nodecon=NULL;
+	int     mncon=0,nncon=0;
+	double* lat=NULL;
+	int     mlat=0,nlat=0,llat=0;
+	double* lng=NULL;
+	int     mlng=0,nlng=0,llng=0;
+	int     nparts=0;
+	int*    part=NULL;
+	int     mprt=0,nprt=0,lprt=0;
+	double* data=NULL;
+	int     mdata=0,ndata=0;
+	double* cmap=NULL;
+	int     mcmap=0,ncmap=0;
+	char*   filnam=NULL;
+	FILE*   fidi=NULL;
+	FILE*   fido=NULL;
+	Options* options=NULL;
+	char*    echo    =NULL;
+	char*    deepecho=NULL;
+	char*    write   =NULL;
+
+	/* output: */
+	int     ierror=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		KMLFileReadUsage(); _error_("KMLFileRead usage error");
+	}
+	if (nrhs < NRHS) {
+		KMLFileReadUsage(); _error_("KMLFileRead usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&filnam,FILENAME);
+	FetchData(&options,NRHS,nrhs,prhs);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	options->Get(&echo    ,"echo"    ,(char*)"off");
+	options->Get(&deepecho,"deepecho",(char*)"off");
+	options->Get(&write   ,"write"   ,(char*)"off");
+
+	/*some checks*/
+	if (!strlen(filnam)) strcpy(filnam,"stdout");
+
+	if (verbose) _printLine_("Opening file \"" << filnam << "\".");
+	fidi=fopen(filnam,"r");
+
+	/* Run core computations: */
+	if (verbose) _printLine_("Calling core:");
+	kobj=KMLFileReadx(fidi);
+
+	if (verbose) _printLine_("Closing file \"" << filnam << "\".");
+	fclose(fidi);
+
+	if (kobj){
+		if (!strncmp(echo    ,"on",2) || !strncmp(echo    ,"y",1))
+			kobj->Echo();
+		if (!strncmp(deepecho,"on",2) || !strncmp(deepecho,"y",1))
+			kobj->DeepEcho();
+		if (strncmp(write,"off",3) && strncmp(write,"no",2)) {
+			if (!strncmp(write,"on",2) || !strncmp(write,"yes",3) || !strncmp(write,"stdout",6)) {
+				kobj->Write(stdout,"");
+			}
+			else {
+				if (verbose) _printLine_("Opening file \"" << write << "\".");
+				fido=fopen(write,"w");
+				kobj->Write(fido,"");
+				if (verbose) _printLine_("Closing file \"" << write << "\".");
+				ierror=fclose(fido);
+			}
+		}
+		delete kobj;
+	}
+
+	/*Write data: */
+	WriteData(ERRORFLAG,ierror);
+
+	/*Clean-up*/
+	xDelete<char>(write);
+	xDelete<char>(deepecho);
+	xDelete<char>(echo);
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/KMLFileRead/KMLFileRead.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/KMLFileRead/KMLFileRead.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/KMLFileRead/KMLFileRead.h	(revision 13651)
@@ -0,0 +1,48 @@
+/*!\file KMLFileRead.h
+ * \brief: prototype for KML file reader mex module.
+ */
+
+#ifndef _KMLFILEREAD_H
+#define _KMLFILEREAD_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "KMLFileRead"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define FILENAME prhs[0]
+/* serial output macros: */
+#define ERRORFLAG (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define FILENAME PyTuple_GetItem(args,0)
+/* serial output macros: */
+#define ERRORFLAG output,0
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  1
+#undef NLHS
+#define NLHS  1
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/KMLMeshWrite/KMLMeshWrite.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/KMLMeshWrite/KMLMeshWrite.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/KMLMeshWrite/KMLMeshWrite.cpp	(revision 13651)
@@ -0,0 +1,148 @@
+/*\file KMLMeshWrite.c
+ *\brief: KML mesh writer module.
+ */
+#include "./KMLMeshWrite.h"
+
+void KMLMeshWriteUsage(void){/*{{{*/
+	_pprintLine_("KMLMeshWrite - KML mesh writer module:");
+	_pprintLine_("");
+	_pprintLine_("   This module writes the mesh of a model as KML polygons into the specified KML file.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      ierror=KMLMeshWrite(name,notes,elem,nodecon,lat,long,part,data,cmap,kmlfile);");
+	_pprintLine_("");
+	_pprintLine_("      name       model name (string, may be empty)");
+	_pprintLine_("      notes      model notes (string or cell array of strings, may be empty)");
+	_pprintLine_("      elem       elements (double array)");
+	_pprintLine_("      nodecon    nodal connectivity array (double array, may be empty)");
+	_pprintLine_("      lat        nodal latititudes (double vector)");
+	_pprintLine_("      long       nodal longitudes (double vector)");
+	_pprintLine_("      part       nodal partitions (double vector, may be empty)");
+	_pprintLine_("      data       nodal or element data (double vector, may be empty)");
+	_pprintLine_("      cmap       color map (double nx3 array, may be empty)");
+	_pprintLine_("      kmlfile    KML file name (string)");
+	_pprintLine_("");
+	_pprintLine_("      ierror     error flag (double, non-zero for error)");
+	_pprintLine_("");
+	_pprintLine_("   Example:");
+	_pprintLine_("      KMLMeshWrite(md.name,md.notes,md.elements,md.nodeconnectivity,md.lat,md.long,md.part,md.fm_criterion,options.cmap,filekml);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(KMLMeshWrite){
+
+	int i,j,nnodes=0,verbose=1;
+
+	/*input: */
+	char*   name=NULL;
+	char*   notes=NULL;
+	char*   notes2=NULL;
+	const mxArray* notesi;
+	mwIndex        nindex;
+	int*    elem=NULL;
+	int     melem=0,nelem=0;
+	int*    nodecon=NULL;
+	int     mncon=0,nncon=0;
+	double* lat=NULL;
+	int     mlat=0,nlat=0,llat=0;
+	double* lng=NULL;
+	int     mlng=0,nlng=0,llng=0;
+	int     nparts=0;
+	int*    part=NULL;
+	int     mprt=0,nprt=0,lprt=0;
+	double* data=NULL;
+	int     mdata=0,ndata=0;
+	double* cmap=NULL;
+	int     mcmap=0,ncmap=0;
+	char*   filnam=NULL;
+	FILE*   fid=NULL;
+	Options* options=NULL;
+
+	/* output: */
+	int     ierror=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		KMLMeshWriteUsage(); _error_("KMLMeshWrite usage error");
+	}
+	if (nrhs < NRHS) {
+		KMLMeshWriteUsage(); _error_("KMLMeshWrite usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&name,NAME);
+
+/*  notes is typically a cell array of character strings  */
+	if (mxIsCell(NOTES)) {
+		for (nindex=0; nindex<mxGetNumberOfElements(NOTES); nindex++) {
+			notesi=mxGetCell(NOTES,nindex);
+			if (notesi && mxIsChar(notesi) && mxGetNumberOfElements(notesi)) {
+				if (!notes) {
+					notes=xNew<char>(mxGetNumberOfElements(notesi)+1);
+					mxGetString(notesi,notes,mxGetNumberOfElements(notesi)+1);
+				}
+				else {
+/*  note that strlen does not include trailing null  */
+					notes2=xNew<char>(strlen(notes)+1+mxGetNumberOfElements(notesi)+1);
+					memcpy(notes2,notes,(strlen(notes)+1)*sizeof(char));
+					xDelete<char>(notes);
+					notes=notes2;
+					notes2=NULL;
+//					notes=(char*)xrealloc(notes,(strlen(notes)+1+mxGetNumberOfElements(notesi)+1)*sizeof(char));
+					strcat(notes,"\n");
+					mxGetString(notesi,&notes[strlen(notes)],mxGetNumberOfElements(notesi)+1);
+				}
+			}
+		}
+	}
+	else
+		FetchData(&notes,NOTES);
+	FetchData(&elem,&melem,&nelem,ELEMHANDLE);
+	FetchData(&nodecon,&mncon,&nncon,NODECONHANDLE);
+	FetchData(&lat,&mlat,&nlat,LATHANDLE);
+	llat=mlat*nlat;
+	FetchData(&lng,&mlng,&nlng,LNGHANDLE);
+	llng=mlng*nlng;
+	FetchData(&part,&mprt,&nprt,PARTHANDLE);
+	lprt=mprt*nprt;
+	FetchData(&data,&mdata,&ndata,DATAHANDLE);
+	FetchData(&cmap,&mcmap,&ncmap,CMAPHANDLE);
+	FetchData(&filnam,FILENAME);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	/*some checks*/
+	for (i=0; i<melem*nelem; i++) if(elem[i]>nnodes) nnodes=elem[i];
+	if(part) for (i=0; i<lprt; i++) if (part[i]+1 > nparts) nparts=part[i]+1;
+
+	if (nodecon && (mncon != nnodes))
+	  {_error_("Nodal connectivity table, if supplied, must be supplied for all nodes.");}
+	else if (!nodecon)
+		mncon=nnodes;
+	if ((llat != nnodes) || (llng != nnodes) || (llat != llng))
+		_error_("Latitude and longitude vectors must be supplied for all nodes.");
+	if (part && (lprt != nnodes))
+		_error_("Partitioning vector, if supplied, must be supplied for all nodes.");
+	if (data && !((mdata == nnodes) || (mdata == melem)))
+		_error_("Data matrix, if supplied, must be supplied for all nodes or all elements.");
+	if (cmap && (ncmap != 3))
+		_error_("Colormap matrix, if supplied, must have three columns for rgb.");
+	if (!strlen(filnam))
+		strcpy(filnam,"stdout");
+
+	/* Run core computations: */
+	fid=fopen(filnam,"w");
+	KMLMeshWritex(&ierror,name,notes,elem,melem,nelem,nodecon,mncon,nncon,lat,lng,part,data,mdata,ndata,cmap,mcmap,ncmap,fid);
+	fclose(fid);
+
+	/*Write data: */
+	WriteData(ERRORFLAG,ierror);
+
+	/*Clean-up*/
+	delete options;
+	if (mxIsCell(NOTES) && notes) xDelete<char>(notes);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/KMLMeshWrite/KMLMeshWrite.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/KMLMeshWrite/KMLMeshWrite.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/KMLMeshWrite/KMLMeshWrite.h	(revision 13651)
@@ -0,0 +1,66 @@
+/*!\file KMLMeshWrite.h
+ * \brief: prototype for KML mesh writer mex module.
+ */
+
+#ifndef _KMLMESHWRITE_H
+#define _KMLMESHWRITE_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "KMLMeshWrite"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define NAME          prhs[0]
+#define NOTES         prhs[1]
+#define ELEMHANDLE    prhs[2]
+#define NODECONHANDLE prhs[3]
+#define LATHANDLE     prhs[4]
+#define LNGHANDLE     prhs[5]
+#define PARTHANDLE    prhs[6]
+#define DATAHANDLE    prhs[7]
+#define CMAPHANDLE    prhs[8]
+#define FILENAME      prhs[9]
+/* serial output macros: */
+#define ERRORFLAG (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define NAME          PyTuple_GetItem(args,0)
+#define NOTES         PyTuple_GetItem(args,1)
+#define ELEMHANDLE    PyTuple_GetItem(args,2)
+#define NODECONHANDLE PyTuple_GetItem(args,3)
+#define LATHANDLE     PyTuple_GetItem(args,4)
+#define LNGHANDLE     PyTuple_GetItem(args,5)
+#define PARTHANDLE    PyTuple_GetItem(args,6)
+#define DATAHANDLE    PyTuple_GetItem(args,7)
+#define CMAPHANDLE    PyTuple_GetItem(args,8)
+#define FILENAME      PyTuple_GetItem(args,9)
+/* serial output macros: */
+#define ERRORFLAG output,0
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS 10
+#undef NLHS
+#define NLHS  1
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/KMLOverlay/KMLOverlay.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/KMLOverlay/KMLOverlay.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/KMLOverlay/KMLOverlay.cpp	(revision 13651)
@@ -0,0 +1,133 @@
+/*\file KMLOverlay.c
+ *\brief: KML file overlay mex module.
+ */
+#include "./KMLOverlay.h"
+
+void KMLOverlayUsage(void){/*{{{*/
+	_pprintLine_("KMLOverlay - KML file overlay module:");
+	_pprintLine_("");
+	_pprintLine_("   This module reads a list of image files and writes a KML or KMZ overlay file.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      ierror=KMLOverlay(kmlfile,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      kmlfile     KML or KMZ file name (string)");
+	_pprintLine_("");
+	_pprintLine_("      lataxis     latitude axis (double vector [south north], required)");
+	_pprintLine_("      longaxis    longitude axis (double vector [west east], required)");
+	_pprintLine_("      images      relative or http image file names (string or array of strings or cell array of strings, required)");
+	_pprintLine_("      zip         flag to zip the doc.kml and image files into kmzfile (double, non-zero for kmz)");
+	_pprintLine_("");
+	_pprintLine_("      ierror     error flag (double, non-zero for error)");
+	_pprintLine_("");
+	_pprintLine_("   Example:");
+	_pprintLine_("      KMLOverlay(kmlfile,'lataxis',[south north],'longaxis',[west east],'images',{'file1.png','http://issm/file2.png'},'zip',1);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(KMLOverlay){
+
+	int i,verbose=1;
+
+	/*input: */
+	char*   filkml=NULL;
+	char*   filkmz=NULL;
+
+	FILE*   fid=NULL;
+
+	Options* options=NULL;
+	int      nlat=0,nlong=0;
+	double*  lataxis =NULL;
+	double*  longaxis=NULL;
+	int      nimages=0;
+	char**   pimages=NULL;
+	double   dzip=0;
+	char*    czip=NULL;
+
+	/* output: */
+	int     ierror=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if(nlhs>NLHS){
+		KMLOverlayUsage(); _error_("KMLOverlay usage error");
+	}
+	if(nrhs<NRHS){
+		KMLOverlayUsage(); _error_("KMLOverlay usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&filkml,FILENAME);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	options->Get(&lataxis ,&nlat ,(char*)"lataxis");
+	if (verbose && lataxis) for (i=0; i<nlat; i++) _printLine_("  lataxis [" << i << "]=" << lataxis[i]);
+	options->Get(&longaxis,&nlong,(char*)"longaxis");
+	if (verbose && longaxis) for (i=0; i<nlong; i++) _printLine_("  longaxis[" << i << "]=" << longaxis[i]);
+	options->Get(&pimages,&nimages,(char*)"images");
+	if (verbose && pimages) for (i=0; i<nimages; i++) _printLine_("  pimages[" << i << "]=\"" << pimages[i] << "\"");
+	options->Get(&dzip,(char*)"zip",0.);
+	if (verbose) _printLine_("  dzip=" << dzip);
+
+	/*some checks*/
+	if (nlat !=2) _error_("Latitudinal axes \"lataxis\" require two double values, not " << nlat << ".");
+	if (nlong!=2) _error_("Longitudinal axes \"longaxis\" require two double values, not " << nlong << ".");
+	if (!nimages) _error_("No image files provided.");
+
+	if ((int)dzip){
+		filkmz=filkml;
+		filkml=(char*)mxMalloc(8*sizeof(char));
+		strcpy(filkml,"doc.kml");
+	}
+
+	if(!strlen(filkml)) strcpy(filkml,"stdout");
+
+	if(verbose) _printLine_("Opening kml overlay file \"" << filkml << "\".");
+	fid=fopen(filkml,"w");
+
+	/* Run core computations: */
+	if (verbose) _printLine_("Calling core:");
+	KMLOverlayx(&ierror,lataxis,longaxis,nimages,pimages,fid);
+
+	if (verbose) _printLine_("Closing file \"" << filkml << "\".");
+	fclose(fid);
+
+	/* Create kmz file, if specified: */
+	if ((int)dzip) {
+		czip=(char*)mxMalloc((5+strlen(filkmz)+1+strlen(filkml)+1)*sizeof(char));
+		czip[0]='\0';
+		strcat(czip,"!zip ");
+		strcat(czip,filkmz);
+		strcat(czip," ");
+		strcat(czip,filkml);
+		for (i=0; i<nimages; i++)
+			if (strlen(pimages[i]) && strncmp(pimages[i],"http",4)) {
+				czip=(char*)mxRealloc(czip,(strlen(czip)+1+strlen(pimages[i])+1)*sizeof(char));
+				strcat(czip," ");
+				strcat(czip,pimages[i]);
+			}
+		if (verbose) _printLine_("Zipping file \"" << filkmz << "\".");
+		if (verbose) _printLine_(czip);
+
+		if (mexEvalString(czip)) _error_("Error zipping file \"" << filkmz << "\".");
+		xDelete<char>(czip);
+		xDelete<char>(filkmz);
+	}
+
+	/*Write data: */
+	WriteData(ERRORFLAG,ierror);
+
+	/*Clean-up*/
+	if (pimages) {
+		for (i=nimages; i>0; i--) xDelete<char>(pimages[i-1]);
+		xDelete<char*>(pimages);
+	}
+	xDelete<double>(longaxis);
+	xDelete<double>(lataxis);
+	xDelete<char>(filkml);
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/KMLOverlay/KMLOverlay.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/KMLOverlay/KMLOverlay.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/KMLOverlay/KMLOverlay.h	(revision 13651)
@@ -0,0 +1,48 @@
+/*!\file KMLOverlay.h
+ * \brief: prototype for KML file overlay mex module.
+ */
+
+#ifndef _KMLOVERLAY_H
+#define _KMLOVERLAY_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "KMLOverlay"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define FILENAME  prhs[0]
+/* serial output macros: */
+#define ERRORFLAG (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define FILENAME  PyTuple_GetItem(args,0)
+/* serial output macros: */
+#define ERRORFLAG output,0
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  1
+#undef NLHS
+#define NLHS  1
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/Kml2Exp/Kml2Exp.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Kml2Exp/Kml2Exp.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Kml2Exp/Kml2Exp.cpp	(revision 13651)
@@ -0,0 +1,88 @@
+/*\file Kml2Exp.c
+ *\brief: kml to exp file conversion mex module.
+ */
+#include "./Kml2Exp.h"
+
+void Kml2ExpUsage(void){/*{{{*/
+	_pprintLine_("Kml2Exp - kml to exp file conversion module:");
+	_pprintLine_("");
+	_pprintLine_("   This module converts a file from kml to exp format.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [ret]=Kml2Exp(filexp,filkml,sgn,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      filkml      file name of kml file to be read (char)");
+	_pprintLine_("      filexp      file name of exp file to be written (char)");
+	_pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
+	_pprintLine_("");
+	_pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
+	_pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
+	_pprintLine_("");
+	_pprintLine_("      ret         return code (non-zero for warning)");
+	_pprintLine_("");
+	_pprintLine_("   Examples:");
+	_pprintLine_("      [ret]=Kml2Exp('file.kml','file.exp', 1);");
+	_pprintLine_("      [ret]=Kml2Exp('file.kml','file.exp', 1,'central_meridian',45,'standard_parallel',70);");
+	_pprintLine_("      [ret]=Kml2Exp('file.kml','file.exp',-1,'central_meridian', 0,'standard_parallel',71);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Kml2Exp){
+
+	int i,verbose=1;
+
+	/*input: */
+	char    *filkml=NULL,*filexp=NULL;
+	int     sgn;
+	Options* options=NULL;
+	double   cm=0.,sp=0.;
+
+	/* output: */
+	int     iret=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		Kml2ExpUsage(); _error_("Kml2Exp usage error");
+	}
+	if (nrhs < NRHS) {
+		Kml2ExpUsage(); _error_("Kml2Exp usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&filkml,KML_IN);
+	FetchData(&filexp,EXP_IN);
+	FetchData(&sgn,SGN_IN);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	/*  defaults are in Ll2xydef, so don't duplicate them here, and only use user values if both have been specified  */
+	if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
+		options->Get(&cm,"central_meridian");
+		if (verbose) _printLine_("  cm=" << cm);
+		options->Get(&sp,"standard_parallel");
+		if (verbose) _printLine_("  sp=" << sp);
+	}
+
+	/*some checks*/
+	if (sgn !=+1 && sgn!= -1) _error_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
+	if (fabs(cm)      > 180.) _error_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
+	if (sp < 0. || sp >  90.) _error_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
+
+	/* Run core computations: */
+	if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
+		iret=Kml2Expx(filkml,filexp,sgn,cm,sp);
+	else
+		iret=Kml2Expx(filkml,filexp,sgn);
+
+	/*Write data: */
+	WriteData(RET_OUT,iret);
+
+	/*Clean-up*/
+	xDelete<char>(filexp);
+	xDelete<char>(filkml);
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Kml2Exp/Kml2Exp.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Kml2Exp/Kml2Exp.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Kml2Exp/Kml2Exp.h	(revision 13651)
@@ -0,0 +1,52 @@
+/*!\file Kml2Exp.h
+ * \brief: prototype for kml to exp file conversion mex module.
+ */
+
+#ifndef _KML2EXP_H
+#define _KML2EXP_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Kml2Exp"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define KML_IN prhs[0]
+#define EXP_IN prhs[1]
+#define SGN_IN prhs[2]
+/* serial output macros: */
+#define RET_OUT    (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define KML_IN PyTuple_GetItem(args,0)
+#define EXP_IN PyTuple_GetItem(args,1)
+#define SGN_IN PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define RET_OUT    output,0
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  3
+#undef NLHS
+#define NLHS  1
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/Kriging/Kriging.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Kriging/Kriging.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Kriging/Kriging.cpp	(revision 13651)
@@ -0,0 +1,73 @@
+/*\file Kriging.c
+ *\brief: best linear predictor
+ */
+#include "./Kriging.h"
+
+void KrigingUsage(void){/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: predictions=" << __FUNCT__ << "(x,y,observations,x_interp,y_interp,'options');");
+	_pprintLine_("   available options:");
+	_pprintLine_("      -'model': Available variogram models 'gaussian' (default),'spherical','power','exponential'");
+	_pprintLine_("         -'nugget': nugget effect (default 0.2)");
+	_pprintLine_("         -'range':  for gaussian, spherical and exponential models (default sqrt(3))");
+	_pprintLine_("         -'sill':   for gaussian, spherical and exponential models (default 1)");
+	_pprintLine_("         -'slope':  for power model (default 1)");
+	_pprintLine_("         -'power':  for power model (default 1)");
+	_pprintLine_("      -'searchradius': search radius for each prediction (default is observations span)");
+	_pprintLine_("      -'boxlength':    minimum length of quadtree boxes (useful to decrease the number of observations)");
+	_pprintLine_("      -'maxdata':      minimum number of observations for a prediction (default is 50)");
+	_pprintLine_("      -'mindata':      maximum number of observations for a prediction (default is 1)");
+	_pprintLine_("      -'maxtrimming':  maximum trimming value (default is -1.e+21)");
+	_pprintLine_("      -'mintrimming':  minimum trimming value (default is +1.e+21)");
+	_pprintLine_("      -'minspacing':   minimum distance between observation (default is 0.01)");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Kriging){
+
+	/*Outputs*/
+	double  *x            = NULL;
+	double  *y            = NULL;
+	double  *observations = NULL;
+	double  *x_interp     = NULL;
+	double  *y_interp     = NULL;
+	double  *predictions  = NULL;
+	double  *error        = NULL;
+	Options *options      = NULL;
+	int      N_interp,M_interp,M,N,n_obs;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nrhs<NRHS || nlhs>NLHS){
+		KrigingUsage(); _error_("Kriging usage error");
+	}
+
+	/*Fetch inputs: */
+	FetchData(&x,&n_obs,X);
+	FetchData(&y,&N,Y);                       if(n_obs!=N) _error_("x and y should have the same size");
+	FetchData(&observations,&N,OBSERVATIONS); if(n_obs!=N) _error_("x and observations should have the same size");
+	FetchData(&x_interp,&M_interp,&N_interp,XINTERP);
+	FetchData(&y_interp,&M,&N,YINTERP);       if(N!=N_interp || M!=M_interp) _error_("x_interp and y_interp should have the same size");
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	/*Call x layer*/
+	Krigingx(&predictions,&error,x,y,observations,n_obs,x_interp,y_interp,M_interp*N_interp,options);
+
+	/*Generate output Matlab Structures*/
+	if(nlhs>=1) WriteData(PREDICTIONS,predictions,M_interp,N_interp);
+	if(nlhs==2) WriteData(ERROR,error,M_interp,N_interp);
+
+	/*Free ressources: */
+	xDelete<double>(x);
+	xDelete<double>(y);
+	xDelete<double>(observations);
+	xDelete<double>(x_interp);
+	xDelete<double>(y_interp);
+	xDelete<double>(predictions);
+	xDelete<double>(error);
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Kriging/Kriging.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Kriging/Kriging.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Kriging/Kriging.h	(revision 13651)
@@ -0,0 +1,59 @@
+/*
+	Kriging.h
+*/
+
+#ifndef _KRIGING_H_
+#define _KRIGING_H_
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Kriging"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define X            prhs[0]
+#define Y            prhs[1]
+#define OBSERVATIONS prhs[2]
+#define XINTERP      prhs[3]
+#define YINTERP      prhs[4]
+
+/* serial output macros: */
+#define PREDICTIONS (mxArray**)&plhs[0]
+#define ERROR       (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define X            PyTuple_GetItem(args,0)
+#define Y            PyTuple_GetItem(args,1)
+#define OBSERVATIONS PyTuple_GetItem(args,2)
+#define XINTERP      PyTuple_GetItem(args,3)
+#define YINTERP      PyTuple_GetItem(args,4)
+
+/* serial output macros: */
+#define PREDICTIONS output,0
+#define ERROR       output,1
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  2
+#undef NRHS
+#define NRHS  5
+
+#endif  /* _KRIGING_H_ */
Index: /issm/trunk-jpl/src/wrappers/Ll2xy/Ll2xy.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Ll2xy/Ll2xy.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Ll2xy/Ll2xy.cpp	(revision 13651)
@@ -0,0 +1,97 @@
+/*\file Ll2xy.c
+ *\brief: lat/long to x/y coordinate mex module.
+ */
+#include "./Ll2xy.h"
+
+void Ll2xyUsage(void){/*{{{*/
+	_pprintLine_("Ll2xy - lat/long to x/y coordinate transformation module:");
+	_pprintLine_("");
+	_pprintLine_("   This module transforms lat/long to x/y coordinates.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [x,y]=Ll2xy(lat,lon,sgn,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      lat         latitude coordinates (double vector)");
+	_pprintLine_("      lon         longitude coordinates (double vector)");
+	_pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
+	_pprintLine_("");
+	_pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
+	_pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
+	_pprintLine_("");
+	_pprintLine_("      x           x coordinates (double vector)");
+	_pprintLine_("      y           y coordinates (double vector)");
+	_pprintLine_("");
+	_pprintLine_("   Examples:");
+	_pprintLine_("      [x,y]=Ll2xy(lat,lon, 1);");
+	_pprintLine_("      [x,y]=Ll2xy(lat,lon, 1,'central_meridian',45,'standard_parallel',70);");
+	_pprintLine_("      [x,y]=Ll2xy(lat,lon,-1,'central_meridian', 0,'standard_parallel',71);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Ll2xy){
+
+	int i,verbose=1;
+
+	/*input: */
+	double  *lat=NULL,*lon=NULL;
+	int     nlat,nlon,ncoord;
+	int     sgn;
+
+	Options* options=NULL;
+	double   cm=0.,sp=0.;
+
+	/* output: */
+	double  *x=NULL,*y=NULL;
+	int     iret=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		Ll2xyUsage(); _error_("Ll2xy usage error");
+	}
+	if (nrhs < NRHS) {
+		Ll2xyUsage(); _error_("Ll2xy usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&lat,&nlat,LAT_IN);
+	FetchData(&lon,&nlon,LON_IN);
+	FetchData(&sgn,SGN_IN);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	/*  defaults are in Ll2xydef, so don't duplicate them here, and only use user values if both have been specified  */
+	if(options->GetOption("central_meridian") || options->GetOption("standard_parallel")){
+		options->Get(&cm,"central_meridian");
+		if (verbose) _printLine_("  cm=" << cm);
+		options->Get(&sp,"standard_parallel");
+		if (verbose) _printLine_("  sp=" << sp);
+	}
+
+	/*some checks*/
+	if (verbose) _printLine_("Checking inputs:");
+	if (nlat != nlon){_error_("Must have same number of lat[" << nlat << "] and lon[" << nlon << "] coordinates.");}
+	else                ncoord=nlat;
+	if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
+	if (fabs(cm)      > 180.) _error_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
+	if (sp < 0. || sp >  90.) _error_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
+
+	x=(double*)mxMalloc(ncoord*sizeof(double));
+	y=(double*)mxMalloc(ncoord*sizeof(double));
+
+	/* Run core computations: */
+	if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
+		iret=Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp);
+	else
+		iret=Ll2xyx(x,y,lat,lon,ncoord,sgn);
+
+	/*Write data: */
+	WriteData(X_OUT,x,ncoord);
+	WriteData(Y_OUT,y,ncoord);
+
+	/*Clean-up*/
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Ll2xy/Ll2xy.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Ll2xy/Ll2xy.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Ll2xy/Ll2xy.h	(revision 13651)
@@ -0,0 +1,54 @@
+/*!\file Ll2xy.h
+ * \brief: prototype for lat/long to x/y coordinate mex module.
+ */
+
+#ifndef _LL2XY_H
+#define _LL2XY_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Ll2xy"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define LAT_IN prhs[0]
+#define LON_IN prhs[1]
+#define SGN_IN prhs[2]
+/* serial output macros: */
+#define X_OUT (mxArray**)&plhs[0]
+#define Y_OUT (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define LAT_IN PyTuple_GetItem(args,0)
+#define LON_IN PyTuple_GetItem(args,1)
+#define SGN_IN PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define X_OUT output,0
+#define Y_OUT output,1
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  3
+#undef NLHS
+#define NLHS  2
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/Makefile.am	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Makefile.am	(revision 13651)
@@ -0,0 +1,8 @@
+SUBDIRS = 
+if MATLAB
+SUBDIRS += matlab
+endif
+
+if PYTHON
+SUBDIRS += python
+endif
Index: /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.cpp	(revision 13651)
@@ -0,0 +1,84 @@
+/*!\file:  MeshPartition.cpp
+ * \brief: partition mesh according to number of areas, using Metis library.
+*/
+	
+#include "./MeshPartition.h"
+
+void MeshPartitionUsage(void){/*{{{*/
+	_printLine_("   usage:");
+	_printString_("   [element_partitioning,node_partitioning]=MeshPartition(md.mesh,numpartitions)");
+	_printLine_("   where:");
+	_printLine_("      element_partitioning is a vector of partitioning area numbers, for every element.");
+	_printLine_("      node_partitioning is a vector of partitioning area numbers, for every node.");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(MeshPartition){
+
+	/*Indexing: */
+	int i,j;
+
+	/* required input: */
+	int     dim;
+	int     numberofelements;
+	int     numberofvertices;
+	double *elements         = NULL;
+	int     elements_width;
+
+	int numberofelements2d;
+	int numberofvertices2d;
+	double* elements2d=NULL;
+
+	int numberoflayers;
+	int numareas=1;
+
+	/* output: */
+	int    *int_element_partitioning = NULL;
+	int    *int_node_partitioning    = NULL;
+	double *element_partitioning     = NULL;
+	double *node_partitioning        = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&MeshPartitionUsage);
+
+	/*Fetch data: */
+	FetchData(&dim,mxGetAssignedField(MODEL,0,"dimension"));
+	FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
+	FetchData(&numberofvertices,mxGetAssignedField(MODEL,0,"numberofvertices"));
+	FetchData(&elements,NULL,&elements_width,mxGetAssignedField(MODEL,0,"elements"));
+
+	if (dim==3){
+		FetchData(&numberofelements2d,mxGetAssignedField(MODEL,0,"numberofelements2d"));
+		FetchData(&numberofvertices2d,mxGetAssignedField(MODEL,0,"numberofvertices2d"));
+		FetchData(&elements2d,NULL,NULL,mxGetAssignedField(MODEL,0,"elements2d"));
+	}
+	FetchData(&numberoflayers,mxGetAssignedField(MODEL,0,"numberoflayers"));
+	FetchData(&numareas,NUMAREAS);
+
+	/*Run partitioning algorithm based on a "clever" use of the Metis partitioner: */
+	MeshPartitionx(&int_element_partitioning,&int_node_partitioning,numberofelements,numberofvertices,elements,
+		numberofelements2d,numberofvertices2d,elements2d,numberoflayers,elements_width,dim,numareas);
+
+	/*Post process node_partitioning and element_partitioning to be in double format. Metis needed them in int* format: */
+	element_partitioning=xNew<double>(numberofelements);
+	for (i=0;i<numberofelements;i++){
+		element_partitioning[i]=(double)int_element_partitioning[i]+1; //Metis indexing from 0, matlab from 1.
+	}
+	
+	node_partitioning=xNew<double>(numberofvertices);
+	for (i=0;i<numberofvertices;i++){
+		node_partitioning[i]=(double)int_node_partitioning[i]+1; //Metis indexing from 0, matlab from 1.
+	}
+
+	/*Write data:*/
+	WriteData(ELEMENTPARTITIONING,element_partitioning,numberofelements);
+	WriteData(NODEPARTITIONING,node_partitioning,numberofvertices);
+	
+	/*Free ressources:*/
+	//don't! let matlab do it.
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/MeshPartition/MeshPartition.h	(revision 13651)
@@ -0,0 +1,54 @@
+/*
+	MeshPartition.h
+*/
+
+#ifndef _MESHPARTITION_H
+#define _MESHPARTITION_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "MeshPartition"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define MODEL    prhs[0]
+#define NUMAREAS prhs[1]
+/* serial output macros: */
+#define ELEMENTPARTITIONING (mxArray**)&plhs[0]
+#define NODEPARTITIONING (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define MODEL    PyTuple_GetItem(args,0)
+#define NUMAREAS PyTuple_GetItem(args,1)
+/* serial output macros: */
+#define ELEMENTPARTITIONING output,0
+#define NODEPARTITIONING output,1
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  2
+#undef NRHS
+#define NRHS  2
+
+
+#endif  /* _MESHPARTITION_H */
+
Index: /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 13651)
@@ -0,0 +1,113 @@
+/*! \file  MeshProfileIntersection.cpp
+    \brief: takes a  .exp file (made of several profiles), and figures out its intersection 
+	with a mesh.
+
+	usage:
+	[segments]=MeshProfileIntersection(index,x,y,filename);
+
+	where:
+	input:
+		index,x,y is a triangulation
+		filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)
+	output:
+		segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment 
+		belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the 
+		mesh.
+*/
+	
+#include "./MeshProfileIntersection.h"
+
+void MeshProfileIntersectionUsage(void){/*{{{*/
+	_printLine_("   usage:");
+	_printLine_("   [segments]=MeshProfileIntersection(index,x,y,filename);");
+	_printLine_("   where:");
+	_printLine_("   input:");
+	_printLine_("        index,x,y is a triangulation");
+	_printLine_("        filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)");
+	_printLine_("   output:");
+	_printLine_("        segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment ");
+	_printLine_("        belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the ");
+	_printLine_("        mesh.");
+}/*}}}*/
+WRAPPER(MeshProfileIntersection){
+
+	int i,j;
+
+	/* required input: */
+	//mesh
+	double* double_index=NULL;
+	int*    index=NULL;
+	int     nel;
+	double* x=NULL;
+	double* y=NULL;
+	int     nods;
+	int     dummy;
+	
+	//contours
+	mxArray*  matlabstructure=NULL;
+	Contour<double>** contours=NULL;
+	int       numcontours;
+	Contour<double>*  contouri=NULL;
+
+	/* output: */
+	double* segments=NULL;
+	int     numsegs;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&MeshProfileIntersectionUsage);
+
+	/*First, call expread on filename to build a contour array in the matlab workspace: */
+	mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread");
+
+	/*Fetch inputs: */
+	//index
+	FetchData(&double_index,&nel,&dummy,INDEX);
+	if(dummy!=3 && dummy!=6)_error_("element triangulation should be of 3 or 6 column width!");
+	index=xNew<int>(nel*3);
+	for(i=0;i<nel;i++){
+		for(j=0;j<3;j++){
+			*(index+3*i+j)=(int)*(double_index+dummy*i+j)-1; //"C" style indexing
+		}
+	}
+	//x and y
+	FetchData(&x,&nods,X);
+	FetchData(&y,&dummy,Y);
+
+	//contours
+	numcontours=mxGetNumberOfElements(matlabstructure);
+	contours=xNew<Contour<double>*>(numcontours);
+	for(i=0;i<numcontours;i++){
+		//allocate
+		contouri=xNew<Contour<double> >(1);
+		//retrieve dimension of this contour.
+		contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
+		//set pointers.
+		contouri->x=mxGetPr(mxGetField(matlabstructure,i,"x"));
+		contouri->y=mxGetPr(mxGetField(matlabstructure,i,"y"));
+		*(contours+i)=contouri;
+	}
+
+	/* Debugging of contours :{{{1*/
+	/*for(i=0;i<numcontours;i++){
+		_printLine_("\nContour echo: contour number  " << i+1 << " / " << numcontours);
+		contouri=*(contours+i);
+		_printLine_("   Number of vertices " << contouri->nods);
+		for (j=0;j<contouri->nods;j++){
+			_printLine_("   " << *(contouri->x+j) << "f " << *(contouri->y+j) << "f");
+		}
+	}*/
+	/*}}}*/
+
+	/*Run interpolation routine: */
+	MeshProfileIntersectionx(&segments,&numsegs,index,x,y,nel,nods,contours,numcontours);
+
+	/* output: */
+	WriteData(SEGMENTS,segments,numsegs,5);
+
+	/*end module: */
+	MODULEEND();
+
+}
Index: /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.h	(revision 13651)
@@ -0,0 +1,55 @@
+/*
+	MeshProfileIntersection.h
+*/
+
+#ifndef _MESHPROFILEINTERSECTION_H
+#define _MESHPROFILEINTERSECTION_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__
+#define __FUNCT__ "MeshProfileIntersection"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* input macros: */
+#define INDEX    prhs[0]
+#define X        prhs[1]
+#define Y        prhs[2]
+#define FILENAME prhs[3]
+/* serial output macros: */
+#define SEGMENTS (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* input macros: */
+#define INDEX    PyTuple_GetItem(args,0)
+#define X        PyTuple_GetItem(args,1)
+#define Y        PyTuple_GetItem(args,2)
+#define FILENAME PyTuple_GetItem(args,3)
+/* serial output macros: */
+#define SEGMENTS output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS 1
+#undef NRHS
+#define NRHS 4
+
+#endif  /* _MESHPROFILEINTERSECTION_H */
+
Index: /issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.cpp	(revision 13651)
@@ -0,0 +1,41 @@
+/*\file NodeConnectivity.c
+ *\brief: build node connectivity from elements. 
+ */
+
+#include "./NodeConnectivity.h"
+
+void NodeConnectivityUsage(void){/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: connectivity = " << __FUNCT__ << "(elements, numnodes);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(NodeConnectivity){
+
+	/*inputs: */
+	double* elements=NULL;
+	int     nel;
+	int     nods;
+
+	/*outputs: */
+	double* connectivity=NULL;
+	int     width;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments: */
+	CHECKARGUMENTS(NLHS,NRHS,&NodeConnectivityUsage);
+        
+	/*Input datasets: */
+	FetchData(&elements,&nel,NULL,ELEMENTS);
+	FetchData(&nods,NUMNODES);
+
+	/*!Generate internal degree of freedom numbers: */
+	NodeConnectivityx(&connectivity, &width,elements,nel, nods);
+
+	/*write output datasets: */
+	WriteData(CONNECTIVITY,connectivity,nods,width);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/NodeConnectivity/NodeConnectivity.h	(revision 13651)
@@ -0,0 +1,55 @@
+/*
+	NodeConnectivity.h
+*/
+
+#ifndef _NODECONNECTIVITY_H
+#define _NODECONNECTIVITY_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#undef __FUNCT__ 
+#define __FUNCT__  "NodeConnectivity"
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/toolkits/toolkits.h"
+#include "../../c/include/include.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define ELEMENTS prhs[0]
+#define NUMNODES prhs[1]
+/* serial output macros: */
+#define CONNECTIVITY (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define ELEMENTS PyTuple_GetItem(args,0)
+#define NUMNODES PyTuple_GetItem(args,1)
+/* serial output macros: */
+#define CONNECTIVITY output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  2
+
+#endif  /* _NODECONNECTIVITY_H */
Index: /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 13651)
@@ -0,0 +1,51 @@
+/*! \file  PointCloudFindNeighbors
+    \brief: flag points that are too near one another, within an array of point coordinates
+*/
+	
+#include "./PointCloudFindNeighbors.h"
+
+void PointCloudFindNeighborsUsage(void){/*{{{*/
+	_printLine_("   usage:");
+	_printLine_("   [flags]=PointCloudFindNeighbors(x,y,mindistance,multithread);\n");
+	_printLine_("   where:");
+	_printLine_("      x,y: list of points.");
+	_printLine_("      mindistance: minimum distance that should exist between points in the cloud.");
+	_printLine_("      multithread: run multithreaded or not. with multithreads, flags can get 1 and 2 values in duplicates.");
+	_printLine_("      flags: array of flags (flag==1 means point is within mindistance of another point)");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(PointCloudFindNeighbors){
+
+	int i,j;
+
+	/* required input: */
+	double *x = NULL;
+	double *y = NULL;
+	int     nods;
+	double  mindistance;
+	double  multithread;
+
+	/* output: */
+	SeqVec<double> *flags = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&PointCloudFindNeighborsUsage);
+
+	/*Fetch inputs: */
+	FetchData(&x,&nods,NULL,XHANDLE);  
+	FetchData(&y,NULL,NULL,YHANDLE);
+	FetchData(&mindistance,MINDISTANCE);
+	FetchData(&multithread,MULTITHREAD);
+
+	/*Run core routine: */
+	PointCloudFindNeighborsx(&flags,x,y,nods,mindistance,multithread);
+
+	/* output: */
+	WriteData(FLAGS,flags);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/PointCloudFindNeighbors/PointCloudFindNeighbors.h	(revision 13651)
@@ -0,0 +1,54 @@
+/*
+	PointCloudFindNeighbors.h
+*/
+
+#ifndef _POINTCLOUDFINDNEIGHBORS_H
+#define _POINTCLOUDFINDNEIGHBORS_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__
+#define __FUNCT__ "PointCloudFindNeighbors"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* input macros: */
+#define XHANDLE     prhs[0]
+#define YHANDLE     prhs[1]
+#define MINDISTANCE prhs[2]
+#define MULTITHREAD prhs[3]
+/* serial output macros: */
+#define FLAGS (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* input macros: */
+#define XHANDLE     PyTuple_GetItem(args,0)
+#define YHANDLE     PyTuple_GetItem(args,1)
+#define MINDISTANCE PyTuple_GetItem(args,2)
+#define MULTITHREAD PyTuple_GetItem(args,3)
+/* serial output macros: */
+#define FLAGS output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS 1
+#undef NRHS
+#define NRHS 4
+
+#endif  /* _POINTCLOUDFINDNEIGHBORS_H */
Index: /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp	(revision 13651)
@@ -0,0 +1,46 @@
+/*\file PropagateFlagsFromConnectivity.c
+ *\brief: propagate flags onto mesh, element by element, using connectivity.
+ */
+
+#include "./PropagateFlagsFromConnectivity.h"
+
+void PropagateFlagsFromConnectivityUsage(void) {/*{{{*/
+	_printLine_("");
+	_printLine_("   usage: [pool] = " << __FUNCT__ << "(connectivity,pool,index,flags);");;
+	_printLine_("");
+}/*}}}*/
+WRAPPER(PropagateFlagsFromConnectivity){
+
+	/*input/output datasets: */
+	double* connectivity=NULL;
+	int     nel;
+	double* pool=NULL;
+	double* flags=NULL;
+	int     index;
+	int     dummy;
+	
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&PropagateFlagsFromConnectivityUsage);
+        
+	/*Input datasets: */
+	FetchData(&connectivity,&nel,&dummy,CONNECTIVITY);
+	FetchData(&pool,&dummy,POOL);
+	FetchData(&index,INDEX);
+	FetchData(&flags,&dummy,FLAGS);
+
+	/*!Generate internal degree of freedom numbers: */
+	PropagateFlagsFromConnectivityx(pool,connectivity,index,flags);
+
+	/*write output datasets: */
+	WriteData(POOLOUT,pool,nel);
+
+	/*Free ressources: */
+	xDelete<double>(connectivity);
+	xDelete<double>(flags);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h	(revision 13651)
@@ -0,0 +1,54 @@
+/*
+	PropagateFlagsFromConnectivity.h
+*/
+
+#ifndef _PROPAGATEFLAGSFROMCONNECTIVITY_H
+#define _PROPAGATEFLAGSFROMCONNECTIVITY_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "PropagateFlagsFromConnectivity"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define CONNECTIVITY prhs[0]
+#define POOL         prhs[1]
+#define INDEX        prhs[2]
+#define FLAGS        prhs[3]
+/* serial output macros: */
+#define POOLOUT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define CONNECTIVITY PyTuple_GetItem(args,0)
+#define POOL         PyTuple_GetItem(args,1)
+#define INDEX        PyTuple_GetItem(args,2)
+#define FLAGS        PyTuple_GetItem(args,3)
+/* serial output macros: */
+#define POOLOUT output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  4
+
+#endif  /* _PROPAGATEFLAGSFROMCONNECTIVITY_H */
Index: /issm/trunk-jpl/src/wrappers/Scotch/Scotch.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Scotch/Scotch.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Scotch/Scotch.cpp	(revision 13651)
@@ -0,0 +1,249 @@
+/*\file Scotch.c
+ *\brief:  Scotch partitioner mex module
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+#include "./Scotch.h"
+
+void GmapUsage(void){/*{{{*/
+	mexPrintf("\n");
+	mexPrintf("Usage: [maptab]=Scotch(adjmat,vertlb,vertwt,edgewt,archtyp,archpar,\n");
+	mexPrintf("                         Scotch-specific parameters);\n");
+	mexPrintf("\n");
+}/*}}}*/
+void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){
+
+	#ifndef _HAVE_SCOTCH_ //only works if scotch library has been compiled in.
+	_error_("Scotch not available! Cannot carry out Scotch partitioning!");
+	#else
+
+	int     argcm;
+	char    **argvm=NULL;
+	int     nvert =0,nedge2=0,napar =0;
+	mwIndex *ir=NULL,*jc=NULL;
+	int     *adjir=NULL,*adjjc=NULL;
+	double  *vld=NULL,*vwd=NULL,*ewd=NULL,*apd=NULL;
+	int     *vli=NULL,*vwi=NULL,*ewi=NULL,*api=NULL;
+	char    *archtyp=NULL;
+	int     (*maptabi)[2]=NULL;
+	double* maptabd=NULL;
+	int     i,j,k,imi=0,imo=0,isi=0,ierr;
+
+	/* Check for proper number of arguments */
+   
+	if (nrhs == 0 && nlhs == 0) {
+		GmapUsage();
+		return;
+	}
+	else if (nrhs <  6 || nlhs >  1) {
+		GmapUsage();
+		mexErrMsgTxt(" ");
+	}
+
+/*  load matlab argument list and convert to integer (note that converting here
+	and in the x-layer is inefficient, but it makes the x-layer more general)  */
+
+	argvm = (char **) calloc(nrhs,sizeof(char *));
+
+	if (!(mxIsNumeric(prhs[imi]) &&
+		  (mxGetM(prhs[imi]) == 1 && mxGetN(prhs[imi]) == 1))) {
+		argvm[isi] = (char *) calloc(4+1,sizeof(char));
+		strcpy(argvm[isi],"gmap");
+		mexPrintf("%s -- Using \"%s\" entry point.\n",
+				  __FUNCT__,argvm[isi]);
+		isi++;
+	}
+	else {
+		argvm[isi] = (char *) calloc(5+1,sizeof(char));
+		strcpy(argvm[isi],"gpart");
+		mexPrintf("%s -- Using \"%s\" entry point.\n",
+				  __FUNCT__,argvm[isi]);
+		isi++;
+
+		argvm[isi] = (char *) calloc(17,sizeof(char));
+		sprintf(argvm[isi],"%d",(int)mxGetScalar(prhs[imi]));
+		mexPrintf("%s -- Number of parts is %s.\n",
+				  __FUNCT__,argvm[isi]);
+		isi++;
+		imi++;
+	}
+
+	if (!mxIsNumeric(prhs[imi]) || (!mxIsEmpty(prhs[imi]) && !mxIsSparse(prhs[imi]))) {
+		mexPrintf("%s -- Adjacency matrix must be numeric and sparse.\n",__FUNCT__);
+		mexErrMsgTxt(" ");
+	}
+	else {
+		nvert =mxGetM(prhs[imi]);
+		nedge2=mxGetNzmax(prhs[imi]);
+		if (mxGetNzmax(prhs[imi])) {
+			ir    =mxGetIr(prhs[imi]);
+			adjir = (int *) malloc(mxGetNzmax(prhs[imi])*sizeof(int));
+			for (i=0; i<mxGetNzmax(prhs[imi]); i++)
+				adjir[i]=(int)ir[i];
+		}
+		if (mxGetN(prhs[imi])) {
+			jc    =mxGetJc(prhs[imi]);
+			adjjc = (int *) malloc((mxGetN(prhs[imi])+1)*sizeof(int));
+			for (i=0; i<(mxGetN(prhs[imi])+1); i++)
+				adjjc[i]=(int)jc[i];
+		}
+		mexPrintf("%s -- Adjacency matrix is of size %d by %d with %d non-zeroes.\n",
+				  __FUNCT__,mxGetM(prhs[imi]),mxGetN(prhs[imi]),mxGetNzmax(prhs[imi]));
+	}
+	imi++;
+
+	if (!mxIsNumeric(prhs[imi])) {
+		mexPrintf("%s -- Vertex label vector must be numeric.\n",__FUNCT__);
+		mexErrMsgTxt(" ");
+	}
+	else {
+		if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) {
+			vld=mxGetPr(prhs[imi]);
+			vli = (int *) malloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])*sizeof(int));
+			for (i=0; i<mxGetM(prhs[imi])*mxGetN(prhs[imi]); i++)
+				vli[i]=(int)vld[i];
+		}
+		mexPrintf("%s -- Vertex label vector is of size %d by %d.\n",
+				  __FUNCT__,mxGetM(prhs[imi]),mxGetN(prhs[imi]));
+	}
+	imi++;
+
+	if (!mxIsNumeric(prhs[imi])) {
+		mexPrintf("%s -- Vertex weight vector must be numeric.\n",__FUNCT__);
+		mexErrMsgTxt(" ");
+	}
+	else {
+		if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) {
+			vwd=mxGetPr(prhs[imi]);
+			vwi = (int *) malloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])*sizeof(int));
+			for (i=0; i<mxGetM(prhs[imi])*mxGetN(prhs[imi]); i++)
+				vwi[i]=(int)vwd[i];
+		}
+		mexPrintf("%s -- Vertex weight vector is of size %d by %d.\n",
+				  __FUNCT__,mxGetM(prhs[imi]),mxGetN(prhs[imi]));
+	}
+	imi++;
+
+	if (!mxIsNumeric(prhs[imi]) || (!mxIsEmpty(prhs[imi]) && !mxIsSparse(prhs[imi]))) {
+		mexPrintf("%s -- Edge weight matrix must be numeric and sparse.\n",__FUNCT__);
+		mexErrMsgTxt(" ");
+	}
+	else {
+		if (mxGetM(prhs[imi])) {
+			ewd=mxGetPr(prhs[imi]);
+			ewi = (int *) malloc(mxGetM(prhs[imi])*sizeof(int));
+			for (i=0; i<mxGetNzmax(prhs[imi]); i++)
+				ewi[i]=(int)ewd[i];
+		}
+		mexPrintf("%s -- Edge weight matrix is of size %d by %d with %d non-zeroes.\n",
+				  __FUNCT__,mxGetM(prhs[imi]),mxGetN(prhs[imi]),mxGetNzmax(prhs[imi]));
+	}
+	imi++;
+
+	if (!((strlen (argvm[0]) >= 5) &&
+		  (strncmp (argvm[0] + strlen (argvm[0]) - 5, "gpart", 5) == 0))) {
+		if (!mxIsChar(prhs[imi])) {
+			mexPrintf("%s -- Architecture type must be character.\n",__FUNCT__);
+			mexErrMsgTxt(" ");
+		}
+		else {
+			if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) {
+				archtyp = (char *) calloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])+1,sizeof(char));
+				mxGetString(prhs[imi],archtyp,mxGetM(prhs[imi])*mxGetN(prhs[imi])+1);
+			}
+			mexPrintf("%s -- Architecture type is \"%s\".\n",
+					  __FUNCT__,archtyp);
+		}
+		imi++;
+
+		if (!mxIsNumeric(prhs[imi])) {
+			mexPrintf("%s -- Architecture parameter vector must be numeric.\n",__FUNCT__);
+			mexErrMsgTxt(" ");
+		}
+		else {
+			napar =mxGetM(prhs[imi])*mxGetN(prhs[imi]);
+			if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) {
+				apd=mxGetPr(prhs[imi]);
+				api = (int *) malloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])*sizeof(int));
+				for (i=0; i<mxGetM(prhs[imi])*mxGetN(prhs[imi]); i++)
+					api[i]=(int)apd[i];
+			}
+			mexPrintf("%s -- Architecture parameter vector is of size %d by %d.\n",
+					  __FUNCT__,mxGetM(prhs[imi]),mxGetN(prhs[imi]));
+		}
+		imi++;
+	}
+
+	while (imi < nrhs) {
+		if (!mxIsChar(prhs[imi])) {
+			mexPrintf("%s -- prhs[%d] must be character.\n",__FUNCT__,imi);
+			mexErrMsgTxt(" ");
+		}
+		else {
+			argvm[isi] = (char *) calloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])+1,sizeof(char));
+			mxGetString(prhs[imi],argvm[isi],mxGetM(prhs[imi])*mxGetN(prhs[imi])+1);
+		}
+		isi++;
+		imi++;
+	}
+	argcm=isi;
+	mexPrintf("argcm=%d\n",argcm);
+	for (i=0; i<argcm; i++)
+		mexPrintf("argvm[%d]=\"%s\"\n",i,argvm[i]);
+
+	/* Do the actual computations in a subroutine */
+
+	mexPrintf("Gmapx:\n");
+	ierr=gmapx(&maptabi,
+			   argcm,
+			   argvm,
+			   nvert,
+			   nedge2,
+			   adjir,
+			   adjjc,
+			   vli,
+			   vwi,
+			   ewi,
+			   archtyp,
+			   napar,
+			   api);
+	mexPrintf("%s -- Error %d from Gmapx.\n",__FUNCT__,ierr);
+
+/*  for (i=0; i<nvert; i++)
+		mexPrintf("maptabi[%d][0]=%d, maptabi[%d][1]=%d\n",
+			 	  i,maptabi[i][0],i,maptabi[i][1]); */
+
+	/* Create matrices for the return arguments */
+
+	if (maptabi) {
+		plhs[imo]=mxCreateDoubleMatrix(nvert, 2, mxREAL);
+		maptabd = mxGetPr(plhs[imo]);
+		k=0;
+		for (j=0; j<2; j++)
+			for (i=0; i<nvert; i++)
+				maptabd[k++]=(double)maptabi[i][j];
+		//free(maptabi);
+	}
+	else {
+		plhs[imo]=mxCreateDoubleMatrix(0, 2, mxREAL);
+	}
+	imo++;
+
+	/*if (argvm)
+		for (i=argcm-1; i>=0; i--)
+			free(argvm[i]);
+	if (api)     free(api);
+	if (archtyp) free(archtyp);
+	if (ewi)     free(ewi);
+	if (vwi)     free(vwi);
+	if (vli)     free(vli);
+	if (adjjc)   free(adjjc);
+	if (adjir)   free(adjir);*/
+
+	return;
+#endif //#ifndef _HAVE_SCOTCH_
+}
Index: /issm/trunk-jpl/src/wrappers/Scotch/Scotch.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Scotch/Scotch.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Scotch/Scotch.h	(revision 13651)
@@ -0,0 +1,35 @@
+/*!\file:  Scotch.h
+ * \brief header file for Scotch module.
+ */ 
+
+#ifndef _SCOTCH_H
+#define _SCOTCH_H
+
+#include <stdio.h>
+#include <string.h>    /*  strcasecmp  */
+#include <time.h>      /*  clock,time,difftime  */
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+    
+#undef __FUNCT__ 
+#define __FUNCT__  "Scotch"
+
+/*  Scotch structures and prototypes  */
+#ifdef MATLAB
+#include "mat.h"
+#include "mex.h"
+#include "matrix.h"
+
+#define printf mexPrintf
+#define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__))
+#define malloc mxMalloc
+#define calloc mxCalloc
+#define realloc mxRealloc
+#define free mxFree
+#define exit(status) mexErrMsgTxt("exit=" #status)
+#endif
+
+#endif  /* _SCOTCH_H */
Index: /issm/trunk-jpl/src/wrappers/Shp2Kml/Shp2Kml.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Shp2Kml/Shp2Kml.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Shp2Kml/Shp2Kml.cpp	(revision 13651)
@@ -0,0 +1,99 @@
+/*\file Shp2Kml.c
+ *\brief: shp to kml file conversion mex module.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "./Shp2Kml.h"
+
+void Shp2KmlUsage(void){/*{{{*/
+	_pprintLine_("Shp2Kml - shp to kml file conversion module:");
+	_pprintLine_("");
+	_pprintLine_("   This module converts a file from shp to kml format.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [ret]=Shp2Kml(filshp,filkml,sgn,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      filshp      file name of shp file to be read (char, extension optional)");
+	_pprintLine_("      filkml      file name of kml file to be written (char)");
+	_pprintLine_("      sgn         sign for hemisphere (double, +1 (north); -1 (south); or 0 (no translation))");
+	_pprintLine_("");
+	_pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
+	_pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
+	_pprintLine_("");
+	_pprintLine_("      ret         return code (non-zero for warning)");
+	_pprintLine_("");
+	_pprintLine_("   Examples:");
+	_pprintLine_("      [ret]=Shp2Kml('file.shp','file.kml', 0);");
+	_pprintLine_("      [ret]=Shp2Kml('file.shp','file.kml', 1,'central_meridian',45,'standard_parallel',70);");
+	_pprintLine_("      [ret]=Shp2Kml('file.shp','file.kml',-1,'central_meridian', 0,'standard_parallel',71);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Shp2Kml){
+
+	int i,verbose=1;
+
+	/*input: */
+	char    *filshp=NULL,*filkml=NULL;
+	int     sgn;
+	Options* options=NULL;
+	double   cm=0.,sp=0.;
+
+	/* output: */
+	int     iret=0;
+
+	#ifndef _HAVE_SHAPELIB_ //only works if shapelib library has been compiled in.
+	_error_("Shapelib not available! Cannot carry out shp file translation!");
+	#endif
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		Shp2KmlUsage(); _error_("Shp2Kml usage error");
+	}
+	if (nrhs < NRHS) {
+		Shp2KmlUsage(); _error_("Shp2Kml usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&filshp,SHP_IN);
+	FetchData(&filkml,KML_IN);
+	FetchData(&sgn,SGN_IN);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	/*  defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified  */
+	if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
+		options->Get(&cm,"central_meridian");
+		if (verbose) _printLine_("  cm=" << cm);
+		options->Get(&sp,"standard_parallel");
+		if (verbose) _printLine_("  sp=" << sp);
+	}
+
+	/*some checks*/
+	if (sgn < -1 || sgn > +1) _error_("Hemisphere sgn=" << sgn << " must be +1 (north), -1 (south), or 0 (no translation).");
+	if (fabs(cm)      > 180.) _error_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
+	if (sp < 0. || sp >  90.) _error_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
+
+	/* Run core computations: */
+	if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
+		iret=Shp2Kmlx(filshp,filkml,sgn,cm,sp);
+	else
+		iret=Shp2Kmlx(filshp,filkml,sgn);
+
+	/*Write data: */
+	WriteData(RET_OUT,iret);
+
+	/*Clean-up*/
+	delete options;
+	xDelete<char>(filkml);
+	xDelete<char>(filshp);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Shp2Kml/Shp2Kml.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Shp2Kml/Shp2Kml.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Shp2Kml/Shp2Kml.h	(revision 13651)
@@ -0,0 +1,53 @@
+/*!\file Shp2Kml.h
+ * \brief: prototype for shp to kml file conversion mex module.
+ */
+
+#ifndef _SHP2KML_H
+#define _SHP2KML_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Shp2Kml"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define SHP_IN  prhs[0]
+#define KML_IN  prhs[1]
+#define SGN_IN  prhs[2]
+/* serial output macros: */
+#define RET_OUT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define SHP_IN PyTuple_GetItem(args,0)
+#define KML_IN PyTuple_GetItem(args,1)
+#define SGN_IN PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define RET_OUT output,0
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  3
+#undef NLHS
+#define NLHS  1
+
+#endif
+
Index: /issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.cpp	(revision 13651)
@@ -0,0 +1,34 @@
+/*\file StringToEnum.c
+ *\brief:convert enum (int) to string
+ */
+
+#include "./StringToEnum.h"
+
+void StringToEnumUsage(void){/*{{{*/
+	_pprintLine_("");
+	_pprintLine_("   usage: " << __FUNCT__ << "enum = StringToEnum(string);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(StringToEnum){
+
+	char    *name    = NULL;
+	int      enum_out;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments: */
+	CHECKARGUMENTS(NLHS,NRHS,&StringToEnumUsage);
+
+	/*Fetch inputs: */
+	FetchData(&name,NAME);
+
+	/*Run core function: */
+	enum_out=StringToEnumx(name);
+
+	/* output: */
+	WriteData(ENUMOUT,enum_out);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/StringToEnum/StringToEnum.h	(revision 13651)
@@ -0,0 +1,49 @@
+/*!\file:  StringToEnum.h
+ * \brief header file for StringToEnum module.
+ */ 
+
+#ifndef _STRINGTOENUM_H
+#define _STRINGTOENUM_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "StringToEnum"
+    
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define NAME (mxArray*)prhs[0]
+/* serial output macros: */
+#define ENUMOUT (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define NAME PyTuple_GetItem(args,0)
+/* serial output macros: */
+#define ENUMOUT output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  1
+
+#endif  /* _TEST_H */
Index: /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.cpp	(revision 13651)
@@ -0,0 +1,62 @@
+/*
+ * TriMesh: mesh a domain using an .exp file
+ */
+
+#include "./TriMesh.h"
+
+void TriMeshUsage(void){/*{{{*/
+	_printLine_("");
+	_printLine_("   usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,rifts,area) ");
+	_printLine_("      where: index,x,y defines a triangulation, segments is an array made ");
+	_printLine_("      of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, ");
+	_printLine_("      outlinefilename an Argus domain outline file, ");
+	_printLine_("      area is the maximum area desired for any element of the resulting mesh, ");
+	_printLine_("");
+}/*}}}*/
+WRAPPER(TriMesh){
+	
+	/*intermediary: */
+	double  area;
+	DataSet *domain = NULL;
+	DataSet *rifts  = NULL;
+
+	/* output: */
+	SeqMat<double> *index             = NULL;
+	SeqVec<double> *x                 = NULL;
+	SeqVec<double> *y                 = NULL;
+	SeqMat<double> *segments          = NULL;
+	SeqVec<double> *segmentmarkerlist = NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments: */
+	CHECKARGUMENTS(NLHS,NRHS,&TriMeshUsage);
+	
+	/*Fetch data needed for meshing: */
+	FetchData(&domain,DOMAINOUTLINE);
+	FetchData(&rifts,RIFTSOUTLINE);
+	FetchData(&area,AREA);
+
+	/*call x core: */
+	TriMeshx(&index,&x,&y,&segments,&segmentmarkerlist,domain,rifts,area);
+
+	/*write outputs: */
+	WriteData(INDEX,index);
+	WriteData(X,x);
+	WriteData(Y,y);
+	WriteData(SEGMENTS,segments);
+	WriteData(SEGMENTMARKERLIST,segmentmarkerlist);
+
+	/*free ressources: */
+	delete domain;
+	delete rifts;
+	delete index;
+	delete x;
+	delete y;
+	delete segments;
+	delete segmentmarkerlist;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.h	(revision 13651)
@@ -0,0 +1,65 @@
+/*
+	TriMesh.h
+*/
+
+#ifndef _TRIMESH_H
+#define _TRIMESH_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+/*Header files: */
+#include "../../c/include/globals.h"
+#include "../../c/toolkits/toolkits.h"
+#include "../../c/include/include.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+#include "../../c/io/io.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "TriMesh"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define DOMAINOUTLINE  prhs[0]
+#define RIFTSOUTLINE   prhs[1]
+#define AREA           prhs[2]
+/* serial output macros: */
+#define INDEX             (mxArray**)&plhs[0]
+#define X                 (mxArray**)&plhs[1]
+#define Y                 (mxArray**)&plhs[2]
+#define SEGMENTS          (mxArray**)&plhs[3]
+#define SEGMENTMARKERLIST (mxArray**)&plhs[4]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define DOMAINOUTLINE PyTuple_GetItem(args,0)
+#define RIFTSOUTLINE  PyTuple_GetItem(args,1)
+#define AREA          PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define INDEX             output,0
+#define X                 output,1
+#define Y                 output,2
+#define SEGMENTS          output,3
+#define SEGMENTMARKERLIST output,4
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  5
+#undef NRHS
+#define NRHS  3
+
+#endif  /* _TRIMESH_H */
Index: /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.cpp	(revision 13651)
@@ -0,0 +1,53 @@
+/*!\file:  TriMeshProcessRifts.cpp
+ * \brief split a mesh where a rift (or fault) is present
+ */ 
+
+#include "./TriMeshProcessRifts.h"
+
+void TriMeshProcessRiftsUsage(void){/*{{{*/
+	_printLine_("");
+	_printLine_("   usage: [index2,x2,y2,segments2,segmentmarkers2,rifts2]=TriMeshProcessrifts(index1,x1,y1,segments1,segmentmarkers1) ");
+	_printLine_("      where: (index1,x1,y1,segments1,segmentmarkers1) is an initial triangulation.");
+	_printLine_("      index2,x2,y2,segments2,segmentmarkers2,rifts2 is the resulting triangulation where rifts have been processed.");
+}/*}}}*/
+WRAPPER(TriMeshProcessRifts){
+
+	/* returned quantities: */
+	RiftStruct *riftstruct = NULL;
+
+	/* input: */
+	int     nel,nods;
+	double *index          = NULL;
+	double *x              = NULL;
+	double *y              = NULL;
+	double *segments       = NULL;
+	double *segmentmarkers = NULL;
+	int     num_seg;
+
+	/*Boot module*/
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CHECKARGUMENTS(NLHS,NRHS,&TriMeshProcessRiftsUsage);
+
+	/*Fetch data */
+	FetchData(&index,&nel,NULL,INDEXIN);
+	FetchData(&x,&nods,XIN);
+	FetchData(&y,NULL,YIN);
+	FetchData(&segments,&num_seg,NULL,SEGMENTSIN);
+	FetchData(&segmentmarkers,NULL,SEGMENTMARKERSIN);
+
+	/*call x layer*/
+	TriMeshProcessRiftsx(&index,&nel,&x,&y,&nods,&segments,&segmentmarkers,&num_seg,&riftstruct);
+
+	/*Output : */
+	WriteData(INDEXOUT,index,nel,3);
+	WriteData(XOUT,x,nods,1);
+	WriteData(YOUT,y,nods,1);
+	WriteData(SEGMENTSOUT,segments,num_seg,3);
+	WriteData(SEGMENTMARKERSOUT,segmentmarkers,num_seg,1);
+	WriteData(RIFTSTRUCT,riftstruct);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/TriMeshProcessRifts/TriMeshProcessRifts.h	(revision 13651)
@@ -0,0 +1,66 @@
+/*
+ * TriMeshProcessRifts.h
+ */ 
+
+#ifndef _TRIMESH_PROCESSRIFTS_H_
+#define _TRIMESH_PROCESSRIFTS_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "TriMeshProcessRifts"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define INDEXIN          prhs[0]
+#define XIN              prhs[1]
+#define YIN              prhs[2]
+#define SEGMENTSIN       prhs[3]
+#define SEGMENTMARKERSIN prhs[4]
+/* serial output macros: */
+#define INDEXOUT          (mxArray**)&plhs[0]
+#define XOUT              (mxArray**)&plhs[1]
+#define YOUT              (mxArray**)&plhs[2]
+#define SEGMENTSOUT       (mxArray**)&plhs[3]
+#define SEGMENTMARKERSOUT (mxArray**)&plhs[4]
+#define RIFTSTRUCT        (mxArray**)&plhs[5]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEXIN          PyTuple_GetItem(args,0)
+#define XIN              PyTuple_GetItem(args,1)
+#define YIN              PyTuple_GetItem(args,2)
+#define SEGMENTSIN       PyTuple_GetItem(args,3)
+#define SEGMENTMARKERSIN PyTuple_GetItem(args,4)
+/* serial output macros: */
+#define INDEXOUT          output,0
+#define XOUT              output,1
+#define YOUT              output,2
+#define SEGMENTSOUT       output,3
+#define SEGMENTMARKERSOUT output,4
+#define RIFTSTRUCT        output,5
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  6
+#undef NRHS
+#define NRHS  5
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/TriaSearch/TriaSearch.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriaSearch/TriaSearch.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/TriaSearch/TriaSearch.cpp	(revision 13651)
@@ -0,0 +1,60 @@
+/*\file TriaSearch.c
+ *\brief: TriaSearch module. See TriaSearchx for more details.
+ */
+#include "./TriaSearch.h"
+
+void TriaSearchUsage(void){/*{{{*/
+	_pprintLine_("TriaSearch- find triangle holding a point (x0,y0) in a mesh");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("         tria=TriaSearch(index,x,y,x0,y0);");
+	_pprintLine_("      index,x,y: mesh triangulatrion");
+	_pprintLine_("      x0,y0: coordinates of the point for which we are trying to find a triangle");
+	_pprintLine_("      x0,y0 can be an array of points");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(TriaSearch){
+
+	int i;
+
+	/*input: */
+	int*    index=NULL;
+	int     nel;
+	int     dummy;
+
+	double* x=NULL;
+	double* y=NULL;
+	int     nods;
+
+	double* x0=NULL;
+	double* y0=NULL;
+	int     numberofnodes;
+
+	/* output: */
+	double*  tria=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&TriaSearchUsage);
+
+	/*Input datasets: */
+	FetchData(&index,&nel,&dummy,INDEXHANDLE);
+	FetchData(&x,&nods,XHANDLE);
+	FetchData(&y,&nods,YHANDLE);
+	FetchData(&x0,&numberofnodes,X0HANDLE);
+	FetchData(&y0,&numberofnodes,Y0HANDLE);
+
+	/* Run core computations: */
+	TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes);
+
+	/* c to matlab: */
+	for(i=0;i<numberofnodes;i++)tria[i]++;
+
+	/*Write data: */
+	WriteData(TRIA,tria,numberofnodes);
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/TriaSearch/TriaSearch.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/TriaSearch/TriaSearch.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/TriaSearch/TriaSearch.h	(revision 13651)
@@ -0,0 +1,57 @@
+/*!\file TriaSearch.h
+ */
+
+#ifndef _TRIASEARCH_H
+#define _TRIASEARCH_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "TriaSearch"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define INDEXHANDLE prhs[0]
+#define XHANDLE     prhs[1]
+#define YHANDLE     prhs[2]
+#define X0HANDLE    prhs[3]
+#define Y0HANDLE    prhs[4]
+
+/* serial output macros: */
+#define TRIA (mxArray**)&plhs[0]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define INDEXHANDLE PyTuple _GetItem(args,0)
+#define XHANDLE     PyTuple _GetItem(args,1)
+#define YHANDLE     PyTuple _GetItem(args,2)
+#define X0HANDLE    PyTuple _GetItem(args,3)
+#define Y0HANDLE    PyTuple _GetItem(args,4)
+
+/* serial output macros: */
+#define TRIA output,0
+#endif
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  5
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/Xy2ll/Xy2ll.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/Xy2ll/Xy2ll.cpp	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Xy2ll/Xy2ll.cpp	(revision 13651)
@@ -0,0 +1,96 @@
+/*\file Xy2ll.c
+ *\brief: x/y to lat/long coordinate mex module.
+ */
+#include "./Xy2ll.h"
+
+void Xy2llUsage(void){/*{{{*/
+	_pprintLine_("Xy2ll - x/y to lat/long coordinate transformation module:");
+	_pprintLine_("");
+	_pprintLine_("   This module transforms x/y to lat/long coordinates.");
+	_pprintLine_("");
+	_pprintLine_("   Usage:");
+	_pprintLine_("      [lat,lon]=Xy2ll(x,y,sgn,'param name',param,...);");
+	_pprintLine_("");
+	_pprintLine_("      x           x coordinates (double vector)");
+	_pprintLine_("      y           y coordinates (double vector)");
+	_pprintLine_("      sgn         sign for hemisphere (double, +1 (north) or -1 (south))");
+	_pprintLine_("");
+	_pprintLine_("      central_meridian     central meridian (double, optional, but must specify with sp)");
+	_pprintLine_("      standard_parallel    standard parallel (double, optional, but must specify with cm)");
+	_pprintLine_("");
+	_pprintLine_("      lat         latitude coordinates (double vector)");
+	_pprintLine_("      lon         longitude coordinates (double vector)");
+	_pprintLine_("");
+	_pprintLine_("   Examples:");
+	_pprintLine_("      [lat,lon]=Xy2ll(x,y, 1);");
+	_pprintLine_("      [lat,lon]=Xy2ll(x,y, 1,'central_meridian',45,'standard_parallel',70);");
+	_pprintLine_("      [lat,lon]=Xy2ll(x,y,-1,'central_meridian', 0,'standard_parallel',71);");
+	_pprintLine_("");
+}/*}}}*/
+WRAPPER(Xy2ll){
+
+	int i,verbose=1;
+
+	/*input: */
+	double  *x=NULL,*y=NULL;
+	int     nx,ny,ncoord;
+	int     sgn;
+	Options* options=NULL;
+	double   cm=0.,sp=0.;
+
+	/* output: */
+	double  *lat=NULL,*lon=NULL;
+	int     iret=0;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	if (nlhs > NLHS) {
+		Xy2llUsage(); _error_("Xy2ll usage error");
+	}
+	if (nrhs < NRHS) {
+		Xy2llUsage(); _error_("Xy2ll usage error");
+	}
+
+	/*Input datasets: */
+	FetchData(&x,&nx,X_IN);
+	FetchData(&y,&ny,Y_IN);
+	FetchData(&sgn,SGN_IN);
+	FetchData(&options,NRHS,nrhs,prhs);
+
+	/*  defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified  */
+	if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) {
+		options->Get(&cm,"central_meridian");
+		if (verbose) _printLine_("  cm=" << cm);
+		options->Get(&sp,"standard_parallel");
+		if (verbose) _printLine_("  sp=" << sp);
+	}
+
+	/*some checks*/
+	if   (nx != ny){_error_("Must have same number of x[" << nx << "] and y[" << ny << "] coordinates.");}
+	else            ncoord=nx;
+	if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=" << sgn << " must be +1 (north) or -1 (south).");
+	if (fabs(cm)      > 180.) _error_("Central meridian cm=" << cm << " must be between -180 (west) and +180 (east) degrees.");
+	if (sp < 0. || sp >  90.) _error_("Standard parallel sp=" << sp << " must be between 0 and 90 degrees (in specified hemisphere).");
+
+	lat=(double*)mxMalloc(ncoord*sizeof(double));
+	lon=(double*)mxMalloc(ncoord*sizeof(double));
+
+	/* Run core computations: */
+	if (verbose) _printLine_("Calling core:");
+	if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
+		iret=Xy2llx(lat,lon,x,y,ncoord,sgn,cm,sp);
+	else
+		iret=Xy2llx(lat,lon,x,y,ncoord,sgn);
+
+	/*Write data: */
+	WriteData(LAT_OUT,lat,ncoord);
+	WriteData(LON_OUT,lon,ncoord);
+
+	/*Clean-up*/
+	delete options;
+
+	/*end module: */
+	MODULEEND();
+}
Index: /issm/trunk-jpl/src/wrappers/Xy2ll/Xy2ll.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/Xy2ll/Xy2ll.h	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/Xy2ll/Xy2ll.h	(revision 13651)
@@ -0,0 +1,54 @@
+/*!\file Xy2ll.h
+ * \brief: prototype for x/y to lat/long coordinate mex module.
+ */
+
+#ifndef _XY2LL_H
+#define _XY2LL_H
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+	#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*For python modules: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/issm-binding.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Xy2ll"
+
+#ifdef _HAVE_MATLAB_MODULES_
+/* serial input macros: */
+#define X_IN   prhs[0]
+#define Y_IN   prhs[1]
+#define SGN_IN prhs[2]
+/* serial output macros: */
+#define LAT_OUT (mxArray**)&plhs[0]
+#define LON_OUT (mxArray**)&plhs[1]
+#endif
+
+#ifdef _HAVE_PYTHON_MODULES_
+/* serial input macros: */
+#define X_IN   PyTuple_GetItem(args,0)
+#define Y_IN   PyTuple_GetItem(args,1)
+#define SGN_IN PyTuple_GetItem(args,2)
+/* serial output macros: */
+#define LAT_OUT output,0
+#define LON_OUT output,1
+#endif
+
+/* serial arg counts: */
+#undef NRHS
+#define NRHS  3
+#undef NLHS
+#define NLHS  2
+
+#endif
Index: /issm/trunk-jpl/src/wrappers/matlab/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/matlab/Makefile.am	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/matlab/Makefile.am	(revision 13651)
@@ -0,0 +1,240 @@
+AM_CPPFLAGS = @DAKOTAINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ @ADOLCINCL@
+
+EXEEXT=$(MATLABWRAPPEREXT)
+
+#Modules {{{
+if MODULES
+lib_LTLIBRARIES =  AverageFilter.la\
+						 BamgMesher.la\
+						 BamgConvertMesh.la\
+						 BamgTriangulate.la\
+						 ContourToMesh.la\
+						 ContourToNodes.la\
+						 ElementConnectivity.la\
+						 EnumToString.la\
+						 HoleFiller.la\
+						 InternalFront.la\
+						 InterpFromGridToMesh.la\
+						 InterpFromMeshToMesh2d.la\
+						 InterpFromMeshToMesh3d.la\
+						 InterpFromMeshToGrid.la\
+						 InterpFromMesh2d.la\
+						 Ll2xy.la\
+						 NodeConnectivity.la\
+						 MeshPartition.la\
+						 MeshProfileIntersection.la\
+						 PointCloudFindNeighbors.la\
+						 PropagateFlagsFromConnectivity.la\
+						 StringToEnum.la\
+						 TriaSearch.la\
+						 TriMesh.la\
+						 TriMeshProcessRifts.la\
+						 Scotch.la\
+						 Xy2ll.la\
+						 Chaco.la
+
+if KRIGING
+lib_LTLIBRARIES +=  Kriging.la
+endif
+if KML
+lib_LTLIBRARIES +=  KMLFileRead.la\
+				   KMLMeshWrite.la\
+				   KMLOverlay.la\
+				   Shp2Kml.la\
+				   Exp2Kml.la\
+				   Kml2Exp.la
+endif
+endif 
+
+#}}}
+#Flags and libraries {{{
+if SHAREDLIBS
+deps = ../../c/libISSMCore.la ../../c/libISSMModules.la
+else
+deps = ../../c/libISSMCore.a ../../c/libISSMModules.a
+endif
+
+deps +=  $(MATHLIB) ${MEXLIB}
+
+#$(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(SPOOLESLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB) 
+
+#Triangle library
+AM_CXXFLAGS =  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
+
+#Matlab part
+AM_LDFLAGS = -module $(MEXLINK) -shrext ${EXEEXT}
+if VERSION
+AM_LDFLAGS +=
+else
+AM_LDFLAGS += -avoid-version
+endif
+if SHAREDLIBS
+deps += ../../c/libISSMMatlab.la 
+else
+deps += ../../c/libISSMMatlab.a
+AM_LDFLAGS += --no-warnings 
+endif
+
+AM_CXXFLAGS +=  -D_HAVE_MATLAB_MODULES_ -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread 
+
+######################################################################################
+# Circular dependencies may not be necessary here.
+#deps += ../../c/libISSMCore.a 
+#if CIRCULAR_DEPENDENCIES
+#deps += $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(SPOOLESLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
+#endif
+######################################################################################
+
+if SHAREDLIBS
+deps +=
+else
+deps += ../../c/libISSMModules.a ../../c/libISSMCore.a  
+if ADOLC
+deps += $(ADOLCLIB)
+endif
+endif
+
+#Optimization flags:
+AM_CXXFLAGS += $(CXXOPTFLAGS) 
+#}}}
+#Bin sources {{{
+AverageFilter_la_SOURCES = ../AverageFilter/AverageFilter.cpp\
+									../AverageFilter/AverageFilter.h
+AverageFilter_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+BamgMesher_la_SOURCES = ../BamgMesher/BamgMesher.cpp\
+								../BamgMesher/BamgMesher.h
+BamgMesher_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+BamgConvertMesh_la_SOURCES = ../BamgConvertMesh/BamgConvertMesh.cpp\
+									  ../BamgConvertMesh/BamgConvertMesh.h
+BamgConvertMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+BamgTriangulate_la_SOURCES = ../BamgTriangulate/BamgTriangulate.cpp\
+									  ../BamgTriangulate/BamgTriangulate.h
+BamgTriangulate_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Chaco_la_SOURCES = ../Chaco/Chaco.cpp\
+						 ../Chaco/Chaco.h
+Chaco_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(CHACOLIB)
+
+ContourToMesh_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp\
+									../ContourToMesh/ContourToMesh.h
+ContourToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
+
+ContourToNodes_la_SOURCES = ../ContourToNodes/ContourToNodes.cpp\
+									 ../ContourToNodes/ContourToNodes.h
+ContourToNodes_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+ElementConnectivity_la_SOURCES = ../ElementConnectivity/ElementConnectivity.cpp\
+											../ElementConnectivity/ElementConnectivity.h
+ElementConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+EnumToString_la_SOURCES = ../EnumToString/EnumToString.cpp\
+								  ../EnumToString/EnumToString.h
+EnumToString_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+StringToEnum_la_SOURCES = ../StringToEnum/StringToEnum.cpp\
+								  ../StringToEnum/StringToEnum.h
+StringToEnum_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+HoleFiller_la_SOURCES = ../HoleFiller/HoleFiller.cpp\
+								../HoleFiller/HoleFiller.h
+HoleFiller_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) 
+
+InternalFront_la_SOURCES = ../InternalFront/InternalFront.cpp\
+									../InternalFront/InternalFront.h
+InternalFront_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+InterpFromGridToMesh_la_SOURCES = ../InterpFromGridToMesh/InterpFromGridToMesh.cpp\
+											 ../InterpFromGridToMesh/InterpFromGridToMesh.h
+InterpFromGridToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
+
+InterpFromMeshToMesh2d_la_SOURCES = ../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp\
+												../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
+InterpFromMeshToMesh2d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
+
+InterpFromMeshToMesh3d_la_SOURCES = ../InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp\
+												../InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h
+InterpFromMeshToMesh3d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+InterpFromMeshToGrid_la_SOURCES = ../InterpFromMeshToGrid/InterpFromMeshToGrid.cpp\
+											 ../InterpFromMeshToGrid/InterpFromMeshToGrid.h
+InterpFromMeshToGrid_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+InterpFromMesh2d_la_SOURCES = ../InterpFromMesh2d/InterpFromMesh2d.cpp\
+										../InterpFromMesh2d/InterpFromMesh2d.h
+InterpFromMesh2d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
+
+KMLFileRead_la_SOURCES = ../KMLFileRead/KMLFileRead.cpp\
+								 ../KMLFileRead/KMLFileRead.h
+KMLFileRead_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+KMLMeshWrite_la_SOURCES = ../KMLMeshWrite/KMLMeshWrite.cpp\
+								  ../KMLMeshWrite/KMLMeshWrite.h
+KMLMeshWrite_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+KMLOverlay_la_SOURCES = ../KMLOverlay/KMLOverlay.cpp\
+								../KMLOverlay/KMLOverlay.h
+KMLOverlay_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Xy2ll_la_SOURCES = ../Xy2ll/Xy2ll.cpp\
+						 ../Xy2ll/Xy2ll.h
+Xy2ll_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Ll2xy_la_SOURCES = ../Ll2xy/Ll2xy.cpp\
+						 ../Ll2xy/Ll2xy.h
+Ll2xy_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Exp2Kml_la_SOURCES = ../Exp2Kml/Exp2Kml.cpp\
+							../Exp2Kml/Exp2Kml.h
+Exp2Kml_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Kml2Exp_la_SOURCES = ../Kml2Exp/Kml2Exp.cpp\
+							../Kml2Exp/Kml2Exp.h
+Kml2Exp_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Kriging_la_SOURCES = ../Kriging/Kriging.cpp\
+							../Kriging/Kriging.h
+Kriging_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(GSLLIB) $(MULTITHREADINGLIB)
+
+MeshPartition_la_SOURCES = ../MeshPartition/MeshPartition.cpp\
+									../MeshPartition/MeshPartition.h
+MeshPartition_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(METISLIB)
+
+MeshProfileIntersection_la_SOURCES = ../MeshProfileIntersection/MeshProfileIntersection.cpp\
+												 ../MeshProfileIntersection/MeshProfileIntersection.h
+MeshProfileIntersection_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+NodeConnectivity_la_SOURCES = ../NodeConnectivity/NodeConnectivity.cpp\
+										../NodeConnectivity/NodeConnectivity.h
+NodeConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+PointCloudFindNeighbors_la_SOURCES = ../PointCloudFindNeighbors/PointCloudFindNeighbors.cpp\
+												 ../PointCloudFindNeighbors/PointCloudFindNeighbors.h
+PointCloudFindNeighbors_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
+
+PropagateFlagsFromConnectivity_la_SOURCES = ../PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp\
+														  ../PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h
+PropagateFlagsFromConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+Scotch_la_SOURCES = ../Scotch/Scotch.cpp\
+						  ../Scotch/Scotch.h
+Scotch_la_LIBADD = ${deps} $(SCOTCHLIB) $(MPILIB)
+
+Shp2Kml_la_SOURCES = ../Shp2Kml/Shp2Kml.cpp\
+							../Shp2Kml/Shp2Kml.h
+Shp2Kml_la_LIBADD = ${deps} $(SHAPELIBLIB) $(MPILIB) $(PETSCLIB)
+
+TriaSearch_la_SOURCES = ../TriaSearch/TriaSearch.cpp\
+								../TriaSearch/TriaSearch.h
+TriaSearch_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+TriMesh_la_SOURCES = ../TriMesh/TriMesh.cpp\
+							../TriMesh/TriMesh.h
+TriMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(TRIANGLELIB)
+
+TriMeshProcessRifts_la_SOURCES = ../TriMeshProcessRifts/TriMeshProcessRifts.cpp\
+											../TriMeshProcessRifts/TriMeshProcessRifts.h
+TriMeshProcessRifts_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+#}}}
Index: /issm/trunk-jpl/src/wrappers/python/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/python/Makefile.am	(revision 13651)
+++ /issm/trunk-jpl/src/wrappers/python/Makefile.am	(revision 13651)
@@ -0,0 +1,104 @@
+AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
+
+EXEEXT=$(PYTHONWRAPPEREXT)
+
+#Modules {{{
+if MODULES
+lib_LTLIBRARIES = BamgConvertMesh.la\
+						BamgMesher.la\
+						ContourToMesh.la\
+						ContourToNodes.la\
+						ElementConnectivity.la\
+						EnumToString.la\
+						InterpFromMeshToMesh2d.la\
+						NodeConnectivity.la\
+						StringToEnum.la\
+						TriMesh.la\
+						TriMeshProcessRifts.la
+endif 
+#}}}
+#Flags and libraries {{{
+if SHAREDLIBS
+deps = ../../c/libISSMCore.la ../../c/libISSMModules.la
+else
+deps = ../../c/libISSMCore.a ../../c/libISSMModules.a
+endif
+
+deps +=  $(MATHLIB) ${PYTHONLIB}
+
+#Triangle library
+AM_CXXFLAGS =  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
+
+#Python part
+AM_LDFLAGS   = $(PYTHONLINK) -shrext ${EXEEXT} -module
+if VERSION
+AM_LDFLAGS +=
+else
+AM_LDFLAGS += -avoid-version
+endif
+if SHAREDLIBS
+deps += ../../c/libISSMPython.la 
+else
+deps += ../../c/libISSMPython.a
+AM_LDFLAGS += --no-warnings 
+endif
+
+AM_CXXFLAGS +=  -D_HAVE_PYTHON_MODULES_  -fPIC
+if PYTHON3
+AM_CXXFLAGS +=  -DNPY_NO_DEPRECATED_API 
+endif
+
+if SHAREDLIBS
+deps +=
+else
+deps += ../../c/libISSMModules.a ../../c/libISSMCore.a
+endif
+
+#Optimization flags:
+AM_CXXFLAGS += $(CXXOPTFLAGS) 
+#}}}
+#Bin sources {{{
+BamgConvertMesh_la_SOURCES = ../BamgConvertMesh/BamgConvertMesh.cpp\
+									  ../BamgConvertMesh/BamgConvertMesh.h
+BamgConvertMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+BamgMesher_la_SOURCES = ../BamgMesher/BamgMesher.cpp\
+								../BamgMesher/BamgMesher.h
+BamgMesher_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+ContourToMesh_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp\
+									 ../ContourToMesh/ContourToMesh.h
+ContourToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+ContourToNodes_la_SOURCES = ../ContourToNodes/ContourToNodes.cpp\
+									 ../ContourToNodes/ContourToNodes.h
+ContourToNodes_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+ElementConnectivity_la_SOURCES = ../ElementConnectivity/ElementConnectivity.cpp\
+											../ElementConnectivity/ElementConnectivity.h
+ElementConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+EnumToString_la_SOURCES = ../EnumToString/EnumToString.cpp\
+								  ../EnumToString/EnumToString.h
+EnumToString_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+InterpFromMeshToMesh2d_la_SOURCES = ../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp\
+												../InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
+InterpFromMeshToMesh2d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
+
+NodeConnectivity_la_SOURCES = ../NodeConnectivity/NodeConnectivity.cpp\
+										../NodeConnectivity/NodeConnectivity.h
+NodeConnectivity_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+StringToEnum_la_SOURCES = ../StringToEnum/StringToEnum.cpp\
+								  ../StringToEnum/StringToEnum.h
+StringToEnum_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
+TriMesh_la_SOURCES = ../TriMesh/TriMesh.cpp\
+							../TriMesh/TriMesh.h
+TriMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(TRIANGLELIB)
+
+TriMeshProcessRifts_la_SOURCES = ../TriMeshProcessRifts/TriMeshProcessRifts.cpp\
+											../TriMeshProcessRifts/TriMeshProcessRifts.h
+TriMeshProcessRifts_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+#}}}
