Ignore:
Timestamp:
Feb 5, 2012, 8:44:38 AM (13 years ago)
Author:
dkearney
Message:

adding function rp_utils_progress(percent,message) where percent should be an integer (but can be a double that will be coerced to an integer) between 0 and 100 representing the amount of the application that has completed, and message is a string giving information about the amount of progress complete.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/app-fermi/R/fermi.R

    r2709 r2780  
    11# ----------------------------------------------------------------------
    2 #  EXAMPLE: Fermi-Dirac function in Tcl.
     2#  EXAMPLE: Fermi-Dirac function in R.
    33#
    44#  This simple example shows how to use Rappture within a simulator
    5 #  written in Tcl.
     5#  written in R.
    66# ======================================================================
    77#  AUTHOR:  Derrick Kearney, Purdue University
     
    3030driver <- rp_lib(args[7])
    3131
     32rp_utils_progress(10,"reading inputs")
     33
    3234T <- rp_lib_get_string(driver,"input.number(temperature).current")
    3335T <- rp_units_convert_double(T,"K")
    3436Ef <- rp_lib_get_string(driver,"input.number(Ef).current")
    3537Ef <- rp_units_convert_double(Ef,"eV")
     38
     39rp_utils_progress(30,"performing calculations")
    3640
    3741kT <- 8.61734e-5 * T
     
    4145dE <- 0.005*(Emax-Emin)
    4246
     47rp_utils_progress(60,"performing calculations")
     48
    4349y <- seq(Emin,Emax,by=dE)
    4450x <- sapply(y,function(E) 1.0/(1.0 + exp((E - Ef)/kT)))
     51
     52rp_utils_progress(80,"storing results")
    4553
    4654# Label output graph with title, x-axis label,
     
    5159rp_lib_put_string(driver,"output.curve(f12).yaxis.units","eV",FALSE)
    5260
     61rp_utils_progress(90,"storing results")
     62
    5363# coerce our arrays into a string of the form:
    5464# "x1 y1 \n x2 y2 \n x3 y3\n"...
     
    5868
    5969
     70rp_utils_progress(100,"preparing graphs")
     71
    6072# save the updated XML describing the run...
    6173rp_lib_result(driver)
Note: See TracChangeset for help on using the changeset viewer.