24 double charge_,
double size_)
38 std::string name = species_node[
"name"];
40 auto s = make_shared<Species>(name, comp);
41 if (species_node.
hasChild(
"charge")) {
42 s->charge =
getFloat(species_node,
"charge");
45 s->size =
getFloat(species_node,
"size");
47 if (species_node.
hasChild(
"thermo")) {
54 if (species_node.
hasChild(
"transport")) {
56 s->transport->validate(*s);
60 if (species_node.
hasChild(
"stoichIsMods")) {
61 s->input[
"Debye-Huckel"][
"weak-acid-charge"] =
62 getFloat(species_node,
"stoichIsMods");
65 if (species_node.
hasChild(
"electrolyteSpeciesType")) {
66 s->input[
"Debye-Huckel"][
"electrolyte-species-type"] =
67 species_node.
child(
"electrolyteSpeciesType").
value();
72 if (stdstate && stdstate->
findByName(
"molarVolume")) {
73 s->extra[
"molar_volume"] =
getFloat(*stdstate,
"molarVolume",
"toSI");
78 if (thermo && thermo->
attrib(
"model") ==
"IonFromNeutral") {
79 if (thermo->
hasChild(
"specialSpecies")) {
80 auto& eos = s->input[
"equation-of-state"].getMapWhere(
81 "model",
"ions-from-neutral-molecule",
true);
82 eos[
"special-species"] =
true;
91 unique_ptr<Species> s(
new Species(node[
"name"].asString(),
92 node[
"composition"].asMap<double>()));
94 if (node.
hasKey(
"thermo")) {
101 if (s->composition.find(
"E") != s->composition.end()) {
102 s->charge = -s->composition[
"E"];
105 if (node.
hasKey(
"transport")) {
107 s->transport->validate(*s);
112 const static std::set<std::string> known_keys{
115 s->input.applyUnits(node.
units());
116 for (
const auto& item : node) {
117 if (known_keys.count(item.first) == 0) {
118 s->input[item.first] = item.second;
127 std::vector<shared_ptr<Species> > all_species;
128 for (
const auto& spnode : node.
child(
"speciesData").
getChildren(
"species")) {
136 std::vector<shared_ptr<Species> > all_species;
Header for factory functions to build instances of classes that manage the standard-state thermodynam...
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
Declaration for class Cantera::Species.
A map of string keys to values whose type can vary at runtime.
double getDouble(const std::string &key, double default_) const
If key exists, return it as a double, otherwise return default_.
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
const UnitSystem & units() const
Return the default units that should be used to convert stored values.
A wrapper for a variable whose type is determined at runtime.
const std::vector< T > & asVector(size_t nMin=npos, size_t nMax=npos) const
Return the held value, if it is a vector of type T.
Abstract Base class for the thermodynamic manager for an individual species' reference state.
Contains data about a single chemical species.
Class XML_Node is a tree-based representation of the contents of an XML file.
std::string attrib(const std::string &attr) const
Function returns the value of an attribute.
bool hasChild(const std::string &ch) const
Tests whether the current node has a child node with a particular name.
const XML_Node * findByName(const std::string &nm, int depth=100000) const
This routine carries out a recursive search for an XML node based on the name of the node.
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...
std::string value() const
Return the value of an XML node as a string.
XML_Node & child(const size_t n) const
Return a changeable reference to the n'th child of the current node.
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
std::map< std::string, double > compositionMap
Map connecting a string name with a double.
Namespace for the Cantera kernel.
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
unique_ptr< SpeciesThermoInterpType > newSpeciesThermo(const AnyMap &node)
Create a new SpeciesThermoInterpType object using the specified parameters.
shared_ptr< Species > newSpecies(const XML_Node &species_node)
Create a new Species object from a 'species' XML_Node.
std::vector< shared_ptr< Species > > getSpecies(const XML_Node &node)
Generate Species objects for all <species> nodes in an XML document.
shared_ptr< TransportData > newTransportData(const XML_Node &transport_node)
Create a new TransportData object from a 'transport' XML_Node.
compositionMap parseCompString(const std::string &ss, const std::vector< std::string > &names)
Parse a composition string into a map consisting of individual key:composition pairs.
SpeciesThermoInterpType * newSpeciesThermoInterpType(int type, double tlow, double thigh, double pref, const double *coeffs)
Create a new SpeciesThermoInterpType object given a corresponding constant.
Contains declarations for string manipulation functions within Cantera.