30 std::string default_phase,
bool check_for_duplicates)
39 vector<XML_Node*> rarrays = p.
getChildren(
"reactionArray");
40 if (rarrays.empty()) {
43 for (
size_t n = 0; n < rarrays.size(); n++) {
66 if (sk[
"species"] ==
"undeclared") {
69 if (sk[
"third_bodies"] ==
"undeclared") {
77 vector<XML_Node*> incl = rxns.
getChildren(
"include");
78 vector<XML_Node*> allrxns = rdata->
getChildren(
"reaction");
81 for (
size_t i = 0; i < allrxns.size(); i++) {
86 for (
size_t nii = 0; nii < incl.size(); nii++) {
88 string imin = ii[
"min"];
89 string imax = ii[
"max"];
93 iwild = imin.find(
"*");
95 imin = imin.substr(0,iwild);
100 for (
size_t i = 0; i < allrxns.size(); i++) {
106 rxid = rxid.substr(0,iwild);
112 if ((rxid >= imin) && (rxid <= imax)) {
122 if (check_for_duplicates) {
139 string owning_phase = phase[
"id"];
141 bool check_for_duplicates =
false;
144 if (d[
"reactions"] ==
"yes") {
145 check_for_duplicates =
true;
152 vector<string> phase_ids;
157 phase_ids.push_back(owning_phase);
162 for (
size_t n = 0; n < phase_ids.size(); n++) {
163 string phase_id = phase_ids[n];
164 bool phase_ok =
false;
167 for (
size_t m = 0; m < th.size(); m++) {
168 if (th[m]->
id() == phase_id) {
176 msg +=
" "+th[m]->id();
180 "phase "+phase_id+
" not found. Supplied phases are:"+msg);
206 std::vector<ThermoPhase*> phases{th};
XML_Node * get_XML_Node(const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
std::vector< XML_Node * > getChildren(const std::string &name) const
Get a vector of pointers to XML_Node containing all of the children of the current node which match t...
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
const size_t npos
index returned by functions to indicate "no position"
Headers for the factory class that can create known ThermoPhase objects (see Thermodynamic Properties...
Class XML_Node is a tree-based representation of the contents of an XML file.
virtual bool addReaction(shared_ptr< Reaction > r)
Add a single reaction to the mechanism.
bool installReactionArrays(const XML_Node &p, Kinetics &kin, std::string default_phase, bool check_for_duplicates)
Install information about reactions into the kinetics object, kin.
Base class for a phase with thermodynamic properties.
virtual void init()
Prepare the class for the addition of reactions, after all phases have been added.
bool importKinetics(const XML_Node &phase, std::vector< ThermoPhase *> th, Kinetics *k)
Import a reaction mechanism for a phase or an interface.
Public interface for kinetics managers.
XML_Node * parent() const
Returns a pointer to the parent node of the current node.
Base class for exceptions thrown by Cantera classes.
shared_ptr< Reaction > newReaction(const XML_Node &rxn_node)
Create a new Reaction object for the reaction defined in rxn_node
virtual std::pair< size_t, size_t > checkDuplicates(bool throw_err=true) const
Check for duplicate reactions.
void importPhase(XML_Node &phase, ThermoPhase *th)
Import a phase information into an empty ThermoPhase object.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
XML_Node & root() const
Return the root of the current XML_Node tree.
Definitions of global routines for the importing of data from XML files (see Input File Handling)...
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
void getStringArray(const XML_Node &node, std::vector< std::string > &v)
This function interprets the value portion of an XML element as a string.
Contains declarations for string manipulation functions within Cantera.
Namespace for the Cantera kernel.
virtual void addPhase(thermo_t &thermo)
Add a phase to the kinetics manager object.
void skipUndeclaredThirdBodies(bool skip)
Determine behavior when adding a new reaction that contains third-body efficiencies for species not d...
XML_Node * get_XML_NameID(const std::string &nameTarget, const std::string &file_ID, XML_Node *root)
This routine will locate an XML node in either the input XML tree or in another input file specified ...
size_t phaseIndex(const std::string &ph)
Return the phase index of a phase in the list of phases defined within the object.
void skipUndeclaredSpecies(bool skip)
Determine behavior when adding a new reaction that contains species not defined in any of the phases ...