# Changeset 2780

Ignore:
Timestamp:
Feb 5, 2012 8:44:38 AM (11 years ago)
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.

Location:
trunk
Files:
7 edited

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

 r2709 # ---------------------------------------------------------------------- #  EXAMPLE: Fermi-Dirac function in Tcl. #  EXAMPLE: Fermi-Dirac function in R. # #  This simple example shows how to use Rappture within a simulator #  written in Tcl. #  written in R. # ====================================================================== #  AUTHOR:  Derrick Kearney, Purdue University driver <- rp_lib(args[7]) rp_utils_progress(10,"reading inputs") T <- rp_lib_get_string(driver,"input.number(temperature).current") T <- rp_units_convert_double(T,"K") Ef <- rp_lib_get_string(driver,"input.number(Ef).current") Ef <- rp_units_convert_double(Ef,"eV") rp_utils_progress(30,"performing calculations") kT <- 8.61734e-5 * T dE <- 0.005*(Emax-Emin) rp_utils_progress(60,"performing calculations") y <- seq(Emin,Emax,by=dE) x <- sapply(y,function(E) 1.0/(1.0 + exp((E - Ef)/kT))) rp_utils_progress(80,"storing results") # Label output graph with title, x-axis label, rp_lib_put_string(driver,"output.curve(f12).yaxis.units","eV",FALSE) rp_utils_progress(90,"storing results") # coerce our arrays into a string of the form: # "x1 y1 \n x2 y2 \n x3 y3\n"... rp_utils_progress(100,"preparing graphs") # save the updated XML describing the run... rp_lib_result(driver)
• ## trunk/examples/lang/R/functions_examples.R

 r2710 is.character(result) result percent = as.integer(56) result = rp_utils_progress(percent,"almost done...") is.integer(result) result result = rp_utils_progress(76,"almost done...") is.integer(result) result result = rp_utils_progress(36.546,"almost done...") is.integer(result) result
• ## trunk/lang/R/Rappture/NAMESPACE

 r2709 rp_lib_result, rp_units_convert_double, rp_units_convert_string ) rp_units_convert_string, rp_utils_progress )
• ## trunk/lang/R/Rappture/R/Rappture.R

 r2709 } rp_utils_progress <- function(percent,message) { .Call("RPRUtilsProgress",percent,message) } .onLoad <- function(lib,pkg) { }