Cantera
2.0
|
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 |
Chemkin mechanism file parser.
For internal use by class CKReader.
Definition at line 44 of file CKParser.h.
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.
|
inline |
Destructor.
Definition at line 54 of file CKParser.h.
bool readElementSection | ( | elementList & | elements | ) |
Read the element section of the input file, and return a list of the elements found.
Definition at line 439 of file CKParser.cpp.
References Element::atomicWeight, ckr::capitalize(), Element::comment, ckr::extractSlashData(), CKParser::getCKLine(), ckr::getDefaultAtomicWeights(), ckr::getTokens(), Element::index, ckr::isKeyword(), CKParser::m_log, ckr::match(), Element::name, CKParser::putCKLine(), Element::valid, ckr::valid(), and Element::weightFromDB.
Referenced by CKReader::read().
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.
names | List of species names (input). |
species | Table 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 | ||
) |
Parse the REACTION section of the input file, and return a list of Reaction objects and the units.
Definition at line 961 of file CKParser.cpp.
References RateCoeff::A, ReactionUnits::ActEnergy, RateCoeff::B, RateCoeff::C, ckr::ChemAct, Reaction::comment, RateCoeff::E, Reaction::e3b, ckr::extractSlashData(), ckr::Falloff, CKParser::getCKLine(), ckr::getGroups(), ckr::getTokens(), Reaction::isDuplicate, Reaction::isFalloffRxn, ckr::isKeyword(), Reaction::isReversible, Reaction::isThreeBodyRxn, Reaction::kf, Reaction::kf_aux, Reaction::krev, Reaction::lines, CKParser::m_line, CKParser::m_log, ckr::match(), ckr::Molecules, ckr::Moles, RateCoeff::n, Cantera::npos, Reaction::number, Reaction::otherAuxData, Reaction::products, CKParser::putCKLine(), ReactionUnits::Quantity, Reaction::reactants, ckr::removeWhiteSpace(), Reaction::thirdBody, ckr::ThreeBody, RateCoeff::type, and Reaction::type.
bool readNASA9ThermoSection | ( | std::vector< std::string > & | names, |
speciesTable & | species, | ||
vector_fp & | temp, | ||
int & | optionFlag, | ||
std::ostream & | log | ||
) |
Read species data from THERMO section records.
names | List of species names (input). |
species | Table of species objects holding data from records in THERMO section (output). |
temp | Default vector of temperature region boundaries There are one more temperatures than there are temperature regions. |
Definition at line 156 of file NASA9Parser.cpp.
References ckr::match(), Species::name, and ckr::writeSpeciesData().
Referenced by CKParser::readThermoSection().
void readNASA9ThermoRecord | ( | Species & | sp | ) |
Read one species definition in a NASA9 string.
Definition at line 249 of file NASA9Parser.cpp.
References ckr::addElement(), ckr::getTokens(), Species::id, ckr::illegalNumber(), ckr::isKeyword(), ckr::match(), Species::name, Species::nTempRegions, Species::phase, Species::thermoFormatType, and Species::valid.
|
private |
Read one 4-line species definition record in NASA format.
Definition at line 793 of file CKParser.cpp.
References ckr::addElement(), CKParser::getCKLine(), ckr::getTokens(), Species::highCoeffs, Species::id, ckr::illegalNumber(), ckr::illegalThermoLine(), ckr::isKeyword(), Species::lowCoeffs, CKParser::m_line, CKParser::m_log, ckr::match(), Species::name, Species::phase, CKParser::putCKLine(), Species::thigh, Species::tlow, Species::tmid, and Species::valid.
Referenced by CKParser::readThermoSection().
|
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.
s | On return, s contains the line read from the input file. |
comment | On 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().
|
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().
|
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().
|
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().
|
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().
|
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().