diff --git a/include/cantera/zeroD/ConstPressureReactor.h b/include/cantera/zeroD/ConstPressureReactor.h index 103966f10..4e83d159f 100644 --- a/include/cantera/zeroD/ConstPressureReactor.h +++ b/include/cantera/zeroD/ConstPressureReactor.h @@ -55,7 +55,7 @@ public: virtual void updateState(doublereal* y); - virtual size_t componentIndex(std::string nm) const; + virtual size_t componentIndex(const std::string& nm) const; protected: diff --git a/include/cantera/zeroD/FlowReactor.h b/include/cantera/zeroD/FlowReactor.h index bc619c51e..a18ce489c 100644 --- a/include/cantera/zeroD/FlowReactor.h +++ b/include/cantera/zeroD/FlowReactor.h @@ -69,7 +69,7 @@ public: double distance() const { return m_dist; } - virtual size_t componentIndex(std::string nm) const; + virtual size_t componentIndex(const std::string& nm) const; protected: diff --git a/include/cantera/zeroD/Reactor.h b/include/cantera/zeroD/Reactor.h index 01c2c0649..3f7924c67 100644 --- a/include/cantera/zeroD/Reactor.h +++ b/include/cantera/zeroD/Reactor.h @@ -127,8 +127,7 @@ public: return m_pname[p]; } - // virtual std::string component(int k) const; - virtual size_t componentIndex(std::string nm) const; + virtual size_t componentIndex(const std::string& nm) const; protected: //! Pointer to the homogeneous Kinetics object that handles the reactions diff --git a/include/cantera/zeroD/ReactorBase.h b/include/cantera/zeroD/ReactorBase.h index af8ba8cdf..3dd9b1a88 100644 --- a/include/cantera/zeroD/ReactorBase.h +++ b/include/cantera/zeroD/ReactorBase.h @@ -30,7 +30,7 @@ class ReactorBase public: - ReactorBase(std::string name = "(none)"); + explicit ReactorBase(const std::string& name = "(none)"); virtual ~ReactorBase() {} //----------------------------------------------------- @@ -41,7 +41,7 @@ public: std::string name() const { return m_name; } - void setName(std::string name) { + void setName(const std::string& name) { m_name = name; } @@ -157,7 +157,7 @@ public: //@} - int error(std::string msg) const { + int error(const std::string& msg) const { writelog("Error: "+msg); return 1; } @@ -185,7 +185,7 @@ protected: private: - void tilt(std::string method="") const { + void tilt(const std::string& method="") const { throw CanteraError("ReactorBase::"+method, "ReactorBase method called!"); } diff --git a/include/cantera/zeroD/ReactorNet.h b/include/cantera/zeroD/ReactorNet.h index c849deaaa..dc70c4f15 100644 --- a/include/cantera/zeroD/ReactorNet.h +++ b/include/cantera/zeroD/ReactorNet.h @@ -113,7 +113,7 @@ public: return m_integ->sensitivity(k, p)/m_integ->solution(k); } - double sensitivity(std::string species, size_t p, int reactor=0) { + double sensitivity(const std::string& species, size_t p, int reactor=0) { size_t k = globalComponentIndex(species, reactor); return sensitivity(k, p); } @@ -135,7 +135,7 @@ public: return m_ntotpar; } - size_t globalComponentIndex(std::string species, size_t reactor=0); + size_t globalComponentIndex(const std::string& species, size_t reactor=0); void connect(size_t i, size_t j) { m_connect[j*m_nr + i] = 1; diff --git a/src/zeroD/ConstPressureReactor.cpp b/src/zeroD/ConstPressureReactor.cpp index 20f793c35..11cf89750 100644 --- a/src/zeroD/ConstPressureReactor.cpp +++ b/src/zeroD/ConstPressureReactor.cpp @@ -276,7 +276,7 @@ void ConstPressureReactor::evalEqs(doublereal time, doublereal* y, } } -size_t ConstPressureReactor::componentIndex(string nm) const +size_t ConstPressureReactor::componentIndex(const string& nm) const { if (nm == "H") { return 0; diff --git a/src/zeroD/FlowReactor.cpp b/src/zeroD/FlowReactor.cpp index 9c55231bc..4653ba433 100644 --- a/src/zeroD/FlowReactor.cpp +++ b/src/zeroD/FlowReactor.cpp @@ -125,7 +125,7 @@ void FlowReactor::evalEqs(doublereal time, doublereal* y, } -size_t FlowReactor::componentIndex(string nm) const +size_t FlowReactor::componentIndex(const string& nm) const { if (nm == "X") { return 0; diff --git a/src/zeroD/Reactor.cpp b/src/zeroD/Reactor.cpp index 69c065253..55e1036f2 100644 --- a/src/zeroD/Reactor.cpp +++ b/src/zeroD/Reactor.cpp @@ -318,7 +318,7 @@ void Reactor::addSensitivityReaction(size_t rxn) } -size_t Reactor::componentIndex(string nm) const +size_t Reactor::componentIndex(const string& nm) const { if (nm == "U") { return 0; diff --git a/src/zeroD/ReactorBase.cpp b/src/zeroD/ReactorBase.cpp index 45afcf51f..881a36754 100644 --- a/src/zeroD/ReactorBase.cpp +++ b/src/zeroD/ReactorBase.cpp @@ -12,7 +12,7 @@ using namespace std; namespace Cantera { -ReactorBase::ReactorBase(string name) : m_nsp(0), +ReactorBase::ReactorBase(const string& name) : m_nsp(0), m_thermo(0), m_vol(1.0), m_vol0(1.0), diff --git a/src/zeroD/ReactorNet.cpp b/src/zeroD/ReactorNet.cpp index 5bdf19730..a54d2ca2a 100644 --- a/src/zeroD/ReactorNet.cpp +++ b/src/zeroD/ReactorNet.cpp @@ -268,7 +268,7 @@ void ReactorNet::getInitialConditions(doublereal t0, } } -size_t ReactorNet::globalComponentIndex(string species, size_t reactor) +size_t ReactorNet::globalComponentIndex(const string& species, size_t reactor) { size_t start = 0; size_t n;