Index: /issm/trunk-jpl/src/c/include/macros.h
===================================================================
--- /issm/trunk-jpl/src/c/include/macros.h	(revision 12506)
+++ /issm/trunk-jpl/src/c/include/macros.h	(revision 12507)
@@ -50,10 +50,10 @@
 /* macro to print a line, adds std::endl */
 #define _printLine_(StreamArgs)\
-   {std::cout << StreamArgs << std::endl;}
+   do{std::cout << StreamArgs << std::endl;}while(0)
 /*}}}*/
 /* _printString_ {{{*/
 /* macro to print some string, adds std::ends */
 #define _printString_(StreamArgs)\
-   {std::cout << StreamArgs;}
+   do{std::cout << StreamArgs;}while(0)
 /*}}}*/
 /* _assert_ {{{*/
Index: /issm/trunk-jpl/src/c/modules/HoleFillerx/HoleFillerx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/HoleFillerx/HoleFillerx.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/HoleFillerx/HoleFillerx.cpp	(revision 12507)
@@ -77,5 +77,5 @@
 		}
 		printf( "\n" );
-		printf("Number of zeroes remaining: %10ld",lines*samps-counter);
+		printf("Number of zeroes remaining: %d",lines*samps-counter);
 		fflush( stdout );
 	#endif
@@ -96,5 +96,5 @@
 		//        n u m b e r   o f   z e r o e s   r e m a i n i n g :   1 2 3 4 5 6 7 8 9 10        
 		printf( "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" );
-		printf("Number of zeroes remaining: %10ld",lines*samps-counter);
+		printf("Number of zeroes remaining: %d",lines*samps-counter);
 		fflush( stdout );
 	#endif
Index: /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp	(revision 12507)
@@ -124,5 +124,5 @@
 	double *y             = gate->y;
 	int     nods          = gate->nods;
-	Vector*     data_mesh     = gate->data_mesh;
+	Vector *data_mesh     = gate->data_mesh;
 	double *data          = gate->data;
 	double  default_value = gate->default_value;
@@ -131,8 +131,13 @@
 	int     N             = gate->N;
 
+	bool debug = M*N>1? true:false;
+	debug = true;
+
 	/*partition loop across threads: */
 	PartitionRange(&i0,&i1,nods,num_threads,my_thread);
 	for (i=i0;i<i1;i++) {
 
+		if(debug && my_thread==0)
+		 _printLine_("\r      interpolation progress: "<<setw(5)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%%");
 		x_grid=*(x_mesh+i);
 		y_grid=*(y_mesh+i);
Index: /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp	(revision 12507)
@@ -17,17 +17,17 @@
 	bool debug;
 	int  nels_data;
-	double* index_data=NULL;
-	double* x_data=NULL;
-	double* y_data=NULL;
-	double* data=NULL;
-	double xmin,xmax;
-	double ymin,ymax;
-	int    nods_prime;
-	Vector*    data_prime=NULL;
-	double* x_prime=NULL;
-	double* y_prime=NULL;
-	double* default_values=NULL;
+	double *index_data         = NULL;
+	double *x_data             = NULL;
+	double *y_data             = NULL;
+	double *data               = NULL;
+	double  xmin                 ,xmax;
+	double  ymin                 ,ymax;
+	int     nods_prime;
+	Vector *data_prime         = NULL;
+	double *x_prime            = NULL;
+	double *y_prime            = NULL;
+	double *default_values     = NULL;
 	int     num_default_values;
-	double*    incontour=NULL;
+	double *incontour          = NULL;
 
 	/*intermediary: */
@@ -46,22 +46,22 @@
 	
 	/*recover parameters :*/
-	interpolation_type=gate->interpolation_type;
-	debug=gate->debug;
-	nels_data=gate->nels_data;
-	index_data=gate->index_data;
-	x_data=gate->x_data;
-	y_data=gate->y_data;
-	data=gate->data;
-	xmin=gate->xmin;
-	xmax=gate->xmax;
-	ymin=gate->ymin;
-	ymax=gate->ymax;
-	nods_prime=gate->nods_prime;
-	data_prime=gate->data_prime;
-	x_prime=gate->x_prime;
-	y_prime=gate->y_prime;
-	default_values=gate->default_values;
-	num_default_values=gate->num_default_values;
-	incontour=gate->incontour;
+	interpolation_type = gate->interpolation_type;
+	debug              = gate->debug;
+	nels_data          = gate->nels_data;
+	index_data         = gate->index_data;
+	x_data             = gate->x_data;
+	y_data             = gate->y_data;
+	data               = gate->data;
+	xmin               = gate->xmin;
+	xmax               = gate->xmax;
+	ymin               = gate->ymin;
+	ymax               = gate->ymax;
+	nods_prime         = gate->nods_prime;
+	data_prime         = gate->data_prime;
+	x_prime            = gate->x_prime;
+	y_prime            = gate->y_prime;
+	default_values     = gate->default_values;
+	num_default_values = gate->num_default_values;
+	incontour          = gate->incontour;
 
 	/*partition loop across threads: */
@@ -69,10 +69,9 @@
 
 	/*Loop over the elements*/
-	if (debug && my_thread==0) printf("      interpolation progress:   %5.2lf %%",0.0);
-
 	for (i=i0;i<i1;i++){
 
 		/*display current iteration*/
-		if (debug && my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100*num_threads);
+		if (debug && my_thread==0 && fmod((double)i,(double)100)==0)
+		 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
 
 		/*if there is no point inside the domain, go to next iteration*/
@@ -125,7 +124,6 @@
 		}
 	}
-	if (debug && my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
-	
+	if(debug && my_thread==0)
+	 _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 	return NULL;
-
 }
Index: /issm/trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp	(revision 12507)
@@ -85,9 +85,9 @@
 
 	/*Loop over the elements*/
-	if (debug) printf("      interpolation progress:   %5.2lf %%",0.0);
 	for (n=0;n<nels;n++){
 
 		/*display current iteration*/
-		if (debug && fmod((double)n,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)n/nels*100);
+		if (debug && fmod((double)n,(double)100)==0)
+		 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(n)/double(nels)*100<<"%");
 
 		/*Get extrema coordinates of current elements*/
@@ -168,5 +168,6 @@
 		}
 	}
-	if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
+	if (debug)
+	 _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 
 	/*Assign output pointers:*/
Index: /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp	(revision 12507)
@@ -58,9 +58,9 @@
 
 	/*Loop over the elements*/
-	if (debug) printf("      interpolation progress:   %5.2lf %%",0.0);
 	for (i=0;i<nels_data;i++){
 
 		/*display current iteration*/
-		if (debug && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nels_data*100);
+		if (debug && fmod((double)i,(double)100)==0)
+		 _printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(i)/double(nels_data)*100<<"%");
 
 		/*Get extrema coordinates of current elements*/
@@ -132,5 +132,6 @@
 		}
 	}
-	if (debug) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
+	if (debug)
+	 _printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 
 	/*Assign output pointers:*/
Index: /issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp	(revision 12507)
@@ -96,5 +96,5 @@
 		/*launch the thread manager with Krigingxt as a core: */
 		LaunchThread(NearestNeighbort,(void*)&gate,num);
-		printf("\r      interpolation progress:  100.00%%\n");
+		_printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 		xDelete<double>(gate.percent);
 	}
@@ -115,5 +115,5 @@
 		/*launch the thread manager with Krigingxt as a core: */
 		LaunchThread(idwt,(void*)&gate,num);
-		printf("\r      interpolation progress:  100.00%%\n");
+		_printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 		xDelete<double>(gate.percent);
 	}
@@ -135,5 +135,5 @@
 		/*launch the thread manager with Krigingxt as a core: */
 		LaunchThread(Krigingxt,(void*)&gate,num);
-		printf("\r      interpolation progress:  100.00%%\n");
+		_printLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 		xDelete<double>(gate.percent);
 	}
@@ -190,5 +190,5 @@
 		localpercent=percent[0];
 		for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
-		printf("\r      interpolation progress: %5.2lf%%",localpercent);
+		_printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
 
 		/*Kriging interpolation*/
@@ -239,5 +239,5 @@
 		localpercent=percent[0];
 		for(i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
-		printf("\r      interpolation progress: %5.2lf%%",localpercent);
+		_printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
 
 		observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
@@ -287,5 +287,5 @@
 		localpercent=percent[0];
 		for(int i=1;i<num_threads;i++) localpercent=min(localpercent,percent[i]);
-		printf("\r      interpolation progress: %5.2lf%%",localpercent);
+		_printString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<localpercent<<"%");
 
 		observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
Index: /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp	(revision 12507)
@@ -45,10 +45,9 @@
 
 	/*Loop over the nodes*/
-	if (my_thread==0) printf("      loop progress:   %5.2lf %%",0.0);
-
 	for (i=i0;i<i1;i++){
 
 		/*display current iteration*/
-		if (my_thread==0 && fmod((double)i,(double)100)==0) printf("\b\b\b\b\b\b\b%5.2lf %%",(double)i/nods*100*num_threads);
+		if (my_thread==0 && fmod((double)i,(double)100)==0)
+		 _printString_("\r      loop progress: "<<setw(6)<<setprecision(2)<<double(i-i0)/double(i1-i0)*100<<"%");
 
 		distance=mindistance+100; //make sure initialization respects min distance criterion.
@@ -70,5 +69,6 @@
 		}
 	}
-	if (my_thread==0) printf("\b\b\b\b\b\b\b%5.2lf %%\n",100.0);
+	if (my_thread==0)
+	 _printLine_("\r      loop progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 
 	/*Free ressources:*/
Index: /issm/trunk-jpl/src/c/objects/Bamg/Mesh.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Bamg/Mesh.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/objects/Bamg/Mesh.cpp	(revision 12507)
@@ -2405,12 +2405,12 @@
 		printf("   index:\n");
 		for (i=0;i<nbt;i++){
-			printf("   %4i: [%4i %4i %4i]\n",i+1,
-						((BamgVertex *)triangles[i](0))?GetId(triangles[i][0])+1:0,
-						((BamgVertex *)triangles[i](1))?GetId(triangles[i][1])+1:0,
-						((BamgVertex *)triangles[i](2))?GetId(triangles[i][2])+1:0);
+			_printLine_("   " << setw(4) << i+1 << ": [" 
+						<< setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][0])+1:0) << " " 
+						<< setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][1])+1:0) << " " 
+						<< setw(4) << (((BamgVertex *)triangles[i](0))?GetId(triangles[i][2])+1:0) << "]");
 		}
 		printf("   coordinates:\n");
 		for (i=0;i<nbv;i++){
-			printf("   %4i: [%g %g]\n",i+1,vertices[i].r.x,vertices[i].r.y);
+			_printLine_("   " << setw(4) << i+1 << ": [" << vertices[i].r.x << " " << vertices[i].r.y << "]");
 		}
 
@@ -4067,9 +4067,9 @@
 	printf("      --------------------+-------------+-------------\n"); 
 	for   (i=0;i<=kmax;i++){ 
-		if (i==0) printf("      %10i",0);
-		else      printf("      %10g",exp(lmin+i/delta));
+		if (i==0) _printString_( "      " << setw(10) << 0.);
+		else      _printString_( "      " << setw(10) << exp(lmin+i/delta));
 		if (i==kmax) printf("          +inf   ");
-		else printf("      %10g",exp(lmin+(i+1)/delta));
-		printf("|  %10g |\n",((long)  ((10000.0 * histo[i])/ nbedges))/100.0);
+		else      _printString_( "      " << setw(10) << exp(lmin+(i+1)/delta));
+		_printLine_("|  " << setw(10) << (long((10000. * histo[i])/ nbedges)/100.) << " |");
 		printf("  %i\n",histo[i]);
 	}
Index: /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp	(revision 12507)
@@ -77,11 +77,10 @@
 	printf("   matrix size: %i-%i\n",this->M,this->N);
 	for (i=0;i<this->M;i++){  
-		printf("   [ ");
+		_printString_("   [ ");
 		for (j=0;j<this->N;j++){
-			printf(" %12.6g ",this->values[i*this->N+j]);
+			_printString_( " " << setw(11) << setprecision (5) << this->values[i*this->N+j]);
 		}  
-		printf(" ]\n");
+		_printLine_(" ]");
 	}  
-	printf("\n");
 
 }
Index: /issm/trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp	(revision 12507)
@@ -377,43 +377,43 @@
 
 	int i,j;
-	printf("Element Matrix echo: \n");
-	printf("   nrows: %i\n",nrows);
-	printf("   ncols: %i\n",ncols);
-	printf("   dofsymmetrical: %s\n",dofsymmetrical?"true":"false");
-
-	printf("   values: \n");
+	_printLine_("Element Matrix echo:");
+	_printLine_("   nrows: " << nrows);
+	_printLine_("   ncols: " << nrows);
+	_printLine_("   dofsymmetrical: " << (dofsymmetrical?"true":"false"));
+
+	_printLine_("   values:");
 	for(i=0;i<nrows;i++){
-		printf("      %i: ",i);
-		for(j=0;j<ncols;j++) printf("%10g ",*(values+ncols*i+j));
-		printf("\n");
-	}
-
-	printf("   gglobaldoflist (%p): ",gglobaldoflist);
-	if(gglobaldoflist) for(i=0;i<nrows;i++)printf("%i ",gglobaldoflist[i]); printf("\n");
-
-	printf("   row_fsize: %i\n",row_fsize);
-	printf("   row_flocaldoflist (%p): ",row_flocaldoflist);
-	if(row_flocaldoflist) for(i=0;i<row_fsize;i++)printf("%i ",row_flocaldoflist[i]); printf("\n");
-	printf("   row_fglobaldoflist (%p): ",row_fglobaldoflist);
-	if(row_fglobaldoflist)for(i=0;i<row_fsize;i++)printf("%i ",row_fglobaldoflist[i]); printf("\n");
-
-	printf("   row_ssize: %i\n",row_ssize);
-	printf("   row_slocaldoflist (%p): ",row_slocaldoflist);
-	if(row_slocaldoflist)for(i=0;i<row_ssize;i++)printf("%i ",row_slocaldoflist[i]); printf("\n");
-	printf("   row_sglobaldoflist (%p): ",row_sglobaldoflist);
-	if(row_sglobaldoflist)for(i=0;i<row_ssize;i++)printf("%i ",row_sglobaldoflist[i]); printf("\n");
+		_printString_(setw(4) << right << i << ": ");
+		for(j=0;j<ncols;j++) _printString_( " " << setw(11) << setprecision (5) << right << values[i*ncols+j]);
+		_printLine_("");
+	}
+
+	_printString_("   gglobaldoflist (" << gglobaldoflist << "): ");
+	if(gglobaldoflist) for(i=0;i<nrows;i++) _printString_(" " << gglobaldoflist[i]); _printLine_("");
+
+	_printLine_("   row_fsize: " << row_fsize);
+	_printString_("   row_flocaldoflist  (" << row_flocaldoflist << "): ");
+	if(row_flocaldoflist) for(i=0;i<row_fsize;i++) _printString_(" " << row_flocaldoflist[i]); _printLine_(" ");
+	_printString_("   row_fglobaldoflist  (" << row_fglobaldoflist << "): ");
+	if(row_fglobaldoflist) for(i=0;i<row_fsize;i++) _printString_(" " << row_fglobaldoflist[i]); _printLine_(" ");
+
+	_printLine_("   row_ssize: " << row_ssize);
+	_printString_("   row_slocaldoflist  (" << row_slocaldoflist << "): ");
+	if(row_slocaldoflist) for(i=0;i<row_ssize;i++) _printString_(" " << row_slocaldoflist[i]); _printLine_(" ");
+	_printString_("   row_sglobaldoflist  (" << row_sglobaldoflist << "): ");
+	if(row_sglobaldoflist) for(i=0;i<row_ssize;i++) _printString_(" " << row_sglobaldoflist[i]); _printLine_(" ");
 
 	if(!dofsymmetrical){
-		printf("   col_fsize: %i\n",col_fsize);
-		printf("   col_flocaldoflist (%p): ",col_flocaldoflist);
-		if(col_flocaldoflist)for(i=0;i<col_fsize;i++)printf("%i ",col_flocaldoflist[i]); printf("\n");
-		printf("   col_fglobaldoflist (%p): ",col_fglobaldoflist);
-		if(col_fglobaldoflist)for(i=0;i<col_fsize;i++)printf("%i ",col_fglobaldoflist[i]); printf("\n");
-
-		printf("   col_ssize: %i\n",col_ssize);
-		printf("   col_slocaldoflist (%p): ",col_slocaldoflist);
-		if(col_slocaldoflist)for(i=0;i<col_ssize;i++)printf("%i ",col_slocaldoflist[i]); printf("\n");
-		printf("   col_sglobaldoflist (%p): ",col_sglobaldoflist);
-		if(col_sglobaldoflist)for(i=0;i<col_ssize;i++)printf("%i ",col_sglobaldoflist[i]); printf("\n");
+		_printLine_("   col_fsize: " << col_fsize);
+		_printString_("   col_flocaldoflist  (" << col_flocaldoflist << "): ");
+		if(col_flocaldoflist) for(i=0;i<col_fsize;i++) _printString_(" " << col_flocaldoflist[i]); _printLine_(" ");
+		_printString_("   col_fglobaldoflist  (" << col_fglobaldoflist << "): ");
+		if(col_fglobaldoflist) for(i=0;i<col_fsize;i++) _printString_(" " << col_fglobaldoflist[i]); _printLine_(" ");
+
+		_printLine_("   col_ssize: " << col_ssize);
+		_printString_("   col_slocaldoflist  (" << col_slocaldoflist << "): ");
+		if(col_slocaldoflist) for(i=0;i<col_ssize;i++) _printString_(" " << col_slocaldoflist[i]); _printLine_(" ");
+		_printString_("   col_sglobaldoflist  (" << col_sglobaldoflist << "): ");
+		if(col_sglobaldoflist) for(i=0;i<col_ssize;i++) _printString_(" " << col_sglobaldoflist[i]); _printLine_(" ");
 	}
 }
Index: /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp	(revision 12507)
@@ -222,9 +222,4 @@
 	_printLine_("Element Vector echo:");
 	_printLine_("   nrows: " << nrows);
-
-	_printLine_("   test:");
-	for(i=0;i<nrows;i++) _printString_(" " << i);
-	_printLine_("HERE");
-
 	_printLine_("   values:");
 	for(i=0;i<nrows;i++){
@@ -237,8 +232,10 @@
 
 	_printLine_("   fsize: " << fsize);
-	printf("   flocaldoflist (%p): ",flocaldoflist);
-	if(flocaldoflist) for(i=0;i<fsize;i++)printf("%i ",flocaldoflist[i]); printf("\n");
-	printf("   fglobaldoflist (%p): ",fglobaldoflist);
-	if(fglobaldoflist)for(i=0;i<fsize;i++)printf("%i ",fglobaldoflist[i]); printf("\n");
+	_printString_("   flocaldoflist  (" << flocaldoflist << "): ");
+	if(flocaldoflist) for(i=0;i<fsize;i++) _printString_(" " << flocaldoflist[i] );
+	_printLine_(" ");
+	_printString_("   fglobaldoflist (" << fglobaldoflist << "): ");
+	if(fglobaldoflist) for(i=0;i<fsize;i++) _printString_(" " << fglobaldoflist[i] );
+	_printLine_(" ");
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/shared/Elements/elements.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Elements/elements.h	(revision 12506)
+++ /issm/trunk-jpl/src/c/shared/Elements/elements.h	(revision 12507)
@@ -30,29 +30,28 @@
 
 inline void printarray(IssmDouble* array,int lines,int cols=1){
-	printf("\n");
+	_printLine_("");
 	for(int i=0;i<lines;i++){  
-		printf("   [ ");
-		for(int j=0;j<cols;j++) printf(" %12.7g ",array[i*cols+j]);
-		printf(" ]\n");
+		_printString_("   [ ");
+		for(int j=0;j<cols;j++) _printString_( " " << setw(11) << setprecision (5) << array[i*cols+j]);
+		_printLine_(" ]");
 	}  
-	printf("\n");
+	_printLine_("");
 }
 inline void printarray(int* array,int lines,int cols=1){
-	printf("\n");
+	_printLine_("");
 	for(int i=0;i<lines;i++){  
-		printf("   [ ");
-		for(int j=0;j<cols;j++) printf(" %6i",array[i*cols+j]);
-		printf(" ]\n");
+		_printString_("   [ ");
+		for(int j=0;j<cols;j++) _printString_( " " << setw(11) << setprecision (5) << array[i*cols+j]);
+		_printLine_(" ]");
 	}  
-	printf("\n");
+	_printLine_("");
 }
 inline void printbinary(int n) {
 	unsigned int i=1L<<(sizeof(n)*8-1);
-
 	while (i>0) {
 		if (n&i)
-		 printf("1");
+		 _printString_("1");
 		else
-		 printf("0");
+		 _printString_("0");
 		i>>=1;
 	}
Index: /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp	(revision 12507)
@@ -15,4 +15,5 @@
 #include "../../shared/shared.h"
 #include <float.h>
+#include <iomanip>
 
 void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){
Index: /issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp	(revision 12506)
+++ /issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp	(revision 12507)
@@ -66,6 +66,5 @@
 		mexPrintf("   %s format error.\n", __FUNCT__);
 		TriMeshProcessRiftsUsage();
-		printf("   ");
-		mexErrMsgTxt(" ");
+		_error_("bad usage");
 	}
 
@@ -82,6 +81,5 @@
 	}
 	else{
-		printf("%s%s\n",__FUNCT__," error message: first argument should be the element list!");
-		mexErrMsgTxt(" ");
+		_error_("first argument should be the element list");
 	}
 
@@ -96,6 +94,5 @@
 	}
 	else{
-		printf("%s%s\n",__FUNCT__," error message: second argument should be the x corrdinate list!");
-		mexErrMsgTxt(" ");
+		_error_("second argument should be the x corrdinate list");
 	}
 
@@ -109,6 +106,5 @@
 	}
 	else{
-		printf("%s%s\n",__FUNCT__," error message: third argument should be the y corrdinate list!");
-		mexErrMsgTxt(" ");
+		_error_("third argument should be the y corrdinate list");
 	}	
 
@@ -125,6 +121,5 @@
 	}
 	else{
-		printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segments list!");
-		mexErrMsgTxt(" ");
+		_error_("fourth argument should be the segments list");
 	}
 
@@ -138,29 +133,6 @@
 	}
 	else{
-		printf("%s%s\n",__FUNCT__," error message: fourth argument should be the segmentmarkers list!");
-		mexErrMsgTxt(" ");
-	}
-
-	/*
-	printf("Index: \n");
-	for (i=0;i<nel;i++){
-		for(j=0;j<3;j++){
-			printf("%lf ",*(index_in+3*i+j));
-		}
-		printf("\n");
-	}
-	printf("x,y: \n");
-	for (i=0;i<nods;i++){
-		printf("%16.16lf %16.16lf\n",x_in[i],y_in[i]);
-	}
-	printf("segments:\n");
-	for (i=0;i<num_seg;i++){
-		for(j=0;j<3;j++){
-			printf("%lf ",*(segments_in+3*i+j));
-		}
-		printf("%lf ",segmentmarkers_in[i]);
-		printf("\n");
-	}
-	*/
+		_error_("fourth argument should be the segmentmarkers list");
+	}
 
 	/*First, do some fixing on the existing mesh: we do not want any element belonging entirely to the segment list (ie: 
