Index: trunk/gui/apps/driver
===================================================================
--- trunk/gui/apps/driver (revision 5)
+++ trunk/gui/apps/driver (revision 6)
@@ -82,5 +82,5 @@
# open the XML file containing the material library
-set lib [Rappture::Library::open -std library.xml]
+set lib [Rappture::library -std library.xml]
# open the XML file containing the tool parameters
@@ -89,5 +89,5 @@
exit 1
}
-set tool [Rappture::Library::open $toolfile]
+set tool [Rappture::library $toolfile]
# open the XML file containing the configuration for this application
@@ -96,5 +96,5 @@
exit 1
}
-set config [Rappture::Library::open $configfile]
+set config [Rappture::library $configfile]
# ----------------------------------------------------------------------
@@ -148,8 +148,9 @@
# ----------------------------------------------------------------------
set w $win.input
-set ndevs [$config get -count controls.device]
-if {$ndevs > 0} {
- for {set i 0} {$i < $ndevs} {incr i} {
- set obj [$config get -object controls.device$i]
+set dfirst ""
+set dlist [$config children -type structure controls]
+if {"" != $dlist} {
+ foreach dname $dlist {
+ set obj [$config element -flavor object controls.$dname]
set name [$obj get label]
set devs($name) $obj
@@ -157,5 +158,5 @@
set devlist [lsort [array names devs]]
- if {$ndevs > 1} {
+ if {[array size devs] > 1} {
frame $w.devsel
pack $w.devsel -side top -fill x
@@ -173,4 +174,5 @@
set first [lindex $devlist 0]
+ set dfirst $devs($first)
Rappture::DeviceViewer1D $w.device -device $devs($first) \
-tool $tool -library $lib
@@ -185,6 +187,6 @@
set w $win.output
Rappture::Analyzer $w.analyze -holdwindow $win.input \
- -tool $tool -analysis [$config get -object analysis] \
- -device $devs($first)
+ -tool $tool -analysis [$config element -flavor object analysis] \
+ -device $dfirst
pack $w.analyze -expand yes -fill both
@@ -192,9 +194,8 @@
# HOOK UP ANY CONTROLS CALLED OUT IN CONFIG.XML
# ----------------------------------------------------------------------
-set ncntls [$config get -count controls.access]
-for {set i 0} {$i < $ncntls} {incr i} {
- set name [$config get access$i]
+foreach access [$config children -type access controls] {
+ set name [$config get controls.$access]
switch -glob -- $name {
- parameters.ambient* - device* {
+ parameters.ambient* - structure* {
$win.input.device controls add $name
}
Index: trunk/gui/scripts/analyzer.tcl
===================================================================
--- trunk/gui/scripts/analyzer.tcl (revision 5)
+++ trunk/gui/scripts/analyzer.tcl (revision 6)
@@ -258,5 +258,5 @@
# ----------------------------------------------------------------------
itcl::configbody Rappture::Analyzer::tool {
- if {![Rappture::Library::valid $itk_option(-tool)]} {
+ if {![Rappture::library isvalid $itk_option(-tool)]} {
error "bad value \"$itk_option(-tool)\": should be Rappture::Library"
}
@@ -276,5 +276,5 @@
itcl::configbody Rappture::Analyzer::device {
if {$itk_option(-device) != ""
- && ![Rappture::Library::valid $itk_option(-device)]} {
+ && ![Rappture::library isvalid $itk_option(-device)]} {
error "bad value \"$itk_option(-device)\": should be Rappture::Library"
}
@@ -289,5 +289,5 @@
# ----------------------------------------------------------------------
itcl::configbody Rappture::Analyzer::analysis {
- if {![Rappture::Library::valid $itk_option(-analysis)]} {
+ if {![Rappture::library isvalid $itk_option(-analysis)]} {
error "bad value \"$itk_option(-analysis)\": should be Rappture::Library"
}
@@ -299,5 +299,5 @@
set counter 0
- foreach item [$itk_option(-analysis) get -children] {
+ foreach item [$itk_option(-analysis) children] {
switch -glob -- $item {
xyplot* {
@@ -311,5 +311,5 @@
set _widgets($item) [Rappture::Xyplot $page.#auto \
- -layout [$itk_option(-analysis) get -object $item]]
+ -layout [$itk_option(-analysis) element -flavor object $item]]
pack $_widgets($item) -expand yes -fill both
}
Index: trunk/gui/scripts/curve.tcl
===================================================================
--- trunk/gui/scripts/curve.tcl (revision 5)
+++ trunk/gui/scripts/curve.tcl (revision 6)
@@ -38,9 +38,9 @@
# ----------------------------------------------------------------------
itcl::body Rappture::Curve::constructor {libobj path} {
- if {![Rappture::Library::valid $libobj]} {
+ if {![Rappture::library isvalid $libobj]} {
error "bad value \"$libobj\": should be LibraryObj"
}
set _libobj $libobj
- set _curve [$libobj get -object $path]
+ set _curve [$libobj element -flavor object $path]
# build up vectors for various components of the curve
@@ -144,10 +144,9 @@
# vectors for each part.
#
- set max [$_curve get -count component]
- for {set i 0} {$i < $max} {incr i} {
+ foreach cname [$_curve children -type component] {
set xv ""
set yv ""
- set xydata [$_curve get component$i.xy]
+ set xydata [$_curve get $cname.xy]
if {"" != $xydata} {
set xv [blt::vector create x$_counter]
@@ -163,5 +162,5 @@
if {$xv != "" && $yv != ""} {
- set _comp2vecs(component$i) [list $xv $yv]
+ set _comp2vecs($cname) [list $xv $yv]
incr _counter
}
Index: trunk/gui/scripts/deviceLayout1D.tcl
===================================================================
--- trunk/gui/scripts/deviceLayout1D.tcl (revision 5)
+++ trunk/gui/scripts/deviceLayout1D.tcl (revision 6)
@@ -182,5 +182,5 @@
# see if any of the slabs has a label
if {$_device != ""} {
- foreach nn [$_device get -children recipe] {
+ foreach nn [$_device children recipe] {
if {"" != [$_device get recipe.$nn.label]} {
set extra [expr {1.2*[font metrics $fnt -linespace]}]
@@ -192,5 +192,5 @@
# a little extra height for the molecule image
- if {[$_device get -exists recipe.molecule]} {
+ if {"" != [$_device element recipe.molecule]} {
set h [expr {$h+15}]
}
@@ -210,5 +210,5 @@
set z 0
if {$_device != ""} {
- foreach nn [$_device get -children recipe] {
+ foreach nn [$_device children recipe] {
switch -glob -- $nn {
slab* - molecule* {
@@ -310,5 +310,5 @@
set h [expr {[winfo height $c]-1}]
# a little extra height for the molecule image
- if {[$_device get -exists recipe.molecule]} {
+ if {"" != [$_device element recipe.molecule]} {
set h [expr {$h-15}]
}
@@ -361,5 +361,5 @@
set h [expr {[winfo height $c]-1}]
# a little extra height for the molecule image
- if {[$_device get -exists recipe.molecule]} {
+ if {"" != [$_device element recipe.molecule]} {
set h [expr {$h-15}]
}
@@ -395,5 +395,5 @@
set h [expr {[winfo height $c]-1}]
# a little extra height for the molecule image
- if {[$_device get -exists recipe.molecule]} {
+ if {"" != [$_device element recipe.molecule]} {
set h [expr {$h-15}]
}
@@ -448,5 +448,5 @@
#
if {"" != $_device} {
- set label [$_device get "$elem.label"]
+ set label [$_device get $elem.label]
if {"" != $label} {
set y [expr {$y-0.5*$lh}]
@@ -491,5 +491,5 @@
itcl::configbody Rappture::DeviceLayout1D::library {
if {$itk_option(-library) != ""} {
- if {![Rappture::Library::valid $itk_option(-library)]} {
+ if {![Rappture::library isvalid $itk_option(-library)]} {
error "bad value \"$itk_option(-library)\": should be Rappture::Library"
}
@@ -508,5 +508,5 @@
itcl::configbody Rappture::DeviceLayout1D::device {
if {$itk_option(-device) != ""} {
- if {![Rappture::Library::valid $itk_option(-device)]} {
+ if {![Rappture::library isvalid $itk_option(-device)]} {
error "bad value \"$itk_option(-device)\": should be Rappture::Library"
}
Index: trunk/gui/scripts/deviceViewer1D.tcl
===================================================================
--- trunk/gui/scripts/deviceViewer1D.tcl (revision 5)
+++ trunk/gui/scripts/deviceViewer1D.tcl (revision 6)
@@ -186,5 +186,5 @@
#
if {$_device != ""} {
- foreach nn [$_device get -children] {
+ foreach nn [$_device children] {
if {[string match field* $nn]} {
set name [$_device get $nn.label]
@@ -516,9 +516,8 @@
itcl::body Rappture::DeviceViewer1D::_controlCreate {container libObj path} {
set presets ""
- set npre [$libObj get -count $path.preset]
- for {set i 0} {$i < $npre} {incr i} {
+ foreach pre [$libObj children -type preset $path] {
lappend presets \
- [$libObj get $path.preset$i.value] \
- [$libObj get $path.preset$i.label]
+ [$libObj get $path.$pre.value] \
+ [$libObj get $path.$pre.label]
}
@@ -606,5 +605,5 @@
itcl::configbody Rappture::DeviceViewer1D::device {
if {$itk_option(-device) != ""} {
- if {![Rappture::Library::valid $itk_option(-device)]} {
+ if {![Rappture::library isvalid $itk_option(-device)]} {
error "bad value \"$itk_option(-device)\": should be Rappture::Library"
}
@@ -623,5 +622,5 @@
itcl::configbody Rappture::DeviceViewer1D::tool {
if {$itk_option(-tool) != ""} {
- if {![Rappture::Library::valid $itk_option(-tool)]} {
+ if {![Rappture::library isvalid $itk_option(-tool)]} {
error "bad value \"$itk_option(-tool)\": should be Rappture::Library"
}
Index: trunk/gui/scripts/field.tcl
===================================================================
--- trunk/gui/scripts/field.tcl (revision 5)
+++ trunk/gui/scripts/field.tcl (revision 6)
@@ -43,18 +43,18 @@
# ----------------------------------------------------------------------
itcl::body Rappture::Field::constructor {devobj libobj path} {
- if {![Rappture::Library::valid $devobj]} {
+ if {![Rappture::library isvalid $devobj]} {
error "bad value \"$devobj\": should be LibraryObj"
}
- if {![Rappture::Library::valid $libobj]} {
+ if {![Rappture::library isvalid $libobj]} {
error "bad value \"$libobj\": should be LibraryObj"
}
set _device $devobj
set _libobj $libobj
- set _field [$libobj get -object $path]
+ set _field [$libobj element -flavor object $path]
set _units [$_field get units]
# determine the overall size of the device
set z0 [set z1 0]
- foreach elem [$_device get -children recipe] {
+ foreach elem [$_device children recipe] {
switch -glob -- $elem {
slab* - molecule* {
@@ -192,12 +192,11 @@
# vectors for each part.
#
- set max [$_field get -count component]
- for {set i 0} {$i < $max} {incr i} {
+ foreach cname [$_field children -type component] {
set xv ""
set yv ""
- set val [$_field get component$i.constant]
+ set val [$_field get $cname.constant]
if {$val != ""} {
- set domain [$_field get component$i.domain]
+ set domain [$_field get $cname.domain]
if {$domain == "" || ![info exists _limits($domain)]} {
set z0 0
@@ -217,8 +216,8 @@
set zm [expr {0.5*($z0+$z1)}]
- set _comp2cntls(component$i) \
- [list component$i.constant $zm $val "$val$_units"]
+ set _comp2cntls($cname) \
+ [list $cname.constant $zm $val "$val$_units"]
} else {
- set xydata [$_field get component$i.xy]
+ set xydata [$_field get $cname.xy]
if {"" != $xydata} {
set xv [blt::vector create x$_counter]
@@ -235,5 +234,5 @@
if {$xv != "" && $yv != ""} {
- set _comp2vecs(component$i) [list $xv $yv]
+ set _comp2vecs($cname) [list $xv $yv]
incr _counter
}
Index: trunk/gui/scripts/xyplot.tcl
===================================================================
--- trunk/gui/scripts/xyplot.tcl (revision 5)
+++ trunk/gui/scripts/xyplot.tcl (revision 6)
@@ -96,5 +96,5 @@
if {$layout != "" && $run != ""} {
set count 0
- foreach item [$layout get -children] {
+ foreach item [$layout children] {
switch -glob -- $item {
title {
@@ -118,5 +118,5 @@
field* {
set name [$layout get $item]
- if {[$run get -exists output.$name]} {
+ if {"" != [$run element output.$name]} {
set fobj [Rappture::Field ::#auto $_device $run output.$name]
set _path2obj($name) $fobj
@@ -144,5 +144,5 @@
curve* {
set name [$layout get $item]
- if {[$run get -exists output.$name]} {
+ if {"" != [$run get element output.$name]} {
set cobj [Rappture::Curve ::#auto $run output.$name]
set _path2obj($name) $cobj
@@ -211,5 +211,5 @@
itcl::configbody Rappture::Xyplot::layout {
if {$itk_option(-layout) != ""} {
- if {![Rappture::Library::valid $itk_option(-layout)]} {
+ if {![Rappture::library isvalid $itk_option(-layout)]} {
error "bad value \"$itk_option(-layout)\": should be Rappture::Library"
}
@@ -231,8 +231,8 @@
}
if {$itk_option(-run) != ""} {
- if {![Rappture::Library::valid $itk_option(-run)]} {
+ if {![Rappture::library isvalid $itk_option(-run)]} {
error "bad value \"$itk_option(-run)\": should be Rappture::Library"
}
- set _device [$itk_option(-run) get -object device]
+ set _device [$itk_option(-run) element -flavor object device]
}
after cancel [itcl::code $this _rebuild]
Index: trunk/lib/library.xml
===================================================================
--- trunk/lib/library.xml (revision 6)
+++ trunk/lib/library.xml (revision 6)
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+ K
+ 0
+ 500K
+ 300K
+
+ 300K
+
+
+
+ 77K
+
+
+
+ 4.2K
+
+
+
+ 0K
+
+
+
+
+
+
+
+ GaAs
+ 1.422eV
+ #ccccff
+ 4.070eV
+ 12.847
+ 0.462e18/cm3
+ 0.942e19/cm3
+
+
+ Al(0.3)Ga(0.7)As
+ #9999ff
+ 1.797eV
+ 3.827eV
+ 11.9
+ 0.857e18/cm3
+ 0.111e20/cm3
+
+
+ Au
+ #ffff66
+
+
+
Index: trunk/python/Rappture/library.py
===================================================================
--- trunk/python/Rappture/library.py (revision 5)
+++ trunk/python/Rappture/library.py (revision 6)
@@ -364,4 +364,5 @@
if n.nodeName == type:
pos = n
+
if pos:
pos = pos.nextSibling
Index: trunk/tcl/install
===================================================================
--- trunk/tcl/install (revision 5)
+++ trunk/tcl/install (revision 6)
@@ -40,6 +40,4 @@
set targetdir [file join $dir $package$version]
-mkindex scripts
-
if {![file exists $targetdir]} {
puts "making directory $targetdir..."
@@ -47,5 +45,25 @@
}
-foreach file [find .] {
+set origdir [pwd]
+foreach context {. ../gui} {
+ cd $context
+
+ foreach file [find .] {
+ set target [file join $targetdir $file]
+ if {[file isdirectory $file]} {
+ puts "making directory $target..."
+ catch {file mkdir $target}
+ file attributes $target -permissions ugo+rx
+ } else {
+ puts "installing $target..."
+ file copy -force $file $target
+ file attributes $target -permissions ugo+r
+ }
+ }
+}
+
+cd ..
+catch {file mkdir [file join $targetdir lib]}
+foreach file [find ./lib] {
set target [file join $targetdir $file]
if {[file isdirectory $file]} {
@@ -60,4 +78,6 @@
}
+cd $origdir
+
set fid [open [file join $targetdir pkgIndex.tcl] w]
puts $fid "# Tcl package index file"
@@ -69,3 +89,5 @@
close $fid
+mkindex [file join $targetdir scripts]
+
puts "== $package-$version INSTALLED"
Index: trunk/tcl/scripts/library.tcl
===================================================================
--- trunk/tcl/scripts/library.tcl (revision 5)
+++ trunk/tcl/scripts/library.tcl (revision 6)
@@ -12,8 +12,8 @@
namespace eval Rappture { # forward declaration }
-namespace eval Rappture::Library { # forward declaration }
-
-# ----------------------------------------------------------------------
-# USAGE: open ?-std?
+
+# ----------------------------------------------------------------------
+# USAGE: library ?-std?
+# USAGE: library isvalid