Index: /branches/blt4/examples/objects/app-fermi/tcl/ex2/fermi.tcl
===================================================================
--- /branches/blt4/examples/objects/app-fermi/tcl/ex2/fermi.tcl	(revision 1892)
+++ /branches/blt4/examples/objects/app-fermi/tcl/ex2/fermi.tcl	(revision 1892)
@@ -0,0 +1,93 @@
+# ----------------------------------------------------------------------
+#  EXAMPLE: Fermi-Dirac function in Tcl.
+#
+#  This simple example shows how to use Rappture within a simulator
+#  written in Tcl.
+# ======================================================================
+#  AUTHOR:  Derrick Kearney, Purdue University
+#  Copyright (c) 2005-2009  Purdue Research Foundation
+#
+#  See the file "license.terms" for information on usage and
+#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+# ======================================================================
+package require Rappture
+
+# initialize the global interface
+Rappture::Interface $argv fermi_io
+
+# check the global interface for errors
+if {[Rappture::Interface::error] != 0} {
+    # there were errors while setting up the inteface
+    # dump the traceback
+    set o [Rappture::Interface::outcome]
+    puts stderr [$o context]
+    puts stderr [$o remark]
+    exit [Rappture::Interface::error]
+}
+
+# connect variables to the interface
+# look in the global interface for an object named
+# "temperature, convert its value to Kelvin, and
+# store the value into the address of T.
+# look in the global interface for an object named
+# "Ef", convert its value to electron Volts and store
+# the value into the address of Ef
+# look in the global interface for an object named
+# factorsTable and set the variable result to
+# point to it.
+set T [Rappture::Interface::connect "temperature" -hints {"units=K"}]
+set Ef [Rappture::Interface::connect "Ef" -hints {"units=eV"}]
+set p1 [Rappture::Interface::connect "fdfPlot"]
+set p2 [Rappture::Interface::connect "fdfPlot2"]
+
+if {[Rappture::Interface::error] != 0]} {
+    # there were errors while retrieving input data values
+    # dump the tracepack
+    set o [Rappture::Interface::outcome]
+    puts stderr [$o context]
+    puts stderr [$o remark]
+    exit [Rappture::Interface::error]
+}
+
+# do science calculations
+set nPts 200
+
+set kT [expr {8.61734e-5 * $T}]
+set Emin [expr {$Ef - 10*$kT}]
+set Emax [expr {$Ef + 10*$kT}]
+
+set dE [expr {(1.0/$nPts)*($Emax-$Emin)}]
+
+set E $Emin
+for {set idx 0} {idx < nPts} {incr idx} {
+    set E [expr {$E + $dE}]
+    set f [expr {1.0/(1.0 + exp(($E - $Ef)/$kT))}]
+    lappend fArr $f
+    lappend Err $E
+    set progress [expr {(($E - $Emin)/($Emax - $Emin)*100)}]
+    Rappture::Utils::progress $progress -mesg "Iterating"
+}
+
+# set up the curves for the plot by using the add command
+# add <name> <xdata> <ydata> -format <fmt>
+#
+# to group curves on the same plot, just keep adding curves
+# to save space, X array values are compared between curves.
+# the the X arrays contain the same values, we only store
+# one version in the internal data table, otherwise a new
+# column is created for the array. for big arrays this may take
+# some time, we should benchmark to see if this can be done
+# efficiently.
+
+$p1 add "fdfCurve1" $fArr $EArr -format "g:o"
+
+$p2 add "fdfCurve2" $fArr $EArr -format "b-o"
+$p2 add "fdfCurve3" $fArr $EArr -format "p--"
+
+# close the global interface
+# signal to the graphical user interface that science
+# calculations are complete and to display the data
+# as described in the views
+Rappture::Interface::close
+
+exit 0
Index: /branches/blt4/examples/objects/app-fermi/tcl/ex2/fermi_io.tcl
===================================================================
--- /branches/blt4/examples/objects/app-fermi/tcl/ex2/fermi_io.tcl	(revision 1892)
+++ /branches/blt4/examples/objects/app-fermi/tcl/ex2/fermi_io.tcl	(revision 1892)
@@ -0,0 +1,42 @@
+proc fermi_io {
+
+    # assume global interface variable.
+    # newly created objects are stored in the
+    # global interface variable. if there is more
+    # than one global interface variable, the
+    # interface that should be used is specified
+    # using an alternative version of the object constructor
+    # that supports an interface argument.
+
+    # describe the inputs
+    # declare a number named "temperature",
+    # with units of Kelvin, default value 300,
+    #
+    # the next number is named "Ef", has units of
+    # electron Volts, default value of -5.5
+    #
+    # Rappture::Number is assumed to be an input
+    Rappture::Number "temperature" "K" 300
+    Rappture::Number "Ef" "eV" -5.5
+
+    # Most simple xy plots for output
+    # Because it is a single plot, it gets its own view.
+    # The plot is placed in the position 1,1 of the view.
+    set plot [Rappture::Plot "fdfPlot"]
+    $plot xaxis "Fermi-Dirac Factor" \
+        "Plot of Fermi-Dirac Calculation"
+    $plot yaxis "Energy"
+        "Energy cooresponding to each fdf" \
+        -hints {"units=eV"}
+
+    # Declaring a second plot creates a new view.
+    # The new plot will be placed in the position 1,1 of its view.
+    # User can do simple plot grouping using the add function
+    # in the science code.
+    Rappture::Plot "fdfPlot2" \
+        -xlabel "Fermi-Dirac Factor"\
+        -xdesc "Plot of Fermi-Dirac Calculation" \
+        -yaxis "Energy" \
+        -ydesc "Energy cooresponding to each fdf" \
+        -yhints {"units=eV"}
+}
Index: /branches/blt4/examples/objects/app-fermi/tcl/ex2/readme
===================================================================
--- /branches/blt4/examples/objects/app-fermi/tcl/ex2/readme	(revision 1892)
+++ /branches/blt4/examples/objects/app-fermi/tcl/ex2/readme	(revision 1892)
@@ -0,0 +1,1 @@
+most simple version of getting a plot, no views
Index: /branches/blt4/examples/objects/app-fermi/tcl/ex3/fermi.tcl
===================================================================
--- /branches/blt4/examples/objects/app-fermi/tcl/ex3/fermi.tcl	(revision 1892)
+++ /branches/blt4/examples/objects/app-fermi/tcl/ex3/fermi.tcl	(revision 1892)
@@ -0,0 +1,94 @@
+# ----------------------------------------------------------------------
+#  EXAMPLE: Fermi-Dirac function in Tcl.
+#
+#  This simple example shows how to use Rappture within a simulator
+#  written in Tcl.
+# ======================================================================
+#  AUTHOR:  Derrick Kearney, Purdue University
+#  Copyright (c) 2005-2009  Purdue Research Foundation
+#
+#  See the file "license.terms" for information on usage and
+#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+# ======================================================================
+package require Rappture
+
+# initialize the global interface
+Rappture::Interface $argv fermi_io
+
+# check the global interface for errors
+if {[Rappture::Interface::error] != 0} {
+    # there were errors while setting up the inteface
+    # dump the traceback
+    set o [Rappture::Interface::outcome]
+    puts stderr [$o context]
+    puts stderr [$o remark]
+    exit [Rappture::Interface::error]
+}
+
+# connect variables to the interface
+# look in the global interface for an object named
+# "temperature, convert its value to Kelvin, and
+# store the value into the address of T.
+# look in the global interface for an object named
+# "Ef", convert its value to electron Volts and store
+# the value into the address of Ef
+# look in the global interface for an object named
+# factorsTable and set the variable result to
+# point to it.
+set T [Rappture::Interface::connect "temperature" -hints {"units=K"}]
+set Ef [Rappture::Interface::connect "Ef" -hints {"units=eV"}]
+
+set x1 [Rappture::Interface::connect "Fermi-Dirac Factor"]
+set y1 [Rappture::Interface::connect "Energy"]
+set x2 [Rappture::Interface::connect "Fermi-Dirac Factor * 2"]
+set y2 [Rappture::Interface::connect "Energy * 2"]
+
+if {[Rappture::Interface::error] != 0]} {
+    # there were errors while retrieving input data values
+    # dump the tracepack
+    set o [Rappture::Interface::outcome]
+    puts stderr [$o context]
+    puts stderr [$o remark]
+    exit [Rappture::Interface::error]
+}
+
+# do science calculations
+set nPts 200
+
+set kT [expr {8.61734e-5 * $T}]
+set Emin [expr {$Ef - 10*$kT}]
+set Emax [expr {$Ef + 10*$kT}]
+
+set dE [expr {(1.0/$nPts)*($Emax-$Emin)}]
+
+set E $Emin
+for {set idx 0} {idx < nPts} {incr idx} {
+    set E [expr {$E + $dE}]
+    set f [expr {1.0/(1.0 + exp(($E - $Ef)/$kT))}]
+    lappend fArr $f
+    lappend fArr2 [expr {$f*2}]
+    lappend EArr $E
+    lappend EArr2 [expr {$E*2}]
+    set progress [expr {(($E - $Emin)/($Emax - $Emin)*100)}]
+    Rappture::Utils::progress $progress -mesg "Iterating"
+}
+
+# store results in the results table
+# add data to the table pointed to by the variable result.
+# put the fArr data in the column named "Fermi-Dirac Factor"
+# put the EArr data in the column named "Energy"
+#
+# Rappture::Table Commands:
+# the store command overwrites data that already exists in
+# the column with the new array of data.
+# the append command will append the new array of data onto
+# any previously existing array of data.
+
+$x1 store $fArr
+$y1 store $fArr2
+$x2 store $EArr
+$y2 store $EArr2
+
+Rappture::Interface::close
+
+exit 0
Index: /branches/blt4/examples/objects/app-fermi/tcl/ex3/fermi_io.tcl
===================================================================
--- /branches/blt4/examples/objects/app-fermi/tcl/ex3/fermi_io.tcl	(revision 1892)
+++ /branches/blt4/examples/objects/app-fermi/tcl/ex3/fermi_io.tcl	(revision 1892)
@@ -0,0 +1,69 @@
+proc fermi_io {
+
+    # assume global interface variable.
+    # newly created objects are stored in the
+    # global interface variable. if there is more
+    # than one global interface variable, the
+    # interface that should be used is specified
+    # using an alternative version of the object constructor
+    # that supports an interface argument.
+
+    # describe the inputs
+    # declare a number named "temperature",
+    # with units of Kelvin, default value 300,
+    #
+    # the next number is named "Ef", has units of
+    # electron Volts, default value of -5.5
+    #
+    # Rappture::Number is assumed to be an input
+    Rappture::Number "temperature" "K" 300
+    Rappture::Number "Ef" "eV" -5.5
+
+    # describe the outputs
+    # two new columns are added to the default table
+    # the first column is named "Fermi-Dirac Factor",
+    # a description is provided, and it has no units.
+    # the second column is named "Energy", a description
+    # is provided, and has units of electron Volts.
+    # Rappture::Table is assumed to be an output
+    set x1 [Rappture::Table::column "Fermi-Dirac Factor" \
+            "Plot of Fermi-Dirac Calculation"]
+    set y1 [Rappture::Table::column "Energy" \
+            "Energy cooresponding to each fdf" \
+            -hints {"units=eV"}]
+    set x2 [Rappture::Table::column "Fermi-Dirac Factor * 2" \
+            "Plot of Fermi-Dirac Calculation multiplied by 2"]
+    set y2 [Rappture::Table::column "Energy * 2" \
+            "Energy cooresponding to each fdf multiplied by 2" \
+            -hints {"units=eV"}]
+
+    # describe how the outputs should be displayed
+    # initialize a view named "fdfView", with a 1x1 layout.
+    # next, add a plot named "fdfPlot" to the view "fdfView".
+    # populate the plot with data from the table
+    # "factorsTable". Plot the column named
+    # "Fermi-Dirac Factor" vs the column named "Energy".
+    # place the plot, named fdfPlot, at position 1,1 (by default)
+    # within the view's layout.
+    # Rappture::View is assumed to be an output
+    set v [Rappture::View "fdfView"]
+    $v plot "fdfPlot" {$x1 $y1 "g:o"}
+
+    # two stacked plots in the same view
+    set v2 [Rappture::View "fdfView2"]
+    $v2 plot "fdfPlot2" -at {1 1} {$x1 $y1 "g:o"}
+    $v2 plot "fdfPlot3" -at {2 1} {$x2 $y2 "b-o"}
+
+    # two side by side plots in the same view
+    set v3 [Rappture::View "fdfView3"]
+    $v3 plot "fdfPlot4" -at {1 1} {$x1 $y1 "g:o"}
+    $v3 plot "fdfPlot5" -at {1 2} {$x2 $y2 "b-o"}
+
+    # grouped curves in one plot in a view
+    set v4 [Rappture::View "fdfView4"]
+    $v4 plot "fdfPlot6" -at {1 1} {$x1 $y1 "g:o"}
+    $v4 plot "fdfPlot7" -at {1 1} {$x2 $y2 "b-o"}
+
+    # grouped curves in one plot in a view
+    set v5 [Rappture::View "fdfView5"]
+    $v5 plot "fdfPlot8" {$x1 $y1 "g:o" $x2 $y2 "b-o"}
Index: /branches/blt4/examples/objects/app-fermi/tcl/ex3/readme
===================================================================
--- /branches/blt4/examples/objects/app-fermi/tcl/ex3/readme	(revision 1892)
+++ /branches/blt4/examples/objects/app-fermi/tcl/ex3/readme	(revision 1892)
@@ -0,0 +1,1 @@
+using views to control plot placement
