Ignore:
Timestamp:
Jan 28, 2010 8:26:11 AM (11 years ago)
Author:
dkearney
Message:

adding api for view, updating tcl app-fermi object example with view interface

Location:
trunk/examples/objects
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/objects/app-fermi/tcl/fermi4.tcl

    r1623 r1645  
    7272# put the fArr data in the column named "Fermi-Dirac Factor"
    7373# put the EArr data in the column named "Energy"
     74#
     75# Rappture::Table Commands:
     76# the store command overwrites data that already exists in
     77# the column with the new array of data.
     78# the append command will append the new array of data onto
     79# any previously existing array of data.
    7480
    75 $result add data "Fermi-Dirac Factor" $fArr
    76 $result add data "Energy" $EArr
     81$result store "Fermi-Dirac Factor" $fArr
     82$result store "Energy" $EArr
    7783
    7884Rappture::Interface::close
  • trunk/examples/objects/app-fermi/tcl/fermi_io.tcl

    r1623 r1645  
    1212    # declare a number named "temperature",
    1313    # with units of Kelvin, default value 300,
    14     # and specify that it is only an input
     14    #
    1515    # the next number is named "Ef", has units of
    16     # electron Volts, default value of -5.5 and
    17     # is also only an input value
    18     Rappture::Number "temperature" "K" 300 RP_VAR_INPUT
    19     Rappture::Number "Ef" "eV" -5.5 RP_VAR_INPUT
     16    # electron Volts, default value of -5.5
     17    #
     18    # Rappture::Number are assumed to be an input
     19    Rappture::Number "temperature" "K" 300
     20    Rappture::Number "Ef" "eV" -5.5
    2021
    2122    # describe the outputs
    2223    # declare a table to store the outputs
    23     # table is named "factorsTable" and is declared as
    24     # an output only object. two new columns are added to the
     24    # table is named "factorsTable".
     25    # two new columns are added to the
    2526    # table "factorsTable". the first column is named
    2627    # "Fermi-Dirac Factor", a description is provided,
     
    2829    # "Energy", a description is provided, and has units
    2930    # of electron Volts
    30     set results [Rappture::Table "factorsTable" RP_VAR_OUTPUT]
    31     $results new column "Fermi-Dirac Factor" \
    32                       "Plot of Fermi-Dirac Calculation"
    33     $results new column "Energy" \
    34                       "Energy cooresponding to each fdf" \
    35                       -hints {"units=eV"}
     31    # Rappture::Table is assumed to be an output
     32    set results [Rappture::Table "factorsTable"]
     33    $results column "Fermi-Dirac Factor" \
     34                    "Plot of Fermi-Dirac Calculation"
     35    $results column "Energy" \
     36                    "Energy cooresponding to each fdf" \
     37                    -hints {"units=eV"}
    3638
    3739    # describe how the outputs shoud be displayed
    38     # initialize a view named "fdfView", specifying it
    39     # as an output only object with a 1x1 view layout.
    40     # next, add a plot named "fdfPlot" to the view fdfView".
     40    # initialize a view named "fdfView", with a 1x1 layout.
     41    # next, add a plot named "fdfPlot" to the view "fdfView".
    4142    # populate the plot with data from the table
    42     # "fermifactors". Plot the column named
     43    # "factorsTable". Plot the column named
    4344    # "Fermi-Dirac Factor" vs the column named "Energy".
    44     # place the plot, named fdfPlot, at position 1x1 within
     45    # place the plot, named fdfPlot, at position 1,1 within
    4546    # the view's layout.
    46     set v [Rappture::View "fdfView" -flags RP_VAR_OUTPUT|RP_VIEW_1X1]
    47     $v plot table "fdfPlot" "factorsTable" \
    48                   "Fermi-Dirac Factor" "Energy" \
    49                    -hints {"position=1x1"}
    50 
    51     # add another curve to the "fdfPlot" plot.
    52     # plot the column named "Fermi-Dirac Factor2" vs
    53     # the column named "Energy"
    54     # $v plot table "fdfPlot" "factorsTable" \
    55     #               "Fermi-Dirac Factor2" "Energy" \
    56     #               -hints {"position=1x1"}
     47    # Rappture::View is assumed to be an output
     48    set v [Rappture::View "fdfView" -rows 1 -cols 1]
     49    $v plot "fdfPlot" -at "1,1" -table "factorsTable" \
     50        {"Fermi-Dirac Factor" "Energy" "g:o"}
    5751}
Note: See TracChangeset for help on using the changeset viewer.