Changeset 2061
- Timestamp:
- 05/14/08 07:09:15 (6 months ago)
- Location:
- branches/c08_branch/source
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/c08_branch/source/cpu.cpp
r2040 r2061 443 443 string FileName( fname ); 444 444 vector<string>::size_type begin, end; 445 bool lgAbort = ( scheme == AS_DATA_ONLY || scheme == AS_DATA_ LOCAL ||445 bool lgAbort = ( scheme == AS_DATA_ONLY || scheme == AS_DATA_OPTIONAL || scheme == AS_DATA_LOCAL || 446 446 scheme == AS_LOCAL_DATA || scheme == AS_LOCAL_ONLY ); 447 447 … … 450 450 case AS_DATA_ONLY: 451 451 case AS_DATA_ONLY_TRY: 452 case AS_DATA_OPTIONAL: 452 453 begin = 1; 453 454 end = cpu.chSearchPath.size()-1; … … 484 485 if( handle == NULL && lgAbort ) 485 486 { 486 fprintf( ioQQQ, "\nPROBLEM DISASTER I could not open the data file %s\n\n", fname ); 487 if( scheme == AS_DATA_OPTIONAL ) 488 // presence is optional -> make warning less scary... 489 fprintf( ioQQQ, "\nI could not open the data file %s\n\n", fname ); 490 else 491 fprintf( ioQQQ, "\nPROBLEM DISASTER I could not open the data file %s\n\n", fname ); 487 492 if( cpu.nFileDone == 0 || scheme == AS_DATA_ONLY ) 488 493 { … … 505 510 // failed on search including local directory -> most likely the file name 506 511 // was mistyped on a compile command, or Cloudy is run in the wrong directory 512 // if scheme == AS_DATA_OPTIONAL, this most likely is a stellar grid that is not installed. 507 513 fprintf( ioQQQ, "These are all the paths I tried:\n" ); 508 514 for( vector<string>::size_type i=begin; i < end; ++i ) … … 513 519 fprintf( ioQQQ, " ==<local directory>==\n" ); 514 520 } 515 fprintf( ioQQQ, "\nAlthough there may be other reasons you have received this error,\n"); 516 fprintf( ioQQQ, "the most likely are that you mistyped the file name, or that you\n"); 517 fprintf( ioQQQ, "are running Cloudy in the wrong directory. If you are running a\n"); 518 fprintf( ioQQQ, "COMPILE command, this needs to be done in the data directory.\n\n"); 519 fprintf( ioQQQ, "Otherwise, please have a look at the file path.h in the source\n"); 520 fprintf( ioQQQ, "directory to check how the variable CLOUDY_DATA_PATH is set - \n"); 521 fprintf( ioQQQ, "it should give the location of the data files I need.\n"); 522 fprintf( ioQQQ, "These are the files in the data download from the web site.\n\n"); 523 fprintf( ioQQQ, "Recompile the code with the correct data path set in path.h\n"); 524 fprintf( ioQQQ, "or use the shell command \"export CLOUDY_DATA_PATH=path\" to set the\n"); 525 fprintf( ioQQQ, "path from a bash command prompt.\n\n"); 521 // AS_DATA_OPTIONAL files should provide their own message (currently only stellar grids) 522 if( scheme != AS_DATA_OPTIONAL ) 523 { 524 fprintf( ioQQQ, "\nAlthough there may be other reasons you have received this error,\n"); 525 fprintf( ioQQQ, "the most likely are that you mistyped the file name, or that you\n"); 526 fprintf( ioQQQ, "are running Cloudy in the wrong directory. If you are running a\n"); 527 fprintf( ioQQQ, "COMPILE command, this needs to be done in the data directory.\n\n"); 528 fprintf( ioQQQ, "Otherwise, please have a look at the file path.h in the source\n"); 529 fprintf( ioQQQ, "directory to check how the variable CLOUDY_DATA_PATH is set - \n"); 530 fprintf( ioQQQ, "it should give the location of the data files I need.\n"); 531 fprintf( ioQQQ, "These are the files in the data download from the web site.\n\n"); 532 fprintf( ioQQQ, "Recompile the code with the correct data path set in path.h\n"); 533 fprintf( ioQQQ, "or use the shell command \"export CLOUDY_DATA_PATH=path\" to set the\n"); 534 fprintf( ioQQQ, "path from a bash command prompt.\n\n"); 535 } 526 536 } 527 537 fprintf(ioQQQ, "Sorry.\n\n\n"); -
branches/c08_branch/source/cpu.h
r1845 r2061 132 132 /** flag used as third parameter for open_data, indicates how data files are searched 133 133 * AS_DATA_ONLY: search only in the data directories, not in the current working directory (default) 134 * AS_DATA_OPTIONAL: same as AS_DATA_ONLY, except that the precense of the file is optional 134 135 * AS_DATA_LOCAL: search in data directories first, then in the current working directory 135 136 * AS_LOCAL_DATA: search in the current working directory first, then in the data directories … … 137 138 * versions with _TRY appended have the same meaning, except that they don't abort */ 138 139 typedef enum { AS_DATA_ONLY_TRY, AS_DATA_LOCAL_TRY, AS_LOCAL_DATA_TRY, AS_LOCAL_ONLY_TRY, 139 AS_DATA_ONLY, AS_DATA_ LOCAL, AS_LOCAL_DATA, AS_LOCAL_ONLY } access_scheme;140 AS_DATA_ONLY, AS_DATA_OPTIONAL, AS_DATA_LOCAL, AS_LOCAL_DATA, AS_LOCAL_ONLY } access_scheme; 140 141 141 142 FILE* open_data( const char* fname, const char* mode, access_scheme scheme=AS_DATA_ONLY ); -
branches/c08_branch/source/stars.cpp
r2034 r2061 78 78 * * char names[MDIM][MNAM+1] * 79 79 * * mpp telg[nmods] * 80 * * realnum anu[ngrid] *81 * * realnum mod1[ngrid] *80 * * realnum anu[ngrid] * 81 * * realnum mod1[ngrid] * 82 82 * * ... * 83 * * realnum modn[ngrid] *83 * * realnum modn[ngrid] * 84 84 * ============================ 85 85 * … … 506 506 grid.name += chODFNew; 507 507 grid.name += ".mod"; 508 grid.scheme = AS_DATA_O NLY;508 grid.scheme = AS_DATA_OPTIONAL; 509 509 /* identification of this atmosphere set, used in 510 510 * the Cloudy output, *must* be 12 characters long */ … … 603 603 604 604 grid.name = ( lgHalo ? "Sc1_costar_halo.mod" : "Sc1_costar_solar.mod" ); 605 grid.scheme = AS_DATA_O NLY;605 grid.scheme = AS_DATA_OPTIONAL; 606 606 /* identification of this atmosphere set, used in 607 607 * the Cloudy output, *must* be 12 characters long */ … … 720 720 721 721 grid.name = FileName; 722 grid.scheme = AS_DATA_O NLY;722 grid.scheme = AS_DATA_OPTIONAL; 723 723 /* identification of this atmosphere set, used in 724 724 * the Cloudy output, *must* be 12 characters long */ … … 773 773 774 774 grid.name = "kurucz79.mod"; 775 grid.scheme = AS_DATA_O NLY;775 grid.scheme = AS_DATA_OPTIONAL; 776 776 /* identification of this atmosphere set, used in 777 777 * the Cloudy output, *must* be 12 characters long */ … … 823 823 824 824 grid.name = "mihalas.mod"; 825 grid.scheme = AS_DATA_O NLY;825 grid.scheme = AS_DATA_OPTIONAL; 826 826 /* identification of this atmosphere set, used in 827 827 * the Cloudy output, *must* be 12 characters long */ … … 1179 1179 else 1180 1180 grid.name = ( lgHalo ? "rauch_h-ca_halo.mod" : "rauch_h-ca_solar.mod" ); 1181 grid.scheme = AS_DATA_O NLY;1181 grid.scheme = AS_DATA_OPTIONAL; 1182 1182 /* identification of this atmosphere set, used in 1183 1183 * the Cloudy output, *must* be 12 characters long */ … … 1213 1213 else 1214 1214 grid.name = ( lgHalo ? "rauch_h-ni_halo.mod" : "rauch_h-ni_solar.mod" ); 1215 grid.scheme = AS_DATA_O NLY;1215 grid.scheme = AS_DATA_OPTIONAL; 1216 1216 /* identification of this atmosphere set, used in 1217 1217 * the Cloudy output, *must* be 12 characters long */ … … 1243 1243 1244 1244 grid.name = "rauch_pg1159.mod"; 1245 grid.scheme = AS_DATA_O NLY;1245 grid.scheme = AS_DATA_OPTIONAL; 1246 1246 /* identification of this atmosphere set, used in 1247 1247 * the Cloudy output, *must* be 12 characters long */ … … 1273 1273 1274 1274 grid.name = "rauch_hydr.mod"; 1275 grid.scheme = AS_DATA_O NLY;1275 grid.scheme = AS_DATA_OPTIONAL; 1276 1276 /* identification of this atmosphere set, used in 1277 1277 * the Cloudy output, *must* be 12 characters long */ … … 1303 1303 1304 1304 grid.name = "rauch_helium.mod"; 1305 grid.scheme = AS_DATA_O NLY;1305 grid.scheme = AS_DATA_OPTIONAL; 1306 1306 /* identification of this atmosphere set, used in 1307 1307 * the Cloudy output, *must* be 12 characters long */ … … 1333 1333 1334 1334 grid.name = "rauch_h+he_3d.mod"; 1335 grid.scheme = AS_DATA_O NLY;1335 grid.scheme = AS_DATA_OPTIONAL; 1336 1336 /* identification of this atmosphere set, used in 1337 1337 * the Cloudy output, *must* be 12 characters long */ … … 1646 1646 grid.name += chMetalicity; 1647 1647 grid.name += ".mod"; 1648 grid.scheme = AS_DATA_O NLY;1648 grid.scheme = AS_DATA_OPTIONAL; 1649 1649 /* identification of this atmosphere set, used in 1650 1650 * the Cloudy output, *must* be 12 characters long */ … … 1753 1753 1754 1754 grid.name = "kwerner.mod"; 1755 grid.scheme = AS_DATA_O NLY;1755 grid.scheme = AS_DATA_OPTIONAL; 1756 1756 /* identification of this atmosphere set, used in 1757 1757 * the Cloudy output, *must* be 12 characters long */ … … 1827 1827 1828 1828 grid.name = "wmbasic.mod"; 1829 grid.scheme = AS_DATA_O NLY;1829 grid.scheme = AS_DATA_OPTIONAL; 1830 1830 /* identification of this atmosphere set, used in 1831 1831 * the Cloudy output, *must* be 12 characters long */
