How does Rappture1.x really work?
This is how it works, from start to finish:
First, the user launches an application, the gui searches for and visualizes the tool.xml file. Next, the user fills in the values in gui and clicks simulate.
Behind the scenes, the gui takes all of the values that the user chose and places them into a file called driverNNNN.xml, where NNNN is a number generated by the rappture gui. After generating the driver file, the gui queries the tool.xml file for the data at the path "tool.command" to determine the program to run. For more information on reading xml paths, visit [wiki:FAQ_XmlPathNames ].
"tool.command" is usually located in the first part of the driver file and tends to looks like this:
<?xml version="1.0"?> <run> <tool> <about>Press Simulate to view results.</about> <command>tclsh @tool/fermi.tcl @driver</command> </tool> ... <run>
In the above example, the gui would be looking for a file called 'fermi.tcl' and try to execute it with driver file as its first argument. For more information on what @tool and @driver mean, check out this page describing rappture xml elements
Next, the gui executes the program specified in "tool.command" The program that is executed is generally the science application or a wrapper script.
Generally people embed Rappture library calls into their code as the standard mechanism for i/o for their code. This requires the use of the Rappture API's. For compiled codes, this also means the developer will need to be sure to compile against the Rappture library?.
For legacy codes that have already been well developed and standardized, there is the option to use a wrapper script around the science code. The purpose of the wrapper script is to retrieve the user's inputs from the xml file and produce an equivalent input deck for the science code. The wrapper script is also responsible for executing the science code, parsing the science code's output, and placing this output back into the gui. More information on the basic flow of science codes and wrapper scripts, check out Wrapper Script Basics
After the science code or wrapper script has completed, it sends a signal to the gui by calling the result() function. The gui receives the signal that the application has completed, looks for the runNNNN.xml file that was automatically generated by the result() function and visualizes the output.