wiki:rp_progress

Show progress during long-running simulations

You can show progress during a simulation by printing a special message to the standard output channel. For example:

  =RAPPTURE-PROGRESS=>10 Starting calculation...
  =RAPPTURE-PROGRESS=>25 Solving...
  =RAPPTURE-PROGRESS=>30 Solving...
  =RAPPTURE-PROGRESS=>100 Finished!

The special =RAPPTURE-PROGRESS=> prefix on each line helps Rappture recognize this output mixed in with the rest of the output from your tool. Normally, these messages are mixed in with other output, for example as follows:

  =RAPPTURE-PROGRESS=>10 Starting calculation...
  Iteration #1 ...
  Solving temperature @ 300K
  =RAPPTURE-PROGRESS=>25 Solving...
  =RAPPTURE-PROGRESS=>30 Solving...
  =RAPPTURE-PROGRESS=>100 Finished!

The number right after the =RAPPTURE-PROGRESS=> prefix gives the percentage complete (0-100). The rest of the line is treated as a progress message, which is displayed for the user.

The progress messages appear on screen during the simulation right below the normal output:

There are functions you should use to automatically create these messages. Check out the Rappture Utils module in the bindings documentation for your favorite programming language. Below are some examples:

C programming language:

  #include "rappture.h"
  int main()
  {
      rpUtilsProgress( 10, "Starting calculation\n"); 
      rpUtilsProgress( 25, "Solving...\n");
      return 0;
  }

Fortran:

  program progress_ex
      call rp_utils_progress (10,"Starting calculation")
      call rp_utils_progress (25,"Solving...")
  end program progress_ex

Python:

  import Rappture
  Rappture.Utils.progress(10,"Starting calculation")
  Rappture.Utils.progress(25,"Solving...")

Tcl:

  package require Rappture
  Rappture::Utils::progress 10 -mesg "Starting calculation"
  Rappture::Utils::progress 25 -mesg "Solving..."

Matlab / Octave:

  rpUtilsProgress(10,'Starting calculation');
  rpUtilsProgress(25,'Solving...');

Perl:

  use Rappture;
  Rappture::Utils::progress(10,"Starting calculation");
  Rappture::Utils::progress(25,"Solving...");
Last modified 14 years ago Last modified on Apr 12, 2010 6:52:51 AM