Changeset 1656 for trunk/examples/objects
- Timestamp:
- Feb 10, 2010 2:15:28 PM (11 years ago)
- 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 26 26 double T = 0.0; 27 27 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; 29 32 30 33 … … 62 65 // "Ef", convert its value to electron Volts and store 63 66 // 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. 67 69 Rp_InterfaceConnect("temperature",&T,"units=K",NULL); 68 70 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); 70 76 71 77 // check the global interface for errors … … 102 108 // put the EArr data in the column named "Energy" 103 109 // 104 Rp_Table Store(result,"Fermi-Dirac Factor",nPts,fArr);105 Rp_Table Store(result,"Energy",nPts,EArr);106 Rp_Table Store(result,"Fermi-Dirac Factor * 2",nPts,fArr2);107 Rp_Table Store(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); 108 114 109 115 // close the global interface -
trunk/examples/objects/app-fermi/c/ex3/fermi_io.c
r1655 r1656 35 35 // declare a table to store the outputs 36 36 // 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", 46 43 "Plot of Fermi-Dirac Calculation"); 47 y1 = Rp_TableColumnInit( results,"Energy",44 y1 = Rp_TableColumnInit("Energy", 48 45 "Energy cooresponding to each fdf"); 49 46 Rp_TableColumnHint(y1,"units","eV"); 50 47 51 x2 = Rp_TableColumnInit( results,"Fermi-Dirac Factor * 2",48 x2 = Rp_TableColumnInit("Fermi-Dirac Factor * 2", 52 49 "Plot of Fermi-Dirac Calculation multiplied by 2"); 53 y2 = Rp_TableColumnInit( results,"Energy * 2",50 y2 = Rp_TableColumnInit("Energy * 2", 54 51 "Energy cooresponding to each fdf multiplied by 2"); 55 52 Rp_TableColumnHint(y2,"units","eV"); -
trunk/examples/objects/app-fermi/tcl/ex2/fermi.tcl
r1655 r1656 38 38 set T [Rappture::Interface::connect "temperature" -hints {"units=K"}] 39 39 set Ef [Rappture::Interface::connect "Ef" -hints {"units=eV"}] 40 set fdfPlot[Rappture::Interface::connect "fdfPlot"]41 set fdfPlot2 [Rappture::Interface::connect "fdfPlot2"]40 set p1 [Rappture::Interface::connect "fdfPlot"] 41 set p2 [Rappture::Interface::connect "fdfPlot2"] 42 42 43 43 if {[Rappture::Interface::error] != 0]} { … … 80 80 # efficiently. 81 81 82 $ fdfPlotadd "fdfCurve1" $fArr $EArr -format "g:o"82 $p1 add "fdfCurve1" $fArr $EArr -format "g:o" 83 83 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--" 86 86 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 87 91 Rappture::Interface::close 88 92 -
trunk/examples/objects/app-fermi/tcl/ex2/fermi_io.tcl
r1655 r1656 21 21 22 22 # 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. 24 24 # The plot is placed in the position 1,1 of the view. 25 25 set plot [Rappture::Plot "fdfPlot"] -
trunk/examples/objects/app-fermi/tcl/ex3/fermi.tcl
r1655 r1656 38 38 set T [Rappture::Interface::connect "temperature" -hints {"units=K"}] 39 39 set Ef [Rappture::Interface::connect "Ef" -hints {"units=eV"}] 40 set result [Rappture::Interface::connect "factorsTable"] 40 41 set x1 [Rappture::Interface::connect "Fermi-Dirac Factor"] 42 set y1 [Rappture::Interface::connect "Energy"] 43 set x2 [Rappture::Interface::connect "Fermi-Dirac Factor * 2"] 44 set y2 [Rappture::Interface::connect "Energy * 2"] 41 45 42 46 if {[Rappture::Interface::error] != 0]} { … … 81 85 # any previously existing array of data. 82 86 83 $ result store "Fermi-Dirac Factor"$fArr84 $ result store "Fermi-Dirac Factor * 2"$fArr285 $ result store "Energy"$EArr86 $ result store "Energy * 2"$EArr287 $x1 store $fArr 88 $y1 store $fArr2 89 $x2 store $EArr 90 $y2 store $EArr2 87 91 88 92 Rappture::Interface::close -
trunk/examples/objects/app-fermi/tcl/ex3/fermi_io.tcl
r1655 r1656 16 16 # electron Volts, default value of -5.5 17 17 # 18 # Rappture::Number areassumed to be an input18 # Rappture::Number is assumed to be an input 19 19 Rappture::Number "temperature" "K" 300 20 20 Rappture::Number "Ef" "eV" -5.5 21 21 22 22 # 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. 31 28 # 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"}] 43 39 44 40 # describe how the outputs should be displayed … … 52 48 # Rappture::View is assumed to be an output 53 49 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"} 56 51 57 52 # two stacked plots in the same view 58 53 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"} 63 56 64 57 # two side by side plots in the same view 65 58 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"} 70 61 71 62 # 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.