Show
Ignore:
Timestamp:
05/17/08 09:51:43 (8 months ago)
Author:
rjrw
Message:

Merged from trunk r2022:2078

Files:
1 modified

Legend:

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

    r2023 r2079  
    359359 
    360360        /* >>chng 01 oct 09, disable gradual underflow on ultrasparc whith g++ 
    361          * (only needed for versions prior to 3.1, see Note 1). 
     361         * (only needed for versions < 3.1 or >= 4.3.0, see Note 1). 
    362362         * 
    363363         * compile this module with: 
    364          *     g++ [ other options... ] -I<include-dir> -DHAVE_SUNMATH -c setfpenv.c 
     364         *     g++ [ other options... ] -I<include-dir> -DHAVE_SUNMATH -c cpu.cpp 
    365365         * link the program with: 
    366366         *     g++ -L<library-dir> -o cloudy.exe *.o -lsunmath 
     
    379379         * g++ [ other options... ] -funsafe-math-optimizations -c *.c 
    380380         * g++ [ other options... ] -funsafe-math-optimizations -o cloudy.exe *.o 
     381         * 
     382         * Starting with g++ 4.3.0 the -funsafe-math-optimizations option can no longer be 
     383         * used as it implicitly enables -fno-trapping-math, which is unsafe for Cloudy 
     384         * because we do trap floating point exceptions. 
    381385         * 
    382386         * Note 2: Don't use nonstandard_arithmetic() with CC (the SunWorks/Forte compiler); 
     
    439443        string FileName( fname ); 
    440444        vector<string>::size_type begin, end; 
    441         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 || 
    442446                         scheme == AS_LOCAL_DATA || scheme == AS_LOCAL_ONLY ); 
    443447 
     
    446450        case AS_DATA_ONLY: 
    447451        case AS_DATA_ONLY_TRY: 
     452        case AS_DATA_OPTIONAL: 
    448453                begin = 1; 
    449454                end = cpu.chSearchPath.size()-1; 
     
    480485        if( handle == NULL && lgAbort ) 
    481486        { 
    482                 // failed on very first open -> probably path is not correct 
    483                 fprintf( ioQQQ, "\nPROBLEM DISASTER I could not open the data file %s\n\n", fname ); 
    484                 fprintf( ioQQQ, "Although there may be other reasons you have received this error,\n"); 
    485                 fprintf( ioQQQ, "the most likely are that the path has not been properly set\n"); 
    486                 fprintf( ioQQQ, "or that the path points to an old version of the data.\n\n"); 
    487                 fprintf( ioQQQ, "Please have a look at the file path.h in the source directory\n"); 
    488                 fprintf( ioQQQ, "to check how the variable CLOUDY_DATA_PATH is set - \n"); 
    489                 fprintf( ioQQQ, "it should give the location of the data files I need.\n"); 
    490                 fprintf( ioQQQ, "These are the files in the data download from the web site.\n\n"); 
    491                 fprintf( ioQQQ, "Recompile the code with the correct data path set in path.h\n"); 
    492                 fprintf( ioQQQ, "or use the shell command \"set CLOUDY_DATA_PATH=path\" to set the\n"); 
    493                 fprintf( ioQQQ, "path from a command prompt.\n\n"); 
    494                 cpu.printDataPath(); 
    495  
    496                 fprintf( ioQQQ, " These are all the paths I tried:\n" ); 
    497                 for( vector<string>::size_type i=begin; i < end; ++i ) 
    498                 { 
    499                         if( cpu.chSearchPath[i].length() > 0 ) 
    500                                 fprintf( ioQQQ, "   ==%s==\n", cpu.chSearchPath[i].c_str() ); 
    501                         else 
    502                                 fprintf( ioQQQ, "   ==<local directory>==\n" ); 
     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 ); 
     492                if( cpu.nFileDone == 0 || scheme == AS_DATA_ONLY ) 
     493                { 
     494                        // failed on very first open -> most likely path is not correct 
     495                        // failed on AS_DATA_ONLY -> CLOUDY_DATA_PATH may point to obsolete data dir 
     496                        fprintf( ioQQQ, "Although there may be other reasons you have received this error,\n"); 
     497                        fprintf( ioQQQ, "the most likely are that the path has not been properly set\n"); 
     498                        fprintf( ioQQQ, "or that the path points to an old version of the data.\n\n"); 
     499                        fprintf( ioQQQ, "Please have a look at the file path.h in the source directory\n"); 
     500                        fprintf( ioQQQ, "to check how the variable CLOUDY_DATA_PATH is set - \n"); 
     501                        fprintf( ioQQQ, "it should give the location of the data files I need.\n"); 
     502                        fprintf( ioQQQ, "These are the files in the data download from the web site.\n\n"); 
     503                        fprintf( ioQQQ, "Recompile the code with the correct data path set in path.h\n"); 
     504                        fprintf( ioQQQ, "or use the shell command \"export CLOUDY_DATA_PATH=path\" to set the\n"); 
     505                        fprintf( ioQQQ, "path from a bash command prompt.\n\n"); 
     506                        cpu.printDataPath(); 
     507                } 
     508                else 
     509                { 
     510                        // failed on search including local directory -> most likely the file name 
     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. 
     513                        fprintf( ioQQQ, "These are all the paths I tried:\n" ); 
     514                        for( vector<string>::size_type i=begin; i < end; ++i ) 
     515                        { 
     516                                if( cpu.chSearchPath[i].length() > 0 ) 
     517                                        fprintf( ioQQQ, "   ==%s==\n", cpu.chSearchPath[i].c_str() ); 
     518                                else 
     519                                        fprintf( ioQQQ, "   ==<local directory>==\n" ); 
     520                        } 
     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                        } 
    503536                } 
    504537                fprintf(ioQQQ, "Sorry.\n\n\n");