Index: /issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.cpp
===================================================================
--- /issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.cpp	(revision 5356)
+++ /issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.cpp	(revision 5357)
@@ -13,8 +13,11 @@
 using namespace std;
 
-void TriaSearchx(double* ptria,double* index,int nel, double* x, double* y, int nods,double x0, double y0){
+void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofgrids){
 
 	/*Output*/
-	double tria;
+	double* tria=NULL;
+
+	/*allocate: */
+	tria=(double*)xmalloc(numberofgrids*sizeof(double));
 
 	/*Intermediary*/
@@ -34,27 +37,31 @@
 	Th.CreateSingleVertexToTriangleConnectivity();
 
-	//Get current point coordinates
-	r.x=x0; r.y=y0;
-	I=Th.R2ToI2(r);
+	for(i=0;i<numberofgrids;i++){
 
-	//Find triangle holding r/I
-	Triangle &tb=*Th.TriangleFindFromCoord(I,dete);
+		//Get current point coordinates
+		r.x=x0[i]; r.y=y0[i];
+		
+		I=Th.R2ToI2(r);
 
-	// internal point 
-	if (tb.det>0){ 
-		//Area coordinate
-		areacoord[0]= (double) dete[0]/ tb.det;
-		areacoord[1]= (double) dete[1] / tb.det;
-		areacoord[2]= (double) dete[2] / tb.det;
-		//3 vertices of the triangle
-		i0=Th.GetId(tb[0]);
-		i1=Th.GetId(tb[1]);
-		i2=Th.GetId(tb[2]);
-		//triangle number
-		tria=(double)Th.GetId(tb);
+		//Find triangle holding r/I
+		Triangle &tb=*Th.TriangleFindFromCoord(I,dete);
+
+		// internal point 
+		if (tb.det>0){ 
+			//Area coordinate
+			areacoord[0]= (double) dete[0]/ tb.det;
+			areacoord[1]= (double) dete[1] / tb.det;
+			areacoord[2]= (double) dete[2] / tb.det;
+			//3 vertices of the triangle
+			i0=Th.GetId(tb[0]);
+			i1=Th.GetId(tb[1]);
+			i2=Th.GetId(tb[2]);
+			//triangle number
+			tria[i]=(double)Th.GetId(tb);
+		}
+		//external point
+		else tria[i]=NAN;
 	}
-	//external point
-	else tria=NAN;
-	
+
 	/*Assign output pointers:*/
 	*ptria=tria;
Index: /issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.h
===================================================================
--- /issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.h	(revision 5356)
+++ /issm/trunk/src/c/modules/TriaSearchx/TriaSearchx.h	(revision 5357)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void TriaSearchx(double* ptria,double* index,int nel, double* x, double* y, int nods,double x0, double y0);
+void TriaSearchx(double** ptria,double* index,int nel, double* x, double* y, int nods,double* x0, double* y0,int numberofgrids);
 
 #endif
Index: /issm/trunk/src/m/classes/public/ismodelselfconsistent.m
===================================================================
--- /issm/trunk/src/m/classes/public/ismodelselfconsistent.m	(revision 5356)
+++ /issm/trunk/src/m/classes/public/ismodelselfconsistent.m	(revision 5357)
@@ -351,5 +351,6 @@
 
 	%LENGTH CONTROL FIELDS
-	fields={'maxiter','optscal','cm_responses','cm_jump'};
+	%fields={'maxiter','optscal','cm_responses','cm_jump'};
+	fields={'maxiter','optscal','cm_jump'};
 	checksize(md,fields,[md.nsteps 1]);
 
Index: /issm/trunk/src/m/classes/public/solveparallel.m
===================================================================
--- /issm/trunk/src/m/classes/public/solveparallel.m	(revision 5356)
+++ /issm/trunk/src/m/classes/public/solveparallel.m	(revision 5357)
@@ -42,2 +42,9 @@
 	end
 end
+
+%post processes qmu results if necessary
+if md.qmu_analysis,
+	system(['rm -rf qmu' num2str(GetPId)]);
+end
+
+
Index: /issm/trunk/src/m/utils/Exp/flowlines.m
===================================================================
--- /issm/trunk/src/m/utils/Exp/flowlines.m	(revision 5356)
+++ /issm/trunk/src/m/utils/Exp/flowlines.m	(revision 5357)
@@ -38,12 +38,7 @@
 
 %check seed points
-tria=tsearch(x,y,index,x0,y0);
-pos=find(isnan(tria));
-%seems to be a bug here: must do the test several times...
-while ~isempty(pos)
-	x0(pos)=[];
-	y0(pos)=[];
-	tria=tsearch(x,y,index,x0,y0);
-	pos=find(isnan(tria));
+tria=TriaSearch(index,x,y,x0,y0);
+if isnan(tria),
+	error('flowlines error message: seed point is not inside mesh!');
 end
 
Index: /issm/trunk/src/mex/TriaSearch/TriaSearch.cpp
===================================================================
--- /issm/trunk/src/mex/TriaSearch/TriaSearch.cpp	(revision 5356)
+++ /issm/trunk/src/mex/TriaSearch/TriaSearch.cpp	(revision 5357)
@@ -14,12 +14,13 @@
 
 	double* x=NULL;
+	double* y=NULL;
 	int     nods;
 
-	double* y=NULL;
+	double* x0=NULL;
+	double* y0=NULL;
+	int     numberofgrids;
 
-	double  x0,y0;
-	
 	/* output: */
-	double  tria;
+	double*  tria=NULL;
 
 	/*Boot module: */
@@ -33,6 +34,6 @@
 	FetchData(&x,&nods,XHANDLE);
 	FetchData(&y,&nods,YHANDLE);
-	FetchData(&x0,X0HANDLE);
-	FetchData(&y0,Y0HANDLE);
+	FetchData(&x0,&numberofgrids,X0HANDLE);
+	FetchData(&y0,&numberofgrids,Y0HANDLE);
 
 	/* Echo: {{{1*/
@@ -41,11 +42,11 @@
 
 	/* Run core computations: */
-	TriaSearchx(&tria,index,nel,x,y,nods,x0,y0);
+	TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofgrids);
 
 	/* c to matlab: */
-	tria++;
+	for(i=0;i<numberofgrids;i++)tria[i]++;
 
 	/*Write data: */
-	WriteData(TRIA,tria);
+	WriteData(TRIA,tria,numberofgrids);
 
 	/*end module: */
@@ -61,4 +62,5 @@
 	_printf_("      index,x,y: mesh triangulatrion\n");
 	_printf_("      x0,y0: coordinates of the point for which we are trying to find a triangle\n");
+	_printf_("      x0,y0 can be an array of points\n");
 	_printf_("\n");
 }
