diff --git a/doc/sphinx/cxx-guide/thermodemo.cpp b/doc/sphinx/cxx-guide/thermodemo.cpp index ca3ed9013..2a1b3c65c 100644 --- a/doc/sphinx/cxx-guide/thermodemo.cpp +++ b/doc/sphinx/cxx-guide/thermodemo.cpp @@ -2,7 +2,7 @@ using namespace Cantera; -void thermo_demo(std::string file, std::string phase) +void thermo_demo(const std::string& file, const std::string& phase) { ThermoPhase* gas = newPhase(file, phase); gas->setState_TPX(1500.0, 2.0*OneAtm, "O2:1.0, H2:3.0, AR:1.0"); diff --git a/include/cantera/Edge.h b/include/cantera/Edge.h index b5a42e4e8..cbf68d49c 100644 --- a/include/cantera/Edge.h +++ b/include/cantera/Edge.h @@ -14,7 +14,7 @@ class Edge : public EdgePhase, public EdgeKinetics { public: - Edge(std::string infile, std::string id, std::vector phases) + Edge(const std::string& infile, std::string id, std::vector phases) : m_ok(false), m_r(0) { m_r = get_XML_File(infile); diff --git a/include/cantera/IdealGasMix.h b/include/cantera/IdealGasMix.h index acd9febe7..82ab1529f 100644 --- a/include/cantera/IdealGasMix.h +++ b/include/cantera/IdealGasMix.h @@ -19,7 +19,7 @@ public: IdealGasMix() : m_ok(false), m_r(0) {} - IdealGasMix(std::string infile, std::string id="") : + IdealGasMix(const std::string& infile, std::string id="") : m_ok(false), m_r(0) { m_r = get_XML_File(infile); diff --git a/include/cantera/IncompressibleSolid.h b/include/cantera/IncompressibleSolid.h index cd0d8ae29..652b007e8 100644 --- a/include/cantera/IncompressibleSolid.h +++ b/include/cantera/IncompressibleSolid.h @@ -12,7 +12,7 @@ namespace Cantera class IncompressibleSolid : public ConstDensityThermo { public: - IncompressibleSolid(std::string infile, + IncompressibleSolid(const std::string& infile, std::string id="") : m_ok(false), m_r(0) { m_r = get_XML_File(infile); diff --git a/include/cantera/Interface.h b/include/cantera/Interface.h index 120c6423b..1280bd78b 100644 --- a/include/cantera/Interface.h +++ b/include/cantera/Interface.h @@ -44,7 +44,7 @@ public: * the ReactingSurface class. These classes will be migrated into Cantera * soon. */ - Interface(std::string infile, std::string id, + Interface(const std::string& infile, std::string id, std::vector otherPhases) : m_ok(false), m_r(0) { @@ -122,7 +122,8 @@ protected: /*! * This is the preferred method to create an Interface instance. */ -Interface* importInterface(std::string infile, std::string id, std::vector phases) +Interface* importInterface(const std::string& infile, const std::string& id, + std::vector phases) { return new Interface(infile, id, phases); } diff --git a/include/cantera/Metal.h b/include/cantera/Metal.h index 1fa35fe60..c37556fe1 100644 --- a/include/cantera/Metal.h +++ b/include/cantera/Metal.h @@ -12,7 +12,7 @@ namespace Cantera class Metal : public MetalPhase { public: - Metal(std::string infile, std::string id="") : m_ok(false), m_r(0) { + Metal(const std::string& infile, std::string id="") : m_ok(false), m_r(0) { m_r = get_XML_File(infile); if (id == "-") { diff --git a/include/cantera/PureFluid.h b/include/cantera/PureFluid.h index 9ff149587..4a0c0c05b 100644 --- a/include/cantera/PureFluid.h +++ b/include/cantera/PureFluid.h @@ -17,7 +17,7 @@ public: PureFluid() : m_ok(false), m_r(0) {} - PureFluid(std::string infile, std::string id="") : m_ok(false), m_r(0) { + PureFluid(const std::string& infile, std::string id="") : m_ok(false), m_r(0) { m_r = get_XML_File(infile); if (id == "-") { @@ -29,7 +29,7 @@ public: } - PureFluid(XML_Node& root, std::string id) : m_ok(false), m_r(0) { + PureFluid(XML_Node& root, const std::string& id) : m_ok(false), m_r(0) { m_ok = buildSolutionFromXML(root, id, "phase", this, 0); } diff --git a/include/cantera/base/XML_Writer.h b/include/cantera/base/XML_Writer.h index 94054385b..f57edf5e3 100644 --- a/include/cantera/base/XML_Writer.h +++ b/include/cantera/base/XML_Writer.h @@ -26,7 +26,7 @@ public: return m_s; } - inline std::string XML_filter(std::string name) { + inline std::string XML_filter(const std::string& name) { int ns = static_cast(name.size()); std::string nm(name); for (int m = 0; m < ns; m++) diff --git a/include/cantera/base/ctexceptions.h b/include/cantera/base/ctexceptions.h index 602d0cb82..29093127d 100644 --- a/include/cantera/base/ctexceptions.h +++ b/include/cantera/base/ctexceptions.h @@ -78,7 +78,7 @@ public: * generated. * @param msg Descriptive string describing the type of error message. */ - CanteraError(std::string procedure, std::string msg); + CanteraError(const std::string& procedure, const std::string& msg); //! Destructor for base class does nothing virtual ~CanteraError() throw() {}; @@ -102,7 +102,7 @@ protected: CanteraError() : saved_(false) {}; //! Constructor used by derived classes that override getMessage() - CanteraError(std::string procedure); + explicit CanteraError(const std::string& procedure); //! The name of the procedure where the exception occurred std::string procedure_; @@ -134,7 +134,7 @@ public: * @param sz This is the length supplied to Cantera. * @param reqd This is the required length needed by Cantera */ - ArraySizeError(std::string procedure, size_t sz, size_t reqd) : + ArraySizeError(const std::string& procedure, size_t sz, size_t reqd) : CanteraError(procedure), sz_(sz), reqd_(reqd) {} virtual std::string getMessage() const; @@ -164,7 +164,7 @@ public: * @param mmax This is the maximum allowed value of the index. The * minimum allowed value is assumed to be 0. */ - IndexError(std::string func, std::string arrayName, size_t m, size_t mmax) : + IndexError(const std::string& func, const std::string& arrayName, size_t m, size_t mmax) : CanteraError(func), arrayName_(arrayName), m_(m), mmax_(mmax) {} virtual ~IndexError() throw() {}; diff --git a/include/cantera/base/ctml.h b/include/cantera/base/ctml.h index 738ae1c03..a602008f6 100644 --- a/include/cantera/base/ctml.h +++ b/include/cantera/base/ctml.h @@ -619,7 +619,7 @@ void getFloats(const Cantera::XML_Node& node, std::map& v, * @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, std::string name); +int getInteger(const Cantera::XML_Node& parent, const std::string& name); //! Get a floating-point value from a child element with a defined units field /*! @@ -655,8 +655,10 @@ int getInteger(const Cantera::XML_Node& parent, 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, std::string name, - std::string defaultUnits, std::string type="toSI"); +doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent, + const std::string& name, + const std::string& defaultUnits, + const std::string& type="toSI"); //! Get an optional model name from a named child node. /*! diff --git a/include/cantera/base/global.h b/include/cantera/base/global.h index b8a9e61fa..d2127a55a 100644 --- a/include/cantera/base/global.h +++ b/include/cantera/base/global.h @@ -53,7 +53,7 @@ std::string lastErrorMessage(); * * @ingroup errorhandling */ -void setError(std::string r, std::string msg); +void setError(const std::string& r, const std::string& msg); //! Prints all of the error messages to an ostream /*! @@ -172,7 +172,7 @@ void popError(); * * @ingroup inputfiles */ -std::string findInputFile(std::string name); +std::string findInputFile(const std::string& name); //! Add a directory to the input file search path. /*! @@ -180,7 +180,7 @@ std::string findInputFile(std::string name); * * @param dir String name for the directory to be added to the search path */ -void addDirectory(std::string dir); +void addDirectory(const std::string& dir); //@} @@ -313,14 +313,14 @@ void setLogger(Logger* logwriter); /*! * @param unit String containing the units */ -doublereal toSI(std::string unit); +doublereal toSI(const std::string& unit); /// Return the conversion factor to convert activation energy unit /// std::string 'unit' to Kelvin. /*! * @param unit String containing the activation energy units */ -doublereal actEnergyToSI(std::string unit); +doublereal actEnergyToSI(const std::string& unit); /// Return a pointer to the XML tree for a Cantera input file. /*! @@ -332,13 +332,13 @@ doublereal actEnergyToSI(std::string unit); * @param file String containing the relative or absolute file name * @param debug Debug flag */ -XML_Node* get_XML_File(std::string file, int debug = 0); +XML_Node* get_XML_File(const std::string& file, int debug = 0); /// Close a Cantera input file. /*! * @param file String containing the relative or absolute file name */ -void close_XML_File(std::string file); +void close_XML_File(const std::string& file); #ifdef WITH_HTML_LOGS @@ -376,7 +376,7 @@ void close_XML_File(std::string file); * @param loglevel loglevel of the group. * @ingroup HTML_logs */ -void beginLogGroup(std::string title, int loglevel=-99); +void beginLogGroup(const std::string& title, int loglevel=-99); //! Add an entry to an HTML log file. /*! @@ -387,7 +387,7 @@ void beginLogGroup(std::string title, int loglevel=-99); * * @ingroup HTML_logs */ -void addLogEntry(std::string tag, std::string value); +void addLogEntry(const std::string& tag, const std::string& value); //! Add an entry to an HTML log file. /*! @@ -398,7 +398,7 @@ void addLogEntry(std::string tag, std::string value); * * @ingroup HTML_logs */ -void addLogEntry(std::string tag, doublereal value); +void addLogEntry(const std::string& tag, doublereal value); //! Add an entry to an HTML log file. /*! @@ -409,7 +409,7 @@ void addLogEntry(std::string tag, doublereal value); * * @ingroup HTML_logs */ -void addLogEntry(std::string tag, int value); +void addLogEntry(const std::string& tag, int value); //! Add an entry msg string to an HTML log file. /*! @@ -419,7 +419,7 @@ void addLogEntry(std::string tag, int value); * * @ingroup HTML_logs */ -void addLogEntry(std::string msg); +void addLogEntry(const std::string& msg); //! Close the current group of log messages. /*! @@ -434,7 +434,7 @@ void addLogEntry(std::string msg); * log group created. * @ingroup HTML_logs */ -void endLogGroup(std::string title=""); +void endLogGroup(const std::string& title=""); //! Write the HTML log file. /*! @@ -451,16 +451,16 @@ void endLogGroup(std::string title=""); * @param file Name of the file to be written * @ingroup HTML_logs */ -void write_logfile(std::string file = "log.html"); +void write_logfile(const std::string& file = "log.html"); #else -inline void beginLogGroup(std::string title, int loglevel=-99) {} -inline void addLogEntry(std::string tag, std::string value) {} -inline void addLogEntry(std::string tag, doublereal value) {} -inline void addLogEntry(std::string tag, int value) {} -inline void addLogEntry(std::string msg) {} -inline void endLogGroup(std::string title="") {} -inline void write_logfile(std::string file = "log.html") {} +inline void beginLogGroup(const std::string& title, int loglevel=-99) {} +inline void addLogEntry(const std::string& tag, const std::string& value) {} +inline void addLogEntry(const std::string& tag, doublereal value) {} +inline void addLogEntry(const std::string& tag, int value) {} +inline void addLogEntry(const std::string& msg) {} +inline void endLogGroup(const std::string& title="") {} +inline void write_logfile(const std::string& file = "log.html") {} #endif //! This routine will locate an XML node in either the input diff --git a/include/cantera/base/stringUtils.h b/include/cantera/base/stringUtils.h index 7ccb8d67e..7b37a9a71 100644 --- a/include/cantera/base/stringUtils.h +++ b/include/cantera/base/stringUtils.h @@ -162,7 +162,7 @@ std::string getBaseName(const std::string& fullPath); * * @return Returns an integer */ -int intValue(std::string val); +int intValue(const std::string& val); //! Translate a string into one doublereal value /*! @@ -173,7 +173,7 @@ int intValue(std::string val); * * @return Returns a doublereal value */ -doublereal fpValue(std::string val); +doublereal fpValue(const std::string& val); //! Translate a string into one doublereal value /*! @@ -183,7 +183,7 @@ doublereal fpValue(std::string val); * * @return Returns a doublereal value */ -doublereal fpValueCheck(std::string val); +doublereal fpValueCheck(const std::string& val); //! Parse a name string, separating out the phase name from the species name /*! diff --git a/include/cantera/base/xml.h b/include/cantera/base/xml.h index 32fff945f..6cc6e415f 100644 --- a/include/cantera/base/xml.h +++ b/include/cantera/base/xml.h @@ -76,7 +76,7 @@ public: * @param attribs map of attribute name and * attribute value - output */ - void parseTag(std::string tag, std::string& name, + void parseTag(const std::string& tag, std::string& name, std::map& attribs) const; //! Reads an XML tag into a string @@ -302,7 +302,7 @@ public: * @param cname Name of the child node to the current * node, for which you want the value */ - std::string operator()(std::string cname) const; + std::string operator()(const std::string& cname) const; //! Return the value of an XML node as a single double /*! @@ -427,7 +427,7 @@ public: * * @return Returns true if the child node exists, false otherwise. */ - bool hasChild(const std::string ch) const; + bool hasChild(const std::string& ch) const; //! Tests whether the current node has an attribute with a particular name /*! @@ -435,7 +435,7 @@ public: * * @return Returns true if the attribute exists, false otherwise. */ - bool hasAttrib(std::string a) const; + bool hasAttrib(const std::string& a) const; //! Returns the name of the XML node /*! @@ -449,7 +449,7 @@ public: /*! * @param name The name of the XML node */ - void setName(std::string name) { + void setName(const std::string& name) { m_name = name; } diff --git a/include/cantera/equil/MultiPhase.h b/include/cantera/equil/MultiPhase.h index f221e013b..489493cd5 100644 --- a/include/cantera/equil/MultiPhase.h +++ b/include/cantera/equil/MultiPhase.h @@ -141,7 +141,7 @@ public: /*! * @param name String name of the global element */ - size_t elementIndex(std::string name) const; + size_t elementIndex(const std::string& name) const; //! Number of species, summed over all phases. size_t nSpecies() const { @@ -273,7 +273,7 @@ public: * If the species or phase name is not recognized, this routine throws * a CanteraError. */ - size_t speciesIndex(std::string speciesName, std::string phaseName); + size_t speciesIndex(const std::string& speciesName, const std::string& phaseName); /// Minimum temperature for which all solution phases have /// valid thermo data. Stoichiometric phases are not diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 2c42c9d5f..032653fb5 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -256,7 +256,7 @@ public: * If a -1 is returned, then the phase is not defined in * the Kinetics object. */ - size_t phaseIndex(std::string ph) { + size_t phaseIndex(const std::string& ph) { if (m_phaseindex.find(ph) == m_phaseindex.end()) { return npos; } else { @@ -396,7 +396,7 @@ public: * * @param nm String containing the name of the species. */ - thermo_t& speciesPhase(std::string nm); + thermo_t& speciesPhase(const std::string& nm); /** * This function takes as an argument the kineticsSpecies index @@ -1049,7 +1049,7 @@ private: /*! * @param m String message */ - void err(std::string m) const; + void err(const std::string& m) const; }; diff --git a/include/cantera/kinetics/KineticsFactory.h b/include/cantera/kinetics/KineticsFactory.h index 6ce3a6be7..895641d33 100644 --- a/include/cantera/kinetics/KineticsFactory.h +++ b/include/cantera/kinetics/KineticsFactory.h @@ -19,7 +19,7 @@ namespace Cantera class UnknownKineticsModel : public CanteraError { public: - UnknownKineticsModel(std::string proc, std::string kineticsModel) : + UnknownKineticsModel(const std::string& proc, const std::string& kineticsModel) : CanteraError(proc, "Specified Kinetics model " + kineticsModel + " does not match any known type.") {} @@ -62,7 +62,7 @@ public: virtual Kinetics* newKinetics(XML_Node& phase, std::vector th); - virtual Kinetics* newKinetics(std::string model); + virtual Kinetics* newKinetics(const std::string& model); private: @@ -88,7 +88,7 @@ inline Kinetics* newKineticsMgr(XML_Node& phase, /** * Create a new kinetics manager. */ -inline Kinetics* newKineticsMgr(std::string model, KineticsFactory* f=0) +inline Kinetics* newKineticsMgr(const std::string& model, KineticsFactory* f=0) { if (f == 0) { f = KineticsFactory::factory(); diff --git a/include/cantera/kinetics/ReactionPath.h b/include/cantera/kinetics/ReactionPath.h index 01612714f..fbfcb6fd0 100644 --- a/include/cantera/kinetics/ReactionPath.h +++ b/include/cantera/kinetics/ReactionPath.h @@ -107,7 +107,8 @@ public: /// Destructor virtual ~Path() {} - void addReaction(size_t rxnNumber, doublereal value, std::string label = ""); + void addReaction(size_t rxnNumber, doublereal value, + const std::string& label = ""); /// Upstream node. const SpeciesNode* begin() const { @@ -213,7 +214,7 @@ public: return m_nodes.size(); } - void addNode(size_t k, std::string nm, doublereal x = 0.0); + void addNode(size_t k, const std::string& nm, doublereal x = 0.0); void displayOnly(size_t k=npos) { m_local = k; @@ -222,10 +223,10 @@ public: void linkNodes(size_t k1, size_t k2, size_t rxn, doublereal value, std::string legend = ""); - void include(std::string aaname) { + void include(const std::string& aaname) { m_include.push_back(aaname); } - void exclude(std::string aaname) { + void exclude(const std::string& aaname) { m_exclude.push_back(aaname); } void include(std::vector& names) { @@ -247,7 +248,7 @@ public: std::vector species(); vector_int reactions(); void findMajorPaths(doublereal threshold, size_t lda, doublereal* a); - void setFont(std::string font) { + void setFont(const std::string& font) { m_font = font; } // public attributes @@ -292,7 +293,7 @@ public: int init(std::ostream& logfile, Kinetics& s); - int build(Kinetics& s, std::string element, std::ostream& output, + int build(Kinetics& s, const std::string& element, std::ostream& output, ReactionPathDiagram& r, bool quiet=false); int findGroups(std::ostream& logfile, Kinetics& s); diff --git a/include/cantera/kinetics/ReactionStoichMgr.h b/include/cantera/kinetics/ReactionStoichMgr.h index 0d6d11c43..fdde35466 100644 --- a/include/cantera/kinetics/ReactionStoichMgr.h +++ b/include/cantera/kinetics/ReactionStoichMgr.h @@ -217,7 +217,7 @@ public: */ virtual void multiplyRevProducts(const doublereal* c, doublereal* r); - virtual void write(std::string filename); + virtual void write(const std::string& filename); protected: diff --git a/include/cantera/kinetics/StoichManager.h b/include/cantera/kinetics/StoichManager.h index 265044061..145e31c7d 100644 --- a/include/cantera/kinetics/StoichManager.h +++ b/include/cantera/kinetics/StoichManager.h @@ -150,7 +150,7 @@ static doublereal ppow(doublereal x, doublereal order) } } -inline static std::string fmt(std::string r, size_t n) +inline static std::string fmt(const std::string& r, size_t n) { return r + "[" + int2str(n) + "]"; } @@ -220,21 +220,21 @@ public: return 1; } - void writeMultiply(std::string r, std::map& out) { + void writeMultiply(const std::string& r, std::map& out) { out[m_rxn] = fmt(r, m_ic0); } - void writeIncrementReaction(std::string r, std::map& out) { + void writeIncrementReaction(const std::string& r, std::map& out) { out[m_rxn] += " + "+fmt(r, m_ic0); } - void writeDecrementReaction(std::string r, std::map& out) { + void writeDecrementReaction(const std::string& r, std::map& out) { out[m_rxn] += " - "+fmt(r, m_ic0); } - void writeIncrementSpecies(std::string r, std::map& out) { + void writeIncrementSpecies(const std::string& r, std::map& out) { out[m_ic0] += " + "+fmt(r, m_rxn); } - void writeDecrementSpecies(std::string r, std::map& out) { + void writeDecrementSpecies(const std::string& r, std::map& out) { out[m_ic0] += " - "+fmt(r, m_rxn); } @@ -311,22 +311,22 @@ public: return 2; } - void writeMultiply(std::string r, std::map& out) { + void writeMultiply(const std::string& r, std::map& out) { out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1); } - void writeIncrementReaction(std::string r, std::map& out) { + void writeIncrementReaction(const std::string& r, std::map& out) { out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1); } - void writeDecrementReaction(std::string r, std::map& out) { + void writeDecrementReaction(const std::string& r, std::map& out) { out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1); } - void writeIncrementSpecies(std::string r, std::map& out) { + void writeIncrementSpecies(const std::string& r, std::map& out) { std::string s = " + "+fmt(r, m_rxn); out[m_ic0] += s; out[m_ic1] += s; } - void writeDecrementSpecies(std::string r, std::map& out) { + void writeDecrementSpecies(const std::string& r, std::map& out) { std::string s = " - "+fmt(r, m_rxn); out[m_ic0] += s; out[m_ic1] += s; @@ -416,22 +416,22 @@ public: return 3; } - void writeMultiply(std::string r, std::map& out) { + void writeMultiply(const std::string& r, std::map& out) { out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1) + " * " + fmt(r, m_ic2); } - void writeIncrementReaction(std::string r, std::map& out) { + void writeIncrementReaction(const std::string& r, std::map& out) { out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1)+" + "+fmt(r, m_ic2); } - void writeDecrementReaction(std::string r, std::map& out) { + void writeDecrementReaction(const std::string& r, std::map& out) { out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1)+" - "+fmt(r, m_ic2); } - void writeIncrementSpecies(std::string r, std::map& out) { + void writeIncrementSpecies(const std::string& r, std::map& out) { std::string s = " + "+fmt(r, m_rxn); out[m_ic0] += s; out[m_ic1] += s; out[m_ic2] += s; } - void writeDecrementSpecies(std::string r, std::map& out) { + void writeDecrementSpecies(const std::string& r, std::map& out) { std::string s = " - "+fmt(r, m_rxn); out[m_ic0] += s; out[m_ic1] += s; @@ -548,7 +548,7 @@ public: -= m_stoich[n]*input[m_ic[n]]; } - void writeMultiply(std::string r, std::map& out) { + void writeMultiply(const std::string& r, std::map& out) { out[m_rxn] = ""; for (size_t n = 0; n < m_n; n++) { if (m_order[n] == 1.0) { @@ -561,24 +561,24 @@ public: } } } - void writeIncrementReaction(std::string r, std::map& out) { + void writeIncrementReaction(const std::string& r, std::map& out) { for (size_t n = 0; n < m_n; n++) { out[m_rxn] += " + "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]); } } - void writeDecrementReaction(std::string r, std::map& out) { + void writeDecrementReaction(const std::string& r, std::map& out) { for (size_t n = 0; n < m_n; n++) { out[m_rxn] += " - "+fp2str(m_stoich[n]) + "*" + fmt(r, m_ic[n]); } } - void writeIncrementSpecies(std::string r, std::map& out) { + void writeIncrementSpecies(const std::string& r, std::map& out) { std::string s = fmt(r, m_rxn); for (size_t n = 0; n < m_n; n++) { out[m_ic[n]] += " + "+fp2str(m_stoich[n]) + "*" + s; } } - void writeDecrementSpecies(std::string r, std::map& out) { + void writeDecrementSpecies(const std::string& r, std::map& out) { std::string s = fmt(r, m_rxn); for (size_t n = 0; n < m_n; n++) { out[m_ic[n]] += " - "+fp2str(m_stoich[n]) + "*" + s; @@ -659,8 +659,8 @@ inline static void _decrementReactions(InputIter begin, template -inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::string r, - std::map& out) +inline static void _writeIncrementSpecies(InputIter begin, InputIter end, + const std::string& r, std::map& out) { for (; begin != end; ++begin) { begin->writeIncrementSpecies(r, out); @@ -668,8 +668,8 @@ inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::s } template -inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::string r, - std::map& out) +inline static void _writeDecrementSpecies(InputIter begin, InputIter end, + const std::string& r, std::map& out) { for (; begin != end; ++begin) { begin->writeDecrementSpecies(r, out); @@ -677,8 +677,8 @@ inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::s } template -inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::string r, - std::map& out) +inline static void _writeIncrementReaction(InputIter begin, InputIter end, + const std::string& r, std::map& out) { for (; begin != end; ++begin) { begin->writeIncrementReaction(r, out); @@ -686,8 +686,8 @@ inline static void _writeIncrementReaction(InputIter begin, InputIter end, std:: } template -inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::string r, - std::map& out) +inline static void _writeDecrementReaction(InputIter begin, InputIter end, + const std::string& r, std::map& out) { for (; begin != end; ++begin) { begin->writeDecrementReaction(r, out); @@ -695,8 +695,8 @@ inline static void _writeDecrementReaction(InputIter begin, InputIter end, std:: } template -inline static void _writeMultiply(InputIter begin, InputIter end, std::string r, - std::map& out) +inline static void _writeMultiply(InputIter begin, InputIter end, + const std::string& r, std::map& out) { for (; begin != end; ++begin) { begin->writeMultiply(r, out); @@ -891,35 +891,35 @@ public: _decrementReactions(m_cn_list.begin(), m_cn_list.end(), input, output); } - void writeIncrementSpecies(std::string r, std::map& out) { + void writeIncrementSpecies(const std::string& r, std::map& out) { _writeIncrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out); _writeIncrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out); _writeIncrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out); _writeIncrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out); } - void writeDecrementSpecies(std::string r, std::map& out) { + void writeDecrementSpecies(const std::string& r, std::map& out) { _writeDecrementSpecies(m_c1_list.begin(), m_c1_list.end(), r, out); _writeDecrementSpecies(m_c2_list.begin(), m_c2_list.end(), r, out); _writeDecrementSpecies(m_c3_list.begin(), m_c3_list.end(), r, out); _writeDecrementSpecies(m_cn_list.begin(), m_cn_list.end(), r, out); } - void writeIncrementReaction(std::string r, std::map& out) { + void writeIncrementReaction(const std::string& r, std::map& out) { _writeIncrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out); _writeIncrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out); _writeIncrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out); _writeIncrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out); } - void writeDecrementReaction(std::string r, std::map& out) { + void writeDecrementReaction(const std::string& r, std::map& out) { _writeDecrementReaction(m_c1_list.begin(), m_c1_list.end(), r, out); _writeDecrementReaction(m_c2_list.begin(), m_c2_list.end(), r, out); _writeDecrementReaction(m_c3_list.begin(), m_c3_list.end(), r, out); _writeDecrementReaction(m_cn_list.begin(), m_cn_list.end(), r, out); } - void writeMultiply(std::string r, std::map& out) { + void writeMultiply(const std::string& r, std::map& out) { _writeMultiply(m_c1_list.begin(), m_c1_list.end(), r, out); _writeMultiply(m_c2_list.begin(), m_c2_list.end(), r, out); _writeMultiply(m_c3_list.begin(), m_c3_list.end(), r, out); diff --git a/include/cantera/kinetics/importKinetics.h b/include/cantera/kinetics/importKinetics.h index aabd2d09d..3f37bdbd7 100644 --- a/include/cantera/kinetics/importKinetics.h +++ b/include/cantera/kinetics/importKinetics.h @@ -225,8 +225,8 @@ bool importKinetics(const XML_Node& phase, std::vector th, * @ingroup inputfiles * @see importKinetics() */ -bool buildSolutionFromXML(XML_Node& root, std::string id, std::string nm, - ThermoPhase* th, Kinetics* k); +bool buildSolutionFromXML(XML_Node& root, const std::string& id, + const std::string& nm, ThermoPhase* th, Kinetics* k); //! Search an XML tree for species data. /*! diff --git a/include/cantera/numerics/BEulerInt.h b/include/cantera/numerics/BEulerInt.h index d57e3f7e0..7bb82eb43 100644 --- a/include/cantera/numerics/BEulerInt.h +++ b/include/cantera/numerics/BEulerInt.h @@ -47,7 +47,7 @@ enum BEulerMethodType { class BEulerErr : public CanteraError { public: - BEulerErr(std::string msg); + explicit BEulerErr(const std::string& msg); }; diff --git a/include/cantera/numerics/BandMatrix.h b/include/cantera/numerics/BandMatrix.h index f6d1fa3b7..8181a28ac 100644 --- a/include/cantera/numerics/BandMatrix.h +++ b/include/cantera/numerics/BandMatrix.h @@ -423,7 +423,7 @@ private: /*! * @param msg String containing the message. */ - void err(std::string msg) const; + void err(const std::string& msg) const; }; diff --git a/include/cantera/numerics/DAE_Solver.h b/include/cantera/numerics/DAE_Solver.h index 5a8120fed..92f6bc9a4 100644 --- a/include/cantera/numerics/DAE_Solver.h +++ b/include/cantera/numerics/DAE_Solver.h @@ -244,7 +244,7 @@ protected: private: - void warn(std::string msg) const { + void warn(const std::string& msg) const { writelog(">>>> Warning: method "+msg+" of base class " +"DAE_Solver called. Nothing done.\n"); } @@ -260,7 +260,7 @@ private: * * @return Returns a point to the instantiated DAE_Solver object */ -DAE_Solver* newDAE_Solver(std::string itype, ResidJacEval& f); +DAE_Solver* newDAE_Solver(const std::string& itype, ResidJacEval& f); #endif diff --git a/include/cantera/numerics/DenseMatrix.h b/include/cantera/numerics/DenseMatrix.h index 0ddf974dd..ce9030478 100644 --- a/include/cantera/numerics/DenseMatrix.h +++ b/include/cantera/numerics/DenseMatrix.h @@ -40,7 +40,7 @@ public: * @param routine Name of calling routine * @param msg Informative message */ - CELapackError(std::string routine, std::string msg) : + CELapackError(const std::string& routine, const std::string& msg) : CanteraError(routine + " LAPACK ERROR", msg) { } diff --git a/include/cantera/numerics/Func1.h b/include/cantera/numerics/Func1.h index e2b2e68c3..595d6b0ae 100644 --- a/include/cantera/numerics/Func1.h +++ b/include/cantera/numerics/Func1.h @@ -89,7 +89,7 @@ public: virtual doublereal isProportional(TimesConstant1& other); virtual doublereal isProportional(Func1& other); - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; //! accessor function for the stored constant @@ -166,7 +166,7 @@ public: return (Func1&) *nfunc; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int ID() const { return SinFuncType; @@ -204,7 +204,7 @@ public: Cos1* nfunc = new Cos1(*this); return (Func1&) *nfunc; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int ID() const { return CosFuncType; } @@ -236,7 +236,7 @@ public: Func1::operator=(right); return *this; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int ID() const { return ExpFuncType; } @@ -272,7 +272,7 @@ public: Func1::operator=(right); return *this; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int ID() const { return PowFuncType; } @@ -313,7 +313,7 @@ public: return *this; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int ID() const { return ConstFuncType; } @@ -394,7 +394,7 @@ public: return 0; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; }; @@ -456,7 +456,7 @@ public: return 0; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; }; @@ -509,7 +509,7 @@ public: return dup; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual doublereal eval(doublereal t) const { return m_f1->eval(t) * m_f2->eval(t); @@ -596,7 +596,7 @@ public: return *d; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int order() const { return 0; @@ -654,7 +654,7 @@ public: Func1& f1d = m_f1->derivative(); return f1d; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int order() const { return 0; @@ -725,7 +725,7 @@ public: return r; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int order() const { return 1; @@ -795,7 +795,7 @@ public: return *p; } - virtual std::string write(std::string arg) const; + virtual std::string write(const std::string& arg) const; virtual int order() const { return 2; diff --git a/include/cantera/numerics/IDA_Solver.h b/include/cantera/numerics/IDA_Solver.h index b594f8e6f..4b4cf5b3e 100644 --- a/include/cantera/numerics/IDA_Solver.h +++ b/include/cantera/numerics/IDA_Solver.h @@ -40,7 +40,7 @@ namespace Cantera class IDA_Err : public CanteraError { public: - IDA_Err(std::string msg) : CanteraError("IDA_Solver", msg) {} + explicit IDA_Err(const std::string& msg) : CanteraError("IDA_Solver", msg) {} }; diff --git a/include/cantera/numerics/Integrator.h b/include/cantera/numerics/Integrator.h index 301c88f26..2ecbabb3d 100644 --- a/include/cantera/numerics/Integrator.h +++ b/include/cantera/numerics/Integrator.h @@ -205,7 +205,7 @@ public: private: doublereal m_dummy; - void warn(std::string msg) const { + void warn(const std::string& msg) const { writelog(">>>> Warning: method "+msg+" of base class " +"Integrator called. Nothing done.\n"); } @@ -213,7 +213,7 @@ private: }; // defined in ODE_integrators.cpp -Integrator* newIntegrator(std::string itype); +Integrator* newIntegrator(const std::string& itype); // defined in ODE_integrators.cpp void deleteIntegrator(Integrator* cv); diff --git a/include/cantera/oneD/Domain1D.h b/include/cantera/oneD/Domain1D.h index 1e11db3ed..ddcc63b06 100644 --- a/include/cantera/oneD/Domain1D.h +++ b/include/cantera/oneD/Domain1D.h @@ -225,7 +225,7 @@ public: } } - void setComponentName(size_t n, std::string name) { + void setComponentName(size_t n, const std::string& name) { m_name[n] = name; } @@ -236,7 +236,7 @@ public: } /// index of component with name \a name. - size_t componentIndex(std::string name) const { + size_t componentIndex(const std::string& name) const { size_t nc = nComponents(); for (size_t n = 0; n < nc; n++) { if (name == componentName(n)) { @@ -543,7 +543,7 @@ public: } - void setProfile(std::string name, doublereal* values, doublereal* soln) { + void setProfile(const std::string& name, doublereal* values, doublereal* soln) { for (size_t n = 0; n < m_nv; n++) { if (name == componentName(n)) { for (size_t j = 0; j < m_points; j++) { diff --git a/include/cantera/oneD/Inlet1D.h b/include/cantera/oneD/Inlet1D.h index 190c1227a..3a77777eb 100644 --- a/include/cantera/oneD/Inlet1D.h +++ b/include/cantera/oneD/Inlet1D.h @@ -59,7 +59,7 @@ public: } /// Set the mole fractions by specifying a std::string. - virtual void setMoleFractions(std::string xin) { + virtual void setMoleFractions(const std::string& xin) { err("setMoleFractions"); } @@ -105,7 +105,7 @@ protected: doublereal m_temp, m_mdot; private: - void err(std::string method) { + void err(const std::string& method) { throw CanteraError("Bdry1D::"+method, "attempt to call base class method "+method); } @@ -169,7 +169,7 @@ public: virtual void _finalize(const doublereal* x) {} - virtual void setMoleFractions(std::string xin); + virtual void setMoleFractions(const std::string& xin); virtual void setMoleFractions(doublereal* xin); virtual doublereal massFraction(size_t k) { return m_yin[k]; @@ -319,7 +319,7 @@ public: ; } - virtual void setMoleFractions(std::string xin); + virtual void setMoleFractions(const std::string& xin); virtual void setMoleFractions(doublereal* xin); virtual doublereal massFraction(size_t k) { return m_yres[k]; diff --git a/include/cantera/oneD/OneDim.h b/include/cantera/oneD/OneDim.h index 560a60d49..e8471e72c 100644 --- a/include/cantera/oneD/OneDim.h +++ b/include/cantera/oneD/OneDim.h @@ -58,7 +58,7 @@ public: return *m_dom[i]; } - size_t domainIndex(std::string name); + size_t domainIndex(const std::string& name); //! Check that the specified domain index is in range //! Throws an exception if n is greater than nDomains()-1 @@ -192,7 +192,8 @@ public: */ void writeStats(int printTime = 1); - void save(std::string fname, std::string id, std::string desc, doublereal* sol); + void save(const std::string& fname, std::string id, + const std::string& desc, doublereal* sol); // options void setMinTimeStep(doublereal tmin) { diff --git a/include/cantera/oneD/Sim1D.h b/include/cantera/oneD/Sim1D.h index 083f189c2..5276a04ff 100644 --- a/include/cantera/oneD/Sim1D.h +++ b/include/cantera/oneD/Sim1D.h @@ -52,7 +52,8 @@ public: //@{ /// Set initial guess based on equilibrium - void setInitialGuess(std::string component, vector_fp& locs, vector_fp& vals); + void setInitialGuess(const std::string& component, vector_fp& locs, + vector_fp& vals); /// Set one entry in the solution vector. void setValue(size_t dom, size_t comp, size_t localPoint, doublereal value); @@ -71,7 +72,8 @@ public: //@} - void save(std::string fname, std::string id, std::string desc); + void save(const std::string& fname, const std::string& id, + const std::string& desc); /// Print to stream s the current solution for all domains. void showSolution(std::ostream& s); @@ -102,7 +104,7 @@ public: doublereal slope = 0.8, doublereal curve = 0.8, doublereal prune = -0.1); void setMaxGridPoints(int dom = -1, int npoints = 300); - void restore(std::string fname, std::string id); + void restore(const std::string& fname, const std::string& id); void getInitialSoln(); void setSolution(const doublereal* soln) { diff --git a/include/cantera/oneD/StFlow.h b/include/cantera/oneD/StFlow.h index f0a1e9bf5..6cdf5498c 100644 --- a/include/cantera/oneD/StFlow.h +++ b/include/cantera/oneD/StFlow.h @@ -177,7 +177,7 @@ public: virtual std::string componentName(size_t n) const; - size_t componentIndex(std::string name) const; + size_t componentIndex(const std::string& name) const; virtual void showSolution(const doublereal* x); diff --git a/include/cantera/thermo/AdsorbateThermo.h b/include/cantera/thermo/AdsorbateThermo.h index ea3fc0704..bb1cf28f5 100644 --- a/include/cantera/thermo/AdsorbateThermo.h +++ b/include/cantera/thermo/AdsorbateThermo.h @@ -81,7 +81,7 @@ public: return (SpeciesThermoInterpType*) np; } - virtual void install(std::string name, size_t index, int type, + virtual void install(const std::string& name, size_t index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure) { m_be = c[1]; diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index ca747c182..06c46a57b 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -625,7 +625,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - DebyeHuckel(std::string inputFile, std::string id = ""); + DebyeHuckel(const std::string& inputFile, const std::string& id = ""); //! Full constructor for creating the phase. /*! @@ -633,7 +633,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - DebyeHuckel(XML_Node& phaseRef, std::string id = ""); + DebyeHuckel(XML_Node& phaseRef, const std::string& id = ""); /// Destructor. virtual ~DebyeHuckel(); @@ -1279,7 +1279,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Return the Debye Huckel constant as a function of temperature //! and pressure (Units = sqrt(kg/gmol)) @@ -1670,7 +1670,7 @@ protected: mutable vector_fp m_dlnActCoeffMolaldP; private: - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; //! Initialize the internal lengths. /*! diff --git a/include/cantera/thermo/Elements.h b/include/cantera/thermo/Elements.h index 9e94f016d..f57b275c2 100644 --- a/include/cantera/thermo/Elements.h +++ b/include/cantera/thermo/Elements.h @@ -245,7 +245,7 @@ public: * * @param name String containing the index. */ - int elementIndex(std::string name) const; + int elementIndex(const std::string& name) const; //! Name of the element with index \c m. /*! diff --git a/include/cantera/thermo/FixedChemPotSSTP.h b/include/cantera/thermo/FixedChemPotSSTP.h index f73e61ebb..18f0327d1 100644 --- a/include/cantera/thermo/FixedChemPotSSTP.h +++ b/include/cantera/thermo/FixedChemPotSSTP.h @@ -172,7 +172,7 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - FixedChemPotSSTP(std::string infile, std::string id = ""); + FixedChemPotSSTP(const std::string& infile, std::string id = ""); //! Construct and initialize a FixedChemPotSSTP ThermoPhase object //! directly from an XML database @@ -180,7 +180,7 @@ public: * @param phaseRef XML node pointing to a FixedChemPotSSTP description * @param id Id of the phase. */ - FixedChemPotSSTP(XML_Node& phaseRef, std::string id = ""); + FixedChemPotSSTP(XML_Node& phaseRef, const std::string& id = ""); //! Copy constructor /*! @@ -198,7 +198,7 @@ public: * @param Ename String name of the element * @param chemPot Value of the chemical potential of that element (J/kmol) */ - FixedChemPotSSTP(std::string Ename, doublereal chemPot); + FixedChemPotSSTP(const std::string& Ename, doublereal chemPot); //! Assignment operator /*! @@ -575,7 +575,7 @@ public: virtual void initThermo(); - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the equation of state parameters /*! diff --git a/include/cantera/thermo/GeneralSpeciesThermo.h b/include/cantera/thermo/GeneralSpeciesThermo.h index 6234e3514..b359c922b 100644 --- a/include/cantera/thermo/GeneralSpeciesThermo.h +++ b/include/cantera/thermo/GeneralSpeciesThermo.h @@ -85,7 +85,7 @@ public: * @todo Create a factory method for SpeciesThermoInterpType. * That's basically what we are doing here. */ - virtual void install(std::string name, size_t index, int type, + virtual void install(const std::string& name, size_t index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure); diff --git a/include/cantera/thermo/GibbsExcessVPSSTP.h b/include/cantera/thermo/GibbsExcessVPSSTP.h index 29927a773..b331172e3 100644 --- a/include/cantera/thermo/GibbsExcessVPSSTP.h +++ b/include/cantera/thermo/GibbsExcessVPSSTP.h @@ -576,7 +576,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 24e1632a7..d0783fe9d 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -1254,7 +1254,7 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - HMWSoln(std::string inputFile, std::string id = ""); + HMWSoln(const std::string& inputFile, const std::string& id = ""); //! Construct and initialize an HMWSoln ThermoPhase object //! directly from an XML database @@ -1263,7 +1263,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - HMWSoln(XML_Node& phaseRef, std::string id = ""); + HMWSoln(XML_Node& phaseRef, const std::string& id = ""); //! Copy Constructor @@ -2078,7 +2078,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Value of the Debye Huckel constant as a function of temperature //! and pressure. @@ -3249,7 +3249,7 @@ private: /*! * @param msg print out a message and error exit */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; //! Initialize all of the species - dependent lengths in the object void initLengths(); @@ -3512,7 +3512,7 @@ private: /*! * @param estString string name of the electrolyte species type */ - static int interp_est(std::string estString); + static int interp_est(const std::string& estString); public: /*! diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 6e3d781e4..ab7ea08b5 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -127,7 +127,7 @@ public: * @param inputFile Name of the Input file that contains information about the phase * @param id id of the phase within the input file */ - IdealMolalSoln(std::string inputFile, std::string id = ""); + IdealMolalSoln(const std::string& inputFile, const std::string& id = ""); //! Constructor for phase initialization /*! @@ -138,7 +138,7 @@ public: * the information necessary to initialize the phase. * @param id id of the phase within the input file */ - IdealMolalSoln(XML_Node& phaseRef, std::string id = ""); + IdealMolalSoln(XML_Node& phaseRef, const std::string& id = ""); /// Destructor. virtual ~IdealMolalSoln(); @@ -807,7 +807,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id=""); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id=""); //! Report the molar volume of species k /*! @@ -926,7 +926,7 @@ private: /*! * @param msg message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; //! This function will be called to update the internally stored //! natural logarithm of the molality activity coefficients diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index 8d73b84ed..9ee18cf18 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -107,7 +107,7 @@ public: * @param formCG This parameter initializes the m_formGC variable. The default * is a value of 0. */ - IdealSolidSolnPhase(std::string infile, std::string id="", int formCG=0); + IdealSolidSolnPhase(const std::string& infile, const std::string& id="", int formCG=0); //! Construct and initialize an IdealSolidSolnPhase ThermoPhase object //! directly from an XML database @@ -131,7 +131,7 @@ public: * @param formCG This parameter initializes the m_formGC variable. The default * is a value of 0. */ - IdealSolidSolnPhase(XML_Node& root, std::string id="", int formCG=0); + IdealSolidSolnPhase(XML_Node& root, const std::string& id="", int formCG=0); /*! * Copy Constructor @@ -921,7 +921,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); /** diff --git a/include/cantera/thermo/IdealSolnGasVPSS.h b/include/cantera/thermo/IdealSolnGasVPSS.h index 62b57c631..40fd06e9e 100644 --- a/include/cantera/thermo/IdealSolnGasVPSS.h +++ b/include/cantera/thermo/IdealSolnGasVPSS.h @@ -55,7 +55,7 @@ public: /// Constructor. IdealSolnGasVPSS(); - IdealSolnGasVPSS(std::string infile, std::string id=""); + IdealSolnGasVPSS(const std::string& infile, std::string id=""); /// Copy Constructor. IdealSolnGasVPSS(const IdealSolnGasVPSS&); @@ -410,7 +410,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: //! @internal Initialize the internal lengths in this object. diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index f85b04e2c..348652724 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -107,7 +107,8 @@ public: * If this parameter is zero, then a slave * neutral phase object is created and used. */ - IonsFromNeutralVPSSTP(std::string inputFile, std::string id = "", + IonsFromNeutralVPSSTP(const std::string& inputFile, + const std::string& id = "", ThermoPhase* neutralPhase = 0); //! Construct and initialize an IonsFromNeutralVPSSTP object @@ -127,7 +128,7 @@ public: * If this parameter is zero, then a slave * neutral phase object is created and used. */ - IonsFromNeutralVPSSTP(XML_Node& phaseRoot, std::string id = "", + IonsFromNeutralVPSSTP(XML_Node& phaseRoot, const std::string& id = "", ThermoPhase* neutralPhase = 0); @@ -611,7 +612,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); private: @@ -678,7 +679,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index f2e7f206f..7da310b31 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -272,14 +272,14 @@ public: * @param inputFile String name of the input file * @param id string id of the phase name */ - LatticePhase(std::string inputFile, std::string id = ""); + LatticePhase(const std::string& inputFile, const std::string& id = ""); //! Full constructor for a water phase /*! * @param phaseRef XML node referencing the lattice phase. * @param id string id of the phase name */ - LatticePhase(XML_Node& phaseRef, std::string id = ""); + LatticePhase(XML_Node& phaseRef, const std::string& id = ""); //! Destructor virtual ~LatticePhase(); @@ -869,7 +869,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the equation of state parameters from the argument list /*! diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index d8e4bc637..6d19159db 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -641,7 +641,7 @@ public: * @param x string containing Name:value pairs that will specify the mole fractions * of species on a particular lattice */ - void setLatticeMoleFractionsByName(int n, std::string x); + void setLatticeMoleFractionsByName(int n, const std::string& x); #ifdef H298MODIFY_CAPABILITY @@ -663,7 +663,7 @@ private: * * @return nothing */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 24b5038d4..6e356114f 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -339,7 +339,7 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - MargulesVPSSTP(std::string inputFile, std::string id = ""); + MargulesVPSSTP(const std::string& inputFile, const std::string& id = ""); //! Construct and initialize a MargulesVPSSTP ThermoPhase object //! directly from an XML database @@ -348,7 +348,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - MargulesVPSSTP(XML_Node& phaseRef, std::string id = ""); + MargulesVPSSTP(XML_Node& phaseRef, const std::string& id = ""); //! Special constructor for a hard-coded problem @@ -686,7 +686,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); /** * @} @@ -839,7 +839,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/MetalSHEelectrons.h b/include/cantera/thermo/MetalSHEelectrons.h index 8e2525e3c..9c17abe4b 100644 --- a/include/cantera/thermo/MetalSHEelectrons.h +++ b/include/cantera/thermo/MetalSHEelectrons.h @@ -198,7 +198,7 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - MetalSHEelectrons(std::string infile, std::string id = ""); + MetalSHEelectrons(const std::string& infile, std::string id = ""); //! Construct and initialize a MetalSHEelectrons ThermoPhase object //! directly from an XML database @@ -206,7 +206,7 @@ public: * @param phaseRef XML node pointing to a MetalSHEelectrons description * @param id Id of the phase. */ - MetalSHEelectrons(XML_Node& phaseRef, std::string id = ""); + MetalSHEelectrons(XML_Node& phaseRef, const std::string& id = ""); //! Copy constructor /*! @@ -491,7 +491,7 @@ public: virtual void initThermo(); - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Make the default XML tree /*! diff --git a/include/cantera/thermo/MineralEQ3.h b/include/cantera/thermo/MineralEQ3.h index 8fef1116b..f07d0f26d 100644 --- a/include/cantera/thermo/MineralEQ3.h +++ b/include/cantera/thermo/MineralEQ3.h @@ -174,7 +174,7 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - MineralEQ3(std::string infile, std::string id = ""); + MineralEQ3(const std::string& infile, std::string id = ""); //! Construct and initialize a StoichSubstanceSSTP ThermoPhase object //! directly from an XML database @@ -182,7 +182,7 @@ public: * @param phaseRef XML node pointing to a StoichSubstanceSSTP description * @param id Id of the phase. */ - MineralEQ3(XML_Node& phaseRef, std::string id = ""); + MineralEQ3(XML_Node& phaseRef, const std::string& id = ""); //! Copy constructor /*! @@ -487,7 +487,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the equation of state parameters /*! diff --git a/include/cantera/thermo/MixedSolventElectrolyte.h b/include/cantera/thermo/MixedSolventElectrolyte.h index 7ba727425..a8076592c 100644 --- a/include/cantera/thermo/MixedSolventElectrolyte.h +++ b/include/cantera/thermo/MixedSolventElectrolyte.h @@ -340,7 +340,8 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - MixedSolventElectrolyte(std::string inputFile, std::string id = ""); + MixedSolventElectrolyte(const std::string& inputFile, + const std::string& id = ""); //! Construct and initialize a MixedSolventElectrolyte ThermoPhase object //! directly from an XML database @@ -349,7 +350,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - MixedSolventElectrolyte(XML_Node& phaseRef, std::string id = ""); + MixedSolventElectrolyte(XML_Node& phaseRef, const std::string& id = ""); //! Special constructor for a hard-coded problem @@ -688,7 +689,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); /** * @} @@ -841,7 +842,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index 17b078c1f..f838de033 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -688,7 +688,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: @@ -947,7 +947,7 @@ private: /*! * @param msg Error message string */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/thermo/MolalityVPSSTP.h b/include/cantera/thermo/MolalityVPSSTP.h index 58f7e7b4e..4e5a75b7e 100644 --- a/include/cantera/thermo/MolalityVPSSTP.h +++ b/include/cantera/thermo/MolalityVPSSTP.h @@ -760,7 +760,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the temperature (K), pressure (Pa), and molalities @@ -931,7 +931,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; diff --git a/include/cantera/thermo/MolarityIonicVPSSTP.h b/include/cantera/thermo/MolarityIonicVPSSTP.h index e94897e3e..c268d390b 100644 --- a/include/cantera/thermo/MolarityIonicVPSSTP.h +++ b/include/cantera/thermo/MolarityIonicVPSSTP.h @@ -85,7 +85,7 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - MolarityIonicVPSSTP(std::string inputFile, std::string id = ""); + MolarityIonicVPSSTP(const std::string& inputFile, const std::string& id = ""); //! Construct and initialize a MolarityIonicVPSSTP ThermoPhase object //! directly from an XML database @@ -94,7 +94,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - MolarityIonicVPSSTP(XML_Node& phaseRef, std::string id = ""); + MolarityIonicVPSSTP(XML_Node& phaseRef, const std::string& id = ""); //! Copy constructor @@ -385,7 +385,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); //! returns a summary of the state of the phase as a string @@ -449,7 +449,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/Mu0Poly.h b/include/cantera/thermo/Mu0Poly.h index c25a835d4..7955b6f80 100644 --- a/include/cantera/thermo/Mu0Poly.h +++ b/include/cantera/thermo/Mu0Poly.h @@ -297,7 +297,7 @@ private: * * @ingroup spthermo */ -void installMu0ThermoFromXML(std::string speciesName, +void installMu0ThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const XML_Node* Mu0Node_ptr); } diff --git a/include/cantera/thermo/PDSS.h b/include/cantera/thermo/PDSS.h index ccd457a55..0bde77843 100644 --- a/include/cantera/thermo/PDSS.h +++ b/include/cantera/thermo/PDSS.h @@ -281,7 +281,7 @@ private: /*! * @param msg Message string for this error */ - void err(std::string msg) const; + void err(const std::string& msg) const; public: @@ -605,7 +605,7 @@ public: * phase. If none is given, the first XML * phase element will be used. */ - virtual void initThermoXML(const XML_Node& phaseNode, std::string& id); + virtual void initThermoXML(const XML_Node& phaseNode, const std::string& id); //! This utility function reports back the type of diff --git a/include/cantera/thermo/PDSS_ConstVol.h b/include/cantera/thermo/PDSS_ConstVol.h index a5a889ee8..a64c1be46 100644 --- a/include/cantera/thermo/PDSS_ConstVol.h +++ b/include/cantera/thermo/PDSS_ConstVol.h @@ -57,7 +57,7 @@ public: * file is used. */ PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id = ""); + const std::string& inputFile, const std::string& id = ""); //! Constructor that initializes the object by examining the input file //! of the ThermoPhase object @@ -365,7 +365,7 @@ public: * phase element will be used. */ void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex, - std::string inputFile, std::string id); + const std::string& inputFile, const std::string& id); //! Initialization of a PDSS object using an xml tree /*! diff --git a/include/cantera/thermo/PDSS_HKFT.h b/include/cantera/thermo/PDSS_HKFT.h index 75c5ffe54..003f6f40e 100644 --- a/include/cantera/thermo/PDSS_HKFT.h +++ b/include/cantera/thermo/PDSS_HKFT.h @@ -94,7 +94,7 @@ public: * file is used. */ PDSS_HKFT(VPStandardStateTP* vptp_ptr, size_t spindex, - std::string inputFile, std::string id = ""); + const std::string& inputFile, const std::string& id = ""); //! Constructor that initializes the object by examining the input file //! of the ThermoPhase object @@ -380,7 +380,7 @@ public: * phase element will be used. */ void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex, - std::string inputFile, std::string id); + const std::string& inputFile, const std::string& id); //! Initialization of a PDSS object using an xml tree /*! diff --git a/include/cantera/thermo/PDSS_IdealGas.h b/include/cantera/thermo/PDSS_IdealGas.h index 0472491b3..771216575 100644 --- a/include/cantera/thermo/PDSS_IdealGas.h +++ b/include/cantera/thermo/PDSS_IdealGas.h @@ -69,7 +69,7 @@ public: * file is used. */ PDSS_IdealGas(VPStandardStateTP* tp, int spindex, - std::string inputFile, std::string id = ""); + const std::string& inputFile, const std::string& id = ""); //! Constructor that initializes the object by examining the input file @@ -364,7 +364,7 @@ public: * phase element will be used. */ void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex, - std::string inputFile, std::string id); + const std::string& inputFile, const std::string& id); //!Initialization of a PDSS object using an xml tree /*! @@ -389,7 +389,7 @@ public: * phase element will be used. */ void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex, - const XML_Node& phaseNode, std::string id); + const XML_Node& phaseNode, const std::string& id); //! Initialization routine for the PDSS object based on the phaseNode /*! diff --git a/include/cantera/thermo/PDSS_IonsFromNeutral.h b/include/cantera/thermo/PDSS_IonsFromNeutral.h index 09a076e1f..e52b304bd 100644 --- a/include/cantera/thermo/PDSS_IonsFromNeutral.h +++ b/include/cantera/thermo/PDSS_IonsFromNeutral.h @@ -59,7 +59,7 @@ public: * file is used. */ PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id = ""); + const std::string& inputFile, const std::string& id = ""); //! Constructor that initializes the object by examining the input file @@ -393,7 +393,7 @@ public: * phase element will be used. */ void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex, - std::string inputFile, std::string id); + const std::string& inputFile, const std::string& id); //! Initialization of a PDSS object using an xml tree /*! @@ -421,7 +421,7 @@ public: */ void constructPDSSXML(VPStandardStateTP* vptp_ptr, size_t spindex, const XML_Node& speciesNode, - const XML_Node& phaseNode, std::string id); + const XML_Node& phaseNode, const std::string& id); //! Initialization routine for the PDSS object based on the phaseNode /*! diff --git a/include/cantera/thermo/PDSS_SSVol.h b/include/cantera/thermo/PDSS_SSVol.h index 6610f678b..83c60c159 100644 --- a/include/cantera/thermo/PDSS_SSVol.h +++ b/include/cantera/thermo/PDSS_SSVol.h @@ -192,7 +192,7 @@ public: * file is used. */ PDSS_SSVol(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id = ""); + const std::string& inputFile, const std::string& id = ""); //! Constructor that initializes the object by examining the input file //! of the ThermoPhase object @@ -508,7 +508,7 @@ private: * phase element will be used. */ void constructPDSSFile(VPStandardStateTP* vptp_ptr, size_t spindex, - std::string inputFile, std::string id); + const std::string& inputFile, const std::string& id); //! Initialization of a PDSS object using an xml tree /*! diff --git a/include/cantera/thermo/PDSS_Water.h b/include/cantera/thermo/PDSS_Water.h index b949dda5c..2a71ab99a 100644 --- a/include/cantera/thermo/PDSS_Water.h +++ b/include/cantera/thermo/PDSS_Water.h @@ -106,7 +106,7 @@ public: * file is used. */ PDSS_Water(VPStandardStateTP* tp, int spindex, - std::string inputFile, std::string id = ""); + const std::string& inputFile, const std::string& id = ""); //! Constructor that initializes the object by examining the input file //! of the variable pressure ThermoPhase object @@ -430,7 +430,7 @@ public: * phase element will be used. */ void constructPDSSFile(VPStandardStateTP* vptp_ptr, int spindex, - std::string inputFile, std::string id); + const std::string& inputFile, const std::string& id); //!Initialization of a PDSS object using an xml tree /*! @@ -455,7 +455,7 @@ public: * phase element will be used. */ void constructPDSSXML(VPStandardStateTP* vptp_ptr, int spindex, - const XML_Node& phaseNode, std::string id); + const XML_Node& phaseNode, const std::string& id); //! Initialization routine for all of the shallow pointers /*! diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index ddf1fa8ba..18bcc985a 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -37,7 +37,7 @@ class ElementsFrozen : public CanteraError public: //! Constructor for class //! @param func Function where the error occurred. - ElementsFrozen(std::string func) + ElementsFrozen(const std::string& func) : CanteraError(func, "Elements cannot be added after species.") {} }; @@ -138,14 +138,14 @@ public: //! Set the string id for the phase. //! @param id String id of the phase - void setID(std::string id); + void setID(const std::string& id); //! Return the name of the phase. std::string name() const; //! Sets the string name for the phase. //! @param nm String name of the phase - void setName(std::string nm); + void setName(const std::string& nm); //!@} end group Name and ID //! @name Element and Species Information @@ -159,7 +159,7 @@ public: //! assigned to each element in the order it was added. Returns \ref npos //! if the specified element is not found. //! @param name Name of the element - size_t elementIndex(std::string name) const; + size_t elementIndex(const std::string& name) const; //! Return a read-only reference to the vector of element names. const std::vector& elementNames() const; @@ -233,7 +233,7 @@ public: //! phaseName:speciesName //! @return The index of the species. If the name is not found, //! the value \ref npos is returned. - size_t speciesIndex(std::string name) const; + size_t speciesIndex(const std::string& name) const; //! Name of the species with index k //! @param k index of the species @@ -414,7 +414,7 @@ public: //! Return the mole fraction of a single species //! @param name String name of the species //! @return Mole fraction of the species - doublereal moleFraction(std::string name) const; + doublereal moleFraction(const std::string& name) const; //! Return the mass fraction of a single species //! @param k species index @@ -424,7 +424,7 @@ public: //! Return the mass fraction of a single species //! @param name String name of the species //! @return Mass Fraction of the species - doublereal massFraction(std::string name) const; + doublereal massFraction(const std::string& name) const; //! Get the species mole fraction vector. //! @param x On return, x contains the mole fractions. Must have a diff --git a/include/cantera/thermo/PhaseCombo_Interaction.h b/include/cantera/thermo/PhaseCombo_Interaction.h index a8693494b..352ce123a 100644 --- a/include/cantera/thermo/PhaseCombo_Interaction.h +++ b/include/cantera/thermo/PhaseCombo_Interaction.h @@ -369,7 +369,7 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - PhaseCombo_Interaction(std::string inputFile, std::string id = ""); + PhaseCombo_Interaction(const std::string& inputFile, const std::string& id = ""); //! Construct and initialize a PhaseCombo_Interaction ThermoPhase object //! directly from an XML database @@ -378,7 +378,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - PhaseCombo_Interaction(XML_Node& phaseRef, std::string id = ""); + PhaseCombo_Interaction(XML_Node& phaseRef, const std::string& id = ""); //! Special constructor for a hard-coded problem @@ -679,7 +679,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); /** * @} @@ -832,7 +832,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/PseudoBinaryVPSSTP.h b/include/cantera/thermo/PseudoBinaryVPSSTP.h index 188779463..8813f70bb 100644 --- a/include/cantera/thermo/PseudoBinaryVPSSTP.h +++ b/include/cantera/thermo/PseudoBinaryVPSSTP.h @@ -311,7 +311,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); //! returns a summary of the state of the phase as a string @@ -338,7 +338,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index df860e786..978cb6dd3 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -336,7 +336,7 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - RedlichKisterVPSSTP(std::string inputFile, std::string id = ""); + RedlichKisterVPSSTP(const std::string& inputFile, const std::string& id = ""); //! Construct and initialize a RedlichKisterVPSSTP ThermoPhase object //! directly from an XML database @@ -345,7 +345,7 @@ public: * @param id id attribute containing the name of the phase. * (default is the empty string) */ - RedlichKisterVPSSTP(XML_Node& phaseRef, std::string id = ""); + RedlichKisterVPSSTP(XML_Node& phaseRef, const std::string& id = ""); //! Special constructor for a hard-coded problem @@ -681,7 +681,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - void initThermoXML(XML_Node& phaseNode, std::string id); + void initThermoXML(XML_Node& phaseNode, const std::string& id); /** * @} @@ -828,7 +828,7 @@ private: * * @param msg Message to be printed */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; protected: diff --git a/include/cantera/thermo/RedlichKwongMFTP.h b/include/cantera/thermo/RedlichKwongMFTP.h index bcf77edf3..09d243e87 100644 --- a/include/cantera/thermo/RedlichKwongMFTP.h +++ b/include/cantera/thermo/RedlichKwongMFTP.h @@ -63,7 +63,7 @@ public: * to set up the object * @param id ID of the phase in the input file. Defaults to the empty string. */ - RedlichKwongMFTP(std::string infile, std::string id=""); + RedlichKwongMFTP(const std::string& infile, std::string id=""); //! Construct and initialize a RedlichKwongMFTP ThermoPhase object //! directly from an XML database @@ -71,7 +71,7 @@ public: * @param phaseRef XML phase node containing the description of the phase * @param id id attribute containing the name of the phase. (default is the empty string) */ - RedlichKwongMFTP(XML_Node& phaseRef, std::string id = ""); + RedlichKwongMFTP(XML_Node& phaseRef, const std::string& id = ""); //! This is a special constructor, used to replicate test problems //! during the initial verification of the object @@ -551,7 +551,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: //! Read the pure species RedlichKwong input parameters diff --git a/include/cantera/thermo/SimpleThermo.h b/include/cantera/thermo/SimpleThermo.h index c61af9baa..0a3f683c5 100644 --- a/include/cantera/thermo/SimpleThermo.h +++ b/include/cantera/thermo/SimpleThermo.h @@ -151,7 +151,7 @@ public: * * @see ConstCpPoly */ - virtual void install(std::string name, size_t index, int type, const doublereal* c, + virtual void install(const std::string& name, size_t index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure) { m_logt0.push_back(log(c[0])); diff --git a/include/cantera/thermo/SingleSpeciesTP.h b/include/cantera/thermo/SingleSpeciesTP.h index 01e1e47b9..e6a99ff2b 100644 --- a/include/cantera/thermo/SingleSpeciesTP.h +++ b/include/cantera/thermo/SingleSpeciesTP.h @@ -760,7 +760,7 @@ private: /*! * @param msg String message */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/thermo/SpeciesThermo.h b/include/cantera/thermo/SpeciesThermo.h index 6f00c7a3f..640446a40 100644 --- a/include/cantera/thermo/SpeciesThermo.h +++ b/include/cantera/thermo/SpeciesThermo.h @@ -234,7 +234,7 @@ public: * parameterization. * @see speciesThermoTypes.h */ - virtual void install(std::string name, size_t index, int type, + virtual void install(const std::string& name, size_t index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure)=0; diff --git a/include/cantera/thermo/SpeciesThermoFactory.h b/include/cantera/thermo/SpeciesThermoFactory.h index 46ce29680..1341cc428 100644 --- a/include/cantera/thermo/SpeciesThermoFactory.h +++ b/include/cantera/thermo/SpeciesThermoFactory.h @@ -37,8 +37,8 @@ public: * @param spName Species Name that caused the error * @param speciesThermoModel Unrecognized species thermo model name */ - UnknownSpeciesThermoModel(std::string proc, std::string spName, - std::string speciesThermoModel) : + UnknownSpeciesThermoModel(const std::string& proc, const std::string& spName, + const std::string& speciesThermoModel) : CanteraError(proc, "species " + spName + ": Specified speciesThermoPhase model " + speciesThermoModel + diff --git a/include/cantera/thermo/SpeciesThermoMgr.h b/include/cantera/thermo/SpeciesThermoMgr.h index 1a4eef52d..f25104853 100644 --- a/include/cantera/thermo/SpeciesThermoMgr.h +++ b/include/cantera/thermo/SpeciesThermoMgr.h @@ -34,7 +34,7 @@ public: * @param proc name of the procecdure * @param type unknown type */ - UnknownSpeciesThermo(std::string proc, int type) : + UnknownSpeciesThermo(const std::string& proc, int type) : CanteraError(proc, "Specified species parameterization type (" + int2str(type) + ") does not match any known type.") {} @@ -43,7 +43,7 @@ public: * @param proc name of the procecdure * @param stype String name for the unknown type */ - UnknownSpeciesThermo(std::string proc, std::string stype) : + UnknownSpeciesThermo(const std::string& proc, const std::string& stype) : CanteraError(proc, "Specified species parameterization type (" + stype + ") does not match any known type.") {} //! destructor @@ -116,7 +116,7 @@ public: * parameterization. * @see speciesThermoTypes.h */ - virtual void install(std::string name, size_t sp, int type, + virtual void install(const std::string& name, size_t sp, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure); @@ -277,7 +277,7 @@ SpeciesThermoDuo::duplMyselfAsSpeciesThermo() const template void -SpeciesThermoDuo::install(std::string name, size_t sp, int type, +SpeciesThermoDuo::install(const std::string& name, size_t sp, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, diff --git a/include/cantera/thermo/StatMech.h b/include/cantera/thermo/StatMech.h index 26df38b32..13e58ba21 100644 --- a/include/cantera/thermo/StatMech.h +++ b/include/cantera/thermo/StatMech.h @@ -44,7 +44,7 @@ public: * parameters for the standard state. */ StatMech(int n, doublereal tlow, doublereal thigh, doublereal pref, - const doublereal* coeffs, std::string my_name); + const doublereal* coeffs, const std::string& my_name); //! copy constructor /*! diff --git a/include/cantera/thermo/StoichSubstanceSSTP.h b/include/cantera/thermo/StoichSubstanceSSTP.h index f32f49a03..3759c4cdf 100644 --- a/include/cantera/thermo/StoichSubstanceSSTP.h +++ b/include/cantera/thermo/StoichSubstanceSSTP.h @@ -173,7 +173,7 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - StoichSubstanceSSTP(std::string infile, std::string id = ""); + StoichSubstanceSSTP(const std::string& infile, std::string id = ""); //! Construct and initialize a StoichSubstanceSSTP ThermoPhase object //! directly from an XML database @@ -181,7 +181,7 @@ public: * @param phaseRef XML node pointing to a StoichSubstanceSSTP description * @param id Id of the phase. */ - StoichSubstanceSSTP(XML_Node& phaseRef, std::string id = ""); + StoichSubstanceSSTP(XML_Node& phaseRef, const std::string& id = ""); //! Copy constructor /*! @@ -466,7 +466,7 @@ public: virtual void initThermo(); - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Set the equation of state parameters /*! @@ -544,7 +544,7 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - electrodeElectron(std::string infile, std::string id = ""); + electrodeElectron(const std::string& infile, std::string id = ""); //! Construct and initialize a electrodeElectron ThermoPhase object //! directly from an XML database @@ -552,7 +552,7 @@ public: * @param phaseRef XML node pointing to a electrodeElectron description * @param id Id of the phase. */ - electrodeElectron(XML_Node& phaseRef, std::string id = ""); + electrodeElectron(XML_Node& phaseRef, const std::string& id = ""); //! Copy constructor /*! @@ -571,7 +571,7 @@ public: void setParametersFromXML(const XML_Node& eosdata); - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); void setParameters(int n, doublereal* const c); }; diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index 6a653c6d8..99bac2b48 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -160,7 +160,7 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - SurfPhase(std::string infile, std::string id); + SurfPhase(const std::string& infile, std::string id); //! Construct and initialize a SurfPhase ThermoPhase object //! directly from an XML database @@ -602,7 +602,7 @@ public: /*! * @param cov String containing colon-separated name:value pairs */ - void setCoveragesByName(std::string cov); + void setCoveragesByName(const std::string& cov); //! Return a vector of surface coverages /*! diff --git a/include/cantera/thermo/ThermoFactory.h b/include/cantera/thermo/ThermoFactory.h index 79720734e..63b31c108 100644 --- a/include/cantera/thermo/ThermoFactory.h +++ b/include/cantera/thermo/ThermoFactory.h @@ -42,7 +42,8 @@ public: * @param proc Function name where the error occurred. * @param thermoModel Sting name of ThermoPhase which didn't match */ - UnknownThermoPhaseModel(std::string proc, std::string thermoModel) : + UnknownThermoPhaseModel(const std::string& proc, + const std::string& thermoModel) : CanteraError(proc, "Specified ThermoPhase model " + thermoModel + " does not match any known type.") {} @@ -97,7 +98,7 @@ public: * Throws an exception UnknownThermoPhaseModel if the string * wasn't matched. */ - virtual ThermoPhase* newThermoPhase(std::string model); + virtual ThermoPhase* newThermoPhase(const std::string& model); private: //! static member of a single instance @@ -121,7 +122,7 @@ private: * Throws an exception UnknownThermoPhaseModel if the string * wasn't matched. */ -inline ThermoPhase* newThermoPhase(std::string model, +inline ThermoPhase* newThermoPhase(const std::string& model, ThermoFactory* f=0) { if (f == 0) { @@ -175,7 +176,7 @@ ThermoPhase* newPhase(XML_Node& phase); * @return * Returns an initialized ThermoPhase object. */ -ThermoPhase* newPhase(std::string infile, std::string id); +ThermoPhase* newPhase(const std::string& infile, std::string id); //! Import a phase information into an empty thermophase object /*! @@ -304,7 +305,7 @@ bool installSpecies(size_t k, const XML_Node& s, thermo_t& p, * * */ -const XML_Node* speciesXML_Node(std::string kname, +const XML_Node* speciesXML_Node(const std::string& kname, const XML_Node* phaseSpeciesData); //@} diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index b1727c48d..63c4e37e2 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -1385,8 +1385,8 @@ public: * phase. If none is given, the first XML * phase element encountered will be used. */ - virtual void initThermoFile(std::string inputFile, std::string id); - + virtual void initThermoFile(const std::string& inputFile, + const std::string& id); //!Import and initialize a ThermoPhase object using an XML tree. /*! @@ -1418,7 +1418,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Initialize the ThermoPhase object after all species have been set up /*! @@ -1676,7 +1676,7 @@ private: /*! * @param msg String containing the message. */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; diff --git a/include/cantera/thermo/VPSSMgr.h b/include/cantera/thermo/VPSSMgr.h index c6d25ee6c..141229f25 100644 --- a/include/cantera/thermo/VPSSMgr.h +++ b/include/cantera/thermo/VPSSMgr.h @@ -738,7 +738,7 @@ public: * @param phaseNode Reference to the phaseNode XML node. * @param id ID of the phase. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Install specific content for species k in the reference-state //! thermodynamic SpeciesManager object @@ -962,7 +962,7 @@ private: /*! * @param msg Error message string */ - void err(std::string msg) const; + void err(const std::string& msg) const; }; //@} diff --git a/include/cantera/thermo/VPSSMgr_ConstVol.h b/include/cantera/thermo/VPSSMgr_ConstVol.h index 6f4669f04..7c518ccc4 100644 --- a/include/cantera/thermo/VPSSMgr_ConstVol.h +++ b/include/cantera/thermo/VPSSMgr_ConstVol.h @@ -178,7 +178,7 @@ public: * @param phaseNode Reference to the phase node in the XML tree * @param id string name of the phase */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Create and install a constant volume pressure dependent //! standard state for one species within this object diff --git a/include/cantera/thermo/VPSSMgr_General.h b/include/cantera/thermo/VPSSMgr_General.h index 03a62c2bb..fc321865d 100644 --- a/include/cantera/thermo/VPSSMgr_General.h +++ b/include/cantera/thermo/VPSSMgr_General.h @@ -197,7 +197,7 @@ protected: * @param phaseNode Reference to the phaseNode XML node. * @param id ID of the phase. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); private: //! Local factory routine for the creation of PDSS objects diff --git a/include/cantera/thermo/VPSSMgr_IdealGas.h b/include/cantera/thermo/VPSSMgr_IdealGas.h index b45e82998..4540a86c3 100644 --- a/include/cantera/thermo/VPSSMgr_IdealGas.h +++ b/include/cantera/thermo/VPSSMgr_IdealGas.h @@ -178,7 +178,7 @@ public: * @param phaseNode Reference to the phase node in the XML tree * @param id string name of the phase */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Create and install an ideal gas standard state manager //! for one species within this object diff --git a/include/cantera/thermo/VPSSMgr_Water_ConstVol.h b/include/cantera/thermo/VPSSMgr_Water_ConstVol.h index ca55e0884..bd09f7386 100644 --- a/include/cantera/thermo/VPSSMgr_Water_ConstVol.h +++ b/include/cantera/thermo/VPSSMgr_Water_ConstVol.h @@ -263,7 +263,7 @@ public: * @param phaseNode Reference to the phaseNode XML node. * @param id ID of the phase. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Install specific content for species k in the standard-state //! thermodynamic calculator and also create/return a PDSS object diff --git a/include/cantera/thermo/VPSSMgr_Water_HKFT.h b/include/cantera/thermo/VPSSMgr_Water_HKFT.h index 38b7c392e..48582890e 100644 --- a/include/cantera/thermo/VPSSMgr_Water_HKFT.h +++ b/include/cantera/thermo/VPSSMgr_Water_HKFT.h @@ -347,7 +347,7 @@ public: * @param phaseNode Reference to the phaseNode XML node. * @param id ID of the phase. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Install specific content for species k in the standard-state //! thermodynamic calculator and also create/return a PDSS object diff --git a/include/cantera/thermo/VPStandardStateTP.h b/include/cantera/thermo/VPStandardStateTP.h index cccdeae65..b584ccec3 100644 --- a/include/cantera/thermo/VPStandardStateTP.h +++ b/include/cantera/thermo/VPStandardStateTP.h @@ -565,7 +565,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! set the VPSS Mgr @@ -640,7 +640,7 @@ private: /*! * @param msg Error message string */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index 13ccd7ab0..a17f7f136 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -142,14 +142,14 @@ public: * @param inputFile String name of the input file * @param id string id of the phase name */ - WaterSSTP(std::string inputFile, std::string id = ""); + explicit WaterSSTP(const std::string& inputFile, const std::string& id = ""); //! Full constructor for a water phase /*! * @param phaseRef XML node referencing the water phase. * @param id string id of the phase name */ - WaterSSTP(XML_Node& phaseRef, std::string id = ""); + explicit WaterSSTP(XML_Node& phaseRef, const std::string& id = ""); //! Destructor virtual ~WaterSSTP(); @@ -442,7 +442,7 @@ public: * to see if phaseNode is pointing to the phase * with the correct id. */ - virtual void initThermoXML(XML_Node& phaseNode, std::string id); + virtual void initThermoXML(XML_Node& phaseNode, const std::string& id); //! Initialize the ThermoPhase object after all species have been set up /*! diff --git a/include/cantera/tpx/Sub.h b/include/cantera/tpx/Sub.h index 210cfa09b..3039e4c6e 100644 --- a/include/cantera/tpx/Sub.h +++ b/include/cantera/tpx/Sub.h @@ -30,7 +30,8 @@ namespace tpx class TPX_Error : public Cantera::CanteraError { public: - TPX_Error(std::string p, std::string e) : CanteraError(p, e) { } + TPX_Error(const std::string& p, const std::string& e) : + CanteraError(p, e) { } }; namespace PropertyPair diff --git a/include/cantera/transport/LTPspecies.h b/include/cantera/transport/LTPspecies.h index abdaba271..b78f7dc31 100644 --- a/include/cantera/transport/LTPspecies.h +++ b/include/cantera/transport/LTPspecies.h @@ -97,7 +97,7 @@ public: * is creating a parameterization for (e.g., viscosity) * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. */ - LTPspecies(const XML_Node* const propNode = 0, std::string name = "-", + LTPspecies(const XML_Node* const propNode = 0, const std::string& name = "-", TransportPropertyType tp_ind = TP_UNKNOWN, const thermo_t* thermo = 0); //! Copy constructor @@ -225,7 +225,7 @@ public: * is creating a parameterization for (e.g., viscosity) * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. */ - LTPspecies_Const(const XML_Node& propNode, std::string name, + LTPspecies_Const(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* const thermo); //! Copy constructor @@ -309,7 +309,7 @@ public: * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. * */ - LTPspecies_Arrhenius(const XML_Node& propNode, std::string name, + LTPspecies_Arrhenius(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo); //! Copy constructor @@ -416,7 +416,7 @@ public: * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. * */ - LTPspecies_Poly(const XML_Node& propNode, std::string name, TransportPropertyType tp_ind, const thermo_t* thermo); + LTPspecies_Poly(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo); //! Copy constructor /*! @@ -504,7 +504,7 @@ public: * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. * */ - LTPspecies_ExpT(const XML_Node& propNode, std::string name, + LTPspecies_ExpT(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo); //! Copy constructor diff --git a/include/cantera/transport/LiquidTransport.h b/include/cantera/transport/LiquidTransport.h index 7fe6a2453..99b73f117 100644 --- a/include/cantera/transport/LiquidTransport.h +++ b/include/cantera/transport/LiquidTransport.h @@ -1430,7 +1430,7 @@ private: * * @param msg Indicates the member function which is not implemented */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/transport/SimpleTransport.h b/include/cantera/transport/SimpleTransport.h index eb2012af7..6354bf8e9 100644 --- a/include/cantera/transport/SimpleTransport.h +++ b/include/cantera/transport/SimpleTransport.h @@ -871,7 +871,7 @@ private: * * @param msg Indicates the member function which is not implemented */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/transport/TransportBase.h b/include/cantera/transport/TransportBase.h index 6aa0bf272..5e424441d 100644 --- a/include/cantera/transport/TransportBase.h +++ b/include/cantera/transport/TransportBase.h @@ -887,7 +887,7 @@ private: * * @return returns a double, though we will never get there */ - doublereal err(std::string msg) const; + doublereal err(const std::string& msg) const; }; diff --git a/include/cantera/transport/TransportFactory.h b/include/cantera/transport/TransportFactory.h index f40c32410..f4febbdcf 100644 --- a/include/cantera/transport/TransportFactory.h +++ b/include/cantera/transport/TransportFactory.h @@ -117,7 +117,7 @@ public: * @param thermo ThermoPhase object * @param log_level log level */ - virtual Transport* newTransport(std::string model, thermo_t* thermo, int log_level=0); + virtual Transport* newTransport(const std::string& model, thermo_t* thermo, int log_level=0); //! Build a new transport manager using the default transport manager //! in the phase description and return a base class pointer to it @@ -387,7 +387,7 @@ private: * * @ingroup transportProps */ -Transport* newTransportMgr(std::string transportModel = "", thermo_t* thermo = 0, int loglevel = 0, +Transport* newTransportMgr(const std::string& transportModel = "", thermo_t* thermo = 0, int loglevel = 0, TransportFactory* f = 0); //==================================================================================================================== //! Create a new transport manager instance. diff --git a/include/cantera/transport/TransportParams.h b/include/cantera/transport/TransportParams.h index e026148a6..0f7b88dde 100644 --- a/include/cantera/transport/TransportParams.h +++ b/include/cantera/transport/TransportParams.h @@ -32,7 +32,7 @@ public: /*! * @param method Single string indicating a method that is not implemented */ - NotImplemented(std::string method); + NotImplemented(const std::string& method); }; //==================================================================================================================== //! Base structure to hold transport model parameters. diff --git a/include/cantera/zeroD/FlowDevice.h b/include/cantera/zeroD/FlowDevice.h index 09b730d42..a03e71807 100644 --- a/include/cantera/zeroD/FlowDevice.h +++ b/include/cantera/zeroD/FlowDevice.h @@ -175,7 +175,7 @@ private: ReactorBase* m_out; std::vector m_in2out, m_out2in; - void warn(std::string meth) { + void warn(const std::string& meth) { writelog(std::string("Warning: method ") + meth + " of base class " + " FlowDevice called. Nothing done.\n"); } diff --git a/include/cantera/zeroD/ReactorFactory.h b/include/cantera/zeroD/ReactorFactory.h index c9d8dd823..373c6536b 100644 --- a/include/cantera/zeroD/ReactorFactory.h +++ b/include/cantera/zeroD/ReactorFactory.h @@ -45,7 +45,7 @@ public: * @param n the type to be created. */ virtual ReactorBase* newReactor(int n); - virtual ReactorBase* newReactor(std::string reactorType); + virtual ReactorBase* newReactor(const std::string& reactorType); private: static ReactorFactory* s_factory; @@ -53,7 +53,7 @@ private: ReactorFactory() {} }; -inline ReactorBase* newReactor(std::string model, +inline ReactorBase* newReactor(const std::string& model, ReactorFactory* f=0) { if (f == 0) { diff --git a/samples/cxx/kinetics1/example_utils.h b/samples/cxx/kinetics1/example_utils.h index 6dfbbdd4a..6eeed7526 100644 --- a/samples/cxx/kinetics1/example_utils.h +++ b/samples/cxx/kinetics1/example_utils.h @@ -47,7 +47,8 @@ void makeDataLabels(const G& gas, V& names) } template -void plotSoln(std::string fname, std::string fmt, std::string title, const G& gas, const A& soln) +void plotSoln(const std::string& fname, const std::string& fmt, + const std::string& title, const G& gas, const A& soln) { std::vector names; makeDataLabels(gas, names); diff --git a/src/base/application.cpp b/src/base/application.cpp index 3d056e5ba..f1f8aa9fa 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -112,7 +112,7 @@ Application::Messages::~Messages() } // Set an error condition in the application class without throwing an exception -void Application::Messages::addError(std::string r, std::string msg) +void Application::Messages::addError(const std::string& r, const std::string& msg) { errorMessage.push_back(msg); errorRoutine.push_back(r); @@ -162,7 +162,7 @@ void Application::Messages::writelogendl() #ifdef WITH_HTML_LOGS -void Application::Messages::beginLogGroup(std::string title, int _loglevel /*=-99*/) +void Application::Messages::beginLogGroup(const std::string& title, int _loglevel /*=-99*/) { // Add the current loglevel to the vector of loglevels loglevels.push_back(loglevel); @@ -192,35 +192,35 @@ void Application::Messages::beginLogGroup(std::string title, int _loglevel /*=-9 current = ¤t->addChild("ul"); } -void Application::Messages::addLogEntry(std::string tag, std::string value) +void Application::Messages::addLogEntry(const std::string& tag, const std::string& value) { if (loglevel > 0 && current) { current->addChild("li",tag+": "+value); } } -void Application::Messages::addLogEntry(std::string tag, doublereal value) +void Application::Messages::addLogEntry(const std::string& tag, doublereal value) { if (loglevel > 0 && current) { current->addChild("li",tag+": "+fp2str(value)); } } -void Application::Messages::addLogEntry(std::string tag, int value) +void Application::Messages::addLogEntry(const std::string& tag, int value) { if (loglevel > 0 && current) { current->addChild("li",tag+": "+int2str(value)); } } -void Application::Messages::addLogEntry(std::string msg) +void Application::Messages::addLogEntry(const std::string& msg) { if (loglevel > 0 && current) { current->addChild("li",msg); } } -void Application::Messages::endLogGroup(std::string title) +void Application::Messages::endLogGroup(const std::string& title) { if (title != "" && title != loggroups.back()) { writelog("Logfile error." @@ -249,7 +249,7 @@ void Application::Messages::endLogGroup(std::string title) loglevels.pop_back(); } -void Application::Messages::write_logfile(std::string file) +void Application::Messages::write_logfile(const std::string& file) { if (!xmllog) { return; @@ -391,7 +391,7 @@ void Application::thread_complete() } -XML_Node* Application::get_XML_File(std::string file, int debug) +XML_Node* Application::get_XML_File(const std::string& file, int debug) { ScopedLock xmlLock(xml_mutex); std::string path = ""; @@ -486,7 +486,7 @@ XML_Node* Application::get_XML_File(std::string file, int debug) } -void Application::close_XML_File(std::string file) +void Application::close_XML_File(const std::string& file) { ScopedLock xmlLock(xml_mutex); if (file == "all") { @@ -653,7 +653,7 @@ void Application::setDefaultDirectories() #endif } -void Application::addDataDirectory(std::string dir) +void Application::addDataDirectory(const std::string& dir) { ScopedLock dirLock(dir_mutex); if (inputDirs.size() == 0) { @@ -672,7 +672,7 @@ void Application::addDataDirectory(std::string dir) inputDirs.push_back(d); } -std::string Application::findInputFile(std::string name) +std::string Application::findInputFile(const std::string& name) { ScopedLock dirLock(dir_mutex); string::size_type islash = name.find('/'); diff --git a/src/base/application.h b/src/base/application.h index 6bb3a5fb1..73c5a6009 100644 --- a/src/base/application.h +++ b/src/base/application.h @@ -81,7 +81,7 @@ protected: * @param msg Description of the error * @ingroup errorhandling */ - void addError(std::string r, std::string msg); + void addError(const std::string& r, const std::string& msg); //! Return the number of errors that have been encountered so far. /*! @@ -200,7 +200,7 @@ protected: * @param loglevel loglevel of the group. * @ingroup HTML_logs */ - void beginLogGroup(std::string title, int loglevel) ; + void beginLogGroup(const std::string& title, int loglevel) ; //! Add an entry to an HTML log file. /*! @@ -211,7 +211,7 @@ protected: * * @ingroup HTML_logs */ - void addLogEntry(std::string tag, std::string value) ; + void addLogEntry(const std::string& tag, const std::string& value) ; //! Add an entry to an HTML log file. /*! @@ -222,7 +222,7 @@ protected: * * @ingroup HTML_logs */ - void addLogEntry(std::string tag, doublereal value) ; + void addLogEntry(const std::string& tag, doublereal value) ; //! Add an entry to an HTML log file. /*! @@ -233,7 +233,7 @@ protected: * * @ingroup HTML_logs */ - void addLogEntry(std::string tag, int value) ; + void addLogEntry(const std::string& tag, int value) ; //! Add an entry to an HTML log file. /*! @@ -243,7 +243,7 @@ protected: * * @ingroup HTML_logs */ - void addLogEntry(std::string msg) ; + void addLogEntry(const std::string& msg) ; //! Close the current group of log messages. /*! @@ -257,7 +257,7 @@ protected: * @param title Name of the log group. It defaults to the most recent * log group created. */ - void endLogGroup(std::string title) ; + void endLogGroup(const std::string& title) ; //! Write the HTML log file. /*! @@ -273,7 +273,7 @@ protected: * * @param file Name of the file to be written */ - void write_logfile(std::string file); + void write_logfile(const std::string& file); #endif protected: @@ -366,7 +366,7 @@ public: * @param msg Description of the error * @ingroup errorhandling */ - void addError(std::string r, std::string msg) { + void addError(const std::string& r, const std::string& msg) { pMessenger->addError(r, msg) ; } @@ -438,7 +438,7 @@ public: * * @param dir String name for the directory to be added to the search path */ - void addDataDirectory(std::string dir) ; + void addDataDirectory(const std::string& dir) ; //! Find an input file. /*! @@ -467,7 +467,7 @@ public: * * @ingroup inputfiles */ - std::string findInputFile(std::string name) ; + std::string findInputFile(const std::string& name) ; //! Return a pointer to the XML tree for a Cantera input file. /*! @@ -479,7 +479,7 @@ public: * @param file String containing the relative or absolute file name * @param debug Debug flag */ - XML_Node* get_XML_File(std::string file, int debug=0) ; + XML_Node* get_XML_File(const std::string& file, int debug=0) ; //! Close an XML File /*! @@ -487,7 +487,7 @@ public: * * @param file String containing the relative or absolute file name */ - void close_XML_File(std::string file) ; + void close_XML_File(const std::string& file) ; //! Write a message to the screen. /*! @@ -573,7 +573,7 @@ public: * @param loglevel loglevel of the group. * @ingroup HTML_logs */ - void beginLogGroup(std::string title, int loglevel) { + void beginLogGroup(const std::string& title, int loglevel) { pMessenger->beginLogGroup(title,loglevel); } @@ -586,7 +586,7 @@ public: * * @ingroup HTML_logs */ - void addLogEntry(std::string tag, std::string value) { + void addLogEntry(const std::string& tag, const std::string& value) { pMessenger->addLogEntry(tag, value); } @@ -599,7 +599,7 @@ public: * * @ingroup HTML_logs */ - void addLogEntry(std::string tag, doublereal value) { + void addLogEntry(const std::string& tag, doublereal value) { pMessenger->addLogEntry(tag, value); } @@ -612,7 +612,7 @@ public: * * @ingroup HTML_logs */ - void addLogEntry(std::string tag, int value) { + void addLogEntry(const std::string& tag, int value) { pMessenger->addLogEntry(tag, value); } @@ -624,7 +624,7 @@ public: * * @ingroup HTML_logs */ - void addLogEntry(std::string msg) { + void addLogEntry(const std::string& msg) { pMessenger->addLogEntry(msg); } @@ -641,7 +641,7 @@ public: * log group created. * @ingroup HTML_logs */ - void endLogGroup(std::string title) { + void endLogGroup(const std::string& title) { pMessenger->endLogGroup(title) ; } @@ -659,7 +659,7 @@ public: * * @param file Name of the file to be written */ - void write_logfile(std::string file) { + void write_logfile(const std::string& file) { pMessenger->write_logfile(file) ; } #endif diff --git a/src/base/ctexceptions.cpp b/src/base/ctexceptions.cpp index 9cf66bcc2..3b3d60f6d 100644 --- a/src/base/ctexceptions.cpp +++ b/src/base/ctexceptions.cpp @@ -14,7 +14,7 @@ namespace Cantera static const char* stars = "***********************************************************************\n"; -CanteraError::CanteraError(std::string procedure, std::string msg) : +CanteraError::CanteraError(const std::string& procedure, const std::string& msg) : procedure_(procedure), msg_(msg), saved_(false) @@ -23,7 +23,7 @@ CanteraError::CanteraError(std::string procedure, std::string msg) : save(); } -CanteraError::CanteraError(std::string procedure) : +CanteraError::CanteraError(const std::string& procedure) : procedure_(procedure), saved_(false) { diff --git a/src/base/ctml.cpp b/src/base/ctml.cpp index d234d8b7a..976409d8c 100644 --- a/src/base/ctml.cpp +++ b/src/base/ctml.cpp @@ -659,8 +659,10 @@ bool getOptionalFloat(const Cantera::XML_Node& parent, * * @return returns true if the child element named "name" exists */ -doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent, std::string name, - std::string defaultUnits, std::string type) +doublereal getFloatDefaultUnits(const Cantera::XML_Node& parent, + const std::string& name, + const std::string& defaultUnits, + const std::string& type) { doublereal fctr = 1.0; @@ -755,7 +757,7 @@ bool getOptionalModel(const Cantera::XML_Node& parent, const std::string nodeNam * @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, std::string name) +int getInteger(const Cantera::XML_Node& parent, const std::string& name) { if (!parent.hasChild(name)) { throw CanteraError("getInteger (called from XML Node \"" + diff --git a/src/base/global.cpp b/src/base/global.cpp index cb4aff2a4..deb995f3d 100644 --- a/src/base/global.cpp +++ b/src/base/global.cpp @@ -73,37 +73,37 @@ void error(const std::string& msg) #ifdef WITH_HTML_LOGS -void beginLogGroup(std::string title, int loglevel) +void beginLogGroup(const std::string& title, int loglevel) { app()->beginLogGroup(title, loglevel) ; } -void addLogEntry(std::string tag, std::string value) +void addLogEntry(const std::string& tag, const std::string& value) { app()->addLogEntry(tag, value) ; } -void addLogEntry(std::string tag, doublereal value) +void addLogEntry(const std::string& tag, doublereal value) { app()->addLogEntry(tag, value) ; } -void addLogEntry(std::string tag, int value) +void addLogEntry(const std::string& tag, int value) { app()->addLogEntry(tag, value) ; } -void addLogEntry(std::string msg) +void addLogEntry(const std::string& msg) { app()->addLogEntry(msg) ; } -void endLogGroup(std::string title) +void endLogGroup(const std::string& title) { app()->endLogGroup(title) ; } -void write_logfile(std::string file) +void write_logfile(const std::string& file) { app()->write_logfile(file) ; } @@ -127,14 +127,14 @@ void thread_complete() app()->thread_complete() ; } -XML_Node* get_XML_File(std::string file, int debug) +XML_Node* get_XML_File(const std::string& file, int debug) { XML_Node* xtmp = app()->get_XML_File(file, debug) ; //writelog("get_XML_File: returned from app:get_XML_FILE " + int2str(xtmp) + "\n"); return xtmp; } -void close_XML_File(std::string file) +void close_XML_File(const std::string& file) { app()->close_XML_File(file) ; } @@ -164,22 +164,22 @@ void showErrors() app()->logErrors() ; } -void setError(std::string r, std::string msg) +void setError(const std::string& r, const std::string& msg) { app()->addError(r, msg) ; } -void addDirectory(std::string dir) +void addDirectory(const std::string& dir) { app()->addDataDirectory(dir) ; } -std::string findInputFile(std::string name) +std::string findInputFile(const std::string& name) { return app()->findInputFile(name) ; } -doublereal toSI(std::string unit) +doublereal toSI(const std::string& unit) { doublereal f = Unit::units()->toSI(unit); if (f) { @@ -190,7 +190,7 @@ doublereal toSI(std::string unit) return 1.0; } -doublereal actEnergyToSI(std::string unit) +doublereal actEnergyToSI(const std::string& unit) { doublereal f = Unit::units()->actEnergyToSI(unit); if (f) { diff --git a/src/base/stringUtils.cpp b/src/base/stringUtils.cpp index 493cf59de..da29d0cbd 100644 --- a/src/base/stringUtils.cpp +++ b/src/base/stringUtils.cpp @@ -299,17 +299,17 @@ std::string getBaseName(const std::string& path) return file; } //================================================================================================ -int intValue(std::string val) +int intValue(const std::string& val) { return std::atoi(stripws(val).c_str()); } //================================================================================================ -doublereal fpValue(std::string val) +doublereal fpValue(const std::string& val) { return std::atof(stripws(val).c_str()); } //================================================================================================ -doublereal fpValueCheck(std::string val) +doublereal fpValueCheck(const std::string& val) { return atofCheck(stripws(val).c_str()); } diff --git a/src/base/units.h b/src/base/units.h index 748a227d4..b93a30d36 100644 --- a/src/base/units.h +++ b/src/base/units.h @@ -58,7 +58,7 @@ public: * energy to SI units. * @param units activation energy units */ - doublereal actEnergyToSI(std::string units) { + doublereal actEnergyToSI(const std::string& units) { if (m_act_u.find(units) != m_act_u.end()) { return m_act_u[units]; } else { @@ -75,7 +75,7 @@ public: * * @param units String containing the units description */ - doublereal toSI(std::string units) { + doublereal toSI(const std::string& units) { // if dimensionless, return 1.0 if (units == "") { diff --git a/src/base/xml.cpp b/src/base/xml.cpp index 417f923c0..a0c71803c 100644 --- a/src/base/xml.cpp +++ b/src/base/xml.cpp @@ -73,7 +73,7 @@ public: * @param closetag String representing the closing of the XML bracket * @param line Line number where the error occurred. */ - XML_TagMismatch(std::string opentag, std::string closetag, + XML_TagMismatch(const std::string& opentag, const std::string& closetag, int line=0) : XML_Error(line) { m_msg += "<" + opentag + "> paired with .\n"; @@ -101,7 +101,7 @@ public: * @param child Name of the required child node * @param line Line number where the error occurred. */ - XML_NoChild(const XML_Node* p, std::string parent, + XML_NoChild(const XML_Node* p, const std::string& parent, std::string child, int line=0) : XML_Error(line) { m_msg += " The XML Node \"" + parent + @@ -147,7 +147,7 @@ void XML_Reader::getchr(char& ch) * @param q Search for this character * @param istart Defaults to 0 */ -static string::size_type findUnbackslashed(std::string s, const char q, +static string::size_type findUnbackslashed(const std::string& s, const char q, std::string::size_type istart = 0) { string::size_type iloc, icurrent, len; @@ -220,7 +220,7 @@ int XML_Reader::findQuotedString(const std::string& s, std::string& rstring) con * parseTag parses XML tags, i.e., the XML elements that are * in between angle brackets. */ -void XML_Reader::parseTag(std::string tag, std::string& name, +void XML_Reader::parseTag(const std::string& tag, std::string& name, std::map& attribs) const { string::size_type iloc; @@ -690,7 +690,7 @@ std::string XML_Node::value(const std::string& cname) const * @param cname Name of the child node to the current * node, for which you want the value */ -std::string XML_Node::operator()(std::string loc) const +std::string XML_Node::operator()(const std::string& loc) const { return value(loc); } @@ -823,7 +823,7 @@ XML_Node* XML_Node::setParent(XML_Node* const p) * * @return Returns true if the child node exists, false otherwise. */ -bool XML_Node::hasChild(const std::string ch) const +bool XML_Node::hasChild(const std::string& ch) const { return (m_childindex.find(ch) != m_childindex.end()); } @@ -834,7 +834,7 @@ bool XML_Node::hasChild(const std::string ch) const * * @return Returns true if the attribute exists, false otherwise. */ -bool XML_Node::hasAttrib(std::string a) const +bool XML_Node::hasAttrib(const std::string& a) const { return (m_attribs.find(a) != m_attribs.end()); } diff --git a/src/equil/MultiPhase.cpp b/src/equil/MultiPhase.cpp index 537bbf552..75e7c62d0 100644 --- a/src/equil/MultiPhase.cpp +++ b/src/equil/MultiPhase.cpp @@ -321,7 +321,7 @@ doublereal MultiPhase::charge() const return sum; } //==================================================================================================================== -size_t MultiPhase::speciesIndex(std::string speciesName, std::string phaseName) +size_t MultiPhase::speciesIndex(const std::string& speciesName, const std::string& phaseName) { if (!m_init) { init(); @@ -1035,7 +1035,7 @@ std::string MultiPhase::elementName(size_t m) const } //==================================================================================================================== // Index of element with name \a name. -size_t MultiPhase::elementIndex(std::string name) const +size_t MultiPhase::elementIndex(const std::string& name) const { for (size_t e = 0; e < m_nel; e++) { if (m_enames[e] == name) { diff --git a/src/equil/vcs_report.cpp b/src/equil/vcs_report.cpp index 6410b2553..f23d6afd9 100644 --- a/src/equil/vcs_report.cpp +++ b/src/equil/vcs_report.cpp @@ -25,7 +25,7 @@ static void print_space(int num) } } -static void print_line(std::string schar, size_t num) +static void print_line(const std::string& schar, size_t num) { for (size_t j = 0; j < num; j++) { plogf("%s", schar.c_str()); diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 700be60f7..800d668a6 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -307,7 +307,7 @@ size_t Kinetics::kineticsSpeciesIndex(const std::string& nm, * phase where the species resides. * Will throw an error if the species string doesn't match. */ -thermo_t& Kinetics::speciesPhase(std::string nm) +thermo_t& Kinetics::speciesPhase(const std::string& nm) { size_t np = m_thermo.size(); size_t k; @@ -407,7 +407,7 @@ void Kinetics::finalize() /* * @param m String message */ -void Kinetics::err(std::string m) const +void Kinetics::err(const std::string& m) const { throw CanteraError("Kinetics::" + m, "The default Base class method was called, when " diff --git a/src/kinetics/KineticsFactory.cpp b/src/kinetics/KineticsFactory.cpp index 4d2755364..f9f43c0c0 100644 --- a/src/kinetics/KineticsFactory.cpp +++ b/src/kinetics/KineticsFactory.cpp @@ -118,7 +118,7 @@ newKinetics(XML_Node& phaseData, vector th) /** * Return a new, empty kinetics manager. */ -Kinetics* KineticsFactory::newKinetics(string model) +Kinetics* KineticsFactory::newKinetics(const string& model) { int ikin = -1; diff --git a/src/kinetics/ReactionPath.cpp b/src/kinetics/ReactionPath.cpp index e6a2ec9d9..7d9367cec 100644 --- a/src/kinetics/ReactionPath.cpp +++ b/src/kinetics/ReactionPath.cpp @@ -54,7 +54,7 @@ Path::Path(SpeciesNode* begin, SpeciesNode* end) * label. */ void Path::addReaction(size_t rxnNumber, doublereal value, - string label) + const string& label) { m_rxn[rxnNumber] += value; m_total += value; @@ -463,7 +463,7 @@ void ReactionPathDiagram::exportToDot(ostream& s) } -void ReactionPathDiagram::addNode(size_t k, string nm, doublereal x) +void ReactionPathDiagram::addNode(size_t k, const string& nm, doublereal x) { if (!m_nodes[k]) { m_nodes[k] = new SpeciesNode; @@ -880,8 +880,8 @@ string reactionLabel(size_t i, size_t kr, size_t nr, } -int ReactionPathBuilder::build(Kinetics& s, - string element, ostream& output, ReactionPathDiagram& r, bool quiet) +int ReactionPathBuilder::build(Kinetics& s, const string& element, + ostream& output, ReactionPathDiagram& r, bool quiet) { doublereal f, ropf, ropr, fwd, rev; string fwdlabel, revlabel; diff --git a/src/kinetics/ReactionStoichMgr.cpp b/src/kinetics/ReactionStoichMgr.cpp index 0dcf815a1..205e1ef43 100644 --- a/src/kinetics/ReactionStoichMgr.cpp +++ b/src/kinetics/ReactionStoichMgr.cpp @@ -195,7 +195,7 @@ multiplyRevProducts(const doublereal* c, doublereal* r) void ReactionStoichMgr:: -write(string filename) +write(const string& filename) { ofstream f(filename.c_str()); f << "namespace mech {" << endl; diff --git a/src/kinetics/importKinetics.cpp b/src/kinetics/importKinetics.cpp index 2ec6056ed..2515e0438 100644 --- a/src/kinetics/importKinetics.cpp +++ b/src/kinetics/importKinetics.cpp @@ -1123,8 +1123,8 @@ bool importKinetics(const XML_Node& phase, std::vector th, * Build a single-phase ThermoPhase object with associated kinetics * mechanism. */ -bool buildSolutionFromXML(XML_Node& root, std::string id, std::string nm, - ThermoPhase* th, Kinetics* k) +bool buildSolutionFromXML(XML_Node& root, const std::string& id, + const std::string& nm, ThermoPhase* th, Kinetics* k) { XML_Node* x; x = get_XML_NameID(nm, string("#")+id, &root); diff --git a/src/numerics/BEulerInt.cpp b/src/numerics/BEulerInt.cpp index e71642e29..80cb1aa75 100644 --- a/src/numerics/BEulerInt.cpp +++ b/src/numerics/BEulerInt.cpp @@ -35,7 +35,7 @@ namespace Cantera * Exception thrown when a BEuler error is encountered. We just call the * Cantera Error handler in the initialization list */ -BEulerErr::BEulerErr(std::string msg) : +BEulerErr::BEulerErr(const std::string& msg) : CanteraError("BEulerInt", msg) { } diff --git a/src/numerics/BandMatrix.cpp b/src/numerics/BandMatrix.cpp index 1e2bd18ed..d2e06a310 100644 --- a/src/numerics/BandMatrix.cpp +++ b/src/numerics/BandMatrix.cpp @@ -340,7 +340,7 @@ ostream& operator<<(ostream& s, const BandMatrix& m) return s; } //==================================================================================================================== -void BandMatrix::err(std::string msg) const +void BandMatrix::err(const std::string& msg) const { throw CanteraError("BandMatrix() unimplemented function", msg); } diff --git a/src/numerics/CVodeInt.h b/src/numerics/CVodeInt.h index 353ceb6b0..01c62cfda 100644 --- a/src/numerics/CVodeInt.h +++ b/src/numerics/CVodeInt.h @@ -20,7 +20,7 @@ namespace Cantera class CVodeErr : public CanteraError { public: - CVodeErr(std::string msg) : CanteraError("CVodeInt", msg) {} + explicit CVodeErr(const std::string& msg) : CanteraError("CVodeInt", msg) {} }; diff --git a/src/numerics/CVodesIntegrator.h b/src/numerics/CVodesIntegrator.h index ca7fc67aa..68d6b3773 100644 --- a/src/numerics/CVodesIntegrator.h +++ b/src/numerics/CVodesIntegrator.h @@ -30,7 +30,7 @@ class FuncData; class CVodesErr : public CanteraError { public: - CVodesErr(std::string msg) : CanteraError("CVodesIntegrator", msg) {} + explicit CVodesErr(const std::string& msg) : CanteraError("CVodesIntegrator", msg) {} }; diff --git a/src/numerics/DAE_solvers.cpp b/src/numerics/DAE_solvers.cpp index 9432d87d7..96fedbe08 100644 --- a/src/numerics/DAE_solvers.cpp +++ b/src/numerics/DAE_solvers.cpp @@ -20,7 +20,7 @@ namespace Cantera { -DAE_Solver* newDAE_Solver(std::string itype, ResidJacEval& f) +DAE_Solver* newDAE_Solver(const std::string& itype, ResidJacEval& f) { if (itype == "IDA") { #ifdef HAS_SUNDIALS diff --git a/src/numerics/Func1.cpp b/src/numerics/Func1.cpp index fe2cfe923..a135f6263 100644 --- a/src/numerics/Func1.cpp +++ b/src/numerics/Func1.cpp @@ -148,7 +148,7 @@ void Func1::setParent(Func1* p) /*****************************************************************************/ -string Sin1::write(string arg) const +string Sin1::write(const string& arg) const { string c = ""; if (m_c != 1.0) { @@ -172,7 +172,7 @@ Func1& Cos1::derivative() const return *r; } -std::string Cos1::write(std::string arg) const +std::string Cos1::write(const std::string& arg) const { string c = ""; if (m_c != 1.0) { @@ -193,7 +193,7 @@ Func1& Exp1::derivative() const } } -std::string Exp1::write(std::string arg) const +std::string Exp1::write(const std::string& arg) const { string c = ""; if (m_c != 1.0) { @@ -218,7 +218,7 @@ Func1& Pow1::derivative() const return *r; } -string Func1::write(std::string arg) const +string Func1::write(const std::string& arg) const { return "("+arg+")"; } @@ -226,7 +226,7 @@ string Func1::write(std::string arg) const -string Pow1::write(string arg) const +string Pow1::write(const std::string& arg) const { //cout << "Pow1" << endl; string c = ""; @@ -245,7 +245,7 @@ string Pow1::write(string arg) const } -string Const1::write(string arg) const +string Const1::write(const std::string& arg) const { //cout << "Const1" << endl; string c = ""; @@ -253,14 +253,14 @@ string Const1::write(string arg) const return c; } -string Ratio1::write(string arg) const +string Ratio1::write(const std::string& arg) const { //cout << "Ratio1" << endl; return "\\frac{" + m_f1->write(arg) + "}{" + m_f2->write(arg) + "}"; } -string Product1::write(string arg) const +string Product1::write(const std::string& arg) const { //cout << "Product1" << endl; string s = m_f1->write(arg); @@ -274,7 +274,7 @@ string Product1::write(string arg) const return s + " " + s2; } -string Sum1::write(string arg) const +string Sum1::write(const std::string& arg) const { //cout << "Sum1" << endl; string s1 = m_f1->write(arg); @@ -286,7 +286,7 @@ string Sum1::write(string arg) const } } -string Diff1::write(string arg) const +string Diff1::write(const std::string& arg) const { //cout << "Diff1" << endl; string s1 = m_f1->write(arg); @@ -298,14 +298,14 @@ string Diff1::write(string arg) const } } -string Composite1::write(string arg) const +string Composite1::write(const std::string& arg) const { //cout << "Composite1" << endl; string g = m_f2->write(arg); return m_f1->write(g); } -string TimesConstant1::write(string arg) const +string TimesConstant1::write(const std::string& arg) const { //cout << "TimesConstant1" << endl; string s = m_f1->write(arg); @@ -325,7 +325,7 @@ string TimesConstant1::write(string arg) const return fp2str(m_c) + s; } -string PlusConstant1::write(string arg) const +string PlusConstant1::write(const std::string& arg) const { //cout << "PlusConstant1" << endl; if (m_c == 0.0) { diff --git a/src/numerics/ODE_integrators.cpp b/src/numerics/ODE_integrators.cpp index 252da5e45..03f68ff0e 100644 --- a/src/numerics/ODE_integrators.cpp +++ b/src/numerics/ODE_integrators.cpp @@ -11,7 +11,7 @@ namespace Cantera { -Integrator* newIntegrator(std::string itype) +Integrator* newIntegrator(const std::string& itype) { if (itype == "CVODE") { #ifdef HAS_SUNDIALS diff --git a/src/oneD/OneDim.cpp b/src/oneD/OneDim.cpp index 3c034bfda..d4417d385 100644 --- a/src/oneD/OneDim.cpp +++ b/src/oneD/OneDim.cpp @@ -57,7 +57,7 @@ OneDim::OneDim(vector domains) : } -size_t OneDim::domainIndex(string name) +size_t OneDim::domainIndex(const std::string& name) { for (size_t n = 0; n < m_nd; n++) { if (domain(n).id() == name) { @@ -473,7 +473,8 @@ doublereal OneDim::timeStep(int nsteps, doublereal dt, doublereal* x, } -void OneDim::save(string fname, string id, string desc, doublereal* sol) +void OneDim::save(const std::string& fname, std::string id, + const std::string& desc, doublereal* sol) { struct tm* newtime; diff --git a/src/oneD/Sim1D.cpp b/src/oneD/Sim1D.cpp index 34a0b3f44..fced45404 100644 --- a/src/oneD/Sim1D.cpp +++ b/src/oneD/Sim1D.cpp @@ -53,7 +53,7 @@ Sim1D::Sim1D(vector& domains) : } //==================================================================================================================== -void Sim1D::setInitialGuess(string component, vector_fp& locs, vector_fp& vals) +void Sim1D::setInitialGuess(const std::string& component, vector_fp& locs, vector_fp& vals) { for (size_t dom=0; dom 0) { std::string idp = phaseNode.id(); @@ -1668,7 +1669,7 @@ double DebyeHuckel::AionicRadius(int k) const * Bail out of functions with an error exit if they are not * implemented. */ -doublereal DebyeHuckel::err(std::string msg) const +doublereal DebyeHuckel::err(const std::string& msg) const { throw CanteraError("DebyeHuckel", "Unfinished func called: " + msg); diff --git a/src/thermo/Elements.cpp b/src/thermo/Elements.cpp index c0ece8d5c..674fa8f74 100644 --- a/src/thermo/Elements.cpp +++ b/src/thermo/Elements.cpp @@ -283,7 +283,7 @@ void Elements::freezeElements() * returned. * */ -int Elements::elementIndex(std::string name) const +int Elements::elementIndex(const std::string& name) const { for (int i = 0; i < m_mm; i++) { if (m_elementNames[i] == name) { diff --git a/src/thermo/FixedChemPotSSTP.cpp b/src/thermo/FixedChemPotSSTP.cpp index 6503989a4..540ab708e 100644 --- a/src/thermo/FixedChemPotSSTP.cpp +++ b/src/thermo/FixedChemPotSSTP.cpp @@ -44,7 +44,7 @@ FixedChemPotSSTP::FixedChemPotSSTP() : * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ -FixedChemPotSSTP::FixedChemPotSSTP(std::string infile, std::string id) : +FixedChemPotSSTP::FixedChemPotSSTP(const std::string& infile, std::string id) : SingleSpeciesTP(), chemPot_(0.0) { @@ -72,7 +72,7 @@ FixedChemPotSSTP::FixedChemPotSSTP(std::string infile, std::string id) : * @param phaseRef XML node pointing to a FixedChemPotSSTP description * @param id Id of the phase. */ -FixedChemPotSSTP::FixedChemPotSSTP(XML_Node& xmlphase, std::string id) : +FixedChemPotSSTP::FixedChemPotSSTP(XML_Node& xmlphase, const std::string& id) : SingleSpeciesTP(), chemPot_(0.0) { @@ -97,7 +97,7 @@ FixedChemPotSSTP::FixedChemPotSSTP(XML_Node& xmlphase, std::string id) : } } //==================================================================================================================== -FixedChemPotSSTP::FixedChemPotSSTP(std::string Ename, doublereal val) : +FixedChemPotSSTP::FixedChemPotSSTP(const std::string& Ename, doublereal val) : SingleSpeciesTP(), chemPot_(0.0) { @@ -499,7 +499,7 @@ void FixedChemPotSSTP::initThermo() } //==================================================================================================================== -void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void FixedChemPotSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* * Find the Thermo XML node diff --git a/src/thermo/GeneralSpeciesThermo.cpp b/src/thermo/GeneralSpeciesThermo.cpp index 7757acfdf..1805f1712 100644 --- a/src/thermo/GeneralSpeciesThermo.cpp +++ b/src/thermo/GeneralSpeciesThermo.cpp @@ -104,7 +104,7 @@ GeneralSpeciesThermo::duplMyselfAsSpeciesThermo() const * @param c coefficients. The meaning of these depends on * the parameterization. */ -void GeneralSpeciesThermo::install(std::string name, +void GeneralSpeciesThermo::install(const std::string& name, size_t index, int type, const doublereal* c, diff --git a/src/thermo/GibbsExcessVPSSTP.cpp b/src/thermo/GibbsExcessVPSSTP.cpp index fb2eced4f..5e019d565 100644 --- a/src/thermo/GibbsExcessVPSSTP.cpp +++ b/src/thermo/GibbsExcessVPSSTP.cpp @@ -299,7 +299,7 @@ void GibbsExcessVPSSTP::getPartialMolarVolumes(doublereal* vbar) const -doublereal GibbsExcessVPSSTP::err(std::string msg) const +doublereal GibbsExcessVPSSTP::err(const std::string& msg) const { throw CanteraError("GibbsExcessVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index ea1cb986f..3898099e7 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -91,7 +91,7 @@ HMWSoln::HMWSoln() : * the routine initThermo(), with a reference to the * XML database to get the info for the phase. */ -HMWSoln::HMWSoln(std::string inputFile, std::string id) : +HMWSoln::HMWSoln(const std::string& inputFile, const std::string& id) : MolalityVPSSTP(), m_formPitzer(PITZERFORM_BASE), m_formPitzerTemp(PITZER_TEMP_CONSTANT), @@ -142,7 +142,7 @@ HMWSoln::HMWSoln(std::string inputFile, std::string id) : initThermoFile(inputFile, id); } -HMWSoln::HMWSoln(XML_Node& phaseRoot, std::string id) : +HMWSoln::HMWSoln(XML_Node& phaseRoot, const std::string& id) : MolalityVPSSTP(), m_formPitzer(PITZERFORM_BASE), m_formPitzerTemp(PITZER_TEMP_CONSTANT), @@ -1672,7 +1672,7 @@ double HMWSoln::AionicRadius(int k) const * Bail out of functions with an error exit if they are not * implemented. */ -doublereal HMWSoln::err(std::string msg) const +doublereal HMWSoln::err(const std::string& msg) const { throw CanteraError("HMWSoln", "Unfinished func called: " + msg); diff --git a/src/thermo/HMWSoln_input.cpp b/src/thermo/HMWSoln_input.cpp index 23c86f733..8c971690f 100644 --- a/src/thermo/HMWSoln_input.cpp +++ b/src/thermo/HMWSoln_input.cpp @@ -35,7 +35,7 @@ namespace Cantera /*! * @param estString string name of the electrolyte species type */ -int HMWSoln::interp_est(std::string estString) +int HMWSoln::interp_est(const std::string& estString) { const char* cc = estString.c_str(); string lcs = lowercase(estString); @@ -1066,7 +1066,7 @@ void HMWSoln::initThermo() * with the correct id. */ void HMWSoln:: -initThermoXML(XML_Node& phaseNode, std::string id) +initThermoXML(XML_Node& phaseNode, const std::string& id) { string stemp; if (id.size() > 0) { diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index bea57e163..61507bbc2 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -106,7 +106,8 @@ operator=(const IdealMolalSoln& b) return *this; } -IdealMolalSoln::IdealMolalSoln(std::string inputFile, std::string id) : +IdealMolalSoln::IdealMolalSoln(const std::string& inputFile, + const std::string& id) : MolalityVPSSTP(), m_formGC(2), IMS_typeCutoff_(0), @@ -128,7 +129,7 @@ IdealMolalSoln::IdealMolalSoln(std::string inputFile, std::string id) : initThermoFile(inputFile, id); } -IdealMolalSoln::IdealMolalSoln(XML_Node& root, std::string id) : +IdealMolalSoln::IdealMolalSoln(XML_Node& root, const std::string& id) : MolalityVPSSTP(), m_formGC(2), IMS_typeCutoff_(0), @@ -842,7 +843,7 @@ void IdealMolalSoln::initThermo() * to see if phaseNode is pointing to the phase * with the correct id. */ -void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, std::string id) +void IdealMolalSoln::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* * Find the Thermo XML node @@ -1060,7 +1061,7 @@ void IdealMolalSoln::setParametersFromXML(const XML_Node& eosdata) * Bail out of functions with an error exit if they are not * implemented. */ -doublereal IdealMolalSoln::err(std::string msg) const +doublereal IdealMolalSoln::err(const std::string& msg) const { throw CanteraError("IdealMolalSoln", "Unfinished func called: " + msg); diff --git a/src/thermo/IdealSolidSolnPhase.cpp b/src/thermo/IdealSolidSolnPhase.cpp index a6c652ddc..da4443e58 100644 --- a/src/thermo/IdealSolidSolnPhase.cpp +++ b/src/thermo/IdealSolidSolnPhase.cpp @@ -42,8 +42,9 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(int formGC) : } } -IdealSolidSolnPhase::IdealSolidSolnPhase(std::string inputFile, std::string id, - int formGC) : +IdealSolidSolnPhase::IdealSolidSolnPhase(const std::string& inputFile, + const std::string& id, + int formGC) : ThermoPhase(), m_formGC(formGC), m_mm(0), @@ -60,7 +61,7 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(std::string inputFile, std::string id, initThermoFile(inputFile, id); } //==================================================================================================================== -IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, std::string id, +IdealSolidSolnPhase::IdealSolidSolnPhase(XML_Node& root, const std::string& id, int formGC) : ThermoPhase(), m_formGC(formGC), @@ -1099,7 +1100,7 @@ void IdealSolidSolnPhase::initThermo() * to see if phaseNode is pointing to the phase * with the correct id. */ -void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, std::string id) +void IdealSolidSolnPhase::initThermoXML(XML_Node& phaseNode, const std::string& id) { string subname = "IdealSolidSolnPhase::initThermoXML"; if (id.size() > 0) { diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index 1004e4213..4fa8b5bdb 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -35,7 +35,7 @@ IdealSolnGasVPSS::IdealSolnGasVPSS() : } -IdealSolnGasVPSS::IdealSolnGasVPSS(std::string infile, std::string id) : +IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id) : VPStandardStateTP(), m_idealGas(0), m_formGC(0) @@ -489,7 +489,7 @@ void IdealSolnGasVPSS::initLengths() * This routine initializes the lengths in the current object and * then calls the parent routine. */ -void IdealSolnGasVPSS::initThermoXML(XML_Node& phaseNode, std::string id) +void IdealSolnGasVPSS::initThermoXML(XML_Node& phaseNode, const std::string& id) { IdealSolnGasVPSS::initLengths(); diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index d984341d8..70d23c8ef 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -80,7 +80,8 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() : * If this parameter is zero, then a slave * neutral phase object is created and used. */ -IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(std::string inputFile, std::string id, +IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const std::string& inputFile, + const std::string& id, ThermoPhase* neutralPhase) : GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), @@ -102,8 +103,8 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(std::string inputFile, std::string initThermoFile(inputFile, id); } //==================================================================================================================== -IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot, std::string id, - ThermoPhase* neutralPhase) : +IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot, + const std::string& id, ThermoPhase* neutralPhase) : GibbsExcessVPSSTP(), ionSolnType_(cIonSolnType_SINGLEANION), numNeutralMoleculeSpecies_(0), @@ -956,7 +957,7 @@ void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c) */ -doublereal IonsFromNeutralVPSSTP::err(std::string msg) const +doublereal IonsFromNeutralVPSSTP::err(const std::string& msg) const { throw CanteraError("IonsFromNeutralVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -1057,7 +1058,7 @@ static double factorOverlap(const std::vector& elnamesVN , * to see if phaseNode is pointing to the phase * with the correct id. */ -void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void IonsFromNeutralVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { string stemp; if (id.size() > 0) { diff --git a/src/thermo/LatticePhase.cpp b/src/thermo/LatticePhase.cpp index 1ea20ae4f..11dcb0f21 100644 --- a/src/thermo/LatticePhase.cpp +++ b/src/thermo/LatticePhase.cpp @@ -87,7 +87,7 @@ LatticePhase::~LatticePhase() * @param inputFile String name of the input file * @param id string id of the phase name */ -LatticePhase::LatticePhase(std::string inputFile, std::string id) +LatticePhase::LatticePhase(const std::string& inputFile, const std::string& id) { initThermoFile(inputFile, id); } @@ -97,7 +97,7 @@ LatticePhase::LatticePhase(std::string inputFile, std::string id) * @param phaseRef XML node referencing the lattice phase. * @param id string id of the phase name */ -LatticePhase::LatticePhase(XML_Node& phaseRef, std::string id) +LatticePhase::LatticePhase(XML_Node& phaseRef, const std::string& id) { importPhase(*findXMLPhase(&phaseRef, id), this); } @@ -428,7 +428,7 @@ void LatticePhase::initThermo() ThermoPhase::initThermo(); } //==================================================================================================================== -void LatticePhase::initThermoXML(XML_Node& phaseNode, std::string id) +void LatticePhase::initThermoXML(XML_Node& phaseNode, const std::string& id) { std::string idattrib = phaseNode.id(); if (!id.empty() && id != idattrib) { diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 30557d036..5ab58b6ee 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -608,7 +608,7 @@ void LatticeSolidPhase::_updateThermo() const } } //==================================================================================================================== -void LatticeSolidPhase::setLatticeMoleFractionsByName(int nn, std::string x) +void LatticeSolidPhase::setLatticeMoleFractionsByName(int nn, const std::string& x) { m_lattice[nn]->setMoleFractionsByName(x); size_t loc = 0; @@ -694,7 +694,7 @@ void LatticeSolidPhase::modifyOneHf298SS(const int k, const doublereal Hf298New) #endif //==================================================================================================================== -doublereal LatticeSolidPhase::err(std::string msg) const +doublereal LatticeSolidPhase::err(const std::string& msg) const { throw CanteraError("LatticeSolidPhase","Unimplemented " + msg); return 0.0; diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index d2aa3966f..c8bac5abd 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -45,7 +45,7 @@ MargulesVPSSTP::MargulesVPSSTP() : * XML database to get the info for the phase. */ -MargulesVPSSTP::MargulesVPSSTP(std::string inputFile, std::string id) : +MargulesVPSSTP::MargulesVPSSTP(const std::string& inputFile, const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), formMargules_(0), @@ -54,7 +54,7 @@ MargulesVPSSTP::MargulesVPSSTP(std::string inputFile, std::string id) : initThermoFile(inputFile, id); } -MargulesVPSSTP::MargulesVPSSTP(XML_Node& phaseRoot, std::string id) : +MargulesVPSSTP::MargulesVPSSTP(XML_Node& phaseRoot, const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), formMargules_(0), @@ -502,7 +502,7 @@ void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const } } -doublereal MargulesVPSSTP::err(std::string msg) const +doublereal MargulesVPSSTP::err(const std::string& msg) const { throw CanteraError("MargulesVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -553,7 +553,7 @@ void MargulesVPSSTP::initLengths() * to see if phaseNode is pointing to the phase * with the correct id. */ -void MargulesVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void MargulesVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { string stemp; string subname = "MargulesVPSSTP::initThermoXML"; diff --git a/src/thermo/MetalSHEelectrons.cpp b/src/thermo/MetalSHEelectrons.cpp index 3f526719a..cce3ace42 100644 --- a/src/thermo/MetalSHEelectrons.cpp +++ b/src/thermo/MetalSHEelectrons.cpp @@ -45,7 +45,7 @@ MetalSHEelectrons::MetalSHEelectrons(): * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ -MetalSHEelectrons::MetalSHEelectrons(std::string infile, std::string id) : +MetalSHEelectrons::MetalSHEelectrons(const std::string& infile, std::string id) : SingleSpeciesTP(), xdef_(0) { @@ -79,7 +79,7 @@ MetalSHEelectrons::MetalSHEelectrons(std::string infile, std::string id) : * @param phaseRef XML node pointing to a MetalSHEelectrons description * @param id Id of the phase. */ -MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, std::string id) : +MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id) : SingleSpeciesTP(), xdef_(0) { @@ -438,7 +438,7 @@ void MetalSHEelectrons::initThermo() } //==================================================================================================================== -void MetalSHEelectrons::initThermoXML(XML_Node& phaseNode, std::string id) +void MetalSHEelectrons::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* * Find the Thermo XML node diff --git a/src/thermo/MineralEQ3.cpp b/src/thermo/MineralEQ3.cpp index 09fad0a3e..74fa0b7b7 100644 --- a/src/thermo/MineralEQ3.cpp +++ b/src/thermo/MineralEQ3.cpp @@ -46,7 +46,7 @@ MineralEQ3::MineralEQ3(): * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ -MineralEQ3::MineralEQ3(std::string infile, std::string id) : +MineralEQ3::MineralEQ3(const std::string& infile, std::string id) : StoichSubstanceSSTP() { XML_Node* root = get_XML_File(infile); @@ -73,7 +73,7 @@ MineralEQ3::MineralEQ3(std::string infile, std::string id) : * @param phaseRef XML node pointing to a MineralEQ3 description * @param id Id of the phase. */ -MineralEQ3::MineralEQ3(XML_Node& xmlphase, std::string id) : +MineralEQ3::MineralEQ3(XML_Node& xmlphase, const std::string& id) : StoichSubstanceSSTP() { if (id != "") { @@ -479,7 +479,7 @@ void MineralEQ3::getParameters(int& n, doublereal* const c) const * to see if phaseNode is pointing to the phase * with the correct id. */ -void MineralEQ3::initThermoXML(XML_Node& phaseNode, std::string id) +void MineralEQ3::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* * Find the Thermo XML node diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index f7ffde22e..0d3cb9d2e 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -46,7 +46,8 @@ MixedSolventElectrolyte::MixedSolventElectrolyte() : * XML database to get the info for the phase. */ -MixedSolventElectrolyte::MixedSolventElectrolyte(std::string inputFile, std::string id) : +MixedSolventElectrolyte::MixedSolventElectrolyte(const std::string& inputFile, + const std::string& id) : MolarityIonicVPSSTP(), numBinaryInteractions_(0), formMargules_(0), @@ -55,7 +56,8 @@ MixedSolventElectrolyte::MixedSolventElectrolyte(std::string inputFile, std::str initThermoFile(inputFile, id); } -MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot, std::string id) : +MixedSolventElectrolyte::MixedSolventElectrolyte(XML_Node& phaseRoot, + const std::string& id) : MolarityIonicVPSSTP(), numBinaryInteractions_(0), formMargules_(0), @@ -503,7 +505,7 @@ void MixedSolventElectrolyte::getPartialMolarVolumes(doublereal* vbar) const } } -doublereal MixedSolventElectrolyte::err(std::string msg) const +doublereal MixedSolventElectrolyte::err(const std::string& msg) const { throw CanteraError("MixedSolventElectrolyte","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -554,7 +556,7 @@ void MixedSolventElectrolyte::initLengths() * to see if phaseNode is pointing to the phase * with the correct id. */ -void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, std::string id) +void MixedSolventElectrolyte::initThermoXML(XML_Node& phaseNode, const std::string& id) { string subname = "MixedSolventElectrolyte::initThermoXML"; string stemp; diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index e6b728d97..a589958bd 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -190,7 +190,7 @@ int MixtureFugacityTP::reportSolnBranchActual() const */ //==================================================================================================================== -doublereal MixtureFugacityTP::err(std::string msg) const +doublereal MixtureFugacityTP::err(const std::string& msg) const { throw CanteraError("MixtureFugacityTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -707,7 +707,7 @@ void MixtureFugacityTP::setState_TPX(doublereal t, doublereal p, const doublerea * This routine initializes the lengths in the current object and * then calls the parent routine. */ -void MixtureFugacityTP::initThermoXML(XML_Node& phaseNode, std::string id) +void MixtureFugacityTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { MixtureFugacityTP::initLengths(); diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index c7a0fd1a7..ead8b9cbd 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -559,7 +559,7 @@ void MolalityVPSSTP::getElectrochemPotentials(doublereal* mu) const */ -doublereal MolalityVPSSTP::err(std::string msg) const +doublereal MolalityVPSSTP::err(const std::string& msg) const { throw CanteraError("MolalityVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -814,7 +814,7 @@ void MolalityVPSSTP::initLengths() * to see if phaseNode is pointing to the phase * with the correct id. */ -void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void MolalityVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { initLengths(); diff --git a/src/thermo/MolarityIonicVPSSTP.cpp b/src/thermo/MolarityIonicVPSSTP.cpp index 253fd7f1c..e31221535 100644 --- a/src/thermo/MolarityIonicVPSSTP.cpp +++ b/src/thermo/MolarityIonicVPSSTP.cpp @@ -53,7 +53,8 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP() : * the routine initThermo(), with a reference to the * XML database to get the info for the phase. */ -MolarityIonicVPSSTP::MolarityIonicVPSSTP(std::string inputFile, std::string id) : +MolarityIonicVPSSTP::MolarityIonicVPSSTP(const std::string& inputFile, + const std::string& id) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), @@ -66,7 +67,8 @@ MolarityIonicVPSSTP::MolarityIonicVPSSTP(std::string inputFile, std::string id) initThermoFile(inputFile, id); } //==================================================================================================================== -MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, std::string id) : +MolarityIonicVPSSTP::MolarityIonicVPSSTP(XML_Node& phaseRoot, + const std::string& id) : GibbsExcessVPSSTP(), PBType_(PBTYPE_PASSTHROUGH), numPBSpecies_(m_kk), @@ -486,7 +488,7 @@ void MolarityIonicVPSSTP::s_update_dlnActCoeff_dX_() const * ------------ Partial Molar Properties of the Solution ------------ */ //==================================================================================================================== -doublereal MolarityIonicVPSSTP::err(std::string msg) const +doublereal MolarityIonicVPSSTP::err(const std::string& msg) const { throw CanteraError("MolarityIonicVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -566,7 +568,7 @@ void MolarityIonicVPSSTP::initLengths() * to see if phaseNode is pointing to the phase * with the correct id. */ -void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void MolarityIonicVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { std::string subname = "MolarityIonicVPSSTP::initThermoXML"; std::string stemp; diff --git a/src/thermo/Mu0Poly.cpp b/src/thermo/Mu0Poly.cpp index 56ac1d295..6ded6bf19 100644 --- a/src/thermo/Mu0Poly.cpp +++ b/src/thermo/Mu0Poly.cpp @@ -202,7 +202,7 @@ void Mu0Poly::modifyParameters(doublereal* coeffs) * parameterization for species k into a SpeciesThermo instance, * getting the information from an XML database. */ -void installMu0ThermoFromXML(std::string speciesName, +void installMu0ThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const XML_Node* Mu0Node_ptr) { diff --git a/src/thermo/NasaThermo.h b/src/thermo/NasaThermo.h index 7028c8443..c4f064e6d 100644 --- a/src/thermo/NasaThermo.h +++ b/src/thermo/NasaThermo.h @@ -150,7 +150,7 @@ public: * parameterization. * @see speciesThermoTypes.h */ - virtual void install(std::string name, size_t index, int type, + virtual void install(const std::string& name, size_t index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure) { @@ -558,8 +558,8 @@ private: * @param clow coefficients for lower temperature region * @param chigh coefficients for higher temperature region */ - void checkContinuity(std::string name, double tmid, const doublereal* clow, - doublereal* chigh); + void checkContinuity(const std::string& name, double tmid, + const doublereal* clow, doublereal* chigh); //! for internal use by checkContinuity /*! diff --git a/src/thermo/PDSS.cpp b/src/thermo/PDSS.cpp index 12ef83f48..c001449d7 100644 --- a/src/thermo/PDSS.cpp +++ b/src/thermo/PDSS.cpp @@ -196,7 +196,7 @@ PDSS_enumType PDSS::reportPDSSType() const return m_pdssType; } -void PDSS::initThermoXML(const XML_Node& phaseNode, std::string& id) +void PDSS::initThermoXML(const XML_Node& phaseNode, const std::string& id) { AssertThrow(m_tp != 0, "PDSS::initThermoXML()"); m_p0 = m_vpssmgr_ptr->refPressure(m_spindex); @@ -525,7 +525,7 @@ doublereal PDSS::satPressure(doublereal t) } -void PDSS::err(std::string msg) const +void PDSS::err(const std::string& msg) const { throw CanteraError("PDSS::" + msg, "unimplemented"); } diff --git a/src/thermo/PDSS_ConstVol.cpp b/src/thermo/PDSS_ConstVol.cpp index 97abb3f88..81d216176 100644 --- a/src/thermo/PDSS_ConstVol.cpp +++ b/src/thermo/PDSS_ConstVol.cpp @@ -33,7 +33,8 @@ PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex) : } -PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex, std::string inputFile, std::string id) : +PDSS_ConstVol::PDSS_ConstVol(VPStandardStateTP* tp, size_t spindex, + const std::string& inputFile, const std::string& id) : PDSS(tp, spindex) { m_pdssType = cPDSS_CONSTVOL; @@ -148,7 +149,8 @@ void PDSS_ConstVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, * phase element will be used. */ void PDSS_ConstVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id) + const std::string& inputFile, + const std::string& id) { if (inputFile.size() == 0) { diff --git a/src/thermo/PDSS_HKFT.cpp b/src/thermo/PDSS_HKFT.cpp index 4afcff6f9..9f8dacf48 100644 --- a/src/thermo/PDSS_HKFT.cpp +++ b/src/thermo/PDSS_HKFT.cpp @@ -59,7 +59,8 @@ PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex) : } -PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex, std::string inputFile, std::string id) : +PDSS_HKFT::PDSS_HKFT(VPStandardStateTP* tp, size_t spindex, + const std::string& inputFile, const std::string& id) : PDSS(tp, spindex), m_waterSS(0), m_densWaterSS(-1.0), @@ -809,7 +810,8 @@ void PDSS_HKFT::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, } void PDSS_HKFT::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id) + const std::string& inputFile, + const std::string& id) { if (inputFile.size() == 0) { diff --git a/src/thermo/PDSS_IdealGas.cpp b/src/thermo/PDSS_IdealGas.cpp index 562258f76..72f7f3613 100644 --- a/src/thermo/PDSS_IdealGas.cpp +++ b/src/thermo/PDSS_IdealGas.cpp @@ -34,7 +34,7 @@ PDSS_IdealGas::PDSS_IdealGas(VPStandardStateTP* tp, int spindex) : PDSS_IdealGas::PDSS_IdealGas(VPStandardStateTP* tp, int spindex, - std::string inputFile, std::string id) : + const std::string& inputFile, const std::string& id) : PDSS(tp, spindex) { m_pdssType = cPDSS_IDEALGAS; @@ -113,7 +113,7 @@ PDSS* PDSS_IdealGas::duplMyselfAsPDSS() const * phase element will be used. */ void PDSS_IdealGas::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, - const XML_Node& phaseNode, std::string id) + const XML_Node& phaseNode, const std::string& id) { //initThermo(); //initThermoXML(phaseNode, id); @@ -121,7 +121,8 @@ void PDSS_IdealGas::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, void PDSS_IdealGas::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id) + const std::string& inputFile, + const std::string& id) { if (inputFile.size() == 0) { diff --git a/src/thermo/PDSS_IonsFromNeutral.cpp b/src/thermo/PDSS_IonsFromNeutral.cpp index a74b578d5..480777fca 100644 --- a/src/thermo/PDSS_IonsFromNeutral.cpp +++ b/src/thermo/PDSS_IonsFromNeutral.cpp @@ -37,7 +37,7 @@ PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex } //==================================================================================================================== PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id) : + const std::string& inputFile, const std::string& id) : PDSS(tp, spindex), neutralMoleculePhase_(0), numMult_(0), @@ -154,7 +154,7 @@ void PDSS_IonsFromNeutral::initAllPtrs(VPStandardStateTP* tp, VPSSMgr* vpssmgr_p */ void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, const XML_Node& speciesNode, - const XML_Node& phaseNode, std::string id) + const XML_Node& phaseNode, const std::string& id) { const XML_Node* tn = speciesNode.findByName("thermo"); if (!tn) { @@ -227,7 +227,7 @@ void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP* tp, size_t spinde * phase element will be used. */ void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id) + const std::string& inputFile, const std::string& id) { if (inputFile.size() == 0) { diff --git a/src/thermo/PDSS_SSVol.cpp b/src/thermo/PDSS_SSVol.cpp index 7dc33ec14..649a22f54 100644 --- a/src/thermo/PDSS_SSVol.cpp +++ b/src/thermo/PDSS_SSVol.cpp @@ -39,7 +39,7 @@ PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, size_t spindex) : PDSS_SSVol::PDSS_SSVol(VPStandardStateTP* tp, - size_t spindex, std::string inputFile, std::string id) : + size_t spindex, const std::string& inputFile, const std::string& id) : PDSS(tp, spindex), volumeModel_(cSSVOLUME_CONSTANT), m_constMolarVolume(-1.0) @@ -177,7 +177,7 @@ void PDSS_SSVol::constructPDSSXML(VPStandardStateTP* tp, size_t spindex, * phase element will be used. */ void PDSS_SSVol::constructPDSSFile(VPStandardStateTP* tp, size_t spindex, - std::string inputFile, std::string id) + const std::string& inputFile, const std::string& id) { if (inputFile.size() == 0) { diff --git a/src/thermo/PDSS_Water.cpp b/src/thermo/PDSS_Water.cpp index ac3067b57..a00a20d07 100644 --- a/src/thermo/PDSS_Water.cpp +++ b/src/thermo/PDSS_Water.cpp @@ -69,7 +69,7 @@ PDSS_Water::PDSS_Water(VPStandardStateTP* tp, int spindex) : PDSS_Water::PDSS_Water(VPStandardStateTP* tp, int spindex, - std::string inputFile, std::string id) : + const std::string& inputFile, const std::string& id) : PDSS(tp, spindex), m_sub(0), m_waterProps(0), @@ -196,7 +196,7 @@ PDSS* PDSS_Water::duplMyselfAsPDSS() const * phase element will be used. */ void PDSS_Water::constructPDSSXML(VPStandardStateTP* tp, int spindex, - const XML_Node& phaseNode, std::string id) + const XML_Node& phaseNode, const std::string& id) { constructSet(); } @@ -218,7 +218,7 @@ void PDSS_Water::constructPDSSXML(VPStandardStateTP* tp, int spindex, * phase element will be used. */ void PDSS_Water::constructPDSSFile(VPStandardStateTP* tp, int spindex, - std::string inputFile, std::string id) + const std::string& inputFile, const std::string& id) { if (inputFile.size() == 0) { diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 7b215d29a..866f6d1d0 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -122,7 +122,7 @@ std::string Phase::id() const return m_id; } -void Phase::setID(std::string id) +void Phase::setID(const std::string& id) { m_id = id; } @@ -132,7 +132,7 @@ std::string Phase::name() const return m_name; } -void Phase::setName(std::string nm) +void Phase::setName(const std::string& nm) { m_name = nm; } @@ -162,7 +162,7 @@ string Phase::elementName(size_t m) const return m_elementNames[m]; } -size_t Phase::elementIndex(std::string name) const +size_t Phase::elementIndex(const std::string& name) const { for (size_t i = 0; i < m_mm; i++) { if (m_elementNames[i] == name) { @@ -227,7 +227,7 @@ void Phase::getAtoms(size_t k, double* atomArray) const } } -size_t Phase::speciesIndex(std::string nameStr) const +size_t Phase::speciesIndex(const std::string& nameStr) const { std::string pn; std::string sn = parseSpeciesName(nameStr, pn); @@ -521,7 +521,7 @@ doublereal Phase::moleFraction(size_t k) const return m_ym[k] * m_mmw; } -doublereal Phase::moleFraction(std::string nameSpec) const +doublereal Phase::moleFraction(const std::string& nameSpec) const { size_t iloc = speciesIndex(nameSpec); if (iloc != npos) { @@ -542,7 +542,7 @@ doublereal Phase::massFraction(size_t k) const return m_y[k]; } -doublereal Phase::massFraction(std::string nameSpec) const +doublereal Phase::massFraction(const std::string& nameSpec) const { size_t iloc = speciesIndex(nameSpec); if (iloc != npos) { diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index caa309163..0ffe62783 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -45,7 +45,8 @@ PhaseCombo_Interaction::PhaseCombo_Interaction() : * * HKM - Checked for Transition */ -PhaseCombo_Interaction::PhaseCombo_Interaction(std::string inputFile, std::string id) : +PhaseCombo_Interaction::PhaseCombo_Interaction(const std::string& inputFile, + const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), formMargules_(0), @@ -59,7 +60,8 @@ PhaseCombo_Interaction::PhaseCombo_Interaction(std::string inputFile, std::strin * * HKM - Checked for Transition */ -PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot, std::string id) : +PhaseCombo_Interaction::PhaseCombo_Interaction(XML_Node& phaseRoot, + const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), formMargules_(0), @@ -513,7 +515,7 @@ void PhaseCombo_Interaction::getPartialMolarVolumes(doublereal* vbar) const } } //==================================================================================================================== -doublereal PhaseCombo_Interaction::err(std::string msg) const +doublereal PhaseCombo_Interaction::err(const std::string& msg) const { throw CanteraError("PhaseCombo_Interaction","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -564,7 +566,7 @@ void PhaseCombo_Interaction::initLengths() * to see if phaseNode is pointing to the phase * with the correct id. */ -void PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, std::string id) +void PhaseCombo_Interaction::initThermoXML(XML_Node& phaseNode, const std::string& id) { string subname = "PhaseCombo_Interaction::initThermoXML"; string stemp; diff --git a/src/thermo/PseudoBinaryVPSSTP.cpp b/src/thermo/PseudoBinaryVPSSTP.cpp index 1075de39e..7830eb416 100644 --- a/src/thermo/PseudoBinaryVPSSTP.cpp +++ b/src/thermo/PseudoBinaryVPSSTP.cpp @@ -237,7 +237,7 @@ void PseudoBinaryVPSSTP::calcPseudoBinaryMoleFractions() const */ -doublereal PseudoBinaryVPSSTP::err(std::string msg) const +doublereal PseudoBinaryVPSSTP::err(const std::string& msg) const { throw CanteraError("PseudoBinaryVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -288,7 +288,7 @@ void PseudoBinaryVPSSTP::initLengths() * to see if phaseNode is pointing to the phase * with the correct id. */ -void PseudoBinaryVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void PseudoBinaryVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 1da976bbc..c61fa6d89 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -53,7 +53,8 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP() : * XML database to get the info for the phase. */ -RedlichKisterVPSSTP::RedlichKisterVPSSTP(std::string inputFile, std::string id) : +RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile, + const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), m_pSpecies_A_ij(0), @@ -68,7 +69,8 @@ RedlichKisterVPSSTP::RedlichKisterVPSSTP(std::string inputFile, std::string id) initThermoFile(inputFile, id); } //==================================================================================================================== -RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot, std::string id) : +RedlichKisterVPSSTP::RedlichKisterVPSSTP(XML_Node& phaseRoot, + const std::string& id) : GibbsExcessVPSSTP(), numBinaryInteractions_(0), m_pSpecies_A_ij(0), @@ -477,7 +479,7 @@ void RedlichKisterVPSSTP::getPartialMolarVolumes(doublereal* vbar) const } } //==================================================================================================================== -doublereal RedlichKisterVPSSTP::err(std::string msg) const +doublereal RedlichKisterVPSSTP::err(const std::string& msg) const { throw CanteraError("RedlichKisterVPSSTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -522,7 +524,7 @@ void RedlichKisterVPSSTP::initLengths() * @param id ID of the phase. If nonnull, a check is done to see if phaseNode is pointing to the phase * with the correct id. */ -void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void RedlichKisterVPSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { std::string subname = "RedlichKisterVPSSTP::initThermoXML"; std::string stemp; diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index f83c8fa16..a0404f5be 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -57,7 +57,7 @@ RedlichKwongMFTP::RedlichKwongMFTP() : Vroot_[2] = 0.0; } //==================================================================================================================== -RedlichKwongMFTP::RedlichKwongMFTP(std::string infile, std::string id) : +RedlichKwongMFTP::RedlichKwongMFTP(const std::string& infile, std::string id) : MixtureFugacityTP(), m_standardMixingRules(0), m_formTempParam(0), @@ -92,7 +92,7 @@ RedlichKwongMFTP::RedlichKwongMFTP(std::string infile, std::string id) : importPhase(*xphase, this); } //==================================================================================================================== -RedlichKwongMFTP::RedlichKwongMFTP(XML_Node& phaseRefRoot, std::string id) : +RedlichKwongMFTP::RedlichKwongMFTP(XML_Node& phaseRefRoot, const std::string& id) : MixtureFugacityTP(), m_standardMixingRules(0), m_formTempParam(0), @@ -935,7 +935,7 @@ void RedlichKwongMFTP::initLengths() * This routine initializes the lengths in the current object and * then calls the parent routine. */ -void RedlichKwongMFTP::initThermoXML(XML_Node& phaseNode, std::string id) +void RedlichKwongMFTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { RedlichKwongMFTP::initLengths(); diff --git a/src/thermo/ShomateThermo.h b/src/thermo/ShomateThermo.h index 7c808b217..e978d3ef1 100644 --- a/src/thermo/ShomateThermo.h +++ b/src/thermo/ShomateThermo.h @@ -163,7 +163,7 @@ public: * @see ShomatePoly * @see ShomatePoly2 */ - virtual void install(std::string name, size_t index, int type, + virtual void install(const std::string& name, size_t index, int type, const doublereal* c, doublereal minTemp, doublereal maxTemp, doublereal refPressure) { diff --git a/src/thermo/SingleSpeciesTP.cpp b/src/thermo/SingleSpeciesTP.cpp index 9c0562c3c..fe7b469f3 100644 --- a/src/thermo/SingleSpeciesTP.cpp +++ b/src/thermo/SingleSpeciesTP.cpp @@ -623,7 +623,7 @@ void SingleSpeciesTP::setState_SV(doublereal s, doublereal v, * this class doesn't have an answer for the question given to it, * because the derived class isn't overriding a function. */ -doublereal SingleSpeciesTP::err(std::string msg) const +doublereal SingleSpeciesTP::err(const std::string& msg) const { throw CanteraError("SingleSpeciesTP","Base class method " +msg+" called. Equation of state type: " diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 1a3f125a2..36f957ffe 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -219,8 +219,8 @@ SpeciesThermo* SpeciesThermoFactory::newSpeciesThermoManager(std::string& stype) * Check the continuity of properties at the midpoint * temperature. */ -void NasaThermo::checkContinuity(std::string name, double tmid, const doublereal* clow, - doublereal* chigh) +void NasaThermo::checkContinuity(const std::string& name, double tmid, + const doublereal* clow, doublereal* chigh) { // heat capacity doublereal cplow = poly4(tmid, clow); @@ -276,7 +276,7 @@ void NasaThermo::checkContinuity(std::string name, double tmid, const doublereal * @param f0ptr Ptr to the first XML_Node for the first NASA polynomial * @param f1ptr Ptr to the first XML_Node for the first NASA polynomial */ -static void installNasaThermoFromXML(std::string speciesName, +static void installNasaThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const XML_Node* f0ptr, const XML_Node* f1ptr) { @@ -412,7 +412,7 @@ static doublereal convertDGFormation(size_t k, ThermoPhase* th_ptr) * @param k Species index within the phase * @param MinEQ3node Ptr to the first XML_Node for the first MinEQ3 parameterization */ -static void installMinEQ3asShomateThermoFromXML(std::string speciesName, +static void installMinEQ3asShomateThermoFromXML(const std::string& speciesName, ThermoPhase* th_ptr, SpeciesThermo& sp, size_t k, const XML_Node* MinEQ3node) @@ -499,7 +499,7 @@ static void installMinEQ3asShomateThermoFromXML(std::string speciesName, * @param f0ptr Ptr to the first XML_Node for the first NASA polynomial * @param f1ptr Ptr to the first XML_Node for the first NASA polynomial */ -static void installShomateThermoFromXML(std::string speciesName, SpeciesThermo& sp, size_t k, +static void installShomateThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const XML_Node* f0ptr, const XML_Node* f1ptr) { doublereal tmin0, tmax0, tmin1, tmax1, tmin, tmid, tmax; @@ -565,7 +565,7 @@ static void installShomateThermoFromXML(std::string speciesName, SpeciesThermo& * @param k Species index within the phase * @param f XML_Node for the SimpleThermo block */ -static void installSimpleThermoFromXML(std::string speciesName, +static void installSimpleThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const XML_Node& f) { @@ -595,7 +595,7 @@ static void installSimpleThermoFromXML(std::string speciesName, * @param k Species index within the phase * @param tp Vector of XML Nodes that make up the parameterization */ -static void installNasa9ThermoFromXML(std::string speciesName, +static void installNasa9ThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const std::vector& tp) { @@ -649,7 +649,7 @@ static void installNasa9ThermoFromXML(std::string speciesName, * Install a stat mech based property solver * for species k into a SpeciesThermo instance. */ -static void installStatMechThermoFromXML(std::string speciesName, +static void installStatMechThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, int k, const std::vector& tp) { @@ -702,7 +702,7 @@ static void installStatMechThermoFromXML(std::string speciesName, * @param k Species index within the phase * @param f XML Node that contains the parameterization */ -static void installAdsorbateThermoFromXML(std::string speciesName, +static void installAdsorbateThermoFromXML(const std::string& speciesName, SpeciesThermo& sp, size_t k, const XML_Node& f) { diff --git a/src/thermo/StatMech.cpp b/src/thermo/StatMech.cpp index d990bee14..6bd0f00f5 100644 --- a/src/thermo/StatMech.cpp +++ b/src/thermo/StatMech.cpp @@ -35,7 +35,7 @@ StatMech::StatMech() StatMech::StatMech(int n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs, - std::string my_name) : + const std::string& my_name) : m_lowT(tlow), m_highT(thigh), m_Pref(pref), diff --git a/src/thermo/StoichSubstanceSSTP.cpp b/src/thermo/StoichSubstanceSSTP.cpp index 2eddcfabe..00164c532 100644 --- a/src/thermo/StoichSubstanceSSTP.cpp +++ b/src/thermo/StoichSubstanceSSTP.cpp @@ -42,7 +42,7 @@ StoichSubstanceSSTP::StoichSubstanceSSTP(): * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ -StoichSubstanceSSTP::StoichSubstanceSSTP(std::string infile, std::string id) : +StoichSubstanceSSTP::StoichSubstanceSSTP(const std::string& infile, std::string id) : SingleSpeciesTP() { XML_Node* root = get_XML_File(infile); @@ -69,7 +69,7 @@ StoichSubstanceSSTP::StoichSubstanceSSTP(std::string infile, std::string id) : * @param phaseRef XML node pointing to a StoichSubstanceSSTP description * @param id Id of the phase. */ -StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, std::string id) : +StoichSubstanceSSTP::StoichSubstanceSSTP(XML_Node& xmlphase, const std::string& id) : SingleSpeciesTP() { if (id != "") { @@ -446,7 +446,7 @@ void StoichSubstanceSSTP::initThermo() } -void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, std::string id) +void StoichSubstanceSSTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* * Find the Thermo XML node @@ -530,7 +530,7 @@ electrodeElectron::electrodeElectron(): * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ -electrodeElectron::electrodeElectron(std::string infile, std::string id) : +electrodeElectron::electrodeElectron(const std::string& infile, std::string id) : StoichSubstanceSSTP() { XML_Node* root = get_XML_File(infile); @@ -557,7 +557,7 @@ electrodeElectron::electrodeElectron(std::string infile, std::string id) : * @param phaseRef XML node pointing to a electrodeElectron description * @param id Id of the phase. */ -electrodeElectron::electrodeElectron(XML_Node& xmlphase, std::string id) : +electrodeElectron::electrodeElectron(XML_Node& xmlphase, const std::string& id) : StoichSubstanceSSTP() { if (id != "") { @@ -616,7 +616,7 @@ void electrodeElectron::setParametersFromXML(const XML_Node& eosdata) } } -void electrodeElectron::initThermoXML(XML_Node& phaseNode, std::string id) +void electrodeElectron::initThermoXML(XML_Node& phaseNode, const std::string& id) { doublereal rho = 10.0; setDensity(rho); diff --git a/src/thermo/SurfPhase.cpp b/src/thermo/SurfPhase.cpp index 9e0e84058..e5bb41c77 100644 --- a/src/thermo/SurfPhase.cpp +++ b/src/thermo/SurfPhase.cpp @@ -39,7 +39,7 @@ SurfPhase::SurfPhase(doublereal n0): setNDim(2); } -SurfPhase::SurfPhase(std::string infile, std::string id) : +SurfPhase::SurfPhase(const std::string& infile, std::string id) : ThermoPhase(), m_n0(0.0), m_logn0(0.0), @@ -408,7 +408,7 @@ getCoverages(doublereal* theta) const } void SurfPhase:: -setCoveragesByName(std::string cov) +setCoveragesByName(const std::string& cov) { size_t kk = nSpecies(); compositionMap cc = parseCompString(cov, speciesNames()); diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 36610892e..2484d0a1a 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -92,7 +92,7 @@ static int _itypes[] = {cIdealGas, cIncompressible, /* * This method returns a new instance of a subclass of ThermoPhase */ -ThermoPhase* ThermoFactory::newThermoPhase(std::string model) +ThermoPhase* ThermoFactory::newThermoPhase(const std::string& model) { int ieos=-1; @@ -251,7 +251,7 @@ ThermoPhase* newPhase(XML_Node& xmlphase) return t; } -ThermoPhase* newPhase(std::string infile, std::string id) +ThermoPhase* newPhase(const std::string& infile, std::string id) { XML_Node* root = get_XML_File(infile); if (id == "-") { @@ -776,7 +776,7 @@ bool installSpecies(size_t k, const XML_Node& s, thermo_t& th, * containing the species data for that phase. * */ -const XML_Node* speciesXML_Node(std::string kname, +const XML_Node* speciesXML_Node(const std::string& kname, const XML_Node* phaseSpeciesData) { if (!phaseSpeciesData) { diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 13dd461ac..f892ad688 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -661,7 +661,7 @@ void ThermoPhase::setState_SPorSV(doublereal Starget, doublereal p, } //================================================================================================================= -doublereal ThermoPhase::err(std::string msg) const +doublereal ThermoPhase::err(const std::string& msg) const { throw CanteraError("ThermoPhase","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -775,7 +775,8 @@ SpeciesThermo& ThermoPhase::speciesThermo(int k) * phase. If none is given, the first XML * phase element will be used. */ -void ThermoPhase::initThermoFile(std::string inputFile, std::string id) +void ThermoPhase::initThermoFile(const std::string& inputFile, + const std::string& id) { if (inputFile.size() == 0) { @@ -830,7 +831,7 @@ void ThermoPhase::initThermoFile(std::string inputFile, std::string id) * to see if phaseNode is pointing to the phase * with the correct id. */ -void ThermoPhase::initThermoXML(XML_Node& phaseNode, std::string id) +void ThermoPhase::initThermoXML(XML_Node& phaseNode, const std::string& id) { /* diff --git a/src/thermo/VPSSMgr.cpp b/src/thermo/VPSSMgr.cpp index 361c85d5a..7b5c028d5 100644 --- a/src/thermo/VPSSMgr.cpp +++ b/src/thermo/VPSSMgr.cpp @@ -390,7 +390,7 @@ VPSSMgr::initLengths() mPDSS_Vss.resize(m_kk, 0.0); } -void VPSSMgr::initThermoXML(XML_Node& phaseNode, std::string id) +void VPSSMgr::initThermoXML(XML_Node& phaseNode, const std::string& id) { const PDSS* kPDSS = m_vptp_ptr->providePDSS(0); m_p0 = kPDSS->refPressure(); @@ -499,7 +499,7 @@ VPSSMgr_enumType VPSSMgr::reportVPSSMgrType() const /*****************************************************************/ -void VPSSMgr::err(std::string msg) const +void VPSSMgr::err(const std::string& msg) const { throw CanteraError("VPSSMgr::" + msg, "unimplemented"); } diff --git a/src/thermo/VPSSMgrFactory.cpp b/src/thermo/VPSSMgrFactory.cpp index d3ff83a6c..0c4dfb01b 100644 --- a/src/thermo/VPSSMgrFactory.cpp +++ b/src/thermo/VPSSMgrFactory.cpp @@ -207,7 +207,7 @@ VPSSMgrFactory::~VPSSMgrFactory() } VPSSMgr_enumType -VPSSMgrFactory::VPSSMgr_StringConversion(std::string ssModel) const +VPSSMgrFactory::VPSSMgr_StringConversion(const std::string& ssModel) const { std::string lssModel = lowercase(ssModel); VPSSMgr_enumType type; diff --git a/src/thermo/VPSSMgrFactory.h b/src/thermo/VPSSMgrFactory.h index 2b4c6680e..1d82e953a 100644 --- a/src/thermo/VPSSMgrFactory.h +++ b/src/thermo/VPSSMgrFactory.h @@ -38,8 +38,8 @@ public: * @param proc Function name error occurred. * @param VPSSMgrModel Unrecognized species thermo calculator name */ - UnknownVPSSMgrModel(std::string proc, - std::string VPSSMgrModel) : + UnknownVPSSMgrModel(const std::string& proc, + const std::string& VPSSMgrModel) : CanteraError(proc, "Specified VPSSMgr model " + VPSSMgrModel + " does not match any known type.") {} @@ -121,7 +121,7 @@ public: * @param ssModel String representing the VPSSMGr object */ virtual VPSSMgr_enumType - VPSSMgr_StringConversion(std::string ssModel) const; + VPSSMgr_StringConversion(const std::string& ssModel) const; //! Create a new species variable pressure standard state calculator /*! diff --git a/src/thermo/VPSSMgr_ConstVol.cpp b/src/thermo/VPSSMgr_ConstVol.cpp index 688d57e9c..9e8733b90 100644 --- a/src/thermo/VPSSMgr_ConstVol.cpp +++ b/src/thermo/VPSSMgr_ConstVol.cpp @@ -125,7 +125,7 @@ void VPSSMgr_ConstVol::initThermo() } void -VPSSMgr_ConstVol::initThermoXML(XML_Node& phaseNode, std::string id) +VPSSMgr_ConstVol::initThermoXML(XML_Node& phaseNode, const std::string& id) { VPSSMgr::initThermoXML(phaseNode, id); diff --git a/src/thermo/VPSSMgr_General.cpp b/src/thermo/VPSSMgr_General.cpp index cb2cabfec..be7eae1ed 100644 --- a/src/thermo/VPSSMgr_General.cpp +++ b/src/thermo/VPSSMgr_General.cpp @@ -161,7 +161,7 @@ void VPSSMgr_General::getGibbs_ref(doublereal* g) const } void -VPSSMgr_General::initThermoXML(XML_Node& phaseNode, std::string id) +VPSSMgr_General::initThermoXML(XML_Node& phaseNode, const std::string& id) { VPSSMgr::initThermoXML(phaseNode, id); } diff --git a/src/thermo/VPSSMgr_IdealGas.cpp b/src/thermo/VPSSMgr_IdealGas.cpp index 71f8eef4e..86f482bee 100644 --- a/src/thermo/VPSSMgr_IdealGas.cpp +++ b/src/thermo/VPSSMgr_IdealGas.cpp @@ -90,7 +90,7 @@ void VPSSMgr_IdealGas::_updateStandardStateThermo() } void -VPSSMgr_IdealGas::initThermoXML(XML_Node& phaseNode, std::string id) +VPSSMgr_IdealGas::initThermoXML(XML_Node& phaseNode, const std::string& id) { VPSSMgr::initThermoXML(phaseNode, id); } diff --git a/src/thermo/VPSSMgr_Water_ConstVol.cpp b/src/thermo/VPSSMgr_Water_ConstVol.cpp index ee09f6f49..99a3a6435 100644 --- a/src/thermo/VPSSMgr_Water_ConstVol.cpp +++ b/src/thermo/VPSSMgr_Water_ConstVol.cpp @@ -216,7 +216,7 @@ void VPSSMgr_Water_ConstVol::initThermo() } void -VPSSMgr_Water_ConstVol::initThermoXML(XML_Node& phaseNode, std::string id) +VPSSMgr_Water_ConstVol::initThermoXML(XML_Node& phaseNode, const std::string& id) { VPSSMgr::initThermoXML(phaseNode, id); diff --git a/src/thermo/VPSSMgr_Water_HKFT.cpp b/src/thermo/VPSSMgr_Water_HKFT.cpp index d3b66649b..46256c091 100644 --- a/src/thermo/VPSSMgr_Water_HKFT.cpp +++ b/src/thermo/VPSSMgr_Water_HKFT.cpp @@ -214,7 +214,7 @@ void VPSSMgr_Water_HKFT::initThermo() void -VPSSMgr_Water_HKFT::initThermoXML(XML_Node& phaseNode, std::string id) +VPSSMgr_Water_HKFT::initThermoXML(XML_Node& phaseNode, const std::string& id) { VPSSMgr::initThermoXML(phaseNode, id); diff --git a/src/thermo/VPStandardStateTP.cpp b/src/thermo/VPStandardStateTP.cpp index 76b115f6b..ff34636d7 100644 --- a/src/thermo/VPStandardStateTP.cpp +++ b/src/thermo/VPStandardStateTP.cpp @@ -171,7 +171,7 @@ int VPStandardStateTP::standardStateConvention() const */ -doublereal VPStandardStateTP::err(std::string msg) const +doublereal VPStandardStateTP::err(const std::string& msg) const { throw CanteraError("VPStandardStateTP","Base class method " +msg+" called. Equation of state type: "+int2str(eosType())); @@ -478,7 +478,7 @@ VPStandardStateTP::providePDSS(size_t k) const * This routine initializes the lengths in the current object and * then calls the parent routine. */ -void VPStandardStateTP::initThermoXML(XML_Node& phaseNode, std::string id) +void VPStandardStateTP::initThermoXML(XML_Node& phaseNode, const std::string& id) { VPStandardStateTP::initLengths(); diff --git a/src/thermo/WaterSSTP.cpp b/src/thermo/WaterSSTP.cpp index ccfd14ada..28c3d7b07 100644 --- a/src/thermo/WaterSSTP.cpp +++ b/src/thermo/WaterSSTP.cpp @@ -40,7 +40,7 @@ WaterSSTP::WaterSSTP() : } -WaterSSTP::WaterSSTP(std::string inputFile, std::string id) : +WaterSSTP::WaterSSTP(const std::string& inputFile, const std::string& id) : SingleSpeciesTP(), m_sub(0), m_waterProps(0), @@ -54,7 +54,7 @@ WaterSSTP::WaterSSTP(std::string inputFile, std::string id) : } -WaterSSTP::WaterSSTP(XML_Node& phaseRoot, std::string id) : +WaterSSTP::WaterSSTP(XML_Node& phaseRoot, const std::string& id) : SingleSpeciesTP(), m_sub(0), m_waterProps(0), @@ -129,7 +129,7 @@ void WaterSSTP::initThermo() } void WaterSSTP:: -initThermoXML(XML_Node& phaseNode, std::string id) +initThermoXML(XML_Node& phaseNode, const std::string& id) { /* diff --git a/src/transport/LTPspecies.cpp b/src/transport/LTPspecies.cpp index fbcb2d282..9e140a13c 100644 --- a/src/transport/LTPspecies.cpp +++ b/src/transport/LTPspecies.cpp @@ -21,7 +21,7 @@ public: /*! * @param msg Informative message */ - LTPError(std::string msg) : + explicit LTPError(const std::string& msg) : CanteraError("LTPspecies", "error parsing transport data: " + msg + "\n") { } }; @@ -62,7 +62,7 @@ static void getArrhenius(const XML_Node& node, * is creating a parameterization for (e.g., viscosity) * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. */ -LTPspecies::LTPspecies(const XML_Node* const propNode, std::string name, +LTPspecies::LTPspecies(const XML_Node* const propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo) : m_speciesName(name), m_model(LTP_TD_NOTSET), @@ -151,7 +151,7 @@ void LTPspecies::adjustCoeffsForComposition() * \verbatim \endverbatim node and specifies a type of * transport property (like viscosity) */ -LTPspecies_Const::LTPspecies_Const(const XML_Node& propNode, std::string name, +LTPspecies_Const::LTPspecies_Const(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* const thermo) : LTPspecies(&propNode, name, tp_ind, thermo) { @@ -216,7 +216,7 @@ doublereal LTPspecies_Const::getSpeciesTransProp() * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. * */ -LTPspecies_Arrhenius::LTPspecies_Arrhenius(const XML_Node& propNode, std::string name, +LTPspecies_Arrhenius::LTPspecies_Arrhenius(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo) : LTPspecies(&propNode, name, tp_ind, thermo) { @@ -329,7 +329,7 @@ doublereal LTPspecies_Arrhenius::getSpeciesTransProp() * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. * */ -LTPspecies_Poly::LTPspecies_Poly(const XML_Node& propNode, std::string name, +LTPspecies_Poly::LTPspecies_Poly(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo) : LTPspecies(&propNode, name, tp_ind, thermo), m_temp(-1.0), @@ -402,7 +402,7 @@ doublereal LTPspecies_Poly::getSpeciesTransProp() * @param thermo const pointer to the ThermoPhase object, which is used to find the temperature. * */ -LTPspecies_ExpT::LTPspecies_ExpT(const XML_Node& propNode, std::string name, TransportPropertyType tp_ind, +LTPspecies_ExpT::LTPspecies_ExpT(const XML_Node& propNode, const std::string& name, TransportPropertyType tp_ind, const thermo_t* thermo) : LTPspecies(&propNode, name, tp_ind, thermo), m_temp(-1.0), diff --git a/src/transport/LiquidTranInteraction.cpp b/src/transport/LiquidTranInteraction.cpp index 0387bdd3f..df3373240 100644 --- a/src/transport/LiquidTranInteraction.cpp +++ b/src/transport/LiquidTranInteraction.cpp @@ -23,7 +23,7 @@ namespace Cantera class LTPError : public CanteraError { public: - LTPError(std::string msg) + explicit LTPError(const std::string& msg) : CanteraError("LTPspecies", "error parsing transport data: " + msg + "\n") {} @@ -36,7 +36,7 @@ public: class LTPmodelError : public CanteraError { public: - LTPmodelError(std::string msg) + explicit LTPmodelError(const std::string& msg) : CanteraError("LTPspecies", "error parsing transport data: " + msg + "\n") {} diff --git a/src/transport/LiquidTransport.cpp b/src/transport/LiquidTransport.cpp index efa7464b7..2a5f3e145 100644 --- a/src/transport/LiquidTransport.cpp +++ b/src/transport/LiquidTransport.cpp @@ -1841,7 +1841,7 @@ void LiquidTransport::stefan_maxwell_solve() /* * @param msg String with an informative message */ -doublereal LiquidTransport::err(std::string msg) const +doublereal LiquidTransport::err(const std::string& msg) const { throw CanteraError("LiquidTransport::err()", "\n\n\n**** Method "+ msg +" not implemented in model " diff --git a/src/transport/LiquidTransportParams.cpp b/src/transport/LiquidTransportParams.cpp index abab53815..7f3cb547a 100644 --- a/src/transport/LiquidTransportParams.cpp +++ b/src/transport/LiquidTransportParams.cpp @@ -18,7 +18,7 @@ namespace Cantera class LTPmodelError : public CanteraError { public: - LTPmodelError(std::string msg) : + explicit LTPmodelError(const std::string& msg) : CanteraError("LTPspecies", "error parsing transport data: " + msg + "\n") { } }; diff --git a/src/transport/SimpleTransport.cpp b/src/transport/SimpleTransport.cpp index 368dca81d..ce1d8d60d 100644 --- a/src/transport/SimpleTransport.cpp +++ b/src/transport/SimpleTransport.cpp @@ -1018,7 +1018,7 @@ bool SimpleTransport::update_T() * Throw an exception if this method is invoked. * This probably indicates something is not yet implemented. */ -doublereal SimpleTransport::err(std::string msg) const +doublereal SimpleTransport::err(const std::string& msg) const { throw CanteraError("SimpleTransport Class", "\n\n\n**** Method "+ msg +" not implemented in model " diff --git a/src/transport/TransportBase.cpp b/src/transport/TransportBase.cpp index 18c6a856e..ab413b456 100644 --- a/src/transport/TransportBase.cpp +++ b/src/transport/TransportBase.cpp @@ -121,7 +121,7 @@ void Transport::setThermo(thermo_t& thermo) } -doublereal Transport::err(std::string msg) const +doublereal Transport::err(const std::string& msg) const { throw CanteraError("Transport Base Class", diff --git a/src/transport/TransportFactory.cpp b/src/transport/TransportFactory.cpp index f33963929..8cbb91a95 100644 --- a/src/transport/TransportFactory.cpp +++ b/src/transport/TransportFactory.cpp @@ -68,7 +68,7 @@ public: * @param linenum inputs the line number * @param msg String message to be sent to the user */ - TransportDBError(int linenum, std::string msg) : + TransportDBError(int linenum, const std::string& msg) : CanteraError("getTransportData", "error reading transport data: " + msg + "\n") { } }; @@ -355,7 +355,7 @@ LiquidTranInteraction* TransportFactory::newLTI(const XML_Node& trNode, make one of several transport models, and return a base class pointer to it. */ -Transport* TransportFactory::newTransport(std::string transportModel, +Transport* TransportFactory::newTransport(const std::string& transportModel, thermo_t* phase, int log_level) { @@ -1476,7 +1476,7 @@ void TransportFactory::fitProperties(GasTransportParams& tr, * * @ingroup transportProps */ -Transport* newTransportMgr(std::string transportModel, thermo_t* thermo, int loglevel, TransportFactory* f) +Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, TransportFactory* f) { if (f == 0) { f = TransportFactory::factory(); diff --git a/src/transport/TransportParams.cpp b/src/transport/TransportParams.cpp index f4891928a..bf6a448c1 100644 --- a/src/transport/TransportParams.cpp +++ b/src/transport/TransportParams.cpp @@ -15,7 +15,7 @@ using namespace std; namespace Cantera { //==================================================================================================================== -NotImplemented::NotImplemented(std::string method) : +NotImplemented::NotImplemented(const std::string& method) : CanteraError("Transport", "\n\n**** Method " + method + " not implemented. ****\n" "(Did you forget to specify a transport model?)\n\n") diff --git a/src/zeroD/ReactorFactory.cpp b/src/zeroD/ReactorFactory.cpp index 53eac7977..071fe1241 100644 --- a/src/zeroD/ReactorFactory.cpp +++ b/src/zeroD/ReactorFactory.cpp @@ -30,7 +30,7 @@ static int _itypes[] = {ReservoirType, ReactorType, ConstPressureReactorType, /** * This method returns a new instance of a subclass of ThermoPhase */ -ReactorBase* ReactorFactory::newReactor(string reactorType) +ReactorBase* ReactorFactory::newReactor(const std::string& reactorType) { int ir=-1; diff --git a/test_problems/cxx_ex/equil_example1.cpp b/test_problems/cxx_ex/equil_example1.cpp index c754e6098..7cb59a1ca 100644 --- a/test_problems/cxx_ex/equil_example1.cpp +++ b/test_problems/cxx_ex/equil_example1.cpp @@ -28,8 +28,8 @@ void makeEquilDataLabels(const G& gas, V& names) } template -void plotEquilSoln(std::string fname, std::string fmt, std::string title, - const G& gas, const A& soln) +void plotEquilSoln(const std::string& fname, const std::string& fmt, + const std::string& title, const G& gas, const A& soln) { std::vector names; makeEquilDataLabels(gas, names); diff --git a/test_problems/cxx_ex/example_utils.h b/test_problems/cxx_ex/example_utils.h index 8b9f1295e..7e45cb293 100644 --- a/test_problems/cxx_ex/example_utils.h +++ b/test_problems/cxx_ex/example_utils.h @@ -47,8 +47,8 @@ void makeDataLabels(const G& gas, V& names) } template -void plotSoln(std::string fname, std::string fmt, std::string title, - const G& gas, const A& soln) +void plotSoln(const std::string& fname, const std::string& fmt, + const std::string& title, const G& gas, const A& soln) { std::vector names; makeDataLabels(gas, names); diff --git a/test_problems/cxx_ex/transport_example1.cpp b/test_problems/cxx_ex/transport_example1.cpp index 0d5fd2b98..52d44e49d 100644 --- a/test_problems/cxx_ex/transport_example1.cpp +++ b/test_problems/cxx_ex/transport_example1.cpp @@ -28,8 +28,8 @@ void makeTransportDataLabels(const G& gas, V& names) } template -void plotTransportSoln(std::string fname, std::string fmt, std::string title, - const G& gas, const A& soln) +void plotTransportSoln(const std::string& fname, const std::string& fmt, + const std::string& title, const G& gas, const A& soln) { std::vector names; makeTransportDataLabels(gas, names); diff --git a/test_problems/cxx_ex/transport_example2.cpp b/test_problems/cxx_ex/transport_example2.cpp index a439dd6b5..e4466b512 100644 --- a/test_problems/cxx_ex/transport_example2.cpp +++ b/test_problems/cxx_ex/transport_example2.cpp @@ -29,8 +29,8 @@ void makeTransportDataLabels(const G& gas, V& names) } template -void plotTransportSoln(std::string fname, std::string fmt, std::string title, - const G& gas, const A& soln) +void plotTransportSoln(const std::string& fname, const std::string& fmt, + const std::string& title, const G& gas, const A& soln) { std::vector names; makeTransportDataLabels(gas, names); diff --git a/test_problems/shared/fileLog.h b/test_problems/shared/fileLog.h index 2b9ccc740..2415b60d7 100644 --- a/test_problems/shared/fileLog.h +++ b/test_problems/shared/fileLog.h @@ -6,7 +6,7 @@ class fileLog: public Cantera::Logger { public: - fileLog(std::string fName) { + explicit fileLog(const std::string& fName) { m_fName = fName; m_fs.open(fName.c_str()); }