Changeset 1615 for trunk/examples/objects/app-fermi/fermi4.cc
- Timestamp:
- Nov 16, 2009, 3:03:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/objects/app-fermi/fermi4.cc
r1581 r1615 14 14 #include "rappture.h" 15 15 16 #include < stdlib.h>17 #include < stdio.h>16 #include <cstdlib> 17 #include <cstdio> 18 18 #include <math.h> 19 19 #include <unistd.h> … … 22 22 23 23 // create a rappture library from the file filePath 24 Rappture::Library lib (argv[1]);24 Rappture::Library lib; 25 25 Rappture::Number *T; 26 26 … … 36 36 double fArr[nPts]; 37 37 38 lib.loadFile(argv[1]); 38 39 if (lib.error() != 0) { 39 40 // cannot open file or out of memory … … 41 42 fprintf(stderr, "%s",o.context()); 42 43 fprintf(stderr, "%s",o.remark()); 43 exit(lib.error());44 return (lib.error()); 44 45 } 45 46 46 Rappture:: connect(&lib,"temperature",T);47 Rappture::Connect(&lib,"temperature",T); 47 48 lib.value("Ef", &Ef, 1, "units=eV"); 48 49 … … 53 54 fprintf(stderr, "%s",o.context()); 54 55 fprintf(stderr, "%s",o.remark()); 55 exit(lib.error());56 return(lib.error()); 56 57 } 57 58 … … 68 69 fArr[idx] = f; 69 70 EArr[idx] = E; 70 rpUtilsProgress((int)((E-Emin)/(Emax-Emin)*100),"Iterating");71 Rappture::Utils::progress((int)((E-Emin)/(Emax-Emin)*100),"Iterating"); 71 72 } 72 73 const char *curveLabel = "Fermi-Dirac Curve"74 const char *curveDesc = "Plot of Fermi-Dirac Calculation";75 73 76 74 // do it the easy way, 77 75 // create a plot to add to the library 78 76 // 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); 80 78 81 79 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"); 83 83 p1.propstr("xlabel","Fermi-Dirac Factor"); 84 84 p1.propstr("ylabel","Energy");
Note: See TracChangeset
for help on using the changeset viewer.