Changeset 2061

Show
Ignore:
Timestamp:
05/14/08 07:09:15 (6 months ago)
Author:
peter
Message:

Merging r2051 from mainline - improve error message for missing stellar grid.

Location:
branches/c08_branch/source
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/c08_branch/source/cpu.cpp

    r2040 r2061  
    443443        string FileName( fname ); 
    444444        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 || 
    446446                         scheme == AS_LOCAL_DATA || scheme == AS_LOCAL_ONLY ); 
    447447 
     
    450450        case AS_DATA_ONLY: 
    451451        case AS_DATA_ONLY_TRY: 
     452        case AS_DATA_OPTIONAL: 
    452453                begin = 1; 
    453454                end = cpu.chSearchPath.size()-1; 
     
    484485        if( handle == NULL && lgAbort ) 
    485486        { 
    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 ); 
    487492                if( cpu.nFileDone == 0 || scheme == AS_DATA_ONLY ) 
    488493                { 
     
    505510                        // failed on search including local directory -> most likely the file name 
    506511                        // 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. 
    507513                        fprintf( ioQQQ, "These are all the paths I tried:\n" ); 
    508514                        for( vector<string>::size_type i=begin; i < end; ++i ) 
     
    513519                                        fprintf( ioQQQ, "   ==<local directory>==\n" ); 
    514520                        } 
    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                        } 
    526536                } 
    527537                fprintf(ioQQQ, "Sorry.\n\n\n"); 
  • branches/c08_branch/source/cpu.h

    r1845 r2061  
    132132/** flag used as third parameter for open_data, indicates how data files are searched 
    133133 *  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 
    134135 *  AS_DATA_LOCAL: search in data directories first, then in the current working directory 
    135136 *  AS_LOCAL_DATA: search in the current working directory first, then in the data directories 
     
    137138 *  versions with _TRY appended have the same meaning, except that they don't abort */ 
    138139typedef 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; 
    140141 
    141142FILE* open_data( const char* fname, const char* mode, access_scheme scheme=AS_DATA_ONLY ); 
  • branches/c08_branch/source/stars.cpp

    r2034 r2061  
    7878 *               * char names[MDIM][MNAM+1] * 
    7979 *               * mpp telg[nmods]          * 
    80  *               * realnum anu[ngrid]         * 
    81  *               * realnum mod1[ngrid]        * 
     80 *               * realnum anu[ngrid]       * 
     81 *               * realnum mod1[ngrid]      * 
    8282 *               *    ...                   * 
    83  *               * realnum modn[ngrid]        * 
     83 *               * realnum modn[ngrid]      * 
    8484 *               ============================ 
    8585 * 
     
    506506        grid.name += chODFNew; 
    507507        grid.name += ".mod"; 
    508         grid.scheme = AS_DATA_ONLY; 
     508        grid.scheme = AS_DATA_OPTIONAL; 
    509509        /* identification of this atmosphere set, used in 
    510510         * the Cloudy output, *must* be 12 characters long */ 
     
    603603 
    604604        grid.name = ( lgHalo ? "Sc1_costar_halo.mod" : "Sc1_costar_solar.mod" ); 
    605         grid.scheme = AS_DATA_ONLY; 
     605        grid.scheme = AS_DATA_OPTIONAL; 
    606606        /* identification of this atmosphere set, used in 
    607607         * the Cloudy output, *must* be 12 characters long */ 
     
    720720 
    721721        grid.name = FileName; 
    722         grid.scheme = AS_DATA_ONLY; 
     722        grid.scheme = AS_DATA_OPTIONAL; 
    723723        /* identification of this atmosphere set, used in 
    724724         * the Cloudy output, *must* be 12 characters long */ 
     
    773773 
    774774        grid.name = "kurucz79.mod"; 
    775         grid.scheme = AS_DATA_ONLY; 
     775        grid.scheme = AS_DATA_OPTIONAL; 
    776776        /* identification of this atmosphere set, used in 
    777777         * the Cloudy output, *must* be 12 characters long */ 
     
    823823 
    824824        grid.name = "mihalas.mod"; 
    825         grid.scheme = AS_DATA_ONLY; 
     825        grid.scheme = AS_DATA_OPTIONAL; 
    826826        /* identification of this atmosphere set, used in 
    827827         * the Cloudy output, *must* be 12 characters long */ 
     
    11791179        else 
    11801180                grid.name = ( lgHalo ? "rauch_h-ca_halo.mod" : "rauch_h-ca_solar.mod" ); 
    1181         grid.scheme = AS_DATA_ONLY; 
     1181        grid.scheme = AS_DATA_OPTIONAL; 
    11821182        /* identification of this atmosphere set, used in 
    11831183         * the Cloudy output, *must* be 12 characters long */ 
     
    12131213        else 
    12141214                grid.name = ( lgHalo ? "rauch_h-ni_halo.mod" : "rauch_h-ni_solar.mod" ); 
    1215         grid.scheme = AS_DATA_ONLY; 
     1215        grid.scheme = AS_DATA_OPTIONAL; 
    12161216        /* identification of this atmosphere set, used in 
    12171217         * the Cloudy output, *must* be 12 characters long */ 
     
    12431243 
    12441244        grid.name = "rauch_pg1159.mod"; 
    1245         grid.scheme = AS_DATA_ONLY; 
     1245        grid.scheme = AS_DATA_OPTIONAL; 
    12461246        /* identification of this atmosphere set, used in 
    12471247         * the Cloudy output, *must* be 12 characters long */ 
     
    12731273 
    12741274        grid.name = "rauch_hydr.mod"; 
    1275         grid.scheme = AS_DATA_ONLY; 
     1275        grid.scheme = AS_DATA_OPTIONAL; 
    12761276        /* identification of this atmosphere set, used in 
    12771277         * the Cloudy output, *must* be 12 characters long */ 
     
    13031303 
    13041304        grid.name = "rauch_helium.mod"; 
    1305         grid.scheme = AS_DATA_ONLY; 
     1305        grid.scheme = AS_DATA_OPTIONAL; 
    13061306        /* identification of this atmosphere set, used in 
    13071307         * the Cloudy output, *must* be 12 characters long */ 
     
    13331333 
    13341334        grid.name = "rauch_h+he_3d.mod"; 
    1335         grid.scheme = AS_DATA_ONLY; 
     1335        grid.scheme = AS_DATA_OPTIONAL; 
    13361336        /* identification of this atmosphere set, used in 
    13371337         * the Cloudy output, *must* be 12 characters long */ 
     
    16461646                grid.name += chMetalicity; 
    16471647        grid.name += ".mod"; 
    1648         grid.scheme = AS_DATA_ONLY; 
     1648        grid.scheme = AS_DATA_OPTIONAL; 
    16491649        /* identification of this atmosphere set, used in 
    16501650         * the Cloudy output, *must* be 12 characters long */ 
     
    17531753 
    17541754        grid.name = "kwerner.mod"; 
    1755         grid.scheme = AS_DATA_ONLY; 
     1755        grid.scheme = AS_DATA_OPTIONAL; 
    17561756        /* identification of this atmosphere set, used in 
    17571757         * the Cloudy output, *must* be 12 characters long */ 
     
    18271827 
    18281828        grid.name = "wmbasic.mod"; 
    1829         grid.scheme = AS_DATA_ONLY; 
     1829        grid.scheme = AS_DATA_OPTIONAL; 
    18301830        /* identification of this atmosphere set, used in 
    18311831         * the Cloudy output, *must* be 12 characters long */