Ignore:
Timestamp:
Nov 16, 2009, 3:03:37 PM (15 years ago)
Author:
dkearney
Message:

clean up on example programs for new bindings

File:
1 edited

Legend:

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

    r1581 r1615  
    1414#include "rappture.h"
    1515
    16 #include <stdlib.h>
    17 #include <stdio.h>
     16#include <cstdlib>
     17#include <cstdio>
    1818#include <math.h>
    1919#include <unistd.h>
     
    2222
    2323    // create a rappture library from the file filePath
    24     Rappture::Library lib(argv[1]);
     24    Rappture::Library lib;
    2525    Rappture::Number *T;
    2626
     
    3636    double fArr[nPts];
    3737
     38    lib.loadFile(argv[1]);
    3839    if (lib.error() != 0) {
    3940        // cannot open file or out of memory
     
    4142        fprintf(stderr, "%s",o.context());
    4243        fprintf(stderr, "%s",o.remark());
    43         exit(lib.error());
     44        return (lib.error());
    4445    }
    4546
    46     Rappture::connect(&lib,"temperature",T);
     47    Rappture::Connect(&lib,"temperature",T);
    4748    lib.value("Ef", &Ef, 1, "units=eV");
    4849
     
    5354        fprintf(stderr, "%s",o.context());
    5455        fprintf(stderr, "%s",o.remark());
    55         exit(lib.error());
     56        return(lib.error());
    5657    }
    5758
     
    6869        fArr[idx] = f;
    6970        EArr[idx] = E;
    70         rpUtilsProgress((int)((E-Emin)/(Emax-Emin)*100),"Iterating");
     71        Rappture::Utils::progress((int)((E-Emin)/(Emax-Emin)*100),"Iterating");
    7172    }
    72 
    73     const char *curveLabel = "Fermi-Dirac Curve"
    74     const char *curveDesc = "Plot of Fermi-Dirac Calculation";
    7573
    7674    // do it the easy way,
    7775    // create a plot to add to the library
    7876    // plot is registered with lib upon object creation
    79     // p1.add(nPts,xArr,yArr,format,curveLabel,curveDesc);
     77    // p1.add(nPts,xArr,yArr,format,name);
    8078
    8179    Rappture::Plot p1(lib);
    82     p1.add(nPts,fArr,EArr,"",curveLabel,curveDesc);
     80    p1.add(nPts,fArr,EArr,"","fdfactor");
     81    p1.propstr("label","Fermi-Dirac Curve");
     82    p1.propstr("desc","Plot of Fermi-Dirac Calculation");
    8383    p1.propstr("xlabel","Fermi-Dirac Factor");
    8484    p1.propstr("ylabel","Energy");
Note: See TracChangeset for help on using the changeset viewer.