<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.32.1">
</HEAD>
<BODY>
Dear all,<BR>
<BR>
Somewhere in my boundary element solver I have a console progress bar which prints to screen the progress of an operation.<BR>
It looks like this:<BR>
INFO&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp; 50%&nbsp; [------------&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]<BR>
<BR>
The function is very simple:<BR>
//i is the current iteration number <BR>
//n is the total number of iterations<BR>
void progressBar(int x, int n)<BR>
{<BR>
<BR>
&nbsp;&nbsp;&nbsp; if ( x % (n/100) != 0 ) return;<BR>
<BR>
&nbsp;&nbsp;&nbsp; // Calculate the ratio of complete-to-incomplete.<BR>
&nbsp;&nbsp;&nbsp; float ratio = x/(float)n;<BR>
&nbsp;&nbsp;&nbsp; int&nbsp;&nbsp; c&nbsp;&nbsp;&nbsp;&nbsp; = ratio * 80<BR>
<BR>
&nbsp;&nbsp;&nbsp; // Show the percentage complete.<BR>
&nbsp;&nbsp;&nbsp; printf(&quot;INFO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :\t%3d%% [&quot;, (int)(ratio*100) );<BR>
<BR>
&nbsp;&nbsp;&nbsp; // Show the load bar.<BR>
&nbsp;&nbsp;&nbsp; for (int x=0; x&lt;c-1; x++)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot;-&quot;);<BR>
<BR>
&nbsp;&nbsp;&nbsp; printf(&quot;&gt;&quot;);<BR>
<BR>
&nbsp;&nbsp;&nbsp; for (int x=c; x&lt;pBarWidth; x++)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&quot; &quot;);<BR>
<BR>
&nbsp;&nbsp;&nbsp; // ANSI Control codes to go back to the<BR>
&nbsp;&nbsp;&nbsp; // previous line and clear it.<BR>
&nbsp;&nbsp;&nbsp; printf(&quot;]\n\033[F\033[J&quot;);<BR>
}<BR>
<BR>
<BR>
My problem is that the progress bar doesn't print to screen as soon as I call the PetscInitialize() function (it works fine otherwise).<BR>
I tried to play with fflush(stdout) commands without any success.<BR>
<BR>
Any ideas ?<BR>
<BR>
Thanks,<BR>
Thomas Leissing<BR>
<BR>
</BODY>
</HTML>