Changeset 1542 for trunk/examples/objects
- Timestamp:
- Jul 6, 2009, 8:53:19 AM (15 years ago)
- Location:
- trunk/examples/objects/app-fermi
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/objects/app-fermi/fermi1.cc
r1541 r1542 32 32 double f = 0.0; 33 33 34 int err = 0;35 36 34 // create a rappture library from the file filePath 37 35 lib = new Rappture::Library(argv[1]); … … 43 41 } 44 42 43 lib.value("temperature", &T, "units=K") 44 lib.value("Ef", &Ef, "units=eV"); 45 45 46 /* Alternative ways to access data 47 48 ////////////////////////////// 49 lib.get("input.number(temperature)").value("K",&T) 50 lib.get("input.number(Ef)").value("eV",&Ef); 51 ////////////////////////////// 52 53 ////////////////////////////// 54 Rappture::Number *rpT = NULL; 55 Rappture::Number *rpEf = NULL; 56 rpT = (Rappture::Number *) lib.get("input.number(temperature)"); 57 rpEf = (Rappture::Number *) lib.get("input.number(Ef)"); 58 59 T = rpT->value("K"); 60 Ef = rpEf->value("Ef"); 61 ////////////////////////////// 62 63 ////////////////////////////// 64 T = lib.value("input.number(temperature)","units=K") 65 Ef = lib.value("input.number(Ef)","units=eV"); 66 ////////////////////////////// 67 */ 68 69 int err = 0; 70 err = lib.value("input.number(temperature)", &T, "units=K") 71 err = lib.value("input.number(Ef)", &Ef, "units=eV"); 46 if (lib.error() != 0) { 47 // there were errors while retrieving input data values 48 // dump the tracepack 49 fprintf(stderr, lib.traceback()); 50 exit(lib.error()); 51 } 72 52 73 53 kT = 8.61734e-5 * T;
Note: See TracChangeset
for help on using the changeset viewer.