Index: /issm/trunk-jpl/src/c/include/macros.h
===================================================================
--- /issm/trunk-jpl/src/c/include/macros.h	(revision 12511)
+++ /issm/trunk-jpl/src/c/include/macros.h	(revision 12512)
@@ -57,4 +57,18 @@
    do{std::cout << StreamArgs;}while(0)
 /*}}}*/
+/* _pprintLine_ {{{*/
+/* macro to print a line, adds std::endl */
+#define _pprintLine_(StreamArgs)\
+  do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
+	  aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
+	  PrintfFunction(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
+/*}}}*/
+/* _pprintString_ {{{*/
+/* macro to print some string, adds std::ends */
+#define _pprintString_(StreamArgs)\
+  do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
+	  aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
+	  PrintfFunction(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
+/*}}}*/
 /* _assert_ {{{*/
 /*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/
Index: /issm/trunk-jpl/src/c/io/PrintfFunction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/io/PrintfFunction.cpp	(revision 12511)
+++ /issm/trunk-jpl/src/c/io/PrintfFunction.cpp	(revision 12512)
@@ -29,9 +29,5 @@
 		/* Try to print in the allocated space. */
 		va_start(args, format);
-#ifndef WIN32
 		n=vsnprintf(buffer,size,format,args);
-#else
-		n=vsnprintf(buffer,size,format,args);
-#endif
 		va_end(args);
 
@@ -55,2 +51,8 @@
 	return 1;
 }
+int PrintfFunction(const string & message){
+	extern int  my_rank;
+	if(my_rank==0){
+		printf("%s\n",message.c_str());
+	}
+}
Index: /issm/trunk-jpl/src/c/io/io.h
===================================================================
--- /issm/trunk-jpl/src/c/io/io.h	(revision 12511)
+++ /issm/trunk-jpl/src/c/io/io.h	(revision 12512)
@@ -15,4 +15,5 @@
 /*printf: */
 int PrintfFunction(const char* format,...);
+int PrintfFunction(const string & message);
 
 #endif	/* _IO_H_ */
Index: /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 12511)
+++ /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 12512)
@@ -56,8 +56,8 @@
 		/*partition loop across threads: */
 		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
-			_printf_(true,"\r      interpolation progress: %5.2lf%%",double(idx)/double(n_interp)*100);
+			_pprintString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
 			observations->InterpolationKriging(&predictions[idx],&error[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,variogram);
 		}
-		_printf_(true,"\r      interpolation progress: %5.2lf%%\n",100.);
+		_pprintLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 
 #ifdef _HAVE_MPI_
@@ -74,8 +74,8 @@
 		/*partition loop across threads: */
 		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
-			_printf_(true,"\r      interpolation progress: %5.2lf%%",double(idx)/double(n_interp)*100);
+			_pprintString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
 			observations->InterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius);
 		}
-		_printf_(true,"\r      interpolation progress: %5.2lf%%\n",100.);
+		_pprintLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 
 #ifdef _HAVE_MPI_
@@ -91,8 +91,8 @@
 		/*partition loop across threads: */
 		for(int idx=my_rank;idx<n_interp;idx+=num_procs){
-			_printf_(true,"\r      interpolation progress: %5.2lf%%",double(idx)/double(n_interp)*100);
+			_pprintString_("\r      interpolation progress: "<<setw(6)<<setprecision(2)<<double(idx)/double(n_interp)*100<<"%");
 			observations->InterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power);
 		}
-		_printf_(true,"\r      interpolation progress: %5.2lf%%\n",100.);
+		_pprintLine_("\r      interpolation progress: "<<fixed<<setw(6)<<setprecision(2)<<100.<<"%");
 
 #ifdef _HAVE_MPI_
Index: /issm/trunk-jpl/src/c/objects/KML/KML_LatLonBox.cpp
===================================================================
--- /issm/trunk-jpl/src/c/objects/KML/KML_LatLonBox.cpp	(revision 12511)
+++ /issm/trunk-jpl/src/c/objects/KML/KML_LatLonBox.cpp	(revision 12512)
@@ -44,19 +44,15 @@
 void  KML_LatLonBox::Echo(){
 
-	bool  flag=true;
 
-	_printf_(flag,"KML_LatLonBox:\n");
+	_printLine_("KML_LatLonBox:");
 	KML_Object::Echo();
 
-	_printf_(flag,"         north: %0.16g\n"    ,north);
-	_printf_(flag,"         south: %0.16g\n"    ,south);
-	_printf_(flag,"          east: %0.16g\n"    ,east);
-	_printf_(flag,"          west: %0.16g\n"    ,west);
-	_printf_(flag,"      rotation: %0.16g\n"    ,rotation);
-
-	return;
+	_printLine_("         north: " << north);
+	_printLine_("         south: " << south);
+	_printLine_("          east: " << east);
+	_printLine_("          west: " << west);
+	_printLine_("      rotation: " << rotation);
 }
 /*}}}*/
-
 /*FUNCTION KML_LatLonBox::DeepEcho {{{*/
 void  KML_LatLonBox::DeepEcho(){
@@ -69,5 +65,4 @@
 }
 /*}}}*/
-
 /*FUNCTION KML_LatLonBox::DeepEcho {{{*/
 void  KML_LatLonBox::DeepEcho(const char* indent){
@@ -75,17 +70,14 @@
 	bool  flag=true;
 
-	_printf_(flag,"%sKML_LatLonBox:\n",indent);
+	_printLine_(indent << "KML_LatLonBox:");
 	KML_Object::DeepEcho(indent);
 
-	_printf_(flag,"%s         north: %0.16g\n"    ,indent,north);
-	_printf_(flag,"%s         south: %0.16g\n"    ,indent,south);
-	_printf_(flag,"%s          east: %0.16g\n"    ,indent,east);
-	_printf_(flag,"%s          west: %0.16g\n"    ,indent,west);
-	_printf_(flag,"%s      rotation: %0.16g\n"    ,indent,rotation);
-
-	return;
+	_printLine_("         north: " << north);
+	_printLine_("         south: " << south);
+	_printLine_("          east: " << east);
+	_printLine_("          west: " << west);
+	_printLine_("      rotation: " << rotation);
 }
 /*}}}*/
-
 /*FUNCTION KML_LatLonBox::Write {{{*/
 void  KML_LatLonBox::Write(FILE* filout,const char* indent){
@@ -109,5 +101,4 @@
 }
 /*}}}*/
-
 /*FUNCTION KML_LatLonBox::Read {{{*/
 void  KML_LatLonBox::Read(FILE* fid,char* kstr){
@@ -172,3 +163,2 @@
 }
 /*}}}*/
-
Index: /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp	(revision 12511)
+++ /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp	(revision 12512)
@@ -31,7 +31,7 @@
 	IssmDouble x,x1,x2,xm;
 	IssmDouble tol1,tol2,seps;
-	IssmDouble tolerance=1.e-4;
-	int    maxiter,iter;
-	bool   loop=true,goldenflag;
+	IssmDouble tolerance = 1.e-4;
+	int        maxiter ,iter;
+	bool       loop= true,goldenflag;
 
 	/*Recover parameters:*/
@@ -45,9 +45,12 @@
 	fxmin = (*f)(xmin,optargs);
 	if (isnan(fxmin)) _error2_("Function evaluation returned NaN");
-	_printf_(VerboseControl(),"\n        Iteration         x           f(x)       Tolerance         Procedure\n\n");
-	_printf_(VerboseControl(),"        %s    %12.6g  %12.6g  %s","   N/A",xmin,fxmin,"         N/A         boundary\n");
+	cout<<setprecision(5);
+	if(VerboseControl()) _pprintLine_("");
+	if(VerboseControl()) _pprintLine_("       Iteration         x           f(x)       Tolerance         Procedure");
+	if(VerboseControl()) _pprintLine_("");
+	if(VerboseControl()) _pprintLine_("           N/A    "<<setw(12)<<xmin<<"  "<<setw(12)<<fxmin<<"           N/A         boundary");
 	fxmax = (*f)(xmax,optargs);
 	if (isnan(fxmax)) _error2_("Function evaluation returned NaN");
-	_printf_(VerboseControl(),"        %s    %12.6g  %12.6g  %s","   N/A",xmax,fxmax,"         N/A         boundary\n");
+	if(VerboseControl()) _pprintLine_("           N/A    "<<setw(12)<<xmax<<"  "<<setw(12)<<fxmax<<"           N/A         boundary");
 
 	/*test if jump option activated and xmin==0*/
@@ -85,5 +88,6 @@
 
 	/*4: print result*/
-	_printf_(VerboseControl(),"         %5i    %12.6g  %12.6g  %12.6g  %s\n",iter,xbest,fxbest,pow(pow(xbest-xm,2),0.5),"       initial");
+	if(VerboseControl())
+	 _pprintLine_("         "<<setw(5)<<iter<<"    "<<setw(12)<<xbest<<"  "<<setw(12)<<fxbest<<"  "<<setw(12)<<pow(pow(xbest-xm,2),0.5)<<"         initial");
 	if (!isnan(cm_jump) && (xmin==0) && ((fxbest/fxmin)<cm_jump)){
 		_printf_(VerboseControl(),"      optimization terminated: current x satisfies criteria 'cm_jump'=%g\n",cm_jump);
@@ -180,5 +184,7 @@
 		tol1=seps*pow(pow(xbest,2),0.5)+tolerance/3.0;
 		tol2=2.0*tol1;
-		_printf_(VerboseControl(),"         %5i    %12.6g  %12.6g  %12.6g  %s\n",iter,x,fx,pow(pow(xbest-xm,2),0.5),goldenflag?"       golden":"       parabolic");
+		if(VerboseControl())
+		 _pprintLine_("         "<<setw(5)<<iter<<"    "<<setw(12)<<x<<"  "<<setw(12)<<fx<<"  "<<setw(12)<<pow(pow(xbest-xm,2),0.5)<<
+					 "         "<<(goldenflag?"golden":"parabolic"));
 
 		/*Stop the optimization?*/
Index: /issm/trunk-jpl/src/c/solutions/issm.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solutions/issm.cpp	(revision 12511)
+++ /issm/trunk-jpl/src/c/solutions/issm.cpp	(revision 12512)
@@ -154,15 +154,22 @@
 	#ifdef _HAVE_MPI_
 	MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
-	_printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",finish_init-start_init);
-	_printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",finish_core-start_core);
-	_printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60);
+	_pprintLine_("");
+	_pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<finish_init-start_init);
+	_pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<finish_core-start_core);
+	_pprintLine_("");
+	_pprintLine_("   Total elapsed time:"<<int((finish-start)/3600)<<" hrs "<<int(int(finish-start)%3600/60)<<" min "<<int(finish-start)%60<<" sec");
+	_pprintLine_("");
 	#else
 	finish=(IssmPDouble)clock();
-	_printf_(true,"\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",(finish_init-start_init)/CLOCKS_PER_SEC);
-	_printf_(true,"   %-34s %f seconds  \n","Core solution elapsed time:",(finish_core-start_core)/CLOCKS_PER_SEC);
-	_printf_(true,"\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600/CLOCKS_PER_SEC),int(int((finish-start)/CLOCKS_PER_SEC)%3600/60),(int(finish-start)/CLOCKS_PER_SEC)%60);
+	_pprintLine_("");
+	_pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<(finish_init-start_init)/CLOCKS_PER_SEC);
+	_pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<(finish_core-start_core)/CLOCKS_PER_SEC);
+	_pprintLine_("");
+	_pprintLine_("   Total elapsed time:"
+				<<int((finish-start)/CLOCKS_PER_SEC/3600)<<" hrs "
+				<<int(int(finish-start)/CLOCKS_PER_SEC%3600/60)<<" min "
+				<<int(finish-start)/CLOCKS_PER_SEC%60<<" sec");
+	_pprintLine_("");
 	#endif
-	
-		
 	
 	#ifdef _HAVE_PETSC_
