44 val.resize(
NCHLAB-1,
' ' );
60 val += (*
m_tr.
Hi()).chConfig();
62 val += (*
m_tr.
Lo()).chConfig();
71 return strncmp(
chALab(),s,strlen(s)) == 0;
89 void LinSv::init(
long index,
char chSumTyp,
const char *chComment,
const char *label,
95 ASSERT( (chSumTyp ==
'c') || (chSumTyp ==
'h') || (chSumTyp ==
'i') || (chSumTyp ==
'r') || (chSumTyp ==
't') );
108 else if (
isCat(
"Unit"))
112 else if (
isCat(
"UntD"))
116 else if (
isCat(
"Inwd"))
120 else if (
isCat(
"InwC"))
124 else if (
isCat(
"InwT"))
128 else if (
isCat(
"Coll"))
132 else if (
isCat(
"Pump"))
136 else if (
isCat(
"Heat"))
140 else if (
isCat(
"Ca A"))
144 else if (
isCat(
"Ca B"))
148 else if (
isCat(
"nInu"))
152 else if (
isCat(
"nFnu"))
156 else if (
isCat(
"Pho+"))
160 else if (
isCat(
"Pcon"))
164 else if (
isCat(
"Q(H)"))
195 if ( LineSave.
ipass == 0 )
200 fprintf(
ioQQQ,
"ERROR: A component to line blend \"%s\" %.3f was not identified.\n",
201 species, wavelength1 );
212 if ( LineSave.
ipass == 0 )
218 if( strlen(chLabel) >
NCHLAB-1 )
220 fprintf(
ioQQQ,
" makeBlend called with insane species \"%s\", must be %d or less characters long.\n",
226 strcpy( chCARD, chLabel );
233 for(
char *s=chCARD; *s !=
'\0'; ++s )
241 for(
long j=1; j < LineSave.
nsum; j++ )
244 const char *chCaps = LineSave.
lines[j].chCLab();
248 strcmp(chCaps,chCARD) == 0)
252 LineSave.
lines[j].label().c_str() );
286 for (
long nlin=0; nlin <
nsum; ++nlin)
301 bool lgDEBUG =
false;
303 if( strlen(chLabel) >
NCHLAB-1 )
305 fprintf(
ioQQQ,
" findline called with insane chLabel (between quotes) \"%s\", must be no more than %d characters long.\n",
311 strcpy( chCARD, chLabel );
319 for(
char *s=chCARD; *s !=
'\0'; ++s )
333 smallest_error_w_correct_label=
BIGFLOAT;
344 vector<size_t>::iterator first =
349 if (first ==
SortWL.end())
357 vector<size_t>::iterator second;
358 for(second=first; second !=
SortWL.end(); ++second)
360 if (
wavelength(*second) < wavelength1-errorwave)
364 vector<size_t>::iterator found =
SortWL.end();
367 for (vector<size_t>::iterator pos = first; pos != second; ++pos)
369 if ( strcmp(
lines[*pos].chCLab(),chCARD) == 0 )
378 fprintf(
ioQQQ,
"WARNING: multiple matching lines found in search for \"%s\" %s\n",
383 fprintf(
ioQQQ,
"WARNING: match %d is \"%s\" (dwl=%gA)\n",
384 nmatch,
lines[*pos].biglabel().c_str(),dwl);
386 if ( found ==
SortWL.end() )
391 else if ( fabs(dwl) < dbest )
398 if ( found !=
SortWL.end())
406 fprintf(
ioQQQ,
"WARNING: no exact matching lines found for \"%s\" %s\n",chLabel,wlbuf);
407 for (vector<size_t>::iterator pos = first; pos != second; ++pos)
409 fprintf(
ioQQQ,
"WARNING: Line with incorrect label found close \"%s\"\n",
410 lines[*pos].label().c_str());
413 vector<size_t>::iterator best =
SortWL.end();
420 vector<size_t>::iterator next;
421 if ( errordown < errorup || second ==
SortWL.end())
433 if ( strcmp(
lines[*next].chCLab(),chCARD) == 0 )
447 if (best !=
SortWL.end() && error > 100.*besterror)
450 if (error > 0.01*wavelength1)
457 fprintf(
ioQQQ,
"PROBLEM: no matching line found in search for \"%s\" %s\n",chLabel,wlbuf);
466 long int j, index_of_closest=LONG_MIN,
467 index_of_closest_w_correct_label=-1;
469 for( j=1; j <
nsum; j++ )
473 const char *chCaps =
lines[j].chCLab();
475 if( current_error < smallest_error )
477 index_of_closest = j;
478 smallest_error = current_error;
481 if( current_error < smallest_error_w_correct_label &&
482 (strcmp(chCaps,chCARD) == 0) )
484 index_of_closest_w_correct_label = j;
485 smallest_error_w_correct_label = current_error;
491 if( lgDEBUG && (current_error <= errorwave ||
494 && strcmp(chCaps,chCARD) == 0 )
498 printf(
"Matched %s %15.8g %ld %18.11g %s\n",
500 lines[j].biglabel().c_str());
506 if( index_of_closest_w_correct_label == -1 ||
507 smallest_error_w_correct_label > errorwave )
511 fprintf(
ioQQQ,
" PROBLEM findline did not find line " );
513 if( index_of_closest >= 0 )
515 fprintf(
ioQQQ,
" The closest line (any label) was \"%s\"\n",
516 lines[index_of_closest].label().c_str() );
517 if( index_of_closest_w_correct_label >= 0 )
519 fprintf(
ioQQQ,
" The closest with correct label was \"%s\"\n",
520 lines[index_of_closest_w_correct_label].label().c_str() );
521 fprintf(
ioQQQ,
" Error was %15.8g vs. tolerance %15.8g\n",
522 smallest_error_w_correct_label, errorwave );
525 fprintf(
ioQQQ,
"\n No line found with label \"%s\".\n", chCARD );
530 fprintf(
ioQQQ,
".\n PROBLEM No close line was found\n" );
537 fprintf(
ioQQQ,
"Identified %ld\n",index_of_closest_w_correct_label);
540 return index_of_closest_w_correct_label;
558 *emiss = line->
emslin(lgEmergent);
vector< long > m_component
realnum WavlenErrorGet(realnum wavelength, long sig_figs)
NORETURN void TotalInsanity(void)
long findline(const char *chLabel, realnum wavelength)
void chALabSet(const char *that)
double emslin(int i) const
static bool wavelength_compare_realnum(size_t a, realnum wavelength)
void trimTrailingWhiteSpace(string &str)
void prt_line_err(FILE *ioOUT, const char *label, realnum wvlng)
bool fp_equal(sys_float x, sys_float y, int n=3)
const int INPUT_LINE_LENGTH
qList::iterator Hi() const
realnum wlAirVac(double wlAir)
void init(long index, char chSumTyp, const char *chComment, const char *label, const TransitionProxy &tr)
void sprt_wl(char *chString, realnum wl)
qList::iterator Lo() const
void addComponentID(long id)
bool isCat(const char *s) const
void cdEmis(const char *chLabel, realnum wavelength, double *emiss, bool lgEmergent)
const char * chALab() const
#define DEBUG_ENTRY(funcname)
void addComponent(const char *species, const double wavelength)
static vector< realnum > wavelength
realnum wavelength() const
realnum wavelength(long index)
int fprintf(const Output &stream, const char *format,...)
static bool wavelength_compare(long a, long b)
static const long sig_figs_max
void makeBlend(const char *species, const double wavelength, const double width)