Ignore:
Timestamp:
Feb 10, 2010, 2:15:28 PM (15 years ago)
Author:
dkearney
Message:

removing references to rappture tables, rappture will automagically decide
where to place new table columns, its one less thing for the user to fuss with.
users will reference the connect a TableColumn? variable with the correct name
and populate the TableColumn? in their science code. adding examples for matlab, octave, fixes for other languages.

Location:
trunk/examples/objects/app-fermi
Files:
18 added
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/examples/objects/app-fermi/c/ex3/fermi.c

    r1655 r1656  
    2626    double T          = 0.0;
    2727    double Ef         = 0.0;
    28     Rp_Table *result  = NULL;
     28    Rp_TableColumn *x1 = NULL;
     29    Rp_TableColumn *y1 = NULL;
     30    Rp_TableColumn *x2 = NULL;
     31    Rp_TableColumn *y2 = NULL;
    2932
    3033
     
    6265    // "Ef", convert its value to electron Volts and store
    6366    // the value into the address of Ef.
    64     // look in the global interface for an object named
    65     // factorsTable and set the variable result to
    66     // point to it.
     67    // look in the global interface for the columns to
     68    // store data. retrieve them for later use.
    6769    Rp_InterfaceConnect("temperature",&T,"units=K",NULL);
    6870    Rp_InterfaceConnect("Ef",&Ef,"units=eV",NULL);
    69     Rp_InterfaceConnect("factorsTable",result,NULL);
     71
     72    Rp_InterfaceConnect("Fermi-Dirac Factor",x1,NULL);
     73    Rp_InterfaceConnect("Energy",y1,NULL);
     74    Rp_InterfaceConnect("Fermi-Dirac Factor * 2",x2,NULL);
     75    Rp_InterfaceConnect("Energy * 2",y2,NULL);
    7076
    7177    // check the global interface for errors
     
    102108    // put the EArr data in the column named "Energy"
    103109    //
    104     Rp_TableStore(result,"Fermi-Dirac Factor",nPts,fArr);
    105     Rp_TableStore(result,"Energy",nPts,EArr);
    106     Rp_TableStore(result,"Fermi-Dirac Factor * 2",nPts,fArr2);
    107     Rp_TableStore(result,"Energy * 2",nPts,EArr2);
     110    Rp_TableColumnStore(x1,nPts,fArr);
     111    Rp_TableColumnStore(y1,nPts,EArr);
     112    Rp_TableColumnStore(x2,nPts,fArr2);
     113    Rp_TableColumnStore(y2,nPts,EArr2);
    108114
    109115    // close the global interface
  • trunk/examples/objects/app-fermi/c/ex3/fermi_io.c

    r1655 r1656  
    3535    // declare a table to store the outputs
    3636    // table is named "factorsTable".
    37     // two new columns are added to the
    38     // table "factorsTable". the first column is named
    39     // "Fermi-Dirac Factor", a description is provided,
    40     // and it has no units. the second column is named
    41     // "Energy", a description is provided, and has units
    42     // of electron Volts
    43     results = Rp_TableInit("factorsTable",RP_VAR_OUTPUT);
    44 
    45     x1 = Rp_TableColumnInit(results,"Fermi-Dirac Factor",
     37    // two new columns are added to the default table
     38    // the first column is named "Fermi-Dirac Factor",
     39    // a description is provided, and it has no units.
     40    // the second column is named "Energy", a description
     41    // is provided, and has units of electron Volts
     42    x1 = Rp_TableColumnInit("Fermi-Dirac Factor",
    4643            "Plot of Fermi-Dirac Calculation");
    47     y1 = Rp_TableColumnInit(results,"Energy",
     44    y1 = Rp_TableColumnInit("Energy",
    4845            "Energy cooresponding to each fdf");
    4946    Rp_TableColumnHint(y1,"units","eV");
    5047
    51     x2 = Rp_TableColumnInit(results,"Fermi-Dirac Factor * 2",
     48    x2 = Rp_TableColumnInit("Fermi-Dirac Factor * 2",
    5249            "Plot of Fermi-Dirac Calculation multiplied by 2");
    53     y2 = Rp_TableColumnInit(results,"Energy * 2",
     50    y2 = Rp_TableColumnInit("Energy * 2",
    5451            "Energy cooresponding to each fdf multiplied by 2");
    5552    Rp_TableColumnHint(y2,"units","eV");
  • trunk/examples/objects/app-fermi/tcl/ex2/fermi.tcl

    r1655 r1656  
    3838set T [Rappture::Interface::connect "temperature" -hints {"units=K"}]
    3939set Ef [Rappture::Interface::connect "Ef" -hints {"units=eV"}]
    40 set fdfPlot [Rappture::Interface::connect "fdfPlot"]
    41 set fdfPlot2 [Rappture::Interface::connect "fdfPlot2"]
     40set p1 [Rappture::Interface::connect "fdfPlot"]
     41set p2 [Rappture::Interface::connect "fdfPlot2"]
    4242
    4343if {[Rappture::Interface::error] != 0]} {
     
    8080# efficiently.
    8181
    82 $fdfPlot add "fdfCurve1" $fArr $EArr -format "g:o"
     82$p1 add "fdfCurve1" $fArr $EArr -format "g:o"
    8383
    84 $fdfPlot2 add "fdfCurve2" $fArr $EArr -format "b-o"
    85 $fdfPlot2 add "fdfCurve3" $fArr $EArr -format "p--"
     84$p2 add "fdfCurve2" $fArr $EArr -format "b-o"
     85$p2 add "fdfCurve3" $fArr $EArr -format "p--"
    8686
     87# close the global interface
     88# signal to the graphical user interface that science
     89# calculations are complete and to display the data
     90# as described in the views
    8791Rappture::Interface::close
    8892
  • trunk/examples/objects/app-fermi/tcl/ex2/fermi_io.tcl

    r1655 r1656  
    2121
    2222    # Most simple xy plots for output
    23     # Because it is a single plot, it gets it's own view.
     23    # Because it is a single plot, it gets its own view.
    2424    # The plot is placed in the position 1,1 of the view.
    2525    set plot [Rappture::Plot "fdfPlot"]
  • trunk/examples/objects/app-fermi/tcl/ex3/fermi.tcl

    r1655 r1656  
    3838set T [Rappture::Interface::connect "temperature" -hints {"units=K"}]
    3939set Ef [Rappture::Interface::connect "Ef" -hints {"units=eV"}]
    40 set result [Rappture::Interface::connect "factorsTable"]
     40
     41set x1 [Rappture::Interface::connect "Fermi-Dirac Factor"]
     42set y1 [Rappture::Interface::connect "Energy"]
     43set x2 [Rappture::Interface::connect "Fermi-Dirac Factor * 2"]
     44set y2 [Rappture::Interface::connect "Energy * 2"]
    4145
    4246if {[Rappture::Interface::error] != 0]} {
     
    8185# any previously existing array of data.
    8286
    83 $result store "Fermi-Dirac Factor" $fArr
    84 $result store "Fermi-Dirac Factor * 2" $fArr2
    85 $result store "Energy" $EArr
    86 $result store "Energy * 2" $EArr2
     87$x1 store $fArr
     88$y1 store $fArr2
     89$x2 store $EArr
     90$y2 store $EArr2
    8791
    8892Rappture::Interface::close
  • trunk/examples/objects/app-fermi/tcl/ex3/fermi_io.tcl

    r1655 r1656  
    1616    # electron Volts, default value of -5.5
    1717    #
    18     # Rappture::Number are assumed to be an input
     18    # Rappture::Number is assumed to be an input
    1919    Rappture::Number "temperature" "K" 300
    2020    Rappture::Number "Ef" "eV" -5.5
    2121
    2222    # describe the outputs
    23     # declare a table to store the outputs
    24     # table is named "factorsTable".
    25     # two new columns are added to the
    26     # table "factorsTable". the first column is named
    27     # "Fermi-Dirac Factor", a description is provided,
    28     # and it has no units. the second column is named
    29     # "Energy", a description is provided, and has units
    30     # of electron Volts
     23    # two new columns are added to the default table
     24    # the first column is named "Fermi-Dirac Factor",
     25    # a description is provided, and it has no units.
     26    # the second column is named "Energy", a description
     27    # is provided, and has units of electron Volts.
    3128    # 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"}
    38     $results column "Fermi-Dirac Factor * 2" \
    39                     "Plot of Fermi-Dirac Calculation multiplied by 2"
    40     $results column "Energy * 2" \
    41                     "Energy cooresponding to each fdf multiplied by 2" \
    42                     -hints {"units=eV"}
     29    set x1 [Rappture::Table::column "Fermi-Dirac Factor" \
     30            "Plot of Fermi-Dirac Calculation"]
     31    set y1 [Rappture::Table::column "Energy" \
     32            "Energy cooresponding to each fdf" \
     33            -hints {"units=eV"}]
     34    set x2 [Rappture::Table::column "Fermi-Dirac Factor * 2" \
     35            "Plot of Fermi-Dirac Calculation multiplied by 2"]
     36    set y2 [Rappture::Table::column "Energy * 2" \
     37            "Energy cooresponding to each fdf multiplied by 2" \
     38            -hints {"units=eV"}]
    4339
    4440    # describe how the outputs should be displayed
     
    5248    # Rappture::View is assumed to be an output
    5349    set v [Rappture::View "fdfView"]
    54     $v plot "fdfPlot" -table "factorsTable" \
    55         {"Fermi-Dirac Factor" "Energy" "g:o"}
     50    $v plot "fdfPlot" {$x1 $y1 "g:o"}
    5651
    5752    # two stacked plots in the same view
    5853    set v2 [Rappture::View "fdfView2"]
    59     $v2 plot "fdfPlot2" -at "1,1" -table "factorsTable" \
    60         {"Fermi-Dirac Factor" "Energy" "g:o"}
    61     $v2 plot "fdfPlot3" -at "2,1" -table "factorsTable" \
    62         {"Fermi-Dirac Factor * 2" "Energy * 2" "b-o"}
     54    $v2 plot "fdfPlot2" -at {1 1} {$x1 $y1 "g:o"}
     55    $v2 plot "fdfPlot3" -at {2 1} {$x2 $y2 "b-o"}
    6356
    6457    # two side by side plots in the same view
    6558    set v3 [Rappture::View "fdfView3"]
    66     $v3 plot "fdfPlot4" -at "1,1" -table "factorsTable" \
    67         {"Fermi-Dirac Factor" "Energy" "g:o"}
    68     $v3 plot "fdfPlot5" -at "1,2" -table "factorsTable" \
    69         {"Fermi-Dirac Factor * 2" "Energy * 2" "b-o"}
     59    $v3 plot "fdfPlot4" -at {1 1} {$x1 $y1 "g:o"}
     60    $v3 plot "fdfPlot5" -at {1 2} {$x2 $y2 "b-o"}
    7061
    7162    # grouped curves in one plot in a view
    72     set v4 [Rappture::View "fdfView1"]
    73     $v4 plot "fdfPlot6" -table "factorsTable" \
    74         {"Fermi-Dirac Factor" "Energy" "g:o" \
    75          "Fermi-Dirac Factor * 2" "Energy * 2" "b-o"}
     63    set v4 [Rappture::View "fdfView4"]
     64    $v4 plot "fdfPlot6" -at {1 1} {$x1 $y1 "g:o"}
     65    $v4 plot "fdfPlot7" -at {1 1} {$x2 $y2 "b-o"}
     66
     67    # grouped curves in one plot in a view
     68    set v5 [Rappture::View "fdfView5"]
     69    $v5 plot "fdfPlot8" {$x1 $y1 "g:o" $x2 $y2 "b-o"}
Note: See TracChangeset for help on using the changeset viewer.