Ignore:
Timestamp:
Sep 21, 2012 10:01:16 AM (12 years ago)
Author:
mmc
Message:

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File:
1 edited

Legend:

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

    r1655 r3177  
    1 // ----------------------------------------------------------------------
    2 //  EXAMPLE: Fermi-Dirac function in C
    3 //
    4 //  This simple example shows how to use Rappture within a simulator
    5 //  written in C.
    6 // ======================================================================
    7 //  AUTHOR:  Derrick Kearney, Purdue University
    8 //  Copyright (c) 2005-2009  Purdue Research Foundation
    9 //
    10 //  See the file "license.terms" for information on usage and
    11 //  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12 // ======================================================================
    13 
     1/*
     2 * ----------------------------------------------------------------------
     3 *  EXAMPLE: Fermi-Dirac function in C
     4 *
     5 *  This simple example shows how to use Rappture within a simulator
     6 *  written in C.
     7 * ======================================================================
     8 *  AUTHOR:  Derrick Kearney, Purdue University
     9 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
     10 *
     11 *  See the file "license.terms" for information on usage and
     12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     13 * ======================================================================
     14 */
    1415#include "rappture.h"
    1516
     
    2324int main(int argc, char * argv[]) {
    2425
    25     // declare variables to interact with Rappture
     26    /* declare variables to interact with Rappture */
    2627    double T          = 0.0;
    2728    double Ef         = 0.0;
     
    3031
    3132
    32     // declare program variables
     33    /* declare program variables */
    3334    double E          = 0.0;
    3435    double dE         = 0.0;
     
    4243    double fArr[nPts];
    4344
    44     // initialize the global interface
     45    /* initialize the global interface */
    4546    Rp_InterfaceInit(argc,argv,&fermi_io);
    4647
    47     // check the global interface for errors
     48    /* check the global interface for errors */
    4849    if (Rp_InterfaceError() != 0) {
    49         // there were errors while setting up the interface
    50         // dump the traceback
     50        /* there were errors while setting up the interface */
     51        /* dump the traceback */
    5152        Rp_Outcome *o = Rp_InterfaceOutcome();
    5253        fprintf(stderr, "%s", Rp_OutcomeContext(o));
     
    5556    }
    5657
    57     // connect variables to the interface
    58     // look in the global interface for an object named
    59     // "temperature", convert its value to Kelvin, and
    60     // store the value into the address of T.
    61     // look in the global interface for an object named
    62     // "Ef", convert its value to electron Volts and store
    63     // 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.
     58    /*
     59     * connect variables to the interface
     60     * look in the global interface for an object named
     61     * "temperature", convert its value to Kelvin, and
     62     * store the value into the address of T.
     63     * look in the global interface for an object named
     64     * "Ef", convert its value to electron Volts and store
     65     * the value into the address of Ef.
     66     * look in the global interface for an object named
     67     * factorsTable and set the variable result to
     68     * point to it.
     69     */
    6770    Rp_InterfaceConnect("temperature",&T,"units=K",NULL);
    6871    Rp_InterfaceConnect("Ef",&Ef,"units=eV",NULL);
     
    7073    Rp_InterfaceConnect("fdfPlot2",p2,NULL);
    7174
    72     // check the global interface for errors
     75    /* check the global interface for errors */
    7376    if (Rp_InterfaceError() != 0) {
    74         // there were errors while retrieving input data values
    75         // dump the traceback
     77        /* there were errors while retrieving input data values */
     78        /* dump the traceback */
    7679        Rp_Outcome *o = Rp_InterfaceOutcome();
    7780        fprintf(stderr, "%s", Rp_OutcomeContext(o));
     
    8083    }
    8184
    82     // do science calculations
     85    /* do science calculations */
    8386    kT = 8.61734e-5 * T;
    8487    Emin = Ef - (10*kT);
     
    9699    }
    97100
    98     // set up the curves for the plot by using the add command
    99     // Rp_PlotAdd(plot,name,nPts,xdata,ydata,fmt);
    100     //
    101     // to group curves on the same plot, just keep adding curves
    102     // to save space, X array values are compared between curves.
    103     // the the X arrays contain the same values, we only store
    104     // one version in the internal data table, otherwise a new
    105     // column is created for the array. for big arrays this may take
    106     // some time, we should benchmark to see if this can be done
    107     // efficiently.
    108 
     101    /*
     102     * set up the curves for the plot by using the add command
     103     * Rp_PlotAdd(plot,name,nPts,xdata,ydata,fmt);
     104     *
     105     * to group curves on the same plot, just keep adding curves
     106     * to save space, X array values are compared between curves.
     107     * the the X arrays contain the same values, we only store
     108     * one version in the internal data table, otherwise a new
     109     * column is created for the array. for big arrays this may take
     110     * some time, we should benchmark to see if this can be done
     111     * efficiently.
     112     */
    109113    Rp_PlotAdd(p1,"fdfCurve1",nPts,fArr,EArr,"g:o");
    110114
     
    112116    Rp_PlotAdd(p2,"fdfCurve3",nPts,fArr,EArr,"p--");
    113117
    114     // close the global interface
    115     // signal to the graphical user interface that science
    116     // calculations are complete and to display the data
    117     // as described in the views
     118    /*
     119     * close the global interface
     120     * signal to the graphical user interface that science
     121     * calculations are complete and to display the data
     122     * as described in the views
     123     */
    118124    Rp_InterfaceClose();
    119125
Note: See TracChangeset for help on using the changeset viewer.