From 5214672ab3a680c315dbdf8a5eab5df5a8f1281d Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 27 May 2015 17:46:37 -0400 Subject: [PATCH] Merge namespace ctml with namespace Cantera --- include/cantera/base/ctml.h | 88 ++++++++++----------- include/cantera/thermo/MetalPhase.h | 2 +- include/cantera/thermo/SemiconductorPhase.h | 16 ++-- src/base/application.cpp | 4 +- src/base/ct2ctml.cpp | 7 +- src/base/ctml.cpp | 54 ++++++------- src/clib/ct.cpp | 2 +- src/clib/ctxml.cpp | 1 - src/fortran/fctxml.cpp | 1 - src/kinetics/Reaction.cpp | 2 - src/kinetics/importKinetics.cpp | 5 +- src/oneD/Domain1D.cpp | 1 - src/oneD/OneDim.cpp | 1 - src/oneD/StFlow.cpp | 1 - src/oneD/boundaries1D.cpp | 24 +++--- src/thermo/ConstDensityThermo.cpp | 2 - src/thermo/DebyeHuckel.cpp | 1 - src/thermo/Elements.cpp | 1 - src/thermo/FixedChemPotSSTP.cpp | 4 +- src/thermo/HMWSoln_input.cpp | 1 - src/thermo/IdealMolalSoln.cpp | 2 - src/thermo/IdealSolidSolnPhase.cpp | 2 +- src/thermo/LatticePhase.cpp | 6 +- src/thermo/LatticeSolidPhase.cpp | 2 +- src/thermo/MargulesVPSSTP.cpp | 8 +- src/thermo/MetalSHEelectrons.cpp | 4 +- src/thermo/MineralEQ3.cpp | 14 ++-- src/thermo/MixedSolventElectrolyte.cpp | 8 +- src/thermo/MixtureFugacityTP.cpp | 10 +-- src/thermo/MolalityVPSSTP.cpp | 4 +- src/thermo/Mu0Poly.cpp | 1 - src/thermo/PDSS_ConstVol.cpp | 2 +- src/thermo/PDSS_HKFT.cpp | 1 - src/thermo/PDSS_IonsFromNeutral.cpp | 2 +- src/thermo/PDSS_SSVol.cpp | 6 +- src/thermo/PhaseCombo_Interaction.cpp | 8 +- src/thermo/RedlichKisterVPSSTP.cpp | 4 +- src/thermo/RedlichKwongMFTP.cpp | 6 +- src/thermo/Species.cpp | 2 - src/thermo/SpeciesThermoFactory.cpp | 2 - src/thermo/StoichSubstance.cpp | 2 +- src/thermo/StoichSubstanceSSTP.cpp | 4 +- src/thermo/SurfPhase.cpp | 1 - src/thermo/ThermoFactory.cpp | 1 - src/thermo/ThermoPhase.cpp | 1 - src/thermo/VPSSMgrFactory.cpp | 1 - src/thermo/VPSSMgr_ConstVol.cpp | 4 +- src/thermo/VPSSMgr_IdealGas.cpp | 1 - src/thermo/VPSSMgr_Water_ConstVol.cpp | 4 +- src/transport/LTPspecies.cpp | 2 - src/transport/LiquidTranInteraction.cpp | 2 - src/transport/TransportData.cpp | 3 - test/thermo/phaseConstructors.cpp | 8 +- 53 files changed, 152 insertions(+), 194 deletions(-) diff --git a/include/cantera/base/ctml.h b/include/cantera/base/ctml.h index ff410b7db..bbfeb52fc 100644 --- a/include/cantera/base/ctml.h +++ b/include/cantera/base/ctml.h @@ -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 & v, +size_t getFloatArray(const XML_Node& node, std::vector & 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 & 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& v); +void getStringArray(const XML_Node& node, std::vector& 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& v); * @param m Output Map containing the pairs of values found * in the XML Node */ -void getMap(const Cantera::XML_Node& node, std::map& m); +void getMap(const XML_Node& node, std::map& 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& m * * @return Returns the number of pairs found */ -int getPairs(const Cantera::XML_Node& node, std::vector& key, +int getPairs(const XML_Node& node, std::vector& key, std::vector& val); //! This function interprets the value portion of an XML element @@ -405,10 +395,10 @@ int getPairs(const Cantera::XML_Node& node, std::vector& 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& keyStringRow, const std::vector& 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& v); +void getIntegers(const XML_Node& node, std::map& v); //! Get a floating-point value from a child element. /*! @@ -475,7 +465,7 @@ void getIntegers(const Cantera::XML_Node& node, std::map& 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 diff --git a/include/cantera/thermo/MetalPhase.h b/include/cantera/thermo/MetalPhase.h index c423ec872..5df3b7057 100644 --- a/include/cantera/thermo/MetalPhase.h +++ b/include/cantera/thermo/MetalPhase.h @@ -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); } diff --git a/include/cantera/thermo/SemiconductorPhase.h b/include/cantera/thermo/SemiconductorPhase.h index 467d491d8..8dae8170d 100644 --- a/include/cantera/thermo/SemiconductorPhase.h +++ b/include/cantera/thermo/SemiconductorPhase.h @@ -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); diff --git a/src/base/application.cpp b/src/base/application.cpp index 8f41bd9d2..92bc58681 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -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); diff --git a/src/base/ct2ctml.cpp b/src/base/ct2ctml.cpp index cb556c304..f0a190586 100644 --- a/src/base/ct2ctml.cpp +++ b/src/base/ct2ctml.cpp @@ -17,10 +17,9 @@ #include #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."); diff --git a/src/base/ctml.cpp b/src/base/ctml.cpp index f9fd0235a..ab27c8e04 100644 --- a/src/base/ctml.cpp +++ b/src/base/ctml.cpp @@ -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& v) { std::vector 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 & v, +size_t getFloatArray(const XML_Node& node, std::vector & 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 ll = node.getChildren(nodeName); + vector 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 & v, return v.size(); } -void getMap(const Cantera::XML_Node& node, std::map& m) +void getMap(const XML_Node& node, std::map& m) { std::vector v; getStringArray(node, v); @@ -416,7 +414,7 @@ void getMap(const Cantera::XML_Node& node, std::map& m } } -int getPairs(const Cantera::XML_Node& node, std::vector& key, +int getPairs(const XML_Node& node, std::vector& key, std::vector& val) { vector v; @@ -434,10 +432,10 @@ int getPairs(const Cantera::XML_Node& node, std::vector& key, return n; } -void getMatrixValues(const Cantera::XML_Node& node, +void getMatrixValues(const XML_Node& node, const std::vector& keyStringRow, const std::vector& 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& v) +void getStringArray(const XML_Node& node, std::vector& v) { tokenizeString(node.value(), v); } diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index d215b1399..3435bd00a 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -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); diff --git a/src/clib/ctxml.cpp b/src/clib/ctxml.cpp index 0ef390f80..75219348f 100644 --- a/src/clib/ctxml.cpp +++ b/src/clib/ctxml.cpp @@ -13,7 +13,6 @@ using namespace std; using namespace Cantera; -using namespace ctml; typedef Cabinet XmlCabinet; template<> XmlCabinet* XmlCabinet::s_storage = 0; diff --git a/src/fortran/fctxml.cpp b/src/fortran/fctxml.cpp index c51e032df..f1b9dc362 100644 --- a/src/fortran/fctxml.cpp +++ b/src/fortran/fctxml.cpp @@ -11,7 +11,6 @@ #include #include -using namespace ctml; using namespace std; using Cantera::XML_Node; using Cantera::CanteraError; diff --git a/src/kinetics/Reaction.cpp b/src/kinetics/Reaction.cpp index 51c084f70..62a5d262f 100644 --- a/src/kinetics/Reaction.cpp +++ b/src/kinetics/Reaction.cpp @@ -8,8 +8,6 @@ #include "cantera/base/Array.h" #include -using namespace ctml; - namespace Cantera { diff --git a/src/kinetics/importKinetics.cpp b/src/kinetics/importKinetics.cpp index 9de0f1a21..794d124db 100644 --- a/src/kinetics/importKinetics.cpp +++ b/src/kinetics/importKinetics.cpp @@ -20,7 +20,6 @@ #include -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 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 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++) { diff --git a/src/oneD/Domain1D.cpp b/src/oneD/Domain1D.cpp index 660aa9c48..651444045 100644 --- a/src/oneD/Domain1D.cpp +++ b/src/oneD/Domain1D.cpp @@ -9,7 +9,6 @@ #include using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/oneD/OneDim.cpp b/src/oneD/OneDim.cpp index d204611fc..05fb403d1 100644 --- a/src/oneD/OneDim.cpp +++ b/src/oneD/OneDim.cpp @@ -8,7 +8,6 @@ #include #include -using namespace ctml; using namespace std; namespace Cantera diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index fa7196ef4..6750d6369 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -10,7 +10,6 @@ #include -using namespace ctml; using namespace std; namespace Cantera diff --git a/src/oneD/boundaries1D.cpp b/src/oneD/boundaries1D.cpp index c97aee3f6..a0c72bce9 100644 --- a/src/oneD/boundaries1D.cpp +++ b/src/oneD/boundaries1D.cpp @@ -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++) { diff --git a/src/thermo/ConstDensityThermo.cpp b/src/thermo/ConstDensityThermo.cpp index f68064ba4..bb4bd9000 100644 --- a/src/thermo/ConstDensityThermo.cpp +++ b/src/thermo/ConstDensityThermo.cpp @@ -10,8 +10,6 @@ #include "cantera/thermo/ConstDensityThermo.h" #include "cantera/base/ctml.h" -using namespace ctml; - namespace Cantera { diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index 42bf6e220..4aef6632f 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -23,7 +23,6 @@ #include using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/Elements.cpp b/src/thermo/Elements.cpp index c1d707ff0..6ae2e8d88 100644 --- a/src/thermo/Elements.cpp +++ b/src/thermo/Elements.cpp @@ -9,7 +9,6 @@ #include "cantera/base/ctml.h" #include "cantera/base/stringUtils.h" -using namespace ctml; using namespace std; namespace Cantera diff --git a/src/thermo/FixedChemPotSSTP.cpp b/src/thermo/FixedChemPotSSTP.cpp index a55801cad..362c5ae87 100644 --- a/src/thermo/FixedChemPotSSTP.cpp +++ b/src/thermo/FixedChemPotSSTP.cpp @@ -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; } } diff --git a/src/thermo/HMWSoln_input.cpp b/src/thermo/HMWSoln_input.cpp index a0eede497..99ebdfd13 100644 --- a/src/thermo/HMWSoln_input.cpp +++ b/src/thermo/HMWSoln_input.cpp @@ -22,7 +22,6 @@ #include using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index 33ba92c0c..9f49d6ef6 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -22,8 +22,6 @@ #include "cantera/base/ctml.h" #include -using namespace ctml; - namespace Cantera { diff --git a/src/thermo/IdealSolidSolnPhase.cpp b/src/thermo/IdealSolidSolnPhase.cpp index ecf2050e5..74b7746f1 100644 --- a/src/thermo/IdealSolidSolnPhase.cpp +++ b/src/thermo/IdealSolidSolnPhase.cpp @@ -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"); } /* diff --git a/src/thermo/LatticePhase.cpp b/src/thermo/LatticePhase.cpp index 7a857369b..4f591a3d3 100644 --- a/src/thermo/LatticePhase.cpp +++ b/src/thermo/LatticePhase.cpp @@ -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"); } } diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 568eed052..988e60e57 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -433,7 +433,7 @@ void LatticeSolidPhase::setParametersFromXML(const XML_Node& eosdata) } std::vector pnam; std::vector 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]); diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index 62fd7aa6f..c6f5274ae 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -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, diff --git a/src/thermo/MetalSHEelectrons.cpp b/src/thermo/MetalSHEelectrons.cpp index bbb37fefc..5c3e1c1c5 100644 --- a/src/thermo/MetalSHEelectrons.cpp +++ b/src/thermo/MetalSHEelectrons.cpp @@ -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); } diff --git a/src/thermo/MineralEQ3.cpp b/src/thermo/MineralEQ3.cpp index 3c349eb9f..762c9ac17 100644 --- a/src/thermo/MineralEQ3.cpp +++ b/src/thermo/MineralEQ3.cpp @@ -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(); } diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index 0a6ed5507..86a19fbf0 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -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, diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index ab69e52aa..5e628fc46 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -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(); diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index ef055ad34..5ce18b733 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -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); } } diff --git a/src/thermo/Mu0Poly.cpp b/src/thermo/Mu0Poly.cpp index bffe44285..d118baa81 100644 --- a/src/thermo/Mu0Poly.cpp +++ b/src/thermo/Mu0Poly.cpp @@ -11,7 +11,6 @@ #include "cantera/base/stringUtils.h" using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/PDSS_ConstVol.cpp b/src/thermo/PDSS_ConstVol.cpp index e23f8e020..a0d590b48 100644 --- a/src/thermo/PDSS_ConstVol.cpp +++ b/src/thermo/PDSS_ConstVol.cpp @@ -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, diff --git a/src/thermo/PDSS_HKFT.cpp b/src/thermo/PDSS_HKFT.cpp index 331115280..40af18791 100644 --- a/src/thermo/PDSS_HKFT.cpp +++ b/src/thermo/PDSS_HKFT.cpp @@ -20,7 +20,6 @@ #include using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/PDSS_IonsFromNeutral.cpp b/src/thermo/PDSS_IonsFromNeutral.cpp index b06e770a2..189a4b899 100644 --- a/src/thermo/PDSS_IonsFromNeutral.cpp +++ b/src/thermo/PDSS_IonsFromNeutral.cpp @@ -139,7 +139,7 @@ void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP* tp, size_t spinde std::vector key; std::vector val; - numMult_ = ctml::getPairs(*nsm, key, val); + numMult_ = getPairs(*nsm, key, val); idNeutralMoleculeVec.resize(numMult_); factorVec.resize(numMult_); tmpNM.resize(neutralMoleculePhase_->nSpecies()); diff --git a/src/thermo/PDSS_SSVol.cpp b/src/thermo/PDSS_SSVol.cpp index 1657f140d..fb5dce9b7 100644 --- a/src/thermo/PDSS_SSVol.cpp +++ b/src/thermo/PDSS_SSVol.cpp @@ -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()); diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index b1a3d2459..75ad218a4 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -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, diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 824bfe392..6d76d85e4 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -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); } } diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index 6c8e41c93..e027868ca 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -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 + ")", diff --git a/src/thermo/Species.cpp b/src/thermo/Species.cpp index 49b9008d0..dd2abee36 100644 --- a/src/thermo/Species.cpp +++ b/src/thermo/Species.cpp @@ -9,8 +9,6 @@ #include #include -using namespace ctml; - namespace Cantera { Species::Species() diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 20f030fae..71d492edf 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -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; diff --git a/src/thermo/StoichSubstance.cpp b/src/thermo/StoichSubstance.cpp index fbafca7d6..e615918e6 100644 --- a/src/thermo/StoichSubstance.cpp +++ b/src/thermo/StoichSubstance.cpp @@ -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); } diff --git a/src/thermo/StoichSubstanceSSTP.cpp b/src/thermo/StoichSubstanceSSTP.cpp index c20ae4843..a2e25aa3b 100644 --- a/src/thermo/StoichSubstanceSSTP.cpp +++ b/src/thermo/StoichSubstanceSSTP.cpp @@ -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 ------ diff --git a/src/thermo/SurfPhase.cpp b/src/thermo/SurfPhase.cpp index 6332e7358..bfe81430e 100644 --- a/src/thermo/SurfPhase.cpp +++ b/src/thermo/SurfPhase.cpp @@ -14,7 +14,6 @@ #include "cantera/base/ctml.h" #include "cantera/base/vec_functions.h" -using namespace ctml; using namespace std; namespace Cantera diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 7a9347f48..065f45386 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -56,7 +56,6 @@ #include "cantera/base/stringUtils.h" using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index ce76ae726..b24282630 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -21,7 +21,6 @@ #include using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/VPSSMgrFactory.cpp b/src/thermo/VPSSMgrFactory.cpp index fb1425fd5..d8727680c 100644 --- a/src/thermo/VPSSMgrFactory.cpp +++ b/src/thermo/VPSSMgrFactory.cpp @@ -24,7 +24,6 @@ #include "cantera/base/stringUtils.h" #include "cantera/base/ctml.h" -using namespace ctml; using namespace std; namespace Cantera diff --git a/src/thermo/VPSSMgr_ConstVol.cpp b/src/thermo/VPSSMgr_ConstVol.cpp index 85f6ae9a5..052dbcc2f 100644 --- a/src/thermo/VPSSMgr_ConstVol.cpp +++ b/src/thermo/VPSSMgr_ConstVol.cpp @@ -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); diff --git a/src/thermo/VPSSMgr_IdealGas.cpp b/src/thermo/VPSSMgr_IdealGas.cpp index 3e3c322df..49fe4288c 100644 --- a/src/thermo/VPSSMgr_IdealGas.cpp +++ b/src/thermo/VPSSMgr_IdealGas.cpp @@ -19,7 +19,6 @@ #include "cantera/thermo/SpeciesThermoInterpType.h" using namespace std; -using namespace ctml; namespace Cantera { diff --git a/src/thermo/VPSSMgr_Water_ConstVol.cpp b/src/thermo/VPSSMgr_Water_ConstVol.cpp index df9f7e675..21f40d5f7 100644 --- a/src/thermo/VPSSMgr_Water_ConstVol.cpp +++ b/src/thermo/VPSSMgr_Water_ConstVol.cpp @@ -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); diff --git a/src/transport/LTPspecies.cpp b/src/transport/LTPspecies.cpp index 95430b1f7..ffc9c57e3 100644 --- a/src/transport/LTPspecies.cpp +++ b/src/transport/LTPspecies.cpp @@ -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 { diff --git a/src/transport/LiquidTranInteraction.cpp b/src/transport/LiquidTranInteraction.cpp index 675f60ae1..b1bddf5a9 100644 --- a/src/transport/LiquidTranInteraction.cpp +++ b/src/transport/LiquidTranInteraction.cpp @@ -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. diff --git a/src/transport/TransportData.cpp b/src/transport/TransportData.cpp index 7fb6a6bb5..f5d671ca8 100644 --- a/src/transport/TransportData.cpp +++ b/src/transport/TransportData.cpp @@ -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) diff --git a/test/thermo/phaseConstructors.cpp b/test/thermo/phaseConstructors.cpp index 9521f9154..1c54a0044 100644 --- a/test/thermo/phaseConstructors.cpp +++ b/test/thermo/phaseConstructors.cpp @@ -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