Merge namespace ctml with namespace Cantera

This commit is contained in:
Ray Speth 2015-05-27 17:46:37 -04:00
parent 8845e789ba
commit 5214672ab3
53 changed files with 152 additions and 194 deletions

View file

@ -15,16 +15,6 @@
namespace Cantera
{
class Array2D;
}
//! The ctml namespace adds functionality to the XML object, by providing
//! standard functions that read, write, and interpret XML files and
//! object trees.
/*!
* Standardization of reads and write from Cantera files occur here.
*/
namespace ctml
{
//! const Specifying the CTML version number
/*!
@ -71,7 +61,7 @@ const std::string CTML_Version = "1.4.1";
* and codify that. unitsString shouldn't be here, since it's an int.
* typeString should be codified as to its usage.
*/
void addInteger(Cantera::XML_Node& node, const std::string& titleString,
void addInteger(XML_Node& node, const std::string& titleString,
const int value, const std::string& unitsString="",
const std::string& typeString="");
@ -112,16 +102,16 @@ void addInteger(Cantera::XML_Node& node, const std::string& titleString,
* @param typeString String type. This is an optional parameter. The default
* is to have an empty string.
* @param minval Minimum allowed value of the float. The default is the
* special double, Cantera::Undef, which means to ignore the
* special double, Undef, which means to ignore the
* entry.
* @param maxval Maximum allowed value of the float. The default is the
* special double, Cantera::Undef, which means to ignore the
* special double, Undef, which means to ignore the
* entry.
*/
void addFloat(Cantera::XML_Node& node, const std::string& titleString,
void addFloat(XML_Node& node, const std::string& titleString,
const doublereal value, const std::string& unitsString="",
const std::string& typeString="", const doublereal minval = Cantera::Undef,
const doublereal maxval = Cantera::Undef);
const std::string& typeString="", const doublereal minval=Undef,
const doublereal maxval=Undef);
//! This function adds a child node with the name, "floatArray", with a value
//! consisting of a comma separated list of floats
@ -161,17 +151,17 @@ void addFloat(Cantera::XML_Node& node, const std::string& titleString,
* is to have an empty string.
* @param minval Minimum allowed value of the int. This is an optional
* parameter. The default is the
* special double, Cantera::Undef, which means to ignore the
* special double, Undef, which means to ignore the
* entry.
* @param maxval Maximum allowed value of the int. This is an optional
* parameter. The default is the special double,
* Cantera::Undef, which means to ignore the entry.
* Undef, which means to ignore the entry.
*/
void addFloatArray(Cantera::XML_Node& node, const std::string& titleString,
const size_t n, const doublereal* const values,
void addFloatArray(XML_Node& node, const std::string& titleString,
const size_t n, const doublereal* const values,
const std::string& unitsString="", const std::string& typeString="",
const doublereal minval = Cantera::Undef,
const doublereal maxval = Cantera::Undef);
const doublereal minval=Undef,
const doublereal maxval=Undef);
//! This function adds a child node with the name given by the first parameter
//! with a value consisting of a comma separated list of floats
@ -211,16 +201,16 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& titleString,
* is to have an empty string.
* @param minval Minimum allowed value of the int. This is an optional
* parameter. The default is the special double,
* Cantera::Undef, which means to ignore the entry.
* Undef, which means to ignore the entry.
* @param maxval Maximum allowed value of the int. This is an optional
* parameter. The default is the special double,
* Cantera::Undef, which means to ignore the entry.
* Undef, which means to ignore the entry.
*/
void addNamedFloatArray(Cantera::XML_Node& parentNode, const std::string& name, const size_t n,
void addNamedFloatArray(XML_Node& parentNode, const std::string& name, const size_t n,
const doublereal* const vals, const std::string units = "",
const std::string type = "",
const doublereal minval = Cantera::Undef,
const doublereal maxval = Cantera::Undef);
const doublereal minval=Undef,
const doublereal maxval=Undef);
//! This function adds a child node with the name string with a string value
//! to the current node
@ -248,7 +238,7 @@ void addNamedFloatArray(Cantera::XML_Node& parentNode, const std::string& name,
* @param titleString String name of the title attribute
* @param typeString String type. This is an optional parameter.
*/
void addString(Cantera::XML_Node& node, const std::string& titleString,
void addString(XML_Node& node, const std::string& titleString,
const std::string& valueString, const std::string& typeString="");
//! This function reads the current node or a child node of the current node
@ -301,7 +291,7 @@ void addString(Cantera::XML_Node& node, const std::string& titleString,
* The default value for the node name is floatArray
* @return Returns the number of floats read into v.
*/
size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
size_t getFloatArray(const XML_Node& node, std::vector<doublereal> & v,
const bool convert=true, const std::string& unitsString="",
const std::string& nodeName = "floatArray");
@ -314,7 +304,7 @@ size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
* @param node Node to get the value from
* @param v Output vector containing the string tokens
*/
void getStringArray(const Cantera::XML_Node& node, std::vector<std::string>& v);
void getStringArray(const XML_Node& node, std::vector<std::string>& v);
//! This routine is used to interpret the value portions of XML
//! elements that contain colon separated pairs.
@ -335,7 +325,7 @@ void getStringArray(const Cantera::XML_Node& node, std::vector<std::string>& v);
* @param m Output Map containing the pairs of values found
* in the XML Node
*/
void getMap(const Cantera::XML_Node& node, std::map<std::string, std::string>& m);
void getMap(const XML_Node& node, std::map<std::string, std::string>& m);
//! This function interprets the value portion of an XML element
//! as a series of "Pairs" separated by white space.
@ -365,7 +355,7 @@ void getMap(const Cantera::XML_Node& node, std::map<std::string, std::string>& m
*
* @return Returns the number of pairs found
*/
int getPairs(const Cantera::XML_Node& node, std::vector<std::string>& key,
int getPairs(const XML_Node& node, std::vector<std::string>& key,
std::vector<std::string>& val);
//! This function interprets the value portion of an XML element
@ -405,10 +395,10 @@ int getPairs(const Cantera::XML_Node& node, std::vector<std::string>& key,
* @param matrixSymmetric If true entries are made so that the matrix
* is always symmetric. Default is false.
*/
void getMatrixValues(const Cantera::XML_Node& node,
void getMatrixValues(const XML_Node& node,
const std::vector<std::string>& keyStringRow,
const std::vector<std::string>& keyStringCol,
Cantera::Array2D& returnValues, const bool convert = true,
Array2D& returnValues, const bool convert = true,
const bool matrixSymmetric = false);
//! Get a vector of integer values from a child element.
@ -442,7 +432,7 @@ void getMatrixValues(const Cantera::XML_Node& node,
* @param node Current XML node to get the values from
* @param v Output map of the results.
*/
void getIntegers(const Cantera::XML_Node& node, std::map<std::string,int>& v);
void getIntegers(const XML_Node& node, std::map<std::string,int>& v);
//! Get a floating-point value from a child element.
/*!
@ -475,7 +465,7 @@ void getIntegers(const Cantera::XML_Node& node, std::map<std::string,int>& v);
* and "" , for no conversion. The default value is "",
* which implies that no conversion is allowed.
*/
doublereal getFloat(const Cantera::XML_Node& parent, const std::string& name,
doublereal getFloat(const XML_Node& parent, const std::string& name,
const std::string& type="");
//! Get a floating-point value from the current XML element
@ -509,7 +499,7 @@ doublereal getFloat(const Cantera::XML_Node& parent, const std::string& name,
* and "" , for no conversion. The default value is "",
* which implies that no conversion is allowed.
*/
doublereal getFloatCurrent(const Cantera::XML_Node& currXML, const std::string& type="");
doublereal getFloatCurrent(const XML_Node& currXML, const std::string& type="");
//! Get an optional floating-point value from a child element.
/*!
@ -542,7 +532,7 @@ doublereal getFloatCurrent(const Cantera::XML_Node& currXML, const std::string&
*
* @return returns true if the child element named "name" exists
*/
bool getOptionalFloat(const Cantera::XML_Node& parent, const std::string& name,
bool getOptionalFloat(const XML_Node& parent, const std::string& name,
doublereal& fltRtn, const std::string& type="");
//! Get an integer value from a child element.
@ -570,7 +560,7 @@ bool getOptionalFloat(const Cantera::XML_Node& parent, const std::string& name,
* @param parent reference to the XML_Node object of the parent XML element
* @param name Name of the XML child element
*/
int getInteger(const Cantera::XML_Node& parent, const std::string& name);
int getInteger(const XML_Node& parent, const std::string& name);
//! Get a floating-point value from a child element with a defined units field
/*!
@ -604,7 +594,7 @@ int getInteger(const Cantera::XML_Node& parent, const std::string& name);
* and "" , for no conversion. The default value is "",
* which implies that no conversion is allowed.
*/
doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent,
doublereal getFloatDefaultUnits(const XML_Node& parent,
const std::string& name,
const std::string& defaultUnits,
const std::string& type="toSI");
@ -636,7 +626,7 @@ doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent,
* @param modelName On return this contains the contents of the model attribute
* @return True if the nodeName XML node exists. False otherwise.
*/
bool getOptionalModel(const Cantera::XML_Node& parent, const std::string& nodeName,
bool getOptionalModel(const XML_Node& parent, const std::string& nodeName,
std::string& modelName);
//! Search the child nodes of the current node for an XML Node with a Title
@ -647,7 +637,7 @@ bool getOptionalModel(const Cantera::XML_Node& parent, const std::string& nodeNa
* @return Returns a pointer to the matched child node. Returns 0 if no node
* is found.
*/
Cantera::XML_Node* getByTitle(const Cantera::XML_Node& node, const std::string& title);
XML_Node* getByTitle(const XML_Node& node, const std::string& title);
//! This function reads a child node with the name string with a specific
//! title attribute named titleString
@ -680,7 +670,7 @@ Cantera::XML_Node* getByTitle(const Cantera::XML_Node& node, const std::string&
* @param typeString String type. This is an optional output variable. It
* is filled with the attribute "type" of the XML entry.
*/
void getString(const Cantera::XML_Node& node, const std::string& titleString,
void getString(const XML_Node& node, const std::string& titleString,
std::string& valueString, std::string& typeString);
//! This function attempts to read a named child node and returns with the
@ -723,7 +713,7 @@ void getString(const Cantera::XML_Node& node, const std::string& titleString,
* It is filled with the attribute "type" of the XML entry.
* @deprecated To be removed after Cantera 2.2.
*/
void getNamedStringValue(const Cantera::XML_Node& node, const std::string& nameString, std::string& valueString,
void getNamedStringValue(const XML_Node& node, const std::string& nameString, std::string& valueString,
std::string& typeString);
//! This function reads a child node with the name, nameString, and returns
@ -749,7 +739,7 @@ void getNamedStringValue(const Cantera::XML_Node& node, const std::string& nameS
* @param nameString Name of the child XML_Node to read the value from.
* @return String value of the child XML_Node
*/
std::string getChildValue(const Cantera::XML_Node& parent,
std::string getChildValue(const XML_Node& parent,
const std::string& nameString);
//! Read an ctml file from a file and fill up an XML tree
@ -762,14 +752,14 @@ std::string getChildValue(const Cantera::XML_Node& parent,
* @param debug Turn on debugging printing
* @deprecated To be removed after Cantera 2.2. Use get_XML_File() instead.
*/
void get_CTML_Tree(Cantera::XML_Node* node, const std::string& file,
void get_CTML_Tree(XML_Node* node, const std::string& file,
const int debug = 0);
//! Read an ctml file from a file and fill up an XML tree.
//! @param file Name of the file
//! @return Root of the tree
//! @deprecated To be removed after Cantera 2.2. Use get_XML_File() instead.
Cantera::XML_Node getCtmlTree(const std::string& file);
XML_Node getCtmlTree(const std::string& file);
//! Convert a cti file into a ctml file
/*!
@ -808,6 +798,10 @@ std::string ct_string2ctml_string(const std::string& cti);
void ck2cti(const std::string& in_file, const std::string& thermo_file="",
const std::string& transport_file="",
const std::string& id_tag="gas");
}
// namespace alias for backward compatibility
namespace ctml = Cantera;
#endif

View file

@ -117,7 +117,7 @@ public:
virtual void setParametersFromXML(const XML_Node& eosdata) {
eosdata._require("model","Metal");
doublereal rho = ctml::getFloat(eosdata, "density", "density");
doublereal rho = getFloat(eosdata, "density", "density");
setDensity(rho);
}

View file

@ -67,15 +67,15 @@ public:
virtual void setParametersFromXML(const XML_Node& eosdata) {
eosdata._require("model","Semiconductor");
doublereal rho = ctml::getFloat(eosdata, "density", "-");
doublereal rho = getFloat(eosdata, "density", "-");
setDensity(rho);
m_bandgap = ctml::getFloat(eosdata, "bandgap", "-");
doublereal e_mass = ctml::getFloat(eosdata, "electron_mass", "-");
doublereal h_mass = ctml::getFloat(eosdata, "hole_mass", "-");
doublereal e_donor = ctml::getFloat(eosdata, "donor_energy", "-");
doublereal n_donor = ctml::getFloat(eosdata, "donor_concentration", "-");
doublereal e_acceptor = ctml::getFloat(eosdata, "acceptor_energy", "-");
doublereal n_acceptor = ctml::getFloat(eosdata, "acceptor_concentration", "-");
m_bandgap = getFloat(eosdata, "bandgap", "-");
doublereal e_mass = getFloat(eosdata, "electron_mass", "-");
doublereal h_mass = getFloat(eosdata, "hole_mass", "-");
doublereal e_donor = getFloat(eosdata, "donor_energy", "-");
doublereal n_donor = getFloat(eosdata, "donor_concentration", "-");
doublereal e_acceptor = getFloat(eosdata, "acceptor_energy", "-");
doublereal n_acceptor = getFloat(eosdata, "acceptor_concentration", "-");
setEffectiveMasses(e_mass, h_mass);
setDonorDoping(n_donor, e_donor);
setAcceptorDoping(n_acceptor, e_acceptor);

View file

@ -259,7 +259,7 @@ XML_Node* Application::get_XML_File(const std::string& file, int debug)
XML_Node* x = new XML_Node("doc");
if (ext != ".xml" && ext != ".ctml") {
// Assume that we are trying to open a cti file. Do the conversion to XML.
std::stringstream phase_xml(ctml::ct2ctml_string(path));
std::stringstream phase_xml(ct2ctml_string(path));
x->build(phase_xml);
} else {
std::ifstream s(path.c_str());
@ -289,7 +289,7 @@ XML_Node* Application::get_XML_from_string(const std::string& text)
if (text.substr(start,1) == "<") {
s << text;
} else {
s << ctml::ct_string2ctml_string(text.substr(start));
s << ct_string2ctml_string(text.substr(start));
}
entry.first = new XML_Node();
entry.first->build(s);

View file

@ -17,10 +17,9 @@
#include <windows.h>
#endif
using namespace Cantera;
using namespace std;
namespace ctml
namespace Cantera
{
//! return the full path to the Python interpreter.
@ -275,7 +274,7 @@ void ck2cti(const std::string& in_file, const std::string& thermo_file,
}
}
void get_CTML_Tree(Cantera::XML_Node* rootPtr, const std::string& file, const int debug)
void get_CTML_Tree(XML_Node* rootPtr, const std::string& file, const int debug)
{
warn_deprecated("get_CTML_Tree", "To be removed after Cantera 2.2. "
"Use get_XML_File instead.");
@ -283,7 +282,7 @@ void get_CTML_Tree(Cantera::XML_Node* rootPtr, const std::string& file, const in
src->copy(rootPtr);
}
Cantera::XML_Node getCtmlTree(const std::string& file)
XML_Node getCtmlTree(const std::string& file)
{
warn_deprecated("getCtmlTree", "To be removed after Cantera 2.2. "
"Use get_XML_File instead.");

View file

@ -9,13 +9,12 @@
#include "cantera/base/Array.h"
using namespace std;
using namespace Cantera;
namespace ctml
namespace Cantera
{
std::string FP_Format = "%23.15E";
void addInteger(Cantera::XML_Node& node, const std::string& title, const int val,
void addInteger(XML_Node& node, const std::string& title, const int val,
const std::string& units, const std::string& type)
{
XML_Node& f = node.addChild(title, val);
@ -28,12 +27,12 @@ void addInteger(Cantera::XML_Node& node, const std::string& title, const int val
}
}
void addFloat(Cantera::XML_Node& node, const std::string& title,
void addFloat(XML_Node& node, const std::string& title,
const doublereal val, const std::string& units,
const std::string& type, const doublereal minval,
const doublereal maxval)
{
XML_Node& f = node.addChild(title, val, ctml::FP_Format);
XML_Node& f = node.addChild(title, val, FP_Format);
if (type != "") {
f.addAttribute("type",type);
}
@ -49,7 +48,7 @@ void addFloat(Cantera::XML_Node& node, const std::string& title,
}
}
void addFloatArray(Cantera::XML_Node& node, const std::string& title, const size_t n,
void addFloatArray(XML_Node& node, const std::string& title, const size_t n,
const doublereal* const vals, const std::string& units,
const std::string& type,
const doublereal minval, const doublereal maxval)
@ -82,7 +81,7 @@ void addFloatArray(Cantera::XML_Node& node, const std::string& title, const size
}
}
void addNamedFloatArray(Cantera::XML_Node& node, const std::string& name, const size_t n,
void addNamedFloatArray(XML_Node& node, const std::string& name, const size_t n,
const doublereal* const vals, const std::string units,
const std::string type, const doublereal minval,
const doublereal maxval)
@ -120,7 +119,7 @@ void addNamedFloatArray(Cantera::XML_Node& node, const std::string& name, const
}
}
void addString(Cantera::XML_Node& node, const std::string& titleString,
void addString(XML_Node& node, const std::string& titleString,
const std::string& valueString,
const std::string& typeString)
{
@ -131,7 +130,7 @@ void addString(Cantera::XML_Node& node, const std::string& titleString,
}
}
XML_Node* getByTitle(const Cantera::XML_Node& node, const std::string& title)
XML_Node* getByTitle(const XML_Node& node, const std::string& title)
{
XML_Node* s = node.findByAttr("title", title);
if (s && s->parent() == &node) {
@ -140,7 +139,7 @@ XML_Node* getByTitle(const Cantera::XML_Node& node, const std::string& title)
return 0;
}
std::string getChildValue(const Cantera::XML_Node& parent, const std::string& nameString)
std::string getChildValue(const XML_Node& parent, const std::string& nameString)
{
if (!parent.hasChild(nameString)) {
return "";
@ -148,7 +147,7 @@ std::string getChildValue(const Cantera::XML_Node& parent, const std::string& na
return parent(nameString);
}
void getString(const Cantera::XML_Node& node, const std::string& titleString, std::string& valueString,
void getString(const XML_Node& node, const std::string& titleString, std::string& valueString,
std::string& typeString)
{
XML_Node* s = getByTitle(node, titleString);
@ -161,7 +160,7 @@ void getString(const Cantera::XML_Node& node, const std::string& titleString, st
}
}
void getNamedStringValue(const Cantera::XML_Node& node, const std::string& nameString, std::string& valueString,
void getNamedStringValue(const XML_Node& node, const std::string& nameString, std::string& valueString,
std::string& typeString)
{
warn_deprecated("getNamedStringValue", "To be removed after Cantera 2.2");
@ -180,7 +179,7 @@ void getNamedStringValue(const Cantera::XML_Node& node, const std::string& nameS
}
}
void getIntegers(const Cantera::XML_Node& node,
void getIntegers(const XML_Node& node,
std::map<std::string, int>& v)
{
std::vector<XML_Node*> f = node.getChildren("integer");
@ -192,7 +191,7 @@ void getIntegers(const Cantera::XML_Node& node,
}
}
doublereal getFloat(const Cantera::XML_Node& parent,
doublereal getFloat(const XML_Node& parent,
const std::string& name,
const std::string& type)
{
@ -204,8 +203,7 @@ doublereal getFloat(const Cantera::XML_Node& parent,
return getFloatCurrent(node, type);
}
doublereal getFloatCurrent(const Cantera::XML_Node& node,
const std::string& type)
doublereal getFloatCurrent(const XML_Node& node, const std::string& type)
{
doublereal fctr = 1.0;
doublereal x = node.fp_value();
@ -251,7 +249,7 @@ doublereal getFloatCurrent(const Cantera::XML_Node& node,
return fctr*x;
}
bool getOptionalFloat(const Cantera::XML_Node& parent,
bool getOptionalFloat(const XML_Node& parent,
const std::string& name,
doublereal& fltRtn,
const std::string& type)
@ -263,7 +261,7 @@ bool getOptionalFloat(const Cantera::XML_Node& parent,
return false;
}
doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent,
doublereal getFloatDefaultUnits(const XML_Node& parent,
const std::string& name,
const std::string& defaultUnits,
const std::string& type)
@ -290,7 +288,7 @@ doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent,
return getFloat(parent, name, type) / fctr;
}
bool getOptionalModel(const Cantera::XML_Node& parent, const std::string& nodeName,
bool getOptionalModel(const XML_Node& parent, const std::string& nodeName,
std::string& modelName)
{
if (parent.hasChild(nodeName)) {
@ -300,7 +298,7 @@ bool getOptionalModel(const Cantera::XML_Node& parent, const std::string& nodeNa
return false;
}
int getInteger(const Cantera::XML_Node& parent, const std::string& name)
int getInteger(const XML_Node& parent, const std::string& name)
{
if (!parent.hasChild(name)) {
throw CanteraError("getInteger (called from XML Node \"" +
@ -322,13 +320,13 @@ int getInteger(const Cantera::XML_Node& parent, const std::string& name)
return x;
}
size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
size_t getFloatArray(const XML_Node& node, std::vector<doublereal> & v,
const bool convert, const std::string& unitsString,
const std::string& nodeName)
{
const Cantera::XML_Node* readNode = &node;
const XML_Node* readNode = &node;
if (node.name() != nodeName) {
vector<Cantera::XML_Node*> ll = node.getChildren(nodeName);
vector<XML_Node*> ll = node.getChildren(nodeName);
if (ll.size() == 0) {
throw CanteraError("getFloatArray",
"wrong XML element type/name: was expecting "
@ -402,7 +400,7 @@ size_t getFloatArray(const Cantera::XML_Node& node, std::vector<doublereal> & v,
return v.size();
}
void getMap(const Cantera::XML_Node& node, std::map<std::string, std::string>& m)
void getMap(const XML_Node& node, std::map<std::string, std::string>& m)
{
std::vector<std::string> v;
getStringArray(node, v);
@ -416,7 +414,7 @@ void getMap(const Cantera::XML_Node& node, std::map<std::string, std::string>& m
}
}
int getPairs(const Cantera::XML_Node& node, std::vector<std::string>& key,
int getPairs(const XML_Node& node, std::vector<std::string>& key,
std::vector<std::string>& val)
{
vector<string> v;
@ -434,10 +432,10 @@ int getPairs(const Cantera::XML_Node& node, std::vector<std::string>& key,
return n;
}
void getMatrixValues(const Cantera::XML_Node& node,
void getMatrixValues(const XML_Node& node,
const std::vector<std::string>& keyStringRow,
const std::vector<std::string>& keyStringCol,
Cantera::Array2D& retnValues, const bool convert,
Array2D& retnValues, const bool convert,
const bool matrixSymmetric)
{
if (keyStringRow.size() > retnValues.nRows()) {
@ -502,7 +500,7 @@ void getMatrixValues(const Cantera::XML_Node& node,
}
}
void getStringArray(const Cantera::XML_Node& node, std::vector<std::string>& v)
void getStringArray(const XML_Node& node, std::vector<std::string>& v)
{
tokenizeString(node.value(), v);
}

View file

@ -1501,7 +1501,7 @@ extern "C" {
char* id_tag, int debug, int validate)
{
try {
ctml::ck2cti(in_file, db_file, tr_file, id_tag);
ck2cti(in_file, db_file, tr_file, id_tag);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);

View file

@ -13,7 +13,6 @@
using namespace std;
using namespace Cantera;
using namespace ctml;
typedef Cabinet<XML_Node, false> XmlCabinet;
template<> XmlCabinet* XmlCabinet::s_storage = 0;

View file

@ -11,7 +11,6 @@
#include <cstring>
#include <fstream>
using namespace ctml;
using namespace std;
using Cantera::XML_Node;
using Cantera::CanteraError;

View file

@ -8,8 +8,6 @@
#include "cantera/base/Array.h"
#include <sstream>
using namespace ctml;
namespace Cantera
{

View file

@ -20,7 +20,6 @@
#include <cstring>
using namespace ctml;
using namespace std;
namespace Cantera
@ -120,7 +119,7 @@ bool getReagents(const XML_Node& rxn, Kinetics& kin, int rp,
* pairs in the reactions/products object.
*/
std::vector<string> key, val;
ctml::getPairs(rg, key, val);
getPairs(rg, key, val);
/*
* Loop over each of the pairs and process them
@ -398,7 +397,7 @@ static void getEfficiencies(const XML_Node& eff, Kinetics& kin,
rdata.default_3b_eff = fpValue(eff["default"]);
vector<string> key, val;
ctml::getPairs(eff, key, val);
getPairs(eff, key, val);
string nm;
string phse = kin.thermo(0).id();
for (size_t n = 0; n < key.size(); n++) {

View file

@ -9,7 +9,6 @@
#include <cstdio>
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -8,7 +8,6 @@
#include <fstream>
#include <ctime>
using namespace ctml;
using namespace std;
namespace Cantera

View file

@ -10,7 +10,6 @@
#include <cstdio>
using namespace ctml;
using namespace std;
namespace Cantera

View file

@ -227,10 +227,10 @@ XML_Node& Inlet1D::save(XML_Node& o, const doublereal* const soln)
XML_Node& inlt = Domain1D::save(o, soln);
inlt.addAttribute("type","inlet");
for (size_t k = 0; k < nComponents(); k++) {
ctml::addFloat(inlt, componentName(k), s[k]);
addFloat(inlt, componentName(k), s[k]);
}
for (size_t k=0; k < m_nsp; k++) {
ctml::addFloat(inlt, "massFraction", m_yin[k], "",
addFloat(inlt, "massFraction", m_yin[k], "",
m_flow->phase().speciesName(k));
}
return inlt;
@ -239,8 +239,8 @@ XML_Node& Inlet1D::save(XML_Node& o, const doublereal* const soln)
void Inlet1D::restore(const XML_Node& dom, doublereal* soln, int loglevel)
{
Domain1D::restore(dom, soln, loglevel);
soln[0] = m_mdot = ctml::getFloat(dom, "mdot", "massflowrate");
soln[1] = m_temp = ctml::getFloat(dom, "temperature", "temperature");
soln[0] = m_mdot = getFloat(dom, "mdot", "massflowrate");
soln[1] = m_temp = getFloat(dom, "temperature", "temperature");
m_yin.assign(m_nsp, 0.0);
@ -606,9 +606,9 @@ XML_Node& OutletRes1D::save(XML_Node& o, const doublereal* const soln)
{
XML_Node& outlt = Domain1D::save(o, soln);
outlt.addAttribute("type","outletres");
ctml::addFloat(outlt, "temperature", m_temp, "K");
addFloat(outlt, "temperature", m_temp, "K");
for (size_t k=0; k < m_nsp; k++) {
ctml::addFloat(outlt, "massFraction", m_yres[k], "",
addFloat(outlt, "massFraction", m_yres[k], "",
m_flow->phase().speciesName(k));
}
return outlt;
@ -617,7 +617,7 @@ XML_Node& OutletRes1D::save(XML_Node& o, const doublereal* const soln)
void OutletRes1D::restore(const XML_Node& dom, doublereal* soln, int loglevel)
{
Domain1D::restore(dom, soln, loglevel);
m_temp = ctml::getFloat(dom, "temperature");
m_temp = getFloat(dom, "temperature");
m_yres.assign(m_nsp, 0.0);
for (size_t i = 0; i < dom.nChildren(); i++) {
@ -696,7 +696,7 @@ XML_Node& Surf1D::save(XML_Node& o, const doublereal* const soln)
XML_Node& inlt = Domain1D::save(o, soln);
inlt.addAttribute("type","surface");
for (size_t k = 0; k < nComponents(); k++) {
ctml::addFloat(inlt, componentName(k), s[k]);
addFloat(inlt, componentName(k), s[k]);
}
return inlt;
}
@ -704,7 +704,7 @@ XML_Node& Surf1D::save(XML_Node& o, const doublereal* const soln)
void Surf1D::restore(const XML_Node& dom, doublereal* soln, int loglevel)
{
Domain1D::restore(dom, soln, loglevel);
soln[0] = m_temp = ctml::getFloat(dom, "temperature", "temperature");
soln[0] = m_temp = getFloat(dom, "temperature", "temperature");
resize(1,1);
}
@ -826,9 +826,9 @@ XML_Node& ReactingSurf1D::save(XML_Node& o, const doublereal* const soln)
const doublereal* s = soln + loc();
XML_Node& dom = Domain1D::save(o, soln);
dom.addAttribute("type","surface");
ctml::addFloat(dom, "temperature", s[0], "K");
addFloat(dom, "temperature", s[0], "K");
for (size_t k=0; k < m_nsp; k++) {
ctml::addFloat(dom, "coverage", s[k+1], "",
addFloat(dom, "coverage", s[k+1], "",
m_sphase->speciesName(k));
}
return dom;
@ -838,7 +838,7 @@ void ReactingSurf1D::restore(const XML_Node& dom, doublereal* soln,
int loglevel)
{
Domain1D::restore(dom, soln, loglevel);
soln[0] = m_temp = ctml::getFloat(dom, "temperature");
soln[0] = m_temp = getFloat(dom, "temperature");
m_fixed_cov.assign(m_nsp, 0.0);
for (size_t i = 0; i < dom.nChildren(); i++) {

View file

@ -10,8 +10,6 @@
#include "cantera/thermo/ConstDensityThermo.h"
#include "cantera/base/ctml.h"
using namespace ctml;
namespace Cantera
{

View file

@ -23,7 +23,6 @@
#include <cstdio>
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -9,7 +9,6 @@
#include "cantera/base/ctml.h"
#include "cantera/base/stringUtils.h"
using namespace ctml;
using namespace std;
namespace Cantera

View file

@ -301,7 +301,7 @@ void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id_
"thermo model attribute must be FixedChemPot or StoichSubstance or StoichSubstanceSSTP");
}
if (model == "FixedChemPot") {
double val = ctml::getFloatDefaultUnits(tnode, "chemicalPotential", "J/kmol");
double val = getFloatDefaultUnits(tnode, "chemicalPotential", "J/kmol");
chemPot_ = val;
}
SingleSpeciesTP::initThermoXML(phaseNode, id_);
@ -326,7 +326,7 @@ void FixedChemPotSSTP::setParametersFromXML(const XML_Node& eosdata)
"thermo model attribute must be FixedChemPot or StoichSubstance or StoichSubstanceSSTP");
}
if (model == "FixedChemPotSSTP") {
doublereal val = ctml::getFloatDefaultUnits(eosdata, "chemicalPotential", "J/kmol");
doublereal val = getFloatDefaultUnits(eosdata, "chemicalPotential", "J/kmol");
chemPot_ = val;
}
}

View file

@ -22,7 +22,6 @@
#include <fstream>
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -22,8 +22,6 @@
#include "cantera/base/ctml.h"
#include <iostream>
using namespace ctml;
namespace Cantera
{

View file

@ -575,7 +575,7 @@ void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string&
for (size_t k = 0; k < m_kk; k++) {
XML_Node* s = speciesDB->findByAttr("name", speciesName(k));
XML_Node* ss = s->findByName("standardState");
m_speciesMolarVolume[k] = ctml::getFloat(*ss, "molarVolume", "toSI");
m_speciesMolarVolume[k] = getFloat(*ss, "molarVolume", "toSI");
}
/*

View file

@ -332,7 +332,7 @@ void LatticePhase::initThermoXML(XML_Node& phaseNode, const std::string& id_)
XML_Node* ss = s->findByName("standardState");
if (ss) {
if (ss->findByName("molarVolume")) {
m_speciesMolarVolume[k] = ctml::getFloat(*ss, "molarVolume", "toSI");
m_speciesMolarVolume[k] = getFloat(*ss, "molarVolume", "toSI");
}
}
}
@ -372,8 +372,8 @@ void LatticePhase::getParameters(int& n, doublereal* const c) const
void LatticePhase::setParametersFromXML(const XML_Node& eosdata)
{
eosdata._require("model", "Lattice");
m_site_density = ctml::getFloat(eosdata, "site_density", "toSI");
m_vacancy = ctml::getChildValue(eosdata, "vacancy_species");
m_site_density = getFloat(eosdata, "site_density", "toSI");
m_vacancy = getChildValue(eosdata, "vacancy_species");
}
}

View file

@ -433,7 +433,7 @@ void LatticeSolidPhase::setParametersFromXML(const XML_Node& eosdata)
}
std::vector<string> pnam;
std::vector<string> pval;
int np = ctml::getPairs(eosdata.child("LatticeStoichiometry"), pnam, pval);
int np = getPairs(eosdata.child("LatticeStoichiometry"), pnam, pval);
theta_.resize(m_nlattice);
for (int i = 0; i < np; i++) {
double val = fpValueCheck(pval[i]);

View file

@ -718,7 +718,7 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
if (vParams.size() != 2) {
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies::excessEnthalpy for " + aspName
+ "::" + bspName,
@ -732,7 +732,7 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
if (vParams.size() != 2) {
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies::excessEntropy for " + aspName
+ "::" + bspName,
@ -746,7 +746,7 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
if (vParams.size() != 2) {
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies::excessVolume_Enthalpy for " + aspName
+ "::" + bspName,
@ -760,7 +760,7 @@ void MargulesVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
if (vParams.size() != 2) {
throw CanteraError("MargulesVPSSTP::readXMLBinarySpecies::excessVolume_Entropy for " + aspName
+ "::" + bspName,

View file

@ -230,7 +230,7 @@ void MetalSHEelectrons::initThermoXML(XML_Node& phaseNode, const std::string& id
XML_Node& tnode = phaseNode.child("thermo");
doublereal dens = 2.65E3;
if (tnode.hasChild("density")) {
dens = ctml::getFloatDefaultUnits(tnode, "density", "kg/m3");
dens = getFloatDefaultUnits(tnode, "density", "kg/m3");
}
setDensity(dens);
SingleSpeciesTP::initThermoXML(phaseNode, id_);
@ -308,7 +308,7 @@ void MetalSHEelectrons::setParametersFromXML(const XML_Node& eosdata)
}
doublereal rho = 2.65E3;
if (eosdata.hasChild("density")) {
rho = ctml::getFloat(eosdata, "density", "toSI");
rho = getFloat(eosdata, "density", "toSI");
}
setDensity(rho);
}

View file

@ -252,7 +252,7 @@ void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id_)
if (aV.hasAttrib("units")) {
Afactor = toSI(aV.attrib("units"));
}
volVal = ctml::getFloat(*aStandardState, "V0_Pr_Tr");
volVal = getFloat(*aStandardState, "V0_Pr_Tr");
m_V0_pr_tr= volVal;
volVal *= Afactor;
m_speciesSize[0] = volVal;
@ -265,13 +265,13 @@ void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id_)
const XML_Node& MinEQ3node = xsp->child("thermo").child("MinEQ3");
m_deltaG_formation_pr_tr =
ctml::getFloatDefaultUnits(MinEQ3node, "DG0_f_Pr_Tr", "cal/gmol", "actEnergy");
getFloatDefaultUnits(MinEQ3node, "DG0_f_Pr_Tr", "cal/gmol", "actEnergy");
m_deltaH_formation_pr_tr =
ctml::getFloatDefaultUnits(MinEQ3node, "DH0_f_Pr_Tr", "cal/gmol", "actEnergy");
m_Entrop_pr_tr = ctml::getFloatDefaultUnits(MinEQ3node, "S0_Pr_Tr", "cal/gmol/K");
m_a = ctml::getFloatDefaultUnits(MinEQ3node, "a", "cal/gmol/K");
m_b = ctml::getFloatDefaultUnits(MinEQ3node, "b", "cal/gmol/K2");
m_c = ctml::getFloatDefaultUnits(MinEQ3node, "c", "cal-K/gmol");
getFloatDefaultUnits(MinEQ3node, "DH0_f_Pr_Tr", "cal/gmol", "actEnergy");
m_Entrop_pr_tr = getFloatDefaultUnits(MinEQ3node, "S0_Pr_Tr", "cal/gmol/K");
m_a = getFloatDefaultUnits(MinEQ3node, "a", "cal/gmol/K");
m_b = getFloatDefaultUnits(MinEQ3node, "b", "cal/gmol/K2");
m_c = getFloatDefaultUnits(MinEQ3node, "c", "cal-K/gmol");
convertDGFormation();
}

View file

@ -725,7 +725,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
if (vParams.size() != 2) {
throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessEnthalpy for " + ispName
+ "::" + jspName,
@ -739,7 +739,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
if (vParams.size() != 2) {
throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessEntropy for " + ispName
+ "::" + jspName,
@ -753,7 +753,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
if (vParams.size() != 2) {
throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessVolume_Enthalpy for " + ispName
+ "::" + jspName,
@ -767,7 +767,7 @@ void MixedSolventElectrolyte::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
if (vParams.size() != 2) {
throw CanteraError("MixedSolventElectrolyte::readXMLBinarySpecies::excessVolume_Entropy for " + ispName
+ "::" + jspName,

View file

@ -236,13 +236,13 @@ void MixtureFugacityTP::getStandardVolumes_ref(doublereal* vol) const
void MixtureFugacityTP::setStateFromXML(const XML_Node& state)
{
int doTP = 0;
string comp = ctml::getChildValue(state,"moleFractions");
string comp = getChildValue(state,"moleFractions");
if (comp != "") {
// not overloaded in current object -> phase state is not calculated.
setMoleFractionsByName(comp);
doTP = 1;
} else {
comp = ctml::getChildValue(state,"massFractions");
comp = getChildValue(state,"massFractions");
if (comp != "") {
// not overloaded in current object -> phase state is not calculated.
setMassFractionsByName(comp);
@ -251,14 +251,14 @@ void MixtureFugacityTP::setStateFromXML(const XML_Node& state)
}
double t = temperature();
if (state.hasChild("temperature")) {
t = ctml::getFloat(state, "temperature", "temperature");
t = getFloat(state, "temperature", "temperature");
doTP = 1;
}
if (state.hasChild("pressure")) {
double p = ctml::getFloat(state, "pressure", "pressure");
double p = getFloat(state, "pressure", "pressure");
setState_TP(t, p);
} else if (state.hasChild("density")) {
double rho = ctml::getFloat(state, "density", "density");
double rho = getFloat(state, "density", "density");
setState_TR(t, rho);
} else if (doTP) {
double rho = Phase::density();

View file

@ -365,12 +365,12 @@ void MolalityVPSSTP::setToEquilState(const doublereal* lambda_RT)
void MolalityVPSSTP::setStateFromXML(const XML_Node& state)
{
VPStandardStateTP::setStateFromXML(state);
string comp = ctml::getChildValue(state,"soluteMolalities");
string comp = getChildValue(state,"soluteMolalities");
if (comp != "") {
setMolalitiesByName(comp);
}
if (state.hasChild("pressure")) {
double p = ctml::getFloat(state, "pressure", "pressure");
double p = getFloat(state, "pressure", "pressure");
setPressure(p);
}
}

View file

@ -11,7 +11,6 @@
#include "cantera/base/stringUtils.h"
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -88,7 +88,7 @@ void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
"standardState model for species isn't constant_incompressible: " + speciesNode.name());
}
m_constMolarVolume = ctml::getFloat(*ss, "molarVolume", "toSI");
m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI");
}
void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex,

View file

@ -20,7 +20,6 @@
#include <fstream>
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -139,7 +139,7 @@ void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP* tp, size_t spinde
std::vector<std::string> key;
std::vector<std::string> val;
numMult_ = ctml::getPairs(*nsm, key, val);
numMult_ = getPairs(*nsm, key, val);
idNeutralMoleculeVec.resize(numMult_);
factorVec.resize(numMult_);
tmpNM.resize(neutralMoleculePhase_->nSpecies());

View file

@ -100,17 +100,17 @@ void PDSS_SSVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex,
std::string model = ss->attrib("model");
if (model == "constant_incompressible" || model == "constant") {
volumeModel_ = cSSVOLUME_CONSTANT;
m_constMolarVolume = ctml::getFloat(*ss, "molarVolume", "toSI");
m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI");
} else if (model == "temperature_polynomial") {
volumeModel_ = cSSVOLUME_TPOLY;
size_t num = ctml::getFloatArray(*ss, TCoeff_, true, "toSI", "volumeTemperaturePolynomial");
size_t num = getFloatArray(*ss, TCoeff_, true, "toSI", "volumeTemperaturePolynomial");
if (num != 4) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
" Didn't get 4 density polynomial numbers for species " + speciesNode.name());
}
} else if (model == "density_temperature_polynomial") {
volumeModel_ = cSSVOLUME_DENSITY_TPOLY;
size_t num = ctml::getFloatArray(*ss, TCoeff_, true, "toSI", "densityTemperaturePolynomial");
size_t num = getFloatArray(*ss, TCoeff_, true, "toSI", "densityTemperaturePolynomial");
if (num != 4) {
throw CanteraError("PDSS_SSVol::constructPDSSXML",
" Didn't get 4 density polynomial numbers for species " + speciesNode.name());

View file

@ -767,7 +767,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessEnthalpy");
if (vParams.size() != 2) {
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies::excessEnthalpy for " + ispName
+ "::" + jspName,
@ -781,7 +781,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessEntropy");
if (vParams.size() != 2) {
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies::excessEntropy for " + ispName
+ "::" + jspName,
@ -795,7 +795,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Enthalpy");
if (vParams.size() != 2) {
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies::excessVolume_Enthalpy for " + ispName
+ "::" + jspName,
@ -809,7 +809,7 @@ void PhaseCombo_Interaction::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
getFloatArray(xmlChild, vParams, true, "toSI", "excessVolume_Entropy");
if (vParams.size() != 2) {
throw CanteraError("PhaseCombo_Interaction::readXMLBinarySpecies::excessVolume_Entropy for " + ispName
+ "::" + jspName,

View file

@ -669,7 +669,7 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, hParams, true, "toSI", "excessEnthalpy");
getFloatArray(xmlChild, hParams, true, "toSI", "excessEnthalpy");
Npoly = std::max(hParams.size(), Npoly);
}
@ -677,7 +677,7 @@ void RedlichKisterVPSSTP::readXMLBinarySpecies(XML_Node& xmLBinarySpecies)
/*
* Get the string containing all of the values
*/
ctml::getFloatArray(xmlChild, sParams, true, "toSI", "excessEntropy");
getFloatArray(xmlChild, sParams, true, "toSI", "excessEntropy");
Npoly = std::max(sParams.size(), Npoly);
}
}

View file

@ -853,7 +853,7 @@ void RedlichKwongMFTP::readXMLPureFluid(XML_Node& pureFluidParam)
throw CanteraError("", "unknown model");
}
ctml::getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
nParamsFound = vParams.size();
if (nParamsFound != nParamsExpected) {
throw CanteraError("RedlichKwongMFTP::readXMLPureFluid(for a_coeff" + iName + ")",
@ -864,7 +864,7 @@ void RedlichKwongMFTP::readXMLPureFluid(XML_Node& pureFluidParam)
a_coeff_vec(i, counter) = vParams[i];
}
} else if (nodeName == "b_coeff") {
ctml::getFloatArray(xmlChild, vParams, true, "m3/kmol", "b_coeff");
getFloatArray(xmlChild, vParams, true, "m3/kmol", "b_coeff");
nParamsFound = vParams.size();
if (nParamsFound != 1) {
throw CanteraError("RedlichKwongMFTP::readXMLPureFluid(for b_coeff" + iName + ")",
@ -944,7 +944,7 @@ void RedlichKwongMFTP::readXMLCrossFluid(XML_Node& CrossFluidParam)
throw CanteraError("", "unknown model");
}
ctml::getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
getFloatArray(xmlChild, vParams, true, "Pascal-m6/kmol2", "a_coeff");
nParamsFound = vParams.size();
if (nParamsFound != nParamsExpected) {
throw CanteraError("RedlichKwongMFTP::readXMLCrossFluid(for a_coeff" + iName + ")",

View file

@ -9,8 +9,6 @@
#include <iostream>
#include <limits>
using namespace ctml;
namespace Cantera {
Species::Species()

View file

@ -28,11 +28,9 @@
#include "cantera/base/ctml.h"
using namespace std;
using namespace ctml;
namespace Cantera
{
SpeciesThermoFactory* SpeciesThermoFactory::s_factory = 0;
mutex_t SpeciesThermoFactory::species_thermo_mutex;

View file

@ -260,7 +260,7 @@ void StoichSubstance::getParameters(int& n, double* const c) const
void StoichSubstance::setParametersFromXML(const XML_Node& eosdata)
{
eosdata._require("model","StoichSubstance");
doublereal rho = ctml::getFloat(eosdata, "density", "toSI");
doublereal rho = getFloat(eosdata, "density", "toSI");
setDensity(rho);
}

View file

@ -229,7 +229,7 @@ void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string&
"no thermo XML node");
}
XML_Node& tnode = phaseNode.child("thermo");
double dens = ctml::getFloatDefaultUnits(tnode, "density", "kg/m3");
double dens = getFloatDefaultUnits(tnode, "density", "kg/m3");
setDensity(dens);
SingleSpeciesTP::initThermoXML(phaseNode, id_);
}
@ -252,7 +252,7 @@ void StoichSubstanceSSTP::setParametersFromXML(const XML_Node& eosdata)
throw CanteraError("StoichSubstanceSSTP::setParametersFromXML",
"thermo model attribute must be StoichSubstance");
}
setDensity(ctml::getFloat(eosdata, "density", "toSI"));
setDensity(getFloat(eosdata, "density", "toSI"));
}
// ------ Methods of class electrodeElectron ------

View file

@ -14,7 +14,6 @@
#include "cantera/base/ctml.h"
#include "cantera/base/vec_functions.h"
using namespace ctml;
using namespace std;
namespace Cantera

View file

@ -56,7 +56,6 @@
#include "cantera/base/stringUtils.h"
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -21,7 +21,6 @@
#include <fstream>
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -24,7 +24,6 @@
#include "cantera/base/stringUtils.h"
#include "cantera/base/ctml.h"
using namespace ctml;
using namespace std;
namespace Cantera

View file

@ -121,7 +121,7 @@ VPSSMgr_ConstVol::initThermoXML(XML_Node& phaseNode, const std::string& id)
throw CanteraError("VPSSMgr_ConstVol::initThermoXML",
"standardState model for species isn't constant_incompressible: " + s->attrib("name"));
}
m_Vss[k] = ctml::getFloat(*ss, "molarVolume", "toSI");
m_Vss[k] = getFloat(*ss, "molarVolume", "toSI");
}
}
@ -143,7 +143,7 @@ VPSSMgr_ConstVol::createInstallPDSS(size_t k, const XML_Node& speciesNode,
if (m_Vss.size() < k+1) {
m_Vss.resize(k+1, 0.0);
}
m_Vss[k] = ctml::getFloat(*ss, "molarVolume", "toSI");
m_Vss[k] = getFloat(*ss, "molarVolume", "toSI");
installSTSpecies(k, speciesNode, phaseNode_ptr);
return new PDSS_ConstVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true);

View file

@ -19,7 +19,6 @@
#include "cantera/thermo/SpeciesThermoInterpType.h"
using namespace std;
using namespace ctml;
namespace Cantera
{

View file

@ -231,7 +231,7 @@ VPSSMgr_Water_ConstVol::initThermoXML(XML_Node& phaseNode, const std::string& id
"standardState model for species isn't "
"constant_incompressible: " + s->attrib("name"));
}
m_Vss[k] = ctml::getFloat(*ss, "molarVolume", "toSI");
m_Vss[k] = getFloat(*ss, "molarVolume", "toSI");
}
}
@ -281,7 +281,7 @@ VPSSMgr_Water_ConstVol::createInstallPDSS(size_t k, const XML_Node& speciesNode,
if (m_Vss.size() < k+1) {
m_Vss.resize(k+1, 0.0);
}
m_Vss[k] = ctml::getFloat(*ss, "molarVolume", "toSI");
m_Vss[k] = getFloat(*ss, "molarVolume", "toSI");
// instantiate a new kPDSS object
kPDSS = new PDSS_ConstVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true);

View file

@ -9,11 +9,9 @@
#include "cantera/base/ctml.h"
using namespace std;
using namespace ctml;
namespace Cantera
{
//! Exception thrown if an error is encountered while reading the transport database.
class LTPError : public CanteraError
{

View file

@ -10,11 +10,9 @@
#include "cantera/base/ctml.h"
using namespace std;
using namespace ctml;
namespace Cantera
{
/**
* Exception thrown if an error is encountered while reading the
* transport database.

View file

@ -6,11 +6,8 @@
#include "cantera/base/stringUtils.h"
#include "cantera/base/ctml.h"
using namespace ctml;
namespace Cantera
{
GasTransportData::GasTransportData()
: diameter(0.0)
, well_depth(0.0)

View file

@ -60,7 +60,7 @@ public:
TEST_F(CtiConversionTest, ExplicitConversion) {
p1 = newPhase("../data/air-no-reactions.xml");
ctml::ct2ctml("../data/air-no-reactions.cti");
ct2ctml("../data/air-no-reactions.cti");
p2 = newPhase("air-no-reactions.xml", "");
compare();
}
@ -83,20 +83,20 @@ public:
TEST_F(ChemkinConversionTest, ValidConversion) {
copyInputFile("pdep-test.inp");
ctml::ck2cti("pdep-test.inp");
ck2cti("pdep-test.inp");
ThermoPhase* p = newPhase("pdep-test.cti");
ASSERT_GT(p->temperature(), 0.0);
delete p;
}
TEST_F(ChemkinConversionTest, MissingInputFile) {
ASSERT_THROW(ctml::ck2cti("nonexistent-file.inp"),
ASSERT_THROW(ck2cti("nonexistent-file.inp"),
CanteraError);
}
TEST_F(ChemkinConversionTest, FailedConversion) {
copyInputFile("h2o2_missingThermo.inp");
ASSERT_THROW(ctml::ck2cti("h2o2_missingThermo.inp"),
ASSERT_THROW(ck2cti("h2o2_missingThermo.inp"),
CanteraError);
}
#endif