Show
Ignore:
Timestamp:
03/08/08 12:55:20 (9 months ago)
Author:
rjrw
Message:

Merged from trunk r1803:1829

Location:
branches/newmole/source
Files:
85 modified

Legend:

Unmodified
Added
Removed
  • branches/newmole/source/atmdat.h

    r1739 r1830  
    140140        /** [0] is Atom^+1 + H0 => Atom^0 + H^+ 
    141141         * [n] is Atom^+n+1 + H0 => Atom^+n + H^+ */ 
    142         double HCharExcIonOf[LIMELM][LIMELM+1],  
    143           HCharExcRecTo[LIMELM][LIMELM+1],  
     142        double HCharExcIonOf[LIMELM][LIMELM+1], //(cm3 s-1) 
     143          HCharExcRecTo[LIMELM][LIMELM+1],              //(cm3 s-1) 
    144144          HCharHeatMax,  
    145145          HCharCoolMax,  
     
    167167         *that go into the ionization balance 
    168168         *Ion[ion] is ionization, Rec[ion] is recombination 
    169          *units cm-3 s-1 
     169         *units cm3 s-1 
    170170         */ 
    171171        double HeCharExcIonOf[LIMELM][LIMELM],  
  • branches/newmole/source/atmdat_adfa.cpp

    r1780 r1830  
    1010t_ADfA::t_ADfA() 
    1111{ 
    12         const long VERSION_MAGIC = 20061204L; 
    13         const static char chFile[] = "phfit.dat"; 
    14         char chString[FILENAME_PATH_LENGTH_2]; 
    15         double help[9]; 
    16  
    1712        DEBUG_ENTRY( "t_ADfA()" ); 
    1813 
     
    2015        version = PHFIT_UNDEF; 
    2116 
    22         strcpy( chString, cpu.DataPath()  ); 
    23         strcat( chString, chFile ); 
    24  
    25         FILE *io; 
    26         /* this is the first attempt at opening a data file in this core load 
    27          * if the path is bad this is where we will fail */ 
    28         if( (io = fopen(chString,"r")) == NULL ) 
    29         { 
    30                 path_not_set(); 
    31                 cdEXIT(EXIT_FAILURE); 
    32         } 
     17        double help[9]; 
     18        const long VERSION_MAGIC = 20061204L; 
     19 
     20        const static char chFile[] = "phfit.dat"; 
     21 
     22        FILE *io = open_data( chFile, "r" ); 
    3323 
    3424        bool lgErr = false; 
     
    7565        const static char chFile2[] = "hpfit.dat"; 
    7666 
    77         strcpy( chString,cpu.DataPath()); 
    78         strcat( chString, chFile2 ); 
    79  
    80         if( (io = fopen(chString,"r")) == NULL ) 
    81         { 
    82                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    83                 path_not_set(); 
    84                 cdEXIT(EXIT_FAILURE); 
    85         } 
     67        io = open_data( chFile2, "r" ); 
    8668 
    8769        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
     
    10789        const static char chFile3[] = "rec_lines.dat"; 
    10890 
    109         strcpy( chString, cpu.DataPath() ); 
    110         strcat( chString, chFile3 ); 
    111  
    112         if( (io = fopen(chString,"r")) == NULL ) 
    113         { 
    114                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    115                 path_not_set(); 
    116                 cdEXIT(EXIT_FAILURE); 
    117         } 
     91        io = open_data( chFile3, "r" ); 
    11892 
    11993        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
     
    148122        const static char chFile4[] = "rad_rec.dat"; 
    149123 
    150         strcpy( chString,  cpu.DataPath()  ); 
    151         strcat( chString, chFile4 ); 
    152  
    153         if( (io = fopen(chString,"r")) == NULL ) 
    154         { 
    155                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    156                 path_not_set(); 
    157                 cdEXIT(EXIT_FAILURE); 
    158         } 
     124        io = open_data( chFile4, "r" ); 
    159125 
    160126        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
     
    201167        const static char chFile5[] = "h_rad_rec.dat"; 
    202168 
    203         strcpy( chString, cpu.DataPath()  ); 
    204         strcat( chString, chFile5 ); 
    205  
    206         if( (io = fopen(chString,"r")) == NULL ) 
    207         { 
    208                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    209                 path_not_set(); 
    210                 cdEXIT(EXIT_FAILURE); 
    211         } 
     169        io = open_data( chFile5, "r" ); 
    212170 
    213171        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
     
    233191        const static char chFile6[] = "h_phot_cs.dat"; 
    234192 
    235         strcpy( chString, cpu.DataPath()  ); 
    236         strcat( chString, chFile6 ); 
    237  
    238         if( (io = fopen(chString,"r")) == NULL ) 
    239         { 
    240                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    241                 path_not_set(); 
    242                 cdEXIT(EXIT_FAILURE); 
    243         } 
     193        io = open_data( chFile6, "r" ); 
    244194 
    245195        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
     
    263213        const static char chFile7[] = "coll_ion.dat"; 
    264214 
    265         strcpy( chString, cpu.DataPath()); 
    266         strcat( chString, chFile7 ); 
    267  
    268         if( (io = fopen(chString,"r")) == NULL ) 
    269         { 
    270                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    271                 path_not_set(); 
    272                 cdEXIT(EXIT_FAILURE); 
    273         } 
     215        io = open_data( chFile7, "r" ); 
    274216 
    275217        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
     
    296238        const static char chFile8[] = "h_coll_str.dat"; 
    297239 
    298         strcpy( chString, cpu.DataPath()); 
    299         strcat( chString, chFile8 ); 
    300  
    301         if( (io = fopen(chString,"r")) == NULL ) 
    302         { 
    303                 fprintf( ioQQQ, " Could not open %s for reading\n", chString ); 
    304                 path_not_set(); 
    305                 cdEXIT(EXIT_FAILURE); 
    306         } 
     240        io = open_data( chFile8, "r" ); 
    307241 
    308242        lgErr = lgErr || ( fscanf( io, "%ld", &i ) != 1 ); 
  • branches/newmole/source/atmdat_chianti.cpp

    r1780 r1830  
    3131 
    3232        char chLine[FILENAME_PATH_LENGTH_2] , 
    33                 chFilename[FILENAME_PATH_LENGTH_2], 
    3433                chEnFilename[FILENAME_PATH_LENGTH_2], 
    3534                chTraFilename[FILENAME_PATH_LENGTH_2], 
     
    5453        /*For the CHIANTI DATABASE*/ 
    5554        /*First Opening the energy levels file*/ 
    56         strcpy( chFilename , Species[intNS].chptrSpName );                       
    57         strcat( chFilename , ".elvlc"); 
    58         uncaps( chFilename ); 
    59         strcpy( chEnFilename , cpu.DataPath() ); 
    60         strcat( chEnFilename , chFilename ); 
    61         if(DEBUGSTATE) 
    62                 printf("The data file is %s \n",chFilename); 
     55        strcpy( chEnFilename , Species[intNS].chptrSpName );                     
     56        strcat( chEnFilename , ".elvlc"); 
     57        uncaps( chEnFilename ); 
     58        if(DEBUGSTATE) 
     59                printf("The data file is %s \n",chEnFilename); 
    6360 
    6461        /*Open the files*/ 
    6562        if( trace.lgTrace ) 
    66                 fprintf( ioQQQ," moldat_readin opening %s:",chFilename); 
    67  
    68         if( ( atmolLevDATA = fopen( chEnFilename , "r" ) ) == NULL ) 
    69         { 
    70                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename ); 
    71                 fprintf( ioQQQ, " even tried path\n" ); 
    72  
    73                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename); 
    74                 fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    75                 fprintf( ioQQQ, " final path is ==%s==\n",chEnFilename ); 
    76  
    77                 /* make announcement that path probably not set */ 
    78                 path_not_set(); 
    79  
    80                 cdEXIT(EXIT_FAILURE); 
    81         } 
    82  
    83         if( read_whole_line( chLine , (int)sizeof(chLine) , atmolLevDATA ) == NULL ) 
    84         { 
    85                 fprintf( ioQQQ, " moldat_readin could not read first line of %s.\n",chFilename); 
    86                 cdEXIT(EXIT_FAILURE); 
    87         } 
    88         /*Rewind the file*/ 
    89         if( fseek( atmolLevDATA , 0 , SEEK_SET ) != 0 ) 
    90         { 
    91                 fprintf( ioQQQ, " moldat_readin could not rewind %s.\n",chFilename); 
    92                 cdEXIT(EXIT_FAILURE); 
    93         } 
     63                fprintf( ioQQQ," moldat_readin opening %s:",chEnFilename); 
     64 
     65        atmolLevDATA = open_data( chEnFilename, "r" ); 
     66 
    9467        /*Second:Opening the transition probabilities file*/ 
    95         strcpy( chFilename , Species[intNS].chptrSpName );                       
    96         strcat( chFilename , ".wgfa"); 
    97         uncaps( chFilename ); 
    98         strcpy( chTraFilename , cpu.DataPath() ); 
    99         strcat( chTraFilename , chFilename ); 
    100         if(DEBUGSTATE) 
    101                 printf("The data file is %s \n",chFilename); 
     68        strcpy( chTraFilename , Species[intNS].chptrSpName );                    
     69        strcat( chTraFilename , ".wgfa"); 
     70        uncaps( chTraFilename ); 
     71        if(DEBUGSTATE) 
     72                printf("The data file is %s \n",chTraFilename); 
    10273 
    10374        /*Open the files*/ 
    10475        if( trace.lgTrace ) 
    105                 fprintf( ioQQQ," moldat_readin opening %s:",chFilename); 
    106  
    107         if( ( atmolTraDATA = fopen( chTraFilename , "r" ) ) == NULL ) 
    108         { 
    109                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename ); 
    110                 fprintf( ioQQQ, " even tried path\n" ); 
    111  
    112                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename); 
    113                 fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    114                 fprintf( ioQQQ, " final path is ==%s==\n",chTraFilename ); 
    115  
    116                 /* make announcement that path probably not set */ 
    117                 path_not_set(); 
    118  
    119                 cdEXIT(EXIT_FAILURE); 
    120         } 
    121  
    122         if( read_whole_line( chLine , (int)sizeof(chLine) , atmolTraDATA ) == NULL ) 
    123         { 
    124                 fprintf( ioQQQ, " moldat_readin could not read first line of %s.\n",chFilename); 
    125                 cdEXIT(EXIT_FAILURE); 
    126         } 
    127         /*Rewind the file*/ 
    128         if( fseek( atmolTraDATA , 0 , SEEK_SET ) != 0 ) 
    129         { 
    130                 fprintf( ioQQQ, " moldat_readin could not rewind %s.\n",chFilename); 
    131                 cdEXIT(EXIT_FAILURE); 
    132         } 
     76                fprintf( ioQQQ," moldat_readin opening %s:",chTraFilename); 
     77 
     78        atmolTraDATA = open_data( chTraFilename, "r" ); 
     79 
    13380        /*Third: Opening the electron collision data*/ 
    134         strcpy( chFilename , Species[intNS].chptrSpName );                       
    135         strcat( chFilename , ".splups"); 
    136         uncaps( chFilename ); 
    137         strcpy( chEleColFilename , cpu.DataPath() ); 
    138         strcat( chEleColFilename , chFilename ); 
    139         if(DEBUGSTATE) 
    140                 printf("The data file is %s \n",chFilename); 
     81        strcpy( chEleColFilename , Species[intNS].chptrSpName );                         
     82        strcat( chEleColFilename , ".splups"); 
     83        uncaps( chEleColFilename ); 
     84        if(DEBUGSTATE) 
     85                printf("The data file is %s \n",chEleColFilename); 
    14186        /*Open the files*/ 
    14287        if( trace.lgTrace ) 
    143                 fprintf( ioQQQ," moldat_readin opening %s:",chFilename); 
    144         if( ( atmolEleColDATA = fopen( chEleColFilename , "r" ) ) == NULL ) 
    145         { 
    146                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename ); 
    147                 fprintf( ioQQQ, " even tried path\n" ); 
    148  
    149                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename); 
    150                 fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    151                 fprintf( ioQQQ, " final path is ==%s==\n",chEleColFilename ); 
    152  
    153                 /* make announcement that path probably not set */ 
    154                 path_not_set(); 
    155  
    156                 cdEXIT(EXIT_FAILURE); 
    157         } 
    158  
    159         if( read_whole_line( chLine , (int)sizeof(chLine) , atmolEleColDATA ) == NULL ) 
    160         { 
    161                 fprintf( ioQQQ, " moldat_readin could not read first line of %s.\n",chFilename); 
    162                 cdEXIT(EXIT_FAILURE); 
    163         } 
    164         /*Rewind the electron collision data file*/ 
    165         if( fseek(atmolEleColDATA , 0 , SEEK_SET ) != 0 ) 
    166         { 
    167                 fprintf( ioQQQ, " moldat_readin could not rewind %s.\n",chFilename); 
    168                 cdEXIT(EXIT_FAILURE); 
    169         } 
     88                fprintf( ioQQQ," moldat_readin opening %s:",chEleColFilename); 
     89 
     90        atmolEleColDATA = open_data( chEleColFilename, "r" ); 
     91 
    17092        /*Fourth: Opening the proton collision data*/ 
    171         strcpy( chFilename , Species[intNS].chptrSpName );                       
    172         strcat( chFilename , ".psplups"); 
    173         uncaps( chFilename ); 
    174         strcpy( chProColFilename , cpu.DataPath() ); 
    175         strcat( chProColFilename , chFilename ); 
    176         if(DEBUGSTATE) 
    177                 printf("The data file is %s \n",chFilename); 
     93        strcpy( chProColFilename , Species[intNS].chptrSpName );                         
     94        strcat( chProColFilename , ".psplups"); 
     95        uncaps( chProColFilename ); 
     96        if(DEBUGSTATE) 
     97                printf("The data file is %s \n",chProColFilename); 
    17898        /*Open the files*/ 
    17999        if( trace.lgTrace ) 
    180                 fprintf( ioQQQ," moldat_readin opening %s:",chFilename); 
     100                fprintf( ioQQQ," moldat_readin opening %s:",chProColFilename); 
    181101 
    182102        nMolLevs = 0; 
  • branches/newmole/source/atmdat_lamda.cpp

    r1780 r1830  
    2626 
    2727        char chLine[FILENAME_PATH_LENGTH_2] , 
    28                 chFilename[FILENAME_PATH_LENGTH_2], 
    2928                chEFilename[FILENAME_PATH_LENGTH_2], 
    3029                *chColltemp,*chCollName; 
     
    3534        if(DEBUGSTATE) 
    3635                printf("The name of the %li species is %s \n",intNS+1,Species[intNS].chptrSpName); 
    37         strcpy( chFilename , Species[intNS].chptrSpName );                       
    38         strcat( chFilename , ".dat"); 
    39         uncaps( chFilename ); 
    40         strcpy( chEFilename , cpu.DataPath() ); 
    41         strcat( chEFilename , chFilename ); 
     36        strcpy( chEFilename , Species[intNS].chptrSpName );                      
     37        strcat( chEFilename , ".dat"); 
     38        uncaps( chEFilename ); 
    4239 
    4340        /*Open the files*/ 
    4441        if( trace.lgTrace ) 
    45                 fprintf( ioQQQ," moldat_readin opening %s:",chFilename); 
    46  
    47         if( ( atmolLevDATA = fopen( chEFilename , "r" ) ) == NULL ) 
    48         { 
    49                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename ); 
    50                 fprintf( ioQQQ, " even tried path\n" ); 
    51  
    52                 fprintf( ioQQQ, " moldat_readin could not open %s \n",chFilename); 
    53                 fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    54                 fprintf( ioQQQ, " final path is ==%s==\n",chEFilename ); 
    55  
    56                 /* make announcement that path probably not set */ 
    57                 path_not_set(); 
    58  
    59                 cdEXIT(EXIT_FAILURE); 
    60         } 
    61  
    62         if( read_whole_line( chLine , (int)sizeof(chLine) , atmolLevDATA ) == NULL ) 
    63         { 
    64                 fprintf( ioQQQ, " moldat_readin could not read first line of %s.\n",chFilename); 
    65                 cdEXIT(EXIT_FAILURE); 
    66         } 
    67         /*Rewind the file*/ 
    68         if( fseek( atmolLevDATA , 0 , SEEK_SET ) != 0 ) 
    69         { 
    70                 fprintf( ioQQQ, " moldat_readin could not rewind %s.\n",chFilename); 
    71                 cdEXIT(EXIT_FAILURE); 
    72         } 
     42                fprintf( ioQQQ," moldat_readin opening %s:",chEFilename); 
     43 
     44        atmolLevDATA = open_data( chEFilename, "r" ); 
    7345 
    7446        nMolLevs = 0; 
  • branches/newmole/source/atmdat_readin.cpp

    r1780 r1830  
    338338         *************************************************************/ 
    339339 
    340         strcpy( chFilename , cpu.DataPath() ); 
    341         strcat( chFilename , "level1.dat" ); 
    342  
    343340        if( trace.lgTrace ) 
    344341                fprintf( ioQQQ," atmdat_readin opening level1.dat:"); 
    345342 
    346         if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) 
    347         { 
    348                 fprintf( ioQQQ, " atmdat_readin could not open level1.dat\n" ); 
    349                 fprintf( ioQQQ, " even tried path\n" ); 
    350  
    351                 fprintf( ioQQQ, " atmdat_readin could not open level1.dat\n"); 
    352                 fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    353                 fprintf( ioQQQ, " final path is ==%s==\n",chFilename ); 
    354  
    355  
    356                 /* make announcement that path probably not set */ 
    357                 path_not_set(); 
    358  
    359                 cdEXIT(EXIT_FAILURE); 
    360         } 
     343        ioDATA = open_data( "level1.dat", "r" ); 
    361344 
    362345        /* first line is a version number and does not count */ 
     
    596579                } 
    597580 
    598                 strcpy( chFilename , cpu.DataPath() ); 
    599                 strcat( chFilename , "level2.dat" ); 
    600  
    601581                if( trace.lgTrace ) 
    602582                        fprintf( ioQQQ," atmdat_readin opening level2.dat:"); 
    603583 
    604                 if( ( ioDATA = fopen( chFilename , "r" ) ) == NULL ) 
    605                 { 
    606                         fprintf( ioQQQ, " atmdat_readin could not open level2.dat\n" ); 
    607                         fprintf( ioQQQ, " atmdat_readin could not open level2.dat, even tried path.\n"); 
    608                         fprintf( ioQQQ, " path is *%s*\n",cpu.DataPath() ); 
    609                         fprintf( ioQQQ, " final path is *%s*\n",chFilename ); 
    610                         cdEXIT(EXIT_FAILURE); 
    611                 } 
     584                ioDATA = open_data( "level2.dat", "r" ); 
    612585 
    613586                /* get magic number off first line */ 
     
    712685        if( ionbal.lgInnerShell_Gu06 ) 
    713686        { 
    714                 strcpy( chFilename , cpu.DataPath() ); 
    715                 strcat( chFilename , "UTA_Gu06.dat" ); 
    716687                if( trace.lgTrace ) 
    717688                        fprintf( ioQQQ," atmdat_readin opening UTA_Gu06.dat:"); 
    718689 
    719                 if( ( ioGU06 = fopen( chFilename , "r" ) ) == NULL ) 
    720                 { 
    721                         fprintf( ioQQQ, " atmdat_readin could not open UTA_Gu06.dat\n" ); 
    722                         fprintf( ioQQQ, " even tried path\n" ); 
    723  
    724                         fprintf( ioQQQ, " atmdat_readin could not open UTA_Gu06.dat\n"); 
    725                         fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    726                         fprintf( ioQQQ, " final path is ==%s==\n",chFilename ); 
    727                         cdEXIT(EXIT_FAILURE); 
    728                 } 
     690                ioGU06 = open_data( "UTA_Gu06.dat", "r" ); 
    729691 
    730692                /* count how many non-comment lines there are in Gu06 file */ 
     
    784746                 * >>refer      Fe      inner shell UTA Behar, E., & Netzer, H., 2002, ApJ, 570, 165-170 */ 
    785747 
    786                 strcpy( chFilename , cpu.DataPath() ); 
    787                 strcat( chFilename , "UTA_Behar.dat" ); 
    788748                if( trace.lgTrace ) 
    789749                        fprintf( ioQQQ," atmdat_readin opening UTA_Behar.dat:"); 
    790750 
    791                 if( ( ioBEHAR = fopen( chFilename , "r" ) ) == NULL ) 
    792                 { 
    793                         fprintf( ioQQQ, " atmdat_readin could not open UTA_Behar.dat\n" ); 
    794                         fprintf( ioQQQ, " even tried path\n" ); 
    795  
    796                         fprintf( ioQQQ, " atmdat_readin could not open UTA_Behar.dat\n"); 
    797                         fprintf( ioQQQ, " path is ==%s==\n",cpu.DataPath() ); 
    798                         fprintf( ioQQQ, " final path is ==%s==\n",chFilename ); 
    799  
    800  
    801                         cdEXIT(EXIT_FAILURE); 
    802                 } 
     751                ioBEHAR = open_data( "UTA_Behar.dat", "r" ); 
    803752 
    804753                /* count number