45 val.resize(
NCHLAB-1,
' ' );
61 val += (*
m_tr.
Hi()).chConfig();
63 val += (*
m_tr.
Lo()).chConfig();
72 return strncmp(
chALab(),s,strlen(s)) == 0;
90 void LinSv::init(
long index,
char chSumTyp,
const char *chComment,
const char *label,
96 ASSERT( (chSumTyp ==
'c') || (chSumTyp ==
'h') || (chSumTyp ==
'i') || (chSumTyp ==
'r') || (chSumTyp ==
't') );
109 else if (
isCat(
"Unit"))
113 else if (
isCat(
"UntD"))
117 else if (
isCat(
"Inwd"))
121 else if (
isCat(
"InwC"))
125 else if (
isCat(
"InwT"))
129 else if (
isCat(
"Coll"))
133 else if (
isCat(
"Pump"))
137 else if (
isCat(
"Heat"))
141 else if (
isCat(
"Ca A"))
145 else if (
isCat(
"Ca B"))
149 else if (
isCat(
"nInu"))
153 else if (
isCat(
"nFnu"))
157 else if (
isCat(
"Pho+"))
161 else if (
isCat(
"Pcon"))
165 else if (
isCat(
"Q(H)"))
196 if ( LineSave.
ipass == 0 )
201 fprintf(
ioQQQ,
"ERROR: A component to line blend \"%s\" %.3f was not identified.\n",
202 species, wavelength1 );
213 if ( LineSave.
ipass == 0 )
219 if( strlen(chLabel) >
NCHLAB-1 )
221 fprintf(
ioQQQ,
" makeBlend called with insane species \"%s\", must be %d or less characters long.\n",
227 strcpy( chCARD, chLabel );
234 for(
char *s=chCARD; *s !=
'\0'; ++s )
242 for(
long j=1; j < LineSave.
nsum; j++ )
245 const char *chCaps = LineSave.
lines[j].chCLab();
249 strcmp(chCaps,chCARD) == 0)
253 LineSave.
lines[j].label().c_str() );
287 for (
long nlin=0; nlin <
nsum; ++nlin)
302 bool lgDEBUG =
false;
304 if( strlen(chLabel) >
NCHLAB-1 )
306 fprintf(
ioQQQ,
" findline called with insane chLabel (between quotes) \"%s\", must be no more than %d characters long.\n",
312 strcpy( chCARD, chLabel );
320 for(
char *s=chCARD; *s !=
'\0'; ++s )
334 smallest_error_w_correct_label=
BIGFLOAT;
345 vector<size_t>::iterator first =
350 if (first ==
SortWL.end())
358 vector<size_t>::iterator second;
359 for(second=first; second !=
SortWL.end(); ++second)
361 if (
wavelength(*second) < wavelength1-errorwave)
365 vector<size_t>::iterator found =
SortWL.end();
368 for (vector<size_t>::iterator pos = first; pos != second; ++pos)
370 if ( strcmp(
lines[*pos].chCLab(),chCARD) == 0 )
380 fprintf(
ioQQQ,
"WARNING: multiple matching lines found in search for \"%s\" %s\n",
385 fprintf(
ioQQQ,
"WARNING: match %d is \"%s\" (dwl=%gA)\n",
386 nmatch,
lines[*pos].biglabel().c_str(),dwl);
388 if ( found ==
SortWL.end() )
393 else if ( fabs(dwl) < dbest )
400 if ( found !=
SortWL.end())
408 fprintf(
ioQQQ,
"WARNING: no exact matching lines found for \"%s\" %s\n",chLabel,wlbuf);
409 for (vector<size_t>::iterator pos = first; pos != second; ++pos)
411 fprintf(
ioQQQ,
"WARNING: Line with incorrect label found close \"%s\"\n",
412 lines[*pos].label().c_str());
415 vector<size_t>::iterator best =
SortWL.end();
422 vector<size_t>::iterator next;
423 if ( errordown < errorup || second ==
SortWL.end())
435 if ( strcmp(
lines[*next].chCLab(),chCARD) == 0 )
449 if (best !=
SortWL.end() && error > 100.*besterror)
452 if (error > 0.01*wavelength1)
459 fprintf(
ioQQQ,
"PROBLEM: no matching line found in search for \"%s\" %s\n",chLabel,wlbuf);
468 long int j, index_of_closest=LONG_MIN,
469 index_of_closest_w_correct_label=-1;
471 for( j=1; j <
nsum; j++ )
475 const char *chCaps =
lines[j].chCLab();
477 if( current_error < smallest_error )
479 index_of_closest = j;
480 smallest_error = current_error;
483 if( current_error < smallest_error_w_correct_label &&
484 (strcmp(chCaps,chCARD) == 0) )
486 index_of_closest_w_correct_label = j;
487 smallest_error_w_correct_label = current_error;
493 if( lgDEBUG && (current_error <= errorwave ||
496 && strcmp(chCaps,chCARD) == 0 )
500 printf(
"Matched %s %15.8g %ld %18.11g %s\n",
502 lines[j].biglabel().c_str());
508 if( index_of_closest_w_correct_label == -1 ||
509 smallest_error_w_correct_label > errorwave )
513 fprintf(
ioQQQ,
" PROBLEM findline did not find line " );
515 if( index_of_closest >= 0 )
517 fprintf(
ioQQQ,
" The closest line (any label) was \"%s\"\n",
518 lines[index_of_closest].label().c_str() );
519 if( index_of_closest_w_correct_label >= 0 )
521 fprintf(
ioQQQ,
" The closest with correct label was \"%s\"\n",
522 lines[index_of_closest_w_correct_label].label().c_str() );
523 fprintf(
ioQQQ,
" Error was %15.8g vs. tolerance %15.8g\n",
524 smallest_error_w_correct_label, errorwave );
527 fprintf(
ioQQQ,
"\n No line found with label \"%s\".\n", chCARD );
532 fprintf(
ioQQQ,
".\n PROBLEM No close line was found\n" );
539 fprintf(
ioQQQ,
"Identified %ld\n",index_of_closest_w_correct_label);
542 return index_of_closest_w_correct_label;
560 *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)
static t_version & Inst()
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)