Changes between Initial Version and Version 1 of ProgressInfo


Ignore:
Timestamp:
05/17/12 22:43:52 (2 years ago)
Author:
mmc
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • ProgressInfo

    v1 v1  
     1== Progress Info: A Proposal == 
     2 
     3Rappture has a simple function for reporting progress during simulation.  For example, in C language, the call would be: 
     4{{{ 
     5rpUtilsProgress(25, "Solving sparse matrix..."); 
     6}}} 
     7This brings up a progress bar showing ''25%'' and the message ''Solving sparse matrix...'' beneath it.  Your program should call this again and again during a long simulation to update the percentage and the message displayed to the user. 
     8 
     9Users of some simulators need to see more than a simple status message.  For example, suppose a simulator spends a while trying to achieve convergence for an initial solution, and then computes solutions at a series of time points.  During the initial solution, the user might want to see a plot of convergence, so if the solution is wandering, the simulation can be aborted.  After the initial solution, the user may want to see a plot for each time point, or perhaps a 2D image at each time point, to get a feeling of how the simulation is progressing. 
     10 
     11These advanced scenarios could be handled by defining Rappture objects within a {{{<progress>}}} section of the {{{tool.xml}}} file: 
     12{{{ 
     13<?xml version="1.0"?> 
     14<run> 
     15<tool>...</tool> 
     16<input>...</input> 
     17<progress> 
     18  <phase id="init"> 
     19    <curve id="converge"> 
     20      <about><label>Convergence of Initial Solution</label></about> 
     21      <xaxis><label>Iteration</label></xaxis> 
     22      <yaxis><label>Error</label><scale>log</scale></yaxis> 
     23    </curve> 
     24  </phase> 
     25  <phase id="solve"> 
     26    <image id="2D"> 
     27      <about><label>2D Solution</label></about> 
     28    </image> 
     29  </phase> 
     30</progress> 
     31<output>...</output> 
     32</run> 
     33}}} 
     34This example has two phases of progress.  The first phase is used during the initial solution and shows a plot of error (on a log scale) versus iteration number.  The second phase is used when computing solutions at each time point and it shows a 2D image of the solution for each time point. 
     35 
     36Progress would be reported within the simulation program as follows: 
     37{{{ 
     38import Rappture 
     39import sys 
     40 
     41# open the XML file containing the run parameters 
     42driver = Rappture.library(sys.argv[1]) 
     43 
     44Tstr = driver.get('input.number(temperature).current') 
     45T = Rappture.Units.convert(Tstr, to="K", units="off") 
     46... 
     47 
     48# phase 1 - initial solution 
     49iter = 0 
     50while !converged: 
     51    ...do the computation... 
     52    Rappture.Utils.progressData(driver, 'progress.phase(init).curve(convergence).component.xy', '%d %g\n' % (iter,err), op='append'); 
     53 
     54# phase 2 - solution for each time point 
     55t = 0.0 
     56while t < tmax: 
     57    ...do the computation... 
     58    str = Rappture.encoding.encode(imgdata) 
     59    Rappture.Utils.progressData(driver, 'progress.phase(solve).image(2D).current', str, op='overwrite'); 
     60    Rappture.Utils.progress(t/tmax*100, 'Solving at t = %g' % t); 
     61 
     62Rappture.result(driver) 
     63sys.exit() 
     64}}} 
     65 
     66When data is sent to a particular phase, it appears on the screen.  Note that separate {{{progress()}}} calls can be used in addition to the {{{progressData()}}} calls to indicate overall progress.