source: trunk/examples/objects/app-fermi/c/ex2/fermi_io.c @ 1655

Last change on this file since 1655 was 1655, checked in by dkearney, 11 years ago

examples of using a view in tcl and c, update tcl and c view apis

File size: 1.6 KB
Line 
1#include "rappture.h"
2
3void fermi_io() {
4
5    Rp_Plot *p1 = NULL;
6    Rp_Plot *p2 = NULL;
7
8    // assume global interface variable.
9    // newly created objects are stored in the
10    // global interface variable. if there is more
11    // than one global interface variable, the
12    // interface that should be used is specified
13    // using the Rp_???InitX version of the funtion
14    // where ??? represents the type of object the
15    // user is trying to create.
16
17    // describe the inputs
18    // declare a number named "temperature",
19    // with units of Kelvin, default value 300,
20    //
21    // the next number is named "Ef", has units of
22    // electron Volts, default value of -5.5
23    //
24    // Rp_Number is assumed to be an input
25    Rp_NumberInit("temperature","K",300);
26    Rp_NumberInit("Ef","eV",-5.5);
27
28    // Most simple xy plots for output
29    // Because it is a single plot, it gets it's own view.
30    // The plot is placed in the position 1,1 of the view.
31    p1 = Rp_PlotInit("fdfPlot");
32    Rp_PlotXAxis(p1,"Fermi-Dirac Factor",
33        "Plot of Fermi-Dirac Calculation");
34    Rp_PlotYAxis(p1,"Energy","Energy cooresponding to each fdf");
35    Rp_PlotYAxisHint(p1,"units","eV");
36
37    // Declaring a second plot creates a new view.
38    // The new plot will be placed in the position 1,1 of its view.
39    // User can do simple plot grouping using the add function
40    // in the science code.
41    p2 = Rp_PlotInit("fdfPlot2");
42    Rp_PlotXAxis(p2,"Fermi-Dirac Factor",
43        "Plot of Fermi-Dirac Calculation");
44    Rp_PlotYAxis(p2,"Energy","Energy cooresponding to each fdf");
45    Rp_PlotYAxisHint(p2,"units","eV");
46}
Note: See TracBrowser for help on using the repository browser.