Changeset 2022

Show
Ignore:
Timestamp:
05/05/08 04:38:15 (1 week ago)
Author:
gary
Message:

prt_lines_helium.cpp - bug fix - logic for Case B HeI line wavelengths was incorrect, memory overrun
rt_tau_inc.cpp - tidy up comments - no change in functionality

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/source/prt_lines_helium.cpp

    r2019 r2022  
    6868 
    6969        /* store labels for all case b HeI lines in case we assert case b  
    70          * ipass == -1 only counting number of lines */ 
    71         if( LineSave.ipass < 0 ) 
    72                atmdat.nCaseBHeI = 0; 
    73         else if( LineSave.ipass == 0 && atmdat.nCaseBHeI>0) 
    74         { 
    75                 /* now create space but only if there are He I lines - this is not the 
    76                  * case if He is turned off */ 
     70         * ipass == -1 only counting number of lines, =0, malloc then set wl */ 
     71        static bool lgMustMalloc=true; 
     72        if( LineSave.ipass == 0 && atmdat.nCaseBHeI>0 && lgMustMalloc ) 
     73        { 
     74               /* second time through - on ipass=-1 we counted number of lines 
     75                * atmdat.nCaseBHeI, now create space but only if there are He I lines  
     76                 * this is not done if He is turned off */ 
    7777                atmdat.CaseBWlHeI = (realnum*)MALLOC( sizeof(realnum)*atmdat.nCaseBHeI); 
    78                 atmdat.nCaseBHeI = 0; 
    79         } 
     78                lgMustMalloc=false; 
     79        } 
     80        atmdat.nCaseBHeI = 0; 
    8081 
    8182        /* this is the main printout, where line intensities are entered into the stack */ 
  • trunk/source/rt_tau_inc.cpp

    r1926 r2022  
    5151        rt.mas_lo = 0; 
    5252 
    53         /* >>chng 03 apr 11, to iso loop */ 
    54         /* loop over all lines in iso sequences */ 
     53        /* all lines in iso sequences */ 
    5554        for( ipISO=ipH_LIKE; ipISO<NISO; ++ipISO ) 
    5655        { 
     
    6059                         * for element He is 1 for He-like (HeI) and 2 for H-like (HeII) */ 
    6160                        int ion = nelem+1-ipISO; 
    62                         /* >>chng 06 jun 09, do not evaluate in case where trivial parent ion */ 
    63                         /*if( ion <=dense.IonHigh[nelem] )*/ 
     61                        /* do not evaluate in case where trivial parent ion */ 
    6462                        if( ion <=dense.IonHigh[nelem] && dense.xIonDense[nelem][ion] > dense.density_low_limit ) 
    6563                        { 
    6664                                factor = dense.xIonDense[nelem][ion]; 
    67                                 /* >>chng 06 aug 17, should go to numLevels_local instead of _max. */ 
    6865                                for( ipHi=1; ipHi < iso.numLevels_local[ipISO][nelem]; ipHi++ ) 
    6966                                { 
     
    7471                                        for( ipLo=0; ipLo < ipHi; ipLo++ ) 
    7572                                        { 
    76                                                 /* must temporarily make ipLnPopOpc physical  
    77                                                  * >>chng 06 jun 11, use save var to save div */ 
     73                                                /* must temporarily make ipLnPopOpc physical */ 
    7874                                                double save; 
    7975 
     
    9187                                } 
    9288                                ipLo = 0; 
    93                                 /* these are the extra lyman lines */ 
     89                                /* these are the extra Lyman lines */ 
    9490                                for( ipHi=StatesElem[ipISO][nelem][iso.numLevels_max[ipISO][nelem]-1].n; ipHi < iso.nLyman[ipISO]; ipHi++ ) 
    9591                                { 
     
    113109         * same routine does wind and static, 
    114110         * does not start from 0 since first line is dummy */ 
    115         /*DumpLine( &TauLines[ipT63] );*/ 
    116111        for( i=1; i <= nLevel1; i++ ) 
    117112        { 
     
    162157                dense.xIonDense[HFLines[i].Hi->nelem-1][HFLines[i].Hi->IonStg-1] = save; 
    163158        } 
    164 #       if 0 
    165         { 
    166                 /* this is an option to print out one of the two photon continua */ 
    167                 /*@-redef@*/ 
    168                 enum {DEBUG_LOC=false}; 
    169                 /*@+redef@*/ 
    170                 if( DEBUG_LOC ) 
    171                 {        
    172                         fprintf(ioQQQ,"isotope pops\t%.3e\t%.3e\t%.3e\t%.3e\n", 
    173                                 /*HFLines[0].PopOpc , HFLines[0].opacity, 
    174                                 TauLines[ipH21cm].PopOpc , TauLines[ipH21cm].opacity);*/ 
    175                                 HFLines[0].TauIn , HFLines[0].TauTot, 
    176                                 TauLines[ipH21cm].TauIn , TauLines[ipH21cm].TauTot); 
    177                 } 
    178         } 
    179 #       endif 
    180159 
    181         /* carbon monoxide co lines */ 
     160        /* carbon monoxide CO lines */ 
    182161        for( i=0; i < nCORotate; i++ ) 
    183162        { 
     
    194173        H2_RT_tau_inc(); 
    195174 
    196         /*Atomic & Molecular Lines*/ 
     175        /* database Lines*/ 
    197176        for(i=0; i < linesAdded2; i++) 
    198177        { 
     
    204183        if( wind.windv == 0. ) 
    205184        { 
    206                 /* iron fe feii fe2  
    207                  * first are overlapping feii lines */ 
     185                /* iron fe feii fe2  - overlapping feii lines */ 
    208186                t_fe2ovr_la::Inst().tau_inc(); 
    209187        } 
     
    216194 
    217195        if( trace.lgTrace ) 
    218         { 
    219196                fprintf( ioQQQ, " RT_tau_inc returns.\n" ); 
    220         } 
     197 
    221198        return; 
    222199}