1 | |
---|
2 | # Example of using unirect2d meshes in a field object in Rappture. |
---|
3 | |
---|
4 | package require Rappture |
---|
5 | |
---|
6 | # Read in the data since we're not simulating anything... |
---|
7 | set f [open vectorfield.tcl "r"] |
---|
8 | set data [read $f] |
---|
9 | close $f |
---|
10 | |
---|
11 | # Open an XML run file to write into |
---|
12 | set driver [Rappture::library [lindex $argv 0]] |
---|
13 | |
---|
14 | # Create a "field" object to display the substrate surface. |
---|
15 | |
---|
16 | set flowdemo { |
---|
17 | about.label "Jwire example" |
---|
18 | component(vf1).flow.axis z |
---|
19 | component(vf1).flow.position 0% |
---|
20 | component(vf1).flow.volume yes |
---|
21 | component(vf1).flow.streams no |
---|
22 | component(vf1).flow.outline no |
---|
23 | component(vf1).flow.particles(left).axis x |
---|
24 | component(vf1).flow.particles(left).color lightgreen |
---|
25 | component(vf1).flow.particles(left).position 10% |
---|
26 | component(vf1).flow.particles(right).axis x |
---|
27 | component(vf1).flow.particles(right).color khaki |
---|
28 | component(vf1).flow.particles(right).position 90% |
---|
29 | component(vf1).style "-color blue:red -levels 6 -opacity 1" |
---|
30 | component(vf1).flow.box(one).color cyan |
---|
31 | component(vf1).flow.box(one).corner(1) "0 -100 -100" |
---|
32 | component(vf1).flow.box(one).corner(2) "3000 400 400" |
---|
33 | component(vf1).flow.box(two).color yellow |
---|
34 | component(vf1).flow.box(two).corner(1) "1000 -150 -100" |
---|
35 | component(vf1).flow.box(two).corner(2) "3000 3000 3000" |
---|
36 | component(vf1).flow.box(three).color magenta |
---|
37 | component(vf1).flow.box(three).corner(1) "1000 -150 -100" |
---|
38 | component(vf1).flow.box(three).corner(2) "2000 450 450" |
---|
39 | camera.xposition { |
---|
40 | theta 142.84 phi 339.32 psi 0 pan-x -0.216 pan-y -0.128 zoom 0.64 |
---|
41 | } |
---|
42 | } |
---|
43 | |
---|
44 | foreach {key value} $flowdemo { |
---|
45 | $driver put output.field.$key $value |
---|
46 | } |
---|
47 | |
---|
48 | $driver put output.field.component(vf1).extents 3 |
---|
49 | set data [Rappture::encoding::encode -as zb64 $data] |
---|
50 | $driver put output.field.component(vf1).dx $data |
---|
51 | # save the updated XML describing the run... |
---|
52 | Rappture::result $driver |
---|
53 | puts stdout "done" |
---|
54 | flush stdout |
---|
55 | exit 0 |
---|
56 | |
---|