Pass "const std::string&" instead of "std::string" when possible

This commit is contained in:
Ray Speth
2012-10-24 15:42:51 +00:00
parent d2ac071660
commit 1d19803885
186 changed files with 588 additions and 554 deletions

View File

@@ -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");

View File

@@ -14,7 +14,7 @@ class Edge :
public EdgePhase, public EdgeKinetics
{
public:
Edge(std::string infile, std::string id, std::vector<ThermoPhase*> phases)
Edge(const std::string& infile, std::string id, std::vector<ThermoPhase*> phases)
: m_ok(false), m_r(0) {
m_r = get_XML_File(infile);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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<Cantera::ThermoPhase*> 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<Cantera::ThermoPhase*> phases)
Interface* importInterface(const std::string& infile, const std::string& id,
std::vector<Cantera::ThermoPhase*> phases)
{
return new Interface(infile, id, phases);
}

View File

@@ -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 == "-") {

View File

@@ -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);
}

View File

@@ -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<int>(name.size());
std::string nm(name);
for (int m = 0; m < ns; m++)

View File

@@ -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() {};

View File

@@ -619,7 +619,7 @@ void getFloats(const Cantera::XML_Node& node, std::map<std::string, double>& 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.
/*!

View File

@@ -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

View File

@@ -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
/*!

View File

@@ -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<std::string, std::string>& 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;
}

View File

@@ -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

View File

@@ -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;
};

View File

@@ -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<ThermoPhase*> 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();

View File

@@ -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<std::string>& names) {
@@ -247,7 +248,7 @@ public:
std::vector<size_t> 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);

View File

@@ -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:

View File

@@ -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<size_t, std::string>& out) {
void writeMultiply(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0);
}
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
void writeIncrementReaction(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0);
}
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
void writeDecrementReaction(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0);
}
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
void writeIncrementSpecies(const std::string& r, std::map<size_t, std::string>& out) {
out[m_ic0] += " + "+fmt(r, m_rxn);
}
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
void writeDecrementSpecies(const std::string& r, std::map<size_t, std::string>& out) {
out[m_ic0] += " - "+fmt(r, m_rxn);
}
@@ -311,22 +311,22 @@ public:
return 2;
}
void writeMultiply(std::string r, std::map<size_t, std::string>& out) {
void writeMultiply(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1);
}
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
void writeIncrementReaction(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1);
}
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
void writeDecrementReaction(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1);
}
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
void writeIncrementSpecies(const std::string& r, std::map<size_t, std::string>& out) {
std::string s = " + "+fmt(r, m_rxn);
out[m_ic0] += s;
out[m_ic1] += s;
}
void writeDecrementSpecies(std::string r, std::map<size_t, std::string>& out) {
void writeDecrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeMultiply(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] = fmt(r, m_ic0) + " * " + fmt(r, m_ic1) + " * " + fmt(r, m_ic2);
}
void writeIncrementReaction(std::string r, std::map<size_t, std::string>& out) {
void writeIncrementReaction(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] += " + "+fmt(r, m_ic0)+" + "+fmt(r, m_ic1)+" + "+fmt(r, m_ic2);
}
void writeDecrementReaction(std::string r, std::map<size_t, std::string>& out) {
void writeDecrementReaction(const std::string& r, std::map<size_t, std::string>& out) {
out[m_rxn] += " - "+fmt(r, m_ic0)+" - "+fmt(r, m_ic1)+" - "+fmt(r, m_ic2);
}
void writeIncrementSpecies(std::string r, std::map<size_t, std::string>& out) {
void writeIncrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeDecrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeMultiply(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeIncrementReaction(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeDecrementReaction(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeIncrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeDecrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<class InputIter>
inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::string r,
std::map<size_t, std::string>& out)
inline static void _writeIncrementSpecies(InputIter begin, InputIter end,
const std::string& r, std::map<size_t, std::string>& out)
{
for (; begin != end; ++begin) {
begin->writeIncrementSpecies(r, out);
@@ -668,8 +668,8 @@ inline static void _writeIncrementSpecies(InputIter begin, InputIter end, std::s
}
template<class InputIter>
inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::string r,
std::map<size_t, std::string>& out)
inline static void _writeDecrementSpecies(InputIter begin, InputIter end,
const std::string& r, std::map<size_t, std::string>& out)
{
for (; begin != end; ++begin) {
begin->writeDecrementSpecies(r, out);
@@ -677,8 +677,8 @@ inline static void _writeDecrementSpecies(InputIter begin, InputIter end, std::s
}
template<class InputIter>
inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::string r,
std::map<size_t, std::string>& out)
inline static void _writeIncrementReaction(InputIter begin, InputIter end,
const std::string& r, std::map<size_t, std::string>& out)
{
for (; begin != end; ++begin) {
begin->writeIncrementReaction(r, out);
@@ -686,8 +686,8 @@ inline static void _writeIncrementReaction(InputIter begin, InputIter end, std::
}
template<class InputIter>
inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::string r,
std::map<size_t, std::string>& out)
inline static void _writeDecrementReaction(InputIter begin, InputIter end,
const std::string& r, std::map<size_t, std::string>& out)
{
for (; begin != end; ++begin) {
begin->writeDecrementReaction(r, out);
@@ -695,8 +695,8 @@ inline static void _writeDecrementReaction(InputIter begin, InputIter end, std::
}
template<class InputIter>
inline static void _writeMultiply(InputIter begin, InputIter end, std::string r,
std::map<size_t, std::string>& out)
inline static void _writeMultiply(InputIter begin, InputIter end,
const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeIncrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeDecrementSpecies(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeIncrementReaction(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeDecrementReaction(const std::string& r, std::map<size_t, std::string>& 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<size_t, std::string>& out) {
void writeMultiply(const std::string& r, std::map<size_t, std::string>& 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);

View File

@@ -225,8 +225,8 @@ bool importKinetics(const XML_Node& phase, std::vector<ThermoPhase*> 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.
/*!

View File

@@ -47,7 +47,7 @@ enum BEulerMethodType {
class BEulerErr : public CanteraError
{
public:
BEulerErr(std::string msg);
explicit BEulerErr(const std::string& msg);
};

View File

@@ -423,7 +423,7 @@ private:
/*!
* @param msg String containing the message.
*/
void err(std::string msg) const;
void err(const std::string& msg) const;
};

View File

@@ -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

View File

@@ -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) {
}

View File

@@ -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;

View File

@@ -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) {}
};

View File

@@ -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);

View File

@@ -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++) {

View File

@@ -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];

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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];

View File

@@ -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.
/*!

View File

@@ -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.
/*!

View File

@@ -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
/*!

View File

@@ -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);

View File

@@ -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:

View File

@@ -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:
/*!

View File

@@ -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

View File

@@ -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);
/**

View File

@@ -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.

View File

@@ -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:

View File

@@ -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
/*!

View File

@@ -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:

View File

@@ -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:

View File

@@ -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
/*!

View File

@@ -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
/*!

View File

@@ -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:

View File

@@ -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;
};
}

View File

@@ -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;
};

View File

@@ -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:

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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
/*!

View File

@@ -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
/*!

View File

@@ -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
/*!

View File

@@ -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
/*!

View File

@@ -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
/*!

View File

@@ -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
/*!

View File

@@ -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<std::string>& 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

View File

@@ -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:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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

View File

@@ -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]));

View File

@@ -760,7 +760,7 @@ private:
/*!
* @param msg String message
*/
doublereal err(std::string msg) const;
doublereal err(const std::string& msg) const;
};
}

View File

@@ -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;

View File

@@ -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 +

View File

@@ -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<T1, T2>::duplMyselfAsSpeciesThermo() const
template<class T1, class T2>
void
SpeciesThermoDuo<T1, T2>::install(std::string name, size_t sp, int type,
SpeciesThermoDuo<T1, T2>::install(const std::string& name, size_t sp, int type,
const doublereal* c,
doublereal minTemp,
doublereal maxTemp,

View File

@@ -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
/*!

View File

@@ -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);
};

View File

@@ -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
/*!

View File

@@ -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);
//@}

View File

@@ -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;
};

View File

@@ -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;
};
//@}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;
};
}

View File

@@ -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
/*!

View File

@@ -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

View File

@@ -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

View File

@@ -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;
};
}

View File

@@ -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;
};
}

View File

@@ -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;
};

View File

@@ -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.

View File

@@ -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.

View File

@@ -175,7 +175,7 @@ private:
ReactorBase* m_out;
std::vector<size_t> 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");
}

View File

@@ -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) {

View File

@@ -47,7 +47,8 @@ void makeDataLabels(const G& gas, V& names)
}
template<class G, class A>
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<std::string> names;
makeDataLabels(gas, names);

View File

@@ -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 = &current->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('/');

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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 \"" +

View File

@@ -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) {

View File

@@ -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());
}

View File

@@ -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 == "") {

Some files were not shown because too many files have changed in this diff Show More