Changeset 1750

Show
Ignore:
Timestamp:
01/20/08 08:09:51 (6 months ago)
Author:
peter
Message:

source/parse_table.cpp:
source/cdgetlinelist.cpp:
source/parse.h:
source/zero.cpp:
source/cont_createmesh.cpp:
source/parse_punch.cpp:
source/rfield.h:
source/optimize_phymir.cpp:
source/ion_recomb_Badnell.cpp:
source/cont_ffun.cpp:
source/cloudy.cpp:
source/cdinit.cpp:
source/cddrive.cpp:
source/atom_feii.cpp:
source/hydrobranch.cpp:
source/maincl.cpp:

  • Bug-fix: fix PR45 - large grid fails on max no. of open file descriptors exceeded.
    This is largely a port of r1623, r1711, r1726, and r1728. There are still remaining
    issues with "special" punch commands; these require a more comprehensive bugfix.

tsuite/auto/blr_rnfb.in:
tsuite/auto/blr_kk81.in:
tsuite/auto/blr_rnfa.in:

  • Fix near-botches, largely a result of r1471.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/c07.02_branch/source/atom_feii.cpp

    r1467 r1750  
    699699        } 
    700700 
     701        fclose( ioDATA ); 
     702 
    701703        /*generate needed opacity data for the large FeII atom */ 
    702704 
  • branches/c07.02_branch/source/cddrive.cpp

    r843 r1750  
    22262226        DEBUG_ENTRY( "cdClosePunchFiles()" ); 
    22272227 
    2228         ClosePunchFiles(); 
     2228        ClosePunchFiles( true ); 
    22292229 
    22302230        DEBUG_EXIT( "cdClosePunchFiles()" ); 
  • branches/c07.02_branch/source/cdgetlinelist.cpp

    r759 r1750  
    152152        } 
    153153 
     154        fclose( ioData ); 
     155 
    154156        DEBUG_EXIT( "cdGetLineList()" ); 
    155157 
     
    157159        return nLines; 
    158160} 
    159  
  • branches/c07.02_branch/source/cdinit.cpp

    r1126 r1750  
    323323 
    324324        /* close any open units */ 
    325         /* flush ioQQQ */ 
    326         fflush( ioQQQ ); 
    327  
    328         ClosePunchFiles(); 
     325        ClosePunchFiles( true ); 
    329326 
    330327        /* this routine must be called upon exit or machine will appear to "hang", 
     
    333330        if( lgMPI ) 
    334331        { 
    335                 fprintf(ioQQQ," MPI_Finalize called.\n"); 
    336332#               ifdef MPI 
    337333                MPI_Finalize(); 
  • branches/c07.02_branch/source/cloudy.cpp

    r759 r1750  
    294294        } 
    295295 
    296         ClosePunchFiles(); 
     296        ClosePunchFiles( false ); 
    297297 
    298298        /* this checks that various parts of the code worked properly */ 
  • branches/c07.02_branch/source/cont_createmesh.cpp

    r1226 r1750  
    778778        } 
    779779 
     780        fclose( ioDATA ); 
     781 
    780782        /* now verify continuum grid is ok - first are all values but the last positive? */ 
    781783        for( i=1; i<continuum.nStoredBands-1; ++i ) 
  • branches/c07.02_branch/source/cont_ffun.cpp

    r1212 r1750  
    1313 
    1414/*ReadTable called by TABLE READ to read in continuum from PUNCH TRANSMITTED CONTINUUM */ 
    15 static void ReadTable(FILE * io); 
     15static void ReadTable(const string& fnam); 
    1616 
    1717double ffun(double anu) 
     
    306306 
    307307/*ReadTable called by TABLE READ to read in continuum from PUNCH TRANSMITTED CONTINUUM */ 
    308 static void ReadTable(FILE * io
     308static void ReadTable(const string& fnam
    309309{ 
    310310        char chLine[INPUT_LINE_LENGTH]; 
     
    313313        double Differ,  
    314314          EnerLast; 
     315        FILE *io; 
    315316 
    316317        DEBUG_ENTRY( "ReadTable()" ); 
    317318 
    318319        /* make sure the file handle points somewhere */ 
    319         ASSERT( io != NULL ); 
     320        if( NULL == ( io = fopen(fnam.c_str(),"r") ) ) 
     321        { 
     322                fprintf( ioQQQ, " I could not open file %s.\n", fnam.c_str() ); 
     323                puts( "[Stop in ReadTable]" ); 
     324                cdEXIT(EXIT_FAILURE); 
     325        } 
    320326 
    321327        /* read in first line of header */ 
  • branches/c07.02_branch/source/hydrobranch.cpp

    r792 r1750  
    6161 
    6262        ASSERT( !lgErr ); 
     63 
     64        fclose( io ); 
    6365 
    6466        DEBUG_EXIT( "t_hydrobranch()" ); 
  • branches/c07.02_branch/source/ion_recomb_Badnell.cpp

    r1153 r1750  
    545545        } 
    546546 
     547        fclose( ioDATA ); 
     548 
    547549        /*output coefficients for defined values for testing */ 
    548550#       ifdef PRINT_DR 
  • branches/c07.02_branch/source/maincl.cpp

    r843 r1750  
    329329        /* cdDrive returned 1 if something bad happened, and 0 if everything is ok.  We will 
    330330         * return 0 if everything is ok, and 1 if something bad happened.*/ 
    331         return(lgBadExit); 
     331        cdEXIT(lgBadExit); 
    332332} 
  • branches/c07.02_branch/source/optimize_phymir.cpp

    r779 r1750  
    171171                        yp[0] = (float)optimize_func(xc); 
    172172                        wr_block(&yp[0],(size_t)sizeof(float),fnam1); 
     173                        fclose( ioQQQ ); 
    173174                        cdEXIT(EXIT_SUCCESS); 
    174175                } 
     
    293294                                        yp[jj] = (float)optimize_func(xhlp); 
    294295                                        wr_block(&yp[jj],(size_t)sizeof(float),fnam1); 
     296                                        fclose( ioQQQ ); 
    295297                                        cdEXIT(EXIT_SUCCESS); 
    296298                                } 
  • branches/c07.02_branch/source/parse.h

    r732 r1750  
    3434void PunchFilesInit(void); 
    3535 
    36 /**close all open punch files */ 
    37 void ClosePunchFiles(void); 
     36/**close all open punch files  
     37\param lgFinal - close ALL files, regardless of "no clobber" status 
     38*/ 
     39void ClosePunchFiles( bool lgFinal ); 
    3840 
    3941/**ParseAge - parse the age command */ 
  • branches/c07.02_branch/source/parse_punch.cpp

    r1289 r1750  
    24572457/*ClosePunchFiles close all punch files.  
    24582458 * NB - KEEP THIS ROUTINE SYNCHED UP WITH THE PREVIOUS ONE, PunchFilesInit */ 
    2459 void ClosePunchFiles(void
     2459void ClosePunchFiles( bool lgFinal
    24602460{ 
    24612461        long int i; 
     
    24682468        for( i=0; i < punch.npunch; i++ ) 
    24692469        { 
    2470                 if( punch.ipPnunit[i] != NULL && !lgNoClobber[i] ) 
     2470                /* if lgFinal is true, we close everything, no matter what.  
     2471                 * this means ignoring "no clobber" options */ 
     2472                if( punch.ipPnunit[i] != NULL && ( !lgNoClobber[i] || lgFinal ) ) 
    24712473                { 
    24722474                        fclose( punch.ipPnunit[i] ); 
     
    24812483                punch.lgPunConv = false; 
    24822484        } 
    2483         if( punch.ipDRout != NULL && !lgDROn_noclobber
     2485        if( punch.ipDRout != NULL && !lgDROn_noclobber
    24842486        { 
    24852487                fclose( punch.ipDRout ); 
     
    24872489                punch.lgDROn = false; 
    24882490        } 
    2489         if( punch.ipPoint != NULL && !lgPunPoint_noclobber
     2491        if( punch.ipPoint != NULL && !lgPunPoint_noclobber
    24902492        { 
    24912493                fclose( punch.ipPoint ); 
  • branches/c07.02_branch/source/parse_table.cpp

    r1098 r1750  
    236236        /*fprintf(ioQQQ,"\n");*/ 
    237237 
     238        fclose( ioFILE ); 
     239 
    238240        { 
    239241                /* change following to true to print their original table */ 
     
    10521054                } 
    10531055 
    1054                 /* now open this file */ 
    1055                 if( NULL==(rfield.ioTableRead[rfield.nspec]=fopen( chFile,"r"))) 
    1056                 { 
    1057                         fprintf( ioQQQ, " I could not open file %s.\n",chFile ); 
    1058                         puts( "[Stop in ParseTable]" ); 
    1059                         cdEXIT(EXIT_FAILURE); 
    1060                 } 
     1056                /* store file name for later reading */ 
     1057                rfield.ioTableRead[rfield.nspec] = string( chFile ); 
    10611058 
    10621059                /* set flag saying really just read in continuum exactly as punched */ 
     
    10751072                DEBUG_EXIT( "ParseTable()" ); 
    10761073                return; 
    1077  
    10781074        } 
    10791075 
  • branches/c07.02_branch/source/rfield.h

    r1226 r1750  
    294294 
    295295        /** pointer to file for table read command */ 
    296         FILE *ioTableRead[LIMSPC]; 
     296        string ioTableRead[LIMSPC]; 
    297297 
    298298        /** these are total numbers of photons over various energy ranges */ 
  • branches/c07.02_branch/source/zero.cpp

    r1286 r1750  
    13881388                rfield.range[i][0] = HIONPOT; 
    13891389                rfield.range[i][1] = rfield.egamry; 
    1390                 rfield.ioTableRead[i] = NULL
     1390                rfield.ioTableRead[i].clear()
    13911391        } 
    13921392        rfield.comtot = 0.; 
  • branches/c07.02_branch/tsuite/auto/blr_kk81.in

    r805 r1750  
    7373// >>chng 05 mar 12, from 54.6 to 56.9 RP merge He-like code 
    7474// >>chng 06 jul 18, from 56.9 to 51.9, RP major upgrade VS coll strengths 
    75 assert line "Ba C"    0    51.9 
     75// >>chng 08 jan 20, from 51.9 to 49.3, bugfix stark broadening incorrect (r1471) 
     76assert line "Ba C"    0    49.3 
    7677// 
    7778// >>chng 01 aug 17, from 37.6 to 35.7, slow drift in results 
  • branches/c07.02_branch/tsuite/auto/blr_rnfa.in

    r1088 r1750  
    6464// >>chng 04 dec 08, from 1.62 to 1.46 co-ion feedback, check converg 
    6565// >>chng 05 oct 01, from 1.46 to 1.52, drift down 
    66 assert line "H  1" 1.875m        1.52 
     66// >>chng 08 jan 20, from 1.52 to 1.59, bugfix stark broadening incorrect 
     67assert line "H  1" 1.875m        1.59 
    6768// 
    6869// >>chng 00 oct 03, from 12.1 to 12.86 rebin uv continuum H- opacity bug 
  • branches/c07.02_branch/tsuite/auto/blr_rnfb.in

    r1471 r1750  
    233233// >>chng 04 jul 03, from 1.55 to 1.39, NA update H, Co chem net 
    234234// >>chng 06 jul 18, from 1.39 to 1.58 RP major upgrade VS coll strengths 
    235 assert line "6lev" 1304    1.58, err 0.1 
     235// >>chng 08 jan 20, from 1.58 to 1.43, drift down 
     236assert line "6lev" 1304    1.43, err 0.1 
    236237// 
    237238// >>chng 01 jun 15, from 1.90 to 1.72, H ct network chng