Cantera  2.0
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
CKParser Class Reference

Chemkin mechanism file parser. More...

#include <CKParser.h>

Public Member Functions

 CKParser (std::string ckfile, std::ostream *log)
 
 CKParser (std::istream *infile, const std::string &fname, std::ostream *log)
 Constructor.
 
 ~CKParser ()
 Destructor.
 
bool readElementSection (elementList &elements)
 Read the element section of the input file, and return a list of the elements found.
 
bool readSpeciesSection (speciesList &species)
 Read the SPECIES section of the input file, and return a list of species names.
 
bool readThermoSection (std::vector< std::string > &names, speciesTable &speciesData, vector_fp &temp, int &optionFlag, std::ostream &log)
 Read species data from THERMO section records.
 
bool readReactionSection (const std::vector< std::string > &speciesNames, std::vector< std::string > &elementNames, reactionList &reactions, ReactionUnits &units)
 Parse the REACTION section of the input file, and return a list of Reaction objects and the units.
 
bool advanceToKeyword (const std::string &kw, const std::string &stop)
 
bool readNASA9ThermoSection (std::vector< std::string > &names, speciesTable &species, vector_fp &temp, int &optionFlag, std::ostream &log)
 Read species data from THERMO section records.
 
void readNASA9ThermoRecord (Species &sp)
 Read one species definition in a NASA9 string.
 

Public Attributes

bool verbose
 
bool debug
 

Private Member Functions

void readThermoRecord (Species &sp)
 Read one 4-line species definition record in NASA format.
 
void getCKLine (std::string &s, std::string &comment)
 Get a line from the input file, and return it in string s.
 
void putCKLine (std::string &s, std::string &comment)
 Put back a line read from the input file.
 
void missingAuxData (const std::string &kw)
 
void checkSpeciesName (std::string spname)
 

Private Attributes

int m_line
 Local value of the line number being read.
 
std::string m_buf
 
std::string m_comment
 
std::istream * m_ckfile
 This is the input file that is read.
 
std::string m_ckfilename
 
std::ostream * m_log
 Pointer to the ostream for writing debugging output log info.
 
bool m_nasafmt
 
bool m_nasa9fmt
 Boolean indicating new NASA input file format.
 
char m_last_eol
 

Detailed Description

Chemkin mechanism file parser.

For internal use by class CKReader.

Definition at line 44 of file CKParser.h.

Constructor & Destructor Documentation

CKParser ( std::istream *  infile,
const std::string &  fname,
std::ostream *  log 
)

Constructor.

Construct a parser for the specified input file.

Definition at line 283 of file CKParser.cpp.

References CKParser::m_ckfile, and CKParser::m_log.

~CKParser ( )
inline

Destructor.

Definition at line 54 of file CKParser.h.

Member Function Documentation

bool readElementSection ( elementList elements)
bool readSpeciesSection ( speciesList species)

Read the SPECIES section of the input file, and return a list of species names.

Definition at line 521 of file CKParser.cpp.

References CKParser::getCKLine(), ckr::getTokens(), Species::index, ckr::isKeyword(), CKParser::m_log, ckr::match(), Species::name, and CKParser::putCKLine().

Referenced by CKReader::read().

bool readThermoSection ( std::vector< std::string > &  names,
speciesTable species,
vector_fp &  temp,
int &  optionFlag,
std::ostream &  log 
)

Read species data from THERMO section records.

Parameters
namesList of species names (input).
speciesTable of species objects holding data from records in THERMO section (output).

Definition at line 588 of file CKParser.cpp.

References ckr::checkNASA9Temps(), ckr::checkTemps(), CKParser::getCKLine(), ckr::getTokens(), CKParser::m_line, CKParser::m_nasa9fmt, ckr::match(), Species::name, ckr::NoThermoDatabase, CKParser::putCKLine(), CKParser::readNASA9ThermoSection(), CKParser::readThermoRecord(), Species::thigh, Species::tlow, Species::tmid, and ckr::writeSpeciesData().

Referenced by CKReader::read().

bool readReactionSection ( const std::vector< std::string > &  speciesNames,
std::vector< std::string > &  elementNames,
reactionList reactions,
ReactionUnits units 
)
bool readNASA9ThermoSection ( std::vector< std::string > &  names,
speciesTable species,
vector_fp &  temp,
int &  optionFlag,
std::ostream &  log 
)

Read species data from THERMO section records.

Parameters
namesList of species names (input).
speciesTable of species objects holding data from records in THERMO section (output).
tempDefault vector of temperature region boundaries There are one more temperatures than there are temperature regions.
Returns
True, if the THERMO section exists and the species have all been successfully processed. False, if the THERMO section doesn't exist or there were additional problems.

Definition at line 156 of file NASA9Parser.cpp.

References ckr::match(), Species::name, and ckr::writeSpeciesData().

Referenced by CKParser::readThermoSection().

void readNASA9ThermoRecord ( Species sp)
void readThermoRecord ( Species sp)
private
void getCKLine ( std::string &  s,
std::string &  comment 
)
private

Get a line from the input file, and return it in string s.

If the line contains a comment character (!), then return only the portion preceding it. Non-printing characters are replaced by spaces.

The input file is m_ckfile, an istream.

Parameters
sOn return, s contains the line read from the input file.
commentOn return, comment contains the text following the comment character on the line, if any.

Definition at line 312 of file CKParser.cpp.

References CKParser::m_ckfile, CKParser::m_line, and Cantera::npos.

Referenced by CKParser::readElementSection(), CKParser::readReactionSection(), CKParser::readSpeciesSection(), CKParser::readThermoRecord(), and CKParser::readThermoSection().

void putCKLine ( std::string &  s,
std::string &  comment 
)
private

Put back a line read from the input file.

The next call to getCKLine will return this line.

Definition at line 406 of file CKParser.cpp.

Referenced by CKParser::readElementSection(), CKParser::readReactionSection(), CKParser::readSpeciesSection(), CKParser::readThermoRecord(), and CKParser::readThermoSection().

Member Data Documentation

int m_line
private

Local value of the line number being read.

This is used for debug IO printout purposes

Definition at line 80 of file CKParser.h.

Referenced by CKParser::getCKLine(), CKParser::readReactionSection(), CKParser::readThermoRecord(), and CKParser::readThermoSection().

std::istream* m_ckfile
private

This is the input file that is read.

It's an istream

Definition at line 89 of file CKParser.h.

Referenced by CKParser::CKParser(), and CKParser::getCKLine().

std::ostream* m_log
private

Pointer to the ostream for writing debugging output log info.

Definition at line 94 of file CKParser.h.

Referenced by CKParser::CKParser(), CKParser::readElementSection(), CKParser::readReactionSection(), CKParser::readSpeciesSection(), and CKParser::readThermoRecord().

bool m_nasa9fmt
private

Boolean indicating new NASA input file format.

If this is true, a completely different input file parser is used.

Definition at line 103 of file CKParser.h.

Referenced by CKParser::readThermoSection().


The documentation for this class was generated from the following files: