Last change
on this file since 72 was
72,
checked in by mmc, 19 years ago
|
Added a bunch of XML examples to the zoo.
|
File size:
1.1 KB
|
Line | |
---|
1 | # ---------------------------------------------------------------------- |
---|
2 | # EXAMPLE: Rappture <boolean> elements |
---|
3 | # ====================================================================== |
---|
4 | # AUTHOR: Michael McLennan, Purdue University |
---|
5 | # Copyright (c) 2004-2005 |
---|
6 | # Purdue Research Foundation, West Lafayette, IN |
---|
7 | # ====================================================================== |
---|
8 | package require Rappture |
---|
9 | |
---|
10 | # open the XML file containing the run parameters |
---|
11 | set driver [Rappture::library [lindex $argv 0]] |
---|
12 | |
---|
13 | set npts [$driver get input.(points).current] |
---|
14 | set min 0.01 |
---|
15 | set max 10.0 |
---|
16 | set dx [expr {($max-$min)/double($npts)}] |
---|
17 | |
---|
18 | # generate a single curve |
---|
19 | for {set x $min} {$x < $max} {set x [expr {$x+$dx}]} { |
---|
20 | set y [expr {cos($x)/(1+$x)}] |
---|
21 | $driver put -append yes output.curve(single).component.xy "$x $y\n" |
---|
22 | } |
---|
23 | |
---|
24 | # generate multiple curves on the same plot |
---|
25 | foreach factor {1 2} { |
---|
26 | for {set x $min} {$x < $max} {set x [expr {$x+$dx}]} { |
---|
27 | set y [expr {pow(2.0,$factor*$x)/$x}] |
---|
28 | $driver put -append yes \ |
---|
29 | output.curve(multi$factor).component.xy "$x $y\n" |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | # save the updated XML describing the run... |
---|
34 | Rappture::result $driver |
---|
35 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.