51         vector<genericState> v = 
matchGeneric( speciesLabel.c_str(), false );
 
   54                 fprintf( 
ioQQQ, 
"Error: Incorrect number of matches (%d) for species '%s'\n",
 
   55                                 int(v.size()), speciesLabel.c_str() );
 
   81                 return  (ibin < 0 || ibin >= 
nBins) ? 
false : 
true;
 
   84         virtual void sumBand( 
double *sumOutward, 
double *sumInward ) 
const = 0;
 
   86         void accumulate( 
bool lgReset, 
double dVeffAper );
 
   88         double getInten( 
const long ibin, 
const int ipContType ) 
const;
 
   98                 for( 
long ibin = 0; ibin < 
nBins; ibin++ )
 
  106         vector<double> sumOutward( 
nBins ), sumInward( 
nBins );
 
  110         for( 
long ibin = 0; ibin < 
nBins; ibin++ )
 
  158         void setup( 
string &
label, 
double wlo, 
double whi, 
long nb );
 
  160         void sumBand( 
double *sumOutward, 
double *sumInward ) 
const;
 
  167                                         "out of range (0, %ld)\n",
 
  179                 double mid_wl = 0.5 * ( 
wl[ ibin ] + 
wl[ ibin+1 ] );
 
  198         for( 
long ibin = 0; ibin < 
nBins+1; ++ibin )
 
  214         for( 
long i=0; i<
nBins; ++i )
 
  223         if( 
species.sp->lines == NULL )
 
  226                         "WARNING: Species '%s' does not have any data for 'save species continuum'.\n",
 
  231         double log_step_inv = 1. / 
log_step;
 
  234                 tr != 
species.sp->lines->end(); ++tr )
 
  236                 if( (*tr).WLAng() < 
wlLo || (*tr).WLAng() > 
wlHi )
 
  239                 double bin = (log10( (*tr).WLAng() ) - 
log_wlLo) * log_step_inv;
 
  240                 long ibin = long( bin );
 
  245                         enum { DEBUG_BAND = 
false };
 
  246                         if( DEBUG_BAND && (*tr).Emis().xIntensity() > 0. )
 
  249                                         "WLAng= %g\t wl(i)= %g\t wl(i+1)= %g\t " 
  250                                         "bin= %g\t ibin= %ld\t inten= %g\t " 
  253                                         wl[ibin], 
wl[ibin+1],
 
  255                                         (*tr).Emis().xIntensity(),
 
  256                                         (*tr).Emis().FracInwd() );
 
  260                 sumOutward[ ibin ] += (*tr).Emis().xIntensity() *
 
  261                         MAX2( 0., 1-(*tr).Emis().FracInwd() );
 
  262                 sumInward[ ibin ] += (*tr).Emis().xIntensity() *
 
  263                         (*tr).Emis().FracInwd();
 
  271                                 vector<pseudo_cont>::iterator &this_it )
 
  277         for( vector<pseudo_cont>::iterator it = 
PseudoCont.begin();
 
  283                 if( speciesLabel == (*it).label() )
 
  312                         double &wlLo, 
double &wlHi, 
long &nBins )
 
  316         wlLo = pseudoContDef.
wlLo;
 
  317         wlHi = pseudoContDef.
wlHi;
 
  318         nBins = pseudoContDef.
nBins;
 
  374         for( vector<pseudo_cont>::iterator it = 
PseudoCont.begin();
 
  387         long ipContType = 
UNSET;
 
  388         if( strcmp( saveSpec, 
"CONi" ) == 0 )
 
  392         else if( strcmp( saveSpec, 
"CONo" ) == 0 )
 
  396         else if( strcmp( saveSpec, 
"CONt" ) == 0 )
 
  407         vector<pseudo_cont>::iterator it;
 
  412                         "Error: Species continuum data unmatched for species '%s'\n",
 
  413                         speciesLabel.c_str() );
 
  426                                 "#%s ", speciesLabel.c_str() );
 
  442                                 ": Energy\t%s Int[erg cm-2 s-1]\n",
 
  445                         for( 
long ibin = 0; ibin < (*it).bins(); ibin++ )
 
  451                                         (*it).getWl( ibin ) );
 
  460                 for( 
long ibin = 0; ibin < (*it).bins(); ibin++ )
 
  463                                 (*it).getInten( ibin, ipContType ));
 
  464                         if( ibin < (*it).bins()-1 )
 
  478                                 "#%s ", speciesLabel.c_str() );
 
  480                                 "wl\ttotal\tinward\toutward\n" );
 
  484                 for( 
long ibin = 0; ibin < (*it).bins(); ibin++ )
 
  487                                 (*it).getWl( ibin ) );
 
  489                                 (*it).getInten( ibin, 
TOTAL ) );
 
  491                                 (*it).getInten( ibin, 
INWARD ) );
 
  493                                 (*it).getInten( ibin, 
OUTWARD ) );
 
  528                 return double( 
prt_wl[ iband ] );
 
  532                 return wlLo[ iband ];
 
  536                 return wlHi[ iband ];
 
  563                         fprintf( 
ioQQQ, 
" BandsCreate could not read first line of %s.\n",
 
  569         while( 
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
 
  573                 if( chLine[0] != 
'#')
 
  578         if( fseek( ioDATA , 0 , SEEK_SET ) != 0 )
 
  586         wlLo.resize( nBands );
 
  587         wlHi.resize( nBands );
 
  594                         fprintf( 
ioQQQ, 
" BandsCreate could not read first line of %s.\n",
 
  600                         const long int iyr = 9, imo=6 , idy = 11;
 
  601                         long iyrread, imoread , idyread;
 
  603                         iyrread = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
 
  604                         imoread = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
 
  605                         idyread = (long)
FFmtRead(chLine,&i,
sizeof(chLine),&lgEOL);
 
  607                         if(( iyrread != iyr ) ||
 
  608                           (  imoread != imo ) ||
 
  612                                         " PROBLEM BandsCreate: the version of %s is not the " 
  613                                         "current version.\n",
 
  616                                         "         BandsCreate: I expected the magic numbers %li %li %li " 
  617                                         "but found %li %li %li.\n", 
 
  618                                         iyr, imo , idy ,iyrread, imoread , idyread  );
 
  626         while( 
read_whole_line( chLine , (
int)
sizeof(chLine) , ioDATA ) != NULL )
 
  632                 if( chLine[0] != 
'#')
 
  638                                 fprintf( 
ioQQQ, 
" There should have been a number on this band column 1.   Sorry.\n" );
 
  645                                 fprintf( 
ioQQQ, 
" There should have been a number on this band column 2.   Sorry.\n" );
 
  652                                 fprintf( 
ioQQQ, 
" There should have been a number on this band column 3.   Sorry.\n" );
 
  663         for( 
long i=0; i < 
nBands; ++i )
 
  668                         fprintf( 
ioQQQ, 
" band %li has none positive entry.\n",i );
 
  674                         fprintf( 
ioQQQ, 
" band %li has improper bounds.\n" ,i );
 
  689                                 vector<bands_file>::iterator &this_it )
 
  693         this_it = 
Bands.end();
 
  694         for( vector<bands_file>::iterator it = 
Bands.begin();
 
  695                 it != 
Bands.end(); ++it )
 
  697                 if( (*it).bandFilename() == filename )
 
  706                                 vector<bands_file>::iterator &it )
 
  712         if( it == 
Bands.end() )
 
  715                 b_tmp.
setup( filename );
 
  717                 Bands.push_back( b_tmp );
 
  735         void setup( 
const string &splab, vector<bands_file>::iterator it )
 
  742                 nBins = (*bands_it).get_nBands();
 
  746                 for( 
long iband = 0; iband < 
nBins; ++iband )
 
  760                                         "out of range (0, %ld)\n",
 
  763                                         (*bands_it).bandFilename().c_str(),
 
  769         void sumBand( 
double *sumOutward, 
double *sumInward ) 
const;
 
  777                 return (*bands_it).getWl( iband );
 
  782                 return (*bands_it).getWlLo( iband );
 
  787                 return (*bands_it).getWlHi( iband );
 
  795         for( 
long i=0; i<
nBins; ++i )
 
  804         if( 
species.sp->lines == NULL )
 
  807                         "WARNING: Species '%s' does not have any data for 'save species bands'.\n",
 
  813                 tr != 
species.sp->lines->end(); ++tr )
 
  815                 for( 
long iband = 0; iband < 
nBins; ++iband )
 
  817                         if( (*tr).WLAng() >= 
getWlLo( iband ) &&
 
  818                                 (*tr).WLAng() < 
getWlHi( iband ) )
 
  820                                 sumOutward[ iband ] += (*tr).Emis().xIntensity() *
 
  821                                         MAX2( 0., 1-(*tr).Emis().FracInwd() );
 
  822                                 sumInward[ iband ] += (*tr).Emis().xIntensity() *
 
  823                                         (*tr).Emis().FracInwd();
 
  835                 string spectralLabel;
 
  839                 comment = spectralLabel + 
" emission in bands defined in " +
 
  840                                 (*bands_it).bandFilename();
 
  843         for( 
long iband = 0; iband < 
nBins; iband++ )
 
  851                         (
" total " + 
comment ).c_str() );
 
  856                         (
" inward " + 
comment ).c_str() );
 
  864                                  vector<species_bands>::iterator &this_it )
 
  870         for( vector<species_bands>::iterator it = 
SpecBands.begin();
 
  873                 if( speciesLabel == (*it).label() &&
 
  874                         fileBands == (*it).bandFilename() )
 
  892         for( vector<save_species_bands>::iterator it = 
save.
specBands.begin();
 
  895                 vector<bands_file>::iterator b_it;
 
  899                 sb_tmp.
setup( (*it).speciesLabel, b_it );
 
  910         for( vector<species_bands>::iterator it = 
SpecBands.begin();
 
  922                         const string &fileBands )
 
  926         vector<species_bands>::iterator it;
 
  931                         "Error: Species band data unmatched for species " 
  932                         "'%s' and bands from file '%s'\n",
 
  933                         speciesLabel.c_str(), fileBands.c_str() );
 
  944         for( 
long iband = 0; iband < (*it).bins(); iband++ )
 
  947                         (*it).getWl( iband ) );
 
  949                         (*it).getInten( iband, 
TOTAL ) );
 
  951                         (*it).getInten( iband, 
INWARD ) );
 
  953                         (*it).getInten( iband, 
OUTWARD ) );
 
realnum punarg[LIMPUN][3]
FILE * open_data(const char *fname, const char *mode, access_scheme scheme)
realnum getWlLo(const long iband) const 
static vector< pseudo_cont > PseudoCont
const int FILENAME_PATH_LENGTH_2
NORETURN void TotalInsanity(void)
static vector< bands_file > Bands
vector< save_species_bands > specBands
STATIC void addBandsFile(const string &filename, vector< bands_file >::iterator &it)
double getInten(const long ibin, const int ipContType) const 
void lindst(double xEmiss, realnum wavelength, const char *chLab, long int ipnt, char chInfo, bool lgOutToo, const char *chComment)
string bandFilename() const 
STATIC void getPseudoWlRange(const string &speciesLabel, double &wlLo, double &wlHi, long &nBins)
realnum getWlLo(const long iband) const 
void setup(const string &fname)
void SaveSpeciesBands(const long ipPun, const string &speciesLabel, const string &fileBands)
void SpeciesPseudoContCreate()
vector< genericState > matchGeneric(const char *chLabel, bool lgValidate)
void getSpecies(const string &speciesLabel, genericState &species)
t_pseudo_cont pseudoContDef
string bandFilename() const 
realnum getWl(const long ibin) const 
void PntForLine(double wavelength, const char *chLabel, long int *ipnt)
STATIC void PseudoContCreate(long ips)
bool check_index(const long ibin) const 
void check_index_fatal(const long iband) const 
STATIC string getIntenTypeStr(const int ipContType)
void setup(const string &splab, vector< bands_file >::iterator it)
void sumBand(double *sumOutward, double *sumInward) const 
char chSaveArgs[LIMPUN][5]
realnum getWlHi(const long iband) const 
STATIC long resolveSpecType(const char *saveSpec)
void chemical_to_spectral(const string chLabelChem, string &chLabelSpec)
virtual void sumBand(double *sumOutward, double *sumInward) const =0
virtual realnum getWl(const long ibin) const =0
double AnuUnit(realnum energy)
SaveParams params[LIMPUN]
realnum getWl(const long iband) const 
vector< realnum > inten_inward
void SpeciesBandsCreate()
vector< string > contSaveSpeciesLabel
void SaveHeaderDone(int ipPun)
double density(const genericState &gs)
STATIC void getPseudoIndex(const string &speciesLabel, vector< pseudo_cont >::iterator &this_it)
STATIC void findBandsFile(const string &filename, vector< bands_file >::iterator &this_it)
#define DEBUG_ENTRY(funcname)
void accumulate(bool lgReset, double dVeffAper)
vector< bands_file >::iterator bands_it
int fprintf(const Output &stream, const char *format,...)
STATIC void getSpecBandsIndex(const string &speciesLabel, const string &fileBands, vector< species_bands >::iterator &this_it)
static vector< species_bands > SpecBands
void check_index_fatal(const long ibin) const 
STATIC long getAdjPseudoIndex(const string &speciesLabel)
void SaveSpeciesPseudoCont(const long ipPun, const string &speciesLabel)
realnum getWlHi(const long iband) const 
char * read_whole_line(char *chLine, int nChar, FILE *ioIN)
void SpeciesPseudoContAccum()
void setup(string &label, double wlo, double whi, long nb)
void sumBand(double *sumOutward, double *sumInward) const 
realnum getWl(const long iband) const 
bool lgSaveHeader(int ipPun) const 
vector< realnum > inten_outward
vector< adjPseudoCont > setPseudoCont
virtual void check_index_fatal(const long ibin) const =0
double FFmtRead(const char *chCard, long int *ipnt, long int last, bool *lgEOL)