22 strcpy( chPath,
"abundances" );
24 strcat( chPath, chFile.c_str() );
58 bool lgMatchFound =
true;
62 bool lgPrint = p.
nMatch(
"PRINT");
63 bool lgIsotp = p.
nMatch(
"ISOT" );
65 if(!lgMatchFound && !lgIsotp)
69 chFile =
"Cameron.abn";
73 chFile =
"solar_GASS10.abn";
83 chFile =
"primordial.abn";
85 chFile =
"solar84.abn";
87 chFile =
"allen73.abn";
91 else if( lgIsotp && chFile.length() == 0 )
94 chFile =
"Asplund09-iso.abn";
95 else if( p.
nMatch(
"LODDERS03" ) )
96 chFile =
"Lodders03-iso.abn";
97 else if( p.
nMatch(
"LODDERS09" ) )
98 chFile =
"Lodders09-iso.abn";
99 else if( p.
nMatch(
"ROSM" ) )
100 chFile =
"Rosman98-iso.abn";
103 fprintf(
ioQQQ,
"Unknown isotope abundances file:\t %s\n", chFile.c_str() );
108 if(lgMatchFound && !lgIsotp)
111 bool lgGrainsON =
true;
112 if( p.
nMatch(
"NO GR") != 0 )
116 if( p.
nMatch(
"NO QH") != 0 )
122 for(
int nelem=1; nelem <
LIMELM; nelem++ )
147 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
155 if( chLine[0]==
'\n' || chLine[0]==
'\0' )
157 fprintf(
ioQQQ,
"PROBLEM in ABUNDANCES: Encountered unexpected empty line.\n");
165 strcpy( chLineCAPS , chLine );
167 if(
nMatch(
"GRAINS", chLineCAPS) != 0 )
176 strcat( chLineCAPS,
" NO QHEAT");
187 bool lgFound =
false;
188 for(
int nelem=0; nelem<
LIMELM; nelem++)
196 fprintf(
ioQQQ,
"PROBLEM in ABUNDANCES: negative abundance not allowed.\n");
197 fprintf(
ioQQQ,
"Non-positive abundance found on this line: %s\n", chLine);
217 fprintf(
ioQQQ,
"PROBLEM in ABUNDANCES: did not identify element name on this line: %s\n",
225 for(
int nelem=0; nelem<
LIMELM; nelem++)
244 fprintf(
ioQQQ,
" PROBLEM in ABUNDANCES: I did not find a keyword, file name, or any numbers. Sorry.\n");
257 absav[0] =
exp10(absav[0]);
259 for( i=1; i <
LIMELM; i++ )
268 " Only one number was found. Did you include the keyword ALL? Sorry.\n");
282 for( i=2; i < nElem; i++ )
293 fprintf(
ioQQQ,
" There MUST be%3ld abundances entered, there were only%3ld. Sorry.\n",
303 fprintf(
ioQQQ,
" There MUST be%3ld abundances entered, there were only%3ld. Sorry.\n",
312 fprintf(
ioQQQ,
" There MUST be%3ld abundances entered, there were only%3ld. Sorry.\n",
326 if( !p.
lgEOL() || (chk!=0.) )
329 fprintf(
ioQQQ,
" There were more than %ld abundances entered\n",
331 fprintf(
ioQQQ,
" Could there have been a typo somewhere?\n" );
354 for( i=1; i <
LIMELM; i++ )
358 fprintf(
ioQQQ,
" Is an abundance of %.3e relative to H reasonable for %2.2s?\n",
370 int nRead[
LIMELM] = { 0 };
372 while(
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
380 if( chLine[0]==
'\n' || chLine[0]==
'\0' )
382 fprintf(
ioQQQ,
"PROBLEM in ABUNDANCES ISOTOPES: Encountered unexpected empty line.\n");
387 int ielem = (int)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL) - 1;
388 int Aiso = (int)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
394 "PROBLEM in ABUNDANCES ISOTOPES: Could not store isotope fraction (%7.4f) for ^%d %s\n",
403 for(
int i = 0; i <
LIMELM; i++ )
407 fprintf(
ioQQQ,
"Abundaces Isotopes: %s requires %d isotope pairs to be specified, but found %d\n",
413 fprintf(
ioQQQ,
"Abundaces Isotopes: Non-positive isotope fractions are illegal.\n");
bool nMatch(const char *chKey) const
bool hasCommand(const char *s2)
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
STATIC FILE * open_abn_file(string chFile)
const int FILENAME_PATH_LENGTH_2
void setline(const char *const card)
long nMatch(const char *chKey, const char *chCard)
int GetQuote(string &chLabel)
bool lgElmtSetOff[LIMELM]
t_elementnames elementnames
const int INPUT_LINE_LENGTH
char chElementNameShort[LIMELM][CHARS_ELEMENT_NAME_SHORT]
char chElementSym[LIMELM][CHARS_ELEMENT_SYM]
void ParseGrain(Parser &p)
#define DEBUG_ENTRY(funcname)
int fprintf(const Output &stream, const char *format,...)
void abund_starburst(Parser &p)
sys_float SDIV(sys_float x)
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
char chElementName[LIMELM][CHARS_ELEMENT_NAME]
int setAbn(int Anum, realnum abn)
void prtIsoPairs(FILE *fp)
void ParseElement(Parser &p)
bool isComment(void) const
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)
void ParseAbundances(Parser &p)