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

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

Files:
1 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");