diff --git a/include/cantera/base/AnyMap.h b/include/cantera/base/AnyMap.h index 74ab2d515..0fdc66f1b 100644 --- a/include/cantera/base/AnyMap.h +++ b/include/cantera/base/AnyMap.h @@ -43,7 +43,7 @@ public: //! Get a value from the metadata applicable to the AnyMap tree containing //! this node. - const AnyValue& getMetadata(const std::string& key) const; + const AnyValue& getMetadata(const string& key) const; protected: //! The line where this value occurs in the input file. Set to -1 for values @@ -59,8 +59,8 @@ protected: shared_ptr m_metadata; friend class InputFileError; - friend void warn_deprecated(const std::string& source, const AnyBase& node, - const std::string& message); + friend void warn_deprecated(const string& source, const AnyBase& node, + const string& message); }; class AnyMap; @@ -78,7 +78,7 @@ class AnyMap; * - `double` * - `long int` * - `bool` - * - `std::string` + * - `string` * - `vector` of any of the above * @ingroup anyGroup */ @@ -92,16 +92,16 @@ public: bool operator!=(const AnyValue& other) const; //! If this AnyValue is an AnyMap, return the value stored in `key`. - AnyValue& operator[](const std::string& key); - const AnyValue& operator[](const std::string& key) const; + AnyValue& operator[](const string& key); + const AnyValue& operator[](const string& key) const; //! Returns `true` if this AnyValue is an AnyMap and that map contains //! a key with the given name. - bool hasKey(const std::string& key) const; + bool hasKey(const string& key) const; //! Set the name of the key storing this value in an AnyMap. Used for //! providing informative error messages in class InputFileError. - void setKey(const std::string& key); + void setKey(const string& key); //! Propagate metadata to any child elements void propagateMetadata(shared_ptr& file); @@ -117,7 +117,7 @@ public: const std::type_info& type() const; //! Returns a string specifying the type of the held value. - std::string type_str() const; + string type_str() const; //! Return boolean indicating whether AnyValue is empty. bool empty() const; @@ -158,16 +158,16 @@ public: //! @since New in %Cantera 3.0. pair matrixShape() const; - explicit AnyValue(const std::string& value); + explicit AnyValue(const string& value); explicit AnyValue(const char* value); - AnyValue& operator=(const std::string& value); + AnyValue& operator=(const string& value); AnyValue& operator=(const char* value); //! Return the held value, if it is a string - const std::string& asString() const; - bool operator==(const std::string& other) const; - bool operator!=(const std::string& other) const; - friend bool operator==(const std::string& lhs, const AnyValue& rhs); - friend bool operator!=(const std::string& lhs, const AnyValue& rhs); + const string& asString() const; + bool operator==(const string& other) const; + bool operator!=(const string& other) const; + friend bool operator==(const string& lhs, const AnyValue& rhs); + friend bool operator!=(const string& lhs, const AnyValue& rhs); //! @name Quantity conversions //! Assign a quantity consisting of one or more values and their @@ -179,7 +179,7 @@ public: //! Assign a scalar quantity with units as a string, for example //! `{3.0, "m^2"}`. If the `is_act_energy` flag is set to `true`, the units //! will be converted using the special rules for activation energies. - void setQuantity(double value, const std::string& units, bool is_act_energy=false); + void setQuantity(double value, const string& units, bool is_act_energy=false); //! Assign a scalar quantity with units as a Units object, for cases where //! the units vary and are determined dynamically, such as reaction @@ -187,7 +187,7 @@ public: void setQuantity(double value, const Units& units); //! Assign a vector where all the values have the same units - void setQuantity(const vector& values, const std::string& units); + void setQuantity(const vector& values, const string& units); typedef function unitConverter; @@ -245,15 +245,15 @@ public: AnyValue& operator=(AnyMap&& value); template - AnyValue& operator=(const std::unordered_map items); + AnyValue& operator=(const std::unordered_map items); template - AnyValue& operator=(const map items); + AnyValue& operator=(const map items); //! Return the held `AnyMap` as a `map` where all of the values have //! the specified type. template - map asMap() const; + map asMap() const; //! Access a `vector` as a mapping using the value of `name` from //! each item as the key in the new mapping. @@ -264,8 +264,8 @@ public: * ``` * calling `asMap("name")` will create a map with keys ``O2`` and ``CH4``. */ - std::unordered_map asMap(const std::string& name) const; - std::unordered_map asMap(const std::string& name); + std::unordered_map asMap(const string& name) const; + std::unordered_map asMap(const string& name); //! Treating the value as `vector`, return the item where the given //! key has the specified value. @@ -278,11 +278,11 @@ public: * If the value does not exist but the `create` flag is set to true, a new * map with that key and value will be created and returned. */ - AnyMap& getMapWhere(const std::string& key, const std::string& value, bool create=false); - const AnyMap& getMapWhere(const std::string& key, const std::string& value) const; + AnyMap& getMapWhere(const string& key, const string& value, bool create=false); + const AnyMap& getMapWhere(const string& key, const string& value) const; //! Returns `true` when getMapWhere() would succeed - bool hasMapWhere(const std::string& key, const std::string& value) const; + bool hasMapWhere(const string& key, const string& value) const; //! Return values used to determine the sort order when outputting to YAML pair order() const; @@ -298,7 +298,7 @@ private: void checkSize(const vector& v, size_t nMin, size_t nMax) const; //! Key of this value in a parent `AnyMap` - std::string m_key; + string m_key; //! The held value std::any m_value; @@ -364,7 +364,7 @@ vector& AnyValue::asVector(size_t nMin, size_t nMax); * ``` * AnyMap breakfast; * breakfast["spam"] = 123.4; // Creates a value of type 'double' - * breakfast["eggs"] = "scrambled"; // Creates a value of type 'std::string' + * breakfast["eggs"] = "scrambled"; // Creates a value of type 'string' * * // Create a nested AnyMap named "beans" which has a key named "baked" * // whose value is a vector @@ -372,7 +372,7 @@ vector& AnyValue::asVector(size_t nMin, size_t nMax); * breakfast["beans"]["baked"] = v; * * // Create a nested AnyMap with values of the same type - * map breads{{"wheat", 4.0}, {"white", 2.5}}; + * map breads{{"wheat", 4.0}, {"white", 2.5}}; * breakfast["toast"] = breads; * // Equivalent to: * breakfast["toast"]["wheat"] = 4.0 @@ -383,10 +383,10 @@ vector& AnyValue::asVector(size_t nMin, size_t nMax); * * ``` * double val1 = breakfast["spam"].asDouble(); - * std::string val2 = breakfast["eggs"].asString(); + * string val2 = breakfast["eggs"].asString(); * vector val3 = breakfast["beans"]["baked"].asVector(); * - * map = breakfast["toast"].asMap(); + * map = breakfast["toast"].asMap(); * ``` * * ## Checking for elements @@ -416,8 +416,8 @@ vector& AnyValue::asVector(size_t nMin, size_t nMax); * ``` * if (breakfast["sausage"].is>()) { * // access using asVector - * } else if (breakfast["sausage"].type() == typeid(vector)) { - * // access using asVector + * } else if (breakfast["sausage"].type() == typeid(vector)) { + * // access using asVector * } * ``` * @ingroup anyGroup @@ -433,35 +433,35 @@ public: * first, followed by the current working directory and the %Cantera include * path. */ - static AnyMap fromYamlFile(const std::string& name, - const std::string& parent_name=""); + static AnyMap fromYamlFile(const string& name, + const string& parent_name=""); //! Create an AnyMap from a string containing a YAML document - static AnyMap fromYamlString(const std::string& yaml); + static AnyMap fromYamlString(const string& yaml); - std::string toYamlString() const; + string toYamlString() const; //! Get the value of the item stored in `key`. - AnyValue& operator[](const std::string& key); - const AnyValue& operator[](const std::string& key) const; + AnyValue& operator[](const string& key); + const AnyValue& operator[](const string& key) const; //! Used to create a new item which will be populated from a YAML input //! string, where the item with `key` occurs at the specified line and //! column within the string. - AnyValue& createForYaml(const std::string& key, int line, int column); + AnyValue& createForYaml(const string& key, int line, int column); //! Get the value of the item stored in `key`. Raises an exception if the //! value does not exist. - const AnyValue& at(const std::string& key) const; + const AnyValue& at(const string& key) const; //! Return boolean indicating whether AnyMap is empty. bool empty() const; //! Returns `true` if the map contains an item named `key`. - bool hasKey(const std::string& key) const; + bool hasKey(const string& key) const; //! Erase the value held by `key`. - void erase(const std::string& key); + void erase(const string& key); //! Erase all items in the mapping void clear(); @@ -472,7 +472,7 @@ public: //! Return a string listing the keys in this AnyMap, for use in error //! messages, for example - std::string keys_str() const; + string keys_str() const; //! Return an unordered set of keys //! @since New in %Cantera 3.0. @@ -480,7 +480,7 @@ public: //! Set a metadata value that applies to this AnyMap and its children. //! Mainly for internal use in reading or writing from files. - void setMetadata(const std::string& key, const AnyValue& value); + void setMetadata(const string& key, const AnyValue& value); //! Copy metadata including input line/column from an existing AnyMap void copyMetadata(const AnyMap& other); @@ -489,31 +489,31 @@ public: void propagateMetadata(shared_ptr& file); //! If `key` exists, return it as a `bool`, otherwise return `default_`. - bool getBool(const std::string& key, bool default_) const; + bool getBool(const string& key, bool default_) const; //! If `key` exists, return it as a `long int`, otherwise return `default_`. - long int getInt(const std::string& key, long int default_) const; + long int getInt(const string& key, long int default_) const; //! If `key` exists, return it as a `double`, otherwise return `default_`. - double getDouble(const std::string& key, double default_) const; + double getDouble(const string& key, double default_) const; //! If `key` exists, return it as a `string`, otherwise return `default_`. - const std::string& getString(const std::string& key, - const std::string& default_) const; + const string& getString(const string& key, + const string& default_) const; //! Convert the item stored by the given `key` to the units specified in //! `units`. If the stored value is a double, convert it using the default //! units. If the input is a string, treat this as a dimensioned value, such //! as '988 kg/m^3' and convert from the specified units. - double convert(const std::string& key, const std::string& units) const; - double convert(const std::string& key, const Units& units) const; + double convert(const string& key, const string& units) const; + double convert(const string& key, const Units& units) const; //! Convert the item stored by the given `key` to the units specified in //! `units`. If the stored value is a double, convert it using the default //! units. If the input is a string, treat this as a dimensioned value, such //! as '988 kg/m^3' and convert from the specified units. If the key is //! missing, the `default_` value is returned. - double convert(const std::string& key, const std::string& units, + double convert(const string& key, const string& units, double default_) const; //! Convert a vector of dimensional values @@ -531,7 +531,7 @@ public: * @param nMax Maximum allowed length of the vector. An exception is * thrown if this condition is not met. */ - vector convertVector(const std::string& key, const std::string& units, + vector convertVector(const string& key, const string& units, size_t nMin=npos, size_t nMax=npos) const; //! Defined to allow use with range-based for loops. Iteration automatically @@ -539,13 +539,13 @@ public: class Iterator { public: Iterator() {} - Iterator(const std::unordered_map::const_iterator& start, - const std::unordered_map::const_iterator& stop); + Iterator(const std::unordered_map::const_iterator& start, + const std::unordered_map::const_iterator& stop); - const pair& operator*() const { + const pair& operator*() const { return *m_iter; } - const pair* operator->() const { + const pair* operator->() const { return &*m_iter; } bool operator!=(const Iterator& right) const { @@ -554,8 +554,8 @@ public: Iterator& operator++(); private: - std::unordered_map::const_iterator m_iter; - std::unordered_map::const_iterator m_stop; + std::unordered_map::const_iterator m_iter; + std::unordered_map::const_iterator m_stop; }; //! Defined to allow use with range-based for loops @@ -581,11 +581,11 @@ public: typedef vector, - const pair*>> OrderVector; + const pair*>> OrderVector; private: const AnyMap* m_data; OrderVector m_ordered; - unique_ptr> m_units; + unique_ptr> m_units; }; //! Defined to allow the OrderedProxy class to be used with range-based @@ -596,10 +596,10 @@ public: OrderedIterator(const AnyMap::OrderedProxy::OrderVector::const_iterator& start, const AnyMap::OrderedProxy::OrderVector::const_iterator& stop); - const pair& operator*() const { + const pair& operator*() const { return *m_iter->second; } - const pair* operator->() const { + const pair* operator->() const { return &(*m_iter->second); } bool operator!=(const OrderedIterator& right) const { @@ -689,15 +689,15 @@ public: * second string is the name of a key * @returns ``true``, to facilitate static initialization */ - static bool addOrderingRules(const std::string& objectType, - const vector>& specs); + static bool addOrderingRules(const string& objectType, + const vector>& specs); //! Remove the specified file from the input cache if it is present - static void clearCachedFile(const std::string& filename); + static void clearCachedFile(const string& filename); private: //! The stored data - std::unordered_map m_data; + std::unordered_map m_data; //! The default units that are used to convert stored values shared_ptr m_units; @@ -711,12 +711,12 @@ private: //! Information about fields that should appear first when outputting to //! YAML. Keys in this map are matched to `__type__` keys in AnyMap //! objects, and values are a list of field names. - static std::unordered_map> s_headFields; + static std::unordered_map> s_headFields; //! Information about fields that should appear last when outputting to //! YAML. Keys in this map are matched to `__type__` keys in AnyMap //! objects, and values are a list of field names. - static std::unordered_map> s_tailFields; + static std::unordered_map> s_tailFields; friend class AnyValue; friend YAML::Emitter& YAML::operator<<(YAML::Emitter& out, const AnyMap& rhs); @@ -740,8 +740,8 @@ public: //! `node`. The `message` and `args` are processed as in the CanteraError //! class. template - InputFileError(const std::string& procedure, const AnyBase& node, - const std::string& message, const Args&... args) + InputFileError(const string& procedure, const AnyBase& node, + const string& message, const Args&... args) : CanteraError( procedure, formatError( @@ -754,8 +754,8 @@ public: //! `node1` and `node2`. The `message` and `args` are processed as in the //! CanteraError class. template - InputFileError(const std::string& procedure, const AnyBase& node1, - const AnyBase& node2, const std::string& message, + InputFileError(const string& procedure, const AnyBase& node1, + const AnyBase& node2, const string& message, const Args&... args) : CanteraError( procedure, @@ -766,21 +766,21 @@ public: { } - virtual std::string getClass() const { + virtual string getClass() const { return "InputFileError"; } protected: - static std::string formatError(const std::string& message, + static string formatError(const string& message, int line, int column, const shared_ptr& metadata); - static std::string formatError2(const std::string& message, + static string formatError2(const string& message, int line1, int column1, const shared_ptr& metadata1, int line2, int column2, const shared_ptr& metadata2); }; //! A deprecation warning for syntax in an input file -void warn_deprecated(const std::string& source, const AnyBase& node, - const std::string& message); +void warn_deprecated(const string& source, const AnyBase& node, + const string& message); } diff --git a/include/cantera/base/AnyMap.inl.h b/include/cantera/base/AnyMap.inl.h index cf1818b32..c6059f60b 100644 --- a/include/cantera/base/AnyMap.inl.h +++ b/include/cantera/base/AnyMap.inl.h @@ -8,7 +8,7 @@ namespace Cantera { // re-declared to avoid needing to include global.h here -std::string demangle(const std::type_info& type); +string demangle(const std::type_info& type); // Definitions for AnyValue templated functions @@ -120,7 +120,7 @@ vector &AnyValue::asVector(size_t nMin, size_t nMax) { } template -AnyValue& AnyValue::operator=(const std::unordered_map items) { +AnyValue& AnyValue::operator=(const std::unordered_map items) { m_value = AnyMap(); m_equals = eq_comparer; AnyMap& dest = as(); @@ -131,7 +131,7 @@ AnyValue& AnyValue::operator=(const std::unordered_map items) { } template -AnyValue& AnyValue::operator=(const map items) { +AnyValue& AnyValue::operator=(const map items) { m_value = AnyMap(); m_equals = eq_comparer; AnyMap& dest = as(); @@ -159,9 +159,9 @@ inline AnyMap& AnyValue::as() { } template -map AnyValue::asMap() const +map AnyValue::asMap() const { - map dest; + map dest; for (const auto& item : as()) { dest[item.first] = item.second.as(); } @@ -219,7 +219,7 @@ bool AnyValue::eq_comparer(const std::any& lhs, const std::any& rhs) typedef vector vd; typedef vector vi; typedef vector va; - typedef vector vs; + typedef vector vs; auto& ltype = lhs.type(); auto& rtype = rhs.type(); diff --git a/include/cantera/base/Delegator.h b/include/cantera/base/Delegator.h index 38942c9c0..d6051e9ba 100644 --- a/include/cantera/base/Delegator.h +++ b/include/cantera/base/Delegator.h @@ -104,18 +104,18 @@ class Delegator { public: //! Get the name of the user-defined class in the extension language - std::string delegatorName() const { + string delegatorName() const { return m_delegatorName; } //! Set the name of the user-defined class in the extension language - void setDelegatorName(const std::string& delegatorName) { + void setDelegatorName(const string& delegatorName) { m_delegatorName = delegatorName; } //! Set delegates for member functions with the signature `void()`. - void setDelegate(const std::string& name, const function& func, - const std::string& when) + void setDelegate(const string& name, const function& func, + const string& when) { if (!m_funcs_v.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -125,8 +125,8 @@ public: } //! set delegates for member functions with the signature `void(bool)` - void setDelegate(const std::string& name, const function& func, - const std::string& when) + void setDelegate(const string& name, const function& func, + const string& when) { if (!m_funcs_v_b.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -136,8 +136,8 @@ public: } //! set delegates for member functions with the signature `void(double)` - void setDelegate(const std::string& name, const function& func, - const std::string& when) + void setDelegate(const string& name, const function& func, + const string& when) { if (!m_funcs_v_d.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -159,9 +159,9 @@ public: //! set delegates for member functions with the signature //! `void(AnyMap&, UnitStack&)` - void setDelegate(const std::string& name, + void setDelegate(const string& name, const function& func, - const std::string& when) + const string& when) { if (!m_funcs_v_cAMr_cUSr.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -186,9 +186,9 @@ public: } //! Set delegates for member functions with the signature `void(double*)` - void setDelegate(const std::string& name, + void setDelegate(const string& name, const function, double*)>& func, - const std::string& when) + const string& when) { if (!m_funcs_v_dp.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -199,9 +199,9 @@ public: //! Set delegates for member functions with the signature `void(double, double*)` void setDelegate( - const std::string& name, + const string& name, const function, double, double*)>& func, - const std::string& when) + const string& when) { if (!m_funcs_v_d_dp.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -214,9 +214,9 @@ public: //! Set delegates for member functions with the signature //! `void(double, double*, double*)` void setDelegate( - const std::string& name, + const string& name, const function, double, double*, double*)>& func, - const std::string& when) + const string& when) { if (!m_funcs_v_d_dp_dp.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -229,9 +229,9 @@ public: //! Set delegates for member functions with the signature //! `void(double*, double*, double*)` void setDelegate( - const std::string& name, + const string& name, const function, double*, double*, double*)>& func, - const std::string& when) + const string& when) { if (!m_funcs_v_dp_dp_dp.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -242,9 +242,9 @@ public: } //! set delegates for member functions with the signature `double(void*)` - void setDelegate(const std::string& name, + void setDelegate(const string& name, const function& func, - const std::string& when) + const string& when) { if (!m_funcs_d_vp.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -254,9 +254,9 @@ public: } //! Set delegates for member functions with the signature `string(size_t)` - void setDelegate(const std::string& name, - const function& func, - const std::string& when) + void setDelegate(const string& name, + const function& func, + const string& when) { if (!m_funcs_s_sz.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -267,9 +267,9 @@ public: } //! Set delegates for member functions with the signature `size_t(string)` - void setDelegate(const std::string& name, - const function& func, - const std::string& when) + void setDelegate(const string& name, + const function& func, + const string& when) { if (!m_funcs_sz_csr.count(name)) { throw NotImplementedError("Delegator::setDelegate", @@ -298,7 +298,7 @@ public: protected: //! Install a function with the signature `void()` as being delegatable - void install(const std::string& name, function& target, + void install(const string& name, function& target, const function& func) { target = func; @@ -306,7 +306,7 @@ protected: } //! Install a function with the signature `void(bool)` as being delegatable - void install(const std::string& name, function& target, + void install(const string& name, function& target, const function& func) { target = func; @@ -314,7 +314,7 @@ protected: } //! Install a function with the signature `void(double)` as being delegatable - void install(const std::string& name, function& target, + void install(const string& name, function& target, const function& func) { target = func; @@ -331,7 +331,7 @@ protected: //! Install a function with the signature `void(const AnyMap&, const UnitStack&)` //! as being delegatable - void install(const std::string& name, + void install(const string& name, function& target, const function& func) { @@ -349,7 +349,7 @@ protected: } //! Install a function with the signature `void(double*)` as being delegatable - void install(const std::string& name, + void install(const string& name, function, double*)>& target, const function, double*)>& func) { @@ -358,7 +358,7 @@ protected: } //! Install a function with the signature `void(double, double*)` as being delegatable - void install(const std::string& name, + void install(const string& name, function, double, double*)>& target, const function, double, double*)>& func) { @@ -368,7 +368,7 @@ protected: //! Install a function with the signature `void(double, double*, double*)` as being //! delegatable - void install(const std::string& name, + void install(const string& name, function, double, double*, double*)>& target, const function, double, double*, double*)>& func) { @@ -378,7 +378,7 @@ protected: //! Install a function with the signature //! `void(double*, double*, double*)` as being delegatable - void install(const std::string& name, + void install(const string& name, function, double*, double*, double*)>& target, const function, double*, double*, double*)>& base) { @@ -387,7 +387,7 @@ protected: } //! Install a function with the signature `double(void*)` as being delegatable - void install(const std::string& name, function& target, + void install(const string& name, function& target, const function& func) { target = func; @@ -395,9 +395,9 @@ protected: } //! Install a function with the signature `string(size_t)` as being delegatable - void install(const std::string& name, - function& target, - const function& base) + void install(const string& name, + function& target, + const function& base) { target = base; m_funcs_s_sz[name] = ⌖ @@ -405,9 +405,9 @@ protected: } //! Install a function with the signature `size_t(string)` as being delegatable - void install(const std::string& name, - function& target, - const function& base) + void install(const string& name, + function& target, + const function& base) { target = base; m_funcs_sz_csr[name] = ⌖ @@ -418,7 +418,7 @@ protected: template function makeDelegate( const function& func, - const std::string& when, + const string& when, BaseFunc base) { if (when == "before") { @@ -445,9 +445,9 @@ protected: //! Create a delegate for a function with a return value template function makeDelegate( - const std::string& name, + const string& name, const function& func, - const std::string& when, + const string& when, const function& base) { if (when == "before") { @@ -510,7 +510,7 @@ protected: //! - `v` for `void` //! - `b` for `bool` //! - `d` for `double` - //! - `s` for `std::string` + //! - `s` for `string` //! - `sz` for `size_t` //! - `AM` for `AnyMap` //! - `US` for `UnitStack` @@ -520,35 +520,35 @@ protected: //! @{ // Delegates with no return value - map*> m_funcs_v; - map*> m_funcs_v_b; - map*> m_funcs_v_d; + map*> m_funcs_v; + map*> m_funcs_v_b; + map*> m_funcs_v_d; map*> m_funcs_v_AMr; - map*> m_funcs_v_cAMr_cUSr; map*> m_funcs_v_csr_vp; - map, double*)>*> m_funcs_v_dp; - map, double, double*)>*> m_funcs_v_d_dp; - map, double, double*, double*)>*> m_funcs_v_d_dp_dp; - map, double*, double*, double*)>*> m_funcs_v_dp_dp_dp; // Delegates with a return value - map> m_base_d_vp; - map*> m_funcs_d_vp; + map> m_base_d_vp; + map*> m_funcs_d_vp; - map> m_base_s_sz; - map*> m_funcs_s_sz; + map> m_base_s_sz; + map*> m_funcs_s_sz; - map> m_base_sz_csr; - map*> m_funcs_sz_csr; + map> m_base_sz_csr; + map*> m_funcs_sz_csr; //! @} //! Handles to wrappers for the delegated object in external language interfaces. @@ -557,7 +557,7 @@ protected: map> m_handles; //! Name of the class in the extension language - std::string m_delegatorName; + string m_delegatorName; }; } diff --git a/include/cantera/base/ExtensionManager.h b/include/cantera/base/ExtensionManager.h index 3e1c83fc6..ca82f13c8 100644 --- a/include/cantera/base/ExtensionManager.h +++ b/include/cantera/base/ExtensionManager.h @@ -39,7 +39,7 @@ public: //! Register ReactionRate defined in a user extension with ReactionRateFactory //! @param extensionName - virtual void registerRateBuilders(const std::string& extensionName) { + virtual void registerRateBuilders(const string& extensionName) { throw NotImplementedError("ExtensionManager::registerRateBuilders"); }; @@ -74,7 +74,7 @@ public: //! @param rateName The name of the reaction rate type, which corresponds to the //! name used to register the wrapper generator using registerReactionDataLinker //! @param data The ReactionData object to be wrapped - static void wrapReactionData(const std::string& rateName, + static void wrapReactionData(const string& rateName, ReactionDataDelegator& data); //! Create an object in an external language that wraps the specified Solution @@ -83,7 +83,7 @@ public: //! @param wrapperType A name specifying the wrapper type, which corresponds to //! the name used to register the wrapper generator using registerSolutionLinker //! @param soln The Solution object to be wrapped - static shared_ptr wrapSolution(const std::string& wrapperType, + static shared_ptr wrapSolution(const string& wrapperType, shared_ptr soln); //! Register a function that can be used to create wrappers for ReactionData objects @@ -99,7 +99,7 @@ public: //! Register a function that can be used to create wrappers for Solution objects in //! an external language and link it to the corresponding C++ objects - static void registerSolutionLinker(const std::string& wrapperName, + static void registerSolutionLinker(const string& wrapperName, function(shared_ptr)> link); //! Get the Solution wrapper type corresponding to the specified user-defined @@ -108,11 +108,11 @@ public: protected: //! Functions for wrapping and linking ReactionData objects - static map> s_ReactionData_linkers; //! Functions for wrapping and linking Solution objects - static map(shared_ptr)>> s_Solution_linkers; //! Mapping from user-defined rate types to Solution wrapper types diff --git a/include/cantera/base/ExtensionManagerFactory.h b/include/cantera/base/ExtensionManagerFactory.h index 8e0185e77..30384381e 100644 --- a/include/cantera/base/ExtensionManagerFactory.h +++ b/include/cantera/base/ExtensionManagerFactory.h @@ -19,7 +19,7 @@ class ExtensionManagerFactory : public Factory { public: //! Create a new ExtensionManager - static shared_ptr build(const std::string& extensionType) { + static shared_ptr build(const string& extensionType) { return shared_ptr(factory().create(extensionType)); } diff --git a/include/cantera/base/ExternalLogger.h b/include/cantera/base/ExternalLogger.h index 123286147..0c2078fec 100644 --- a/include/cantera/base/ExternalLogger.h +++ b/include/cantera/base/ExternalLogger.h @@ -22,7 +22,7 @@ public: m_writer = writer; } - void write(const std::string& msg) override { + void write(const string& msg) override { m_writeBuffer.append(msg); if (!m_writeBuffer.empty() && m_writeBuffer.back() == '\n') { @@ -44,16 +44,16 @@ public: m_writeBuffer.erase(); } - void warn(const std::string& warning, const std::string& msg) override { + void warn(const string& warning, const string& msg) override { m_writer(LogLevel::WARN, warning.c_str(), msg.c_str()); } - void error(const std::string& msg) override { + void error(const string& msg) override { m_writer(LogLevel::ERROR, "Error", msg.c_str()); } private: - std::string m_writeBuffer; + string m_writeBuffer; LogCallback m_writer = nullptr; }; diff --git a/include/cantera/base/FactoryBase.h b/include/cantera/base/FactoryBase.h index 59ce9b442..939faa499 100644 --- a/include/cantera/base/FactoryBase.h +++ b/include/cantera/base/FactoryBase.h @@ -72,17 +72,17 @@ public: //! Create an object using the object construction function corresponding to //! "name" and the provided constructor arguments - T* create(const std::string& name, Args... args) { + T* create(const string& name, Args... args) { return m_creators.at(canonicalize(name))(args...); } //! Register a new object construction function - void reg(const std::string& name, function f) { + void reg(const string& name, function f) { m_creators[name] = f; } //! Add an alias for an existing registered type - void addAlias(const std::string& original, const std::string& alias) { + void addAlias(const string& original, const string& alias) { if (!m_creators.count(original)) { throw CanteraError("Factory::addAlias", "Name '{}' not registered", original); @@ -91,7 +91,7 @@ public: } //! Get the canonical name registered for a type - std::string canonicalize(const std::string& name) { + string canonicalize(const string& name) { if (m_creators.count(name)) { return name; } else if (m_synonyms.count(name)) { @@ -107,14 +107,14 @@ public: } //! Returns true if `name` is registered with this factory - bool exists(const std::string& name) const { + bool exists(const string& name) const { return m_creators.count(name) || m_synonyms.count(name); } protected: //! Add a deprecated alias for an existing registered type - void addDeprecatedAlias(const std::string& original, - const std::string& alias) { + void addDeprecatedAlias(const string& original, + const string& alias) { if (!m_creators.count(original)) { throw CanteraError("Factory::addDeprecatedAlias", "Name '{}' not registered", original); @@ -123,14 +123,14 @@ protected: } private: - std::unordered_map> m_creators; + std::unordered_map> m_creators; //! Map of synonyms to canonical names - std::unordered_map m_synonyms; + std::unordered_map m_synonyms; //! Map of deprecated synonyms to canonical names. Use of these names will //! show a deprecation warning. - std::unordered_map m_deprecated_names; + std::unordered_map m_deprecated_names; }; } diff --git a/include/cantera/base/Interface.h b/include/cantera/base/Interface.h index 67887755c..b09c08ed6 100644 --- a/include/cantera/base/Interface.h +++ b/include/cantera/base/Interface.h @@ -68,8 +68,8 @@ protected: * @returns an initialized Interface object. * @ingroup solnGroup */ -shared_ptr newInterface(const std::string& infile, - const std::string& name="", const vector& adjacent={}); +shared_ptr newInterface(const string& infile, + const string& name="", const vector& adjacent={}); //! Create and initialize a new Interface from an input file @@ -84,8 +84,8 @@ shared_ptr newInterface(const std::string& infile, * @returns an initialized Interface object. * @ingroup solnGroup */ -shared_ptr newInterface(const std::string& infile, - const std::string& name, const vector>& adjacent); +shared_ptr newInterface(const string& infile, + const string& name, const vector>& adjacent); //! Create and initialize a new Interface from AnyMap objects /*! diff --git a/include/cantera/base/NoExitLogger.h b/include/cantera/base/NoExitLogger.h index bbed4f93e..9a6051227 100644 --- a/include/cantera/base/NoExitLogger.h +++ b/include/cantera/base/NoExitLogger.h @@ -16,7 +16,7 @@ public: NoExitLogger() {} virtual ~NoExitLogger() {} - virtual void error(const std::string& msg) + virtual void error(const string& msg) { std::cerr << msg << std::endl; } diff --git a/include/cantera/base/Solution.h b/include/cantera/base/Solution.h index 5059feed2..a06e3900f 100644 --- a/include/cantera/base/Solution.h +++ b/include/cantera/base/Solution.h @@ -56,10 +56,10 @@ public: } //! Return the name of this Solution object - std::string name() const; + string name() const; //! Set the name of this Solution object - void setName(const std::string& name); + void setName(const string& name); //! Set the ThermoPhase object virtual void setThermo(shared_ptr thermo); @@ -73,7 +73,7 @@ public: //! Set the Transport object by name //! @param model name of transport model; if omitted, the default model is used //! @since New in %Cantera 3.0 - void setTransportModel(const std::string& model=""); + void setTransportModel(const string& model=""); //! Accessor for the ThermoPhase pointer shared_ptr thermo() { @@ -100,7 +100,7 @@ public: } //! Get the Solution object for an adjacent phase by name - shared_ptr adjacent(const std::string& name) { + shared_ptr adjacent(const string& name) { return m_adjacentByName.at(name); } @@ -116,19 +116,19 @@ public: AnyMap& header(); //! Retrieve source used for object creation; usually an input file name - const std::string source() const; + const string source() const; //! Overwrite source (only required if object is not created using newSolution) - void setSource(const std::string& source); + void setSource(const string& source); //! Store a handle to a wrapper for this Solution object from an external //! language interface (for example, a Python Solution object) - void holdExternalHandle(const std::string& name, shared_ptr handle); + void holdExternalHandle(const string& name, shared_ptr handle); //! Get the handle for a wrapper for this Solution object from an external //! language interface. //! Returns a null pointer if the requested handle does not exist. - shared_ptr getExternalHandle(const std::string& name) const; + shared_ptr getExternalHandle(const string& name) const; //! Register a function to be called if any of the Solution's thermo, kinetics, //! or transport objects is replaced. @@ -155,13 +155,13 @@ protected: vector> m_adjacent; //! Adjacent phases, for access by name - map> m_adjacentByName; + map> m_adjacentByName; AnyMap m_header; //!< Additional input fields; usually from a YAML input file //! Wrappers for this Solution object in extension languages, for evaluation //! of user-defined reaction rates - map> m_externalHandles; + map> m_externalHandles; //! Callback functions that are invoked when the therm, kinetics, or transport //! members of the Solution are replaced. @@ -184,8 +184,8 @@ protected: * @returns an initialized Solution object. * @ingroup solnGroup */ -shared_ptr newSolution(const std::string& infile, const std::string& name, - const std::string& transport, const vector& adjacent); +shared_ptr newSolution(const string& infile, const string& name, + const string& transport, const vector& adjacent); //! Create and initialize a new Solution manager from an input file /*! @@ -201,9 +201,9 @@ shared_ptr newSolution(const std::string& infile, const std::string& n * @returns an initialized Solution object. * @ingroup solnGroup */ -shared_ptr newSolution(const std::string& infile, - const std::string& name="", - const std::string& transport="", +shared_ptr newSolution(const string& infile, + const string& name="", + const string& transport="", const vector>& adjacent={}); //! Create and initialize a new Solution manager from AnyMap objects @@ -227,9 +227,9 @@ shared_ptr newSolution(const std::string& infile, */ shared_ptr newSolution( const AnyMap& phaseNode, const AnyMap& rootNode=AnyMap(), - const std::string& transport="", + const string& transport="", const vector>& adjacent={}, - const map>& related={}); + const map>& related={}); } diff --git a/include/cantera/base/Units.h b/include/cantera/base/Units.h index 68ae62357..379bfc617 100644 --- a/include/cantera/base/Units.h +++ b/include/cantera/base/Units.h @@ -43,7 +43,7 @@ public: //! @param units A string representation of the units. See UnitSystem //! for a description of the formatting options. //! @param force_unity ensure that conversion factor is equal to one - explicit Units(const std::string& units, bool force_unity=false); + explicit Units(const string& units, bool force_unity=false); //! Returns `true` if the specified Units are dimensionally consistent bool convertible(const Units& other) const; @@ -58,7 +58,7 @@ public: //! Provide a string representation of these Units //! @param skip_unity do not print '1' if conversion factor is equal to one - std::string str(bool skip_unity=true) const; + string str(bool skip_unity=true) const; //! Raise these Units to a power, changing both the conversion factor and //! the dimensions of these Units. @@ -68,7 +68,7 @@ public: //! Return dimension of primary unit component //! ("mass", "length", "time", "temperature", "current", or "quantity") - double dimension(const std::string& primary) const; + double dimension(const string& primary) const; private: //! Scale the unit by the factor `k` @@ -169,14 +169,14 @@ class UnitSystem { public: //! Create a unit system with the specified default units - UnitSystem(std::initializer_list units); + UnitSystem(std::initializer_list units); //! Default constructor for unit system (needed as VS2019 does not //! recognize an optional argument with a default value) UnitSystem() : UnitSystem({}) {} //! Return default units used by the unit system - map defaults() const; + map defaults() const; //! Set the default units to convert from when explicit units are not //! provided. Defaults can be set for mass, length, time, quantity, energy, @@ -185,7 +185,7 @@ public: //! //! * To use SI+kmol: `setDefaults({"kg", "m", "s", "Pa", "J", "kmol"});` //! * To use CGS+mol: `setDefaults({"cm", "g", "dyn/cm^2", "erg", "mol"});` - void setDefaults(std::initializer_list units); + void setDefaults(std::initializer_list units); //! Set the default units using a map of dimension to unit pairs. //! @@ -200,32 +200,32 @@ public: //! }; //! setDefaults(defaults); //! ``` - void setDefaults(const map& units); + void setDefaults(const map& units); //! Set the default units to convert from when using the //! `convertActivationEnergy` function. - void setDefaultActivationEnergy(const std::string& e_units); + void setDefaultActivationEnergy(const string& e_units); //! Convert `value` from the units of `src` to the units of `dest`. - double convert(double value, const std::string& src, - const std::string& dest) const; + double convert(double value, const string& src, + const string& dest) const; double convert(double value, const Units& src, const Units& dest) const; //! Convert `value` to the specified `dest` units from the appropriate units //! for this unit system (defined by `setDefaults`) - double convertTo(double value, const std::string& dest) const; + double convertTo(double value, const string& dest) const; double convertTo(double value, const Units& dest) const; //! Convert `value` from the specified `src` units to units appropriate for //! this unit system (defined by `setDefaults`) - double convertFrom(double value, const std::string& src) const; + double convertFrom(double value, const string& src) const; double convertFrom(double value, const Units& src) const; //! Convert a generic AnyValue node to the units specified in `dest`. If the //! input is a double, convert it using the default units. If the input is a //! string, treat this as a dimensioned value, such as '988 kg/m^3' and convert //! from the specified units. - double convert(const AnyValue& val, const std::string& dest) const; + double convert(const AnyValue& val, const string& dest) const; double convert(const AnyValue& val, const Units& dest) const; //! Convert a generic AnyValue node representing a reaction rate coefficient to the @@ -239,30 +239,30 @@ public: //! each node, if the value is a double, convert it using the default units, //! and if it is a string, treat it as a value with the given dimensions. vector convert(const vector& vals, - const std::string& dest) const; + const string& dest) const; vector convert(const vector& vals, const Units& dest) const; //! Convert `value` from the units of `src` to the units of `dest`, allowing //! for the different dimensions that can be used for activation energies - double convertActivationEnergy(double value, const std::string& src, - const std::string& dest) const; + double convertActivationEnergy(double value, const string& src, + const string& dest) const; //! Convert `value` to the units specified by `dest` from the default //! activation energy units - double convertActivationEnergyTo(double value, const std::string& dest) const; + double convertActivationEnergyTo(double value, const string& dest) const; double convertActivationEnergyTo(double value, const Units& dest) const; //! Convert `value` from the units specified by `src` to the default //! activation energy units - double convertActivationEnergyFrom(double value, const std::string& src) const; + double convertActivationEnergyFrom(double value, const string& src) const; //! Convert a generic AnyValue node to the units specified in `dest`. If the //! input is a double, convert it using the default units. If the input is a //! string, treat this as a dimensioned value, such as '2.7e4 J/kmol', and //! convert from the specified units. double convertActivationEnergy(const AnyValue& val, - const std::string& dest) const; + const string& dest) const; //! Get the changes to the defaults from `other` to this UnitSystem AnyMap getDelta(const UnitSystem& other) const; @@ -295,7 +295,7 @@ private: //! Map of dimensions (mass, length, etc.) to names of specified default //! units - map m_defaults; + map m_defaults; }; } diff --git a/include/cantera/base/YamlWriter.h b/include/cantera/base/YamlWriter.h index 36c7865dd..e8fb39331 100644 --- a/include/cantera/base/YamlWriter.h +++ b/include/cantera/base/YamlWriter.h @@ -42,11 +42,11 @@ public: //! Return a YAML string that contains the definitions for the added phases, //! species, and reactions - std::string toYamlString() const; + string toYamlString() const; //! Write the definitions for the added phases, species and reactions to //! the specified file. - void toYamlFile(const std::string& filename) const; + void toYamlFile(const string& filename) const; //! For output floating point values, set the maximum number of digits to //! the right of the decimal point. The default is 15 digits. @@ -66,7 +66,7 @@ public: //! @param units A map where keys are dimensions (mass, length, time, //! quantity, pressure, energy, activation-energy) and the values are //! corresponding units supported by the UnitSystem class. - void setUnits(const map& units={}); + void setUnits(const map& units={}); //! Set the units to be used in the output file. Dimensions not specified //! will use Cantera's defaults. diff --git a/include/cantera/base/ctexceptions.h b/include/cantera/base/ctexceptions.h index 700289c83..30d7a4bd0 100644 --- a/include/cantera/base/ctexceptions.h +++ b/include/cantera/base/ctexceptions.h @@ -80,7 +80,7 @@ public: * @param args Arguments which will be used to interpolate the format string */ template - CanteraError(const std::string& procedure, const std::string& msg, + CanteraError(const string& procedure, const string& msg, const Args&... args) : procedure_(procedure) { @@ -98,13 +98,13 @@ public: const char* what() const throw(); //! Method overridden by derived classes to format the error message - virtual std::string getMessage() const; + virtual string getMessage() const; //! Get the name of the method that threw the exception - virtual std::string getMethod() const; + virtual string getMethod() const; //! Method overridden by derived classes to indicate their type - virtual std::string getClass() const { + virtual string getClass() const { return "CanteraError"; } @@ -114,14 +114,14 @@ protected: CanteraError() {}; //! Constructor used by derived classes that override getMessage() - explicit CanteraError(const std::string& procedure); + explicit CanteraError(const string& procedure); //! The name of the procedure where the exception occurred - std::string procedure_; - mutable std::string formattedMessage_; //!< Formatted message returned by what() + string procedure_; + mutable string formattedMessage_; //!< Formatted message returned by what() private: - std::string msg_; //!< Message associated with the exception + string msg_; //!< Message associated with the exception }; @@ -145,11 +145,11 @@ public: * @param sz This is the length supplied to Cantera. * @param reqd This is the required length needed by Cantera */ - ArraySizeError(const std::string& procedure, size_t sz, size_t reqd) : + ArraySizeError(const string& procedure, size_t sz, size_t reqd) : CanteraError(procedure), sz_(sz), reqd_(reqd) {} - virtual std::string getMessage() const; - virtual std::string getClass() const { + virtual string getMessage() const; + virtual string getClass() const { return "ArraySizeError"; } @@ -176,17 +176,17 @@ public: * @param mmax This is the maximum allowed value of the index. The * minimum allowed value is assumed to be 0. */ - IndexError(const std::string& func, const std::string& arrayName, size_t m, size_t mmax) : + IndexError(const string& func, const string& arrayName, size_t m, size_t mmax) : CanteraError(func), arrayName_(arrayName), m_(m), mmax_(mmax) {} virtual ~IndexError() throw() {}; - virtual std::string getMessage() const; - virtual std::string getClass() const { + virtual string getMessage() const; + virtual string getClass() const { return "IndexError"; } private: - std::string arrayName_; + string arrayName_; size_t m_, mmax_; }; @@ -197,16 +197,16 @@ class NotImplementedError : public CanteraError public: //! @param func Name of the unimplemented function, such as //! `ClassName::functionName` - NotImplementedError(const std::string& func) : + NotImplementedError(const string& func) : CanteraError(func, "Not implemented.") {} //! Alternative constructor taking same arguments as CanteraError template - NotImplementedError(const std::string& func, const std::string& msg, + NotImplementedError(const string& func, const string& msg, const Args&... args) : CanteraError(func, msg, args...) {} - virtual std::string getClass() const { + virtual string getClass() const { return "NotImplementedError"; } }; @@ -217,11 +217,11 @@ public: //! Provides a line number #define STR_TRACE_LINE(s) #s -//! Provides a std::string variable containing the file and line number +//! Provides a string variable containing the file and line number /*! * This is a std:string containing the file name and the line number */ -#define STR_TRACE (std::string(__FILE__) + ":" + XSTR_TRACE_LINE(__LINE__)) +#define STR_TRACE (string(__FILE__) + ":" + XSTR_TRACE_LINE(__LINE__)) #ifdef NDEBUG #ifndef AssertTrace @@ -246,7 +246,7 @@ public: * @ingroup errGroup */ #ifndef AssertTrace -# define AssertTrace(expr) ((expr) ? (void) 0 : throw CanteraError(STR_TRACE, std::string("failed assert: ") + #expr)) +# define AssertTrace(expr) ((expr) ? (void) 0 : throw CanteraError(STR_TRACE, string("failed assert: ") + #expr)) #endif //! Assertion must be true or an error is thrown @@ -260,7 +260,7 @@ public: * @ingroup errGroup */ #ifndef AssertThrow -# define AssertThrow(expr, procedure) ((expr) ? (void) 0 : throw CanteraError(procedure, std::string("failed assert: ") + #expr)) +# define AssertThrow(expr, procedure) ((expr) ? (void) 0 : throw CanteraError(procedure, string("failed assert: ") + #expr)) #endif //! Assertion must be true or an error is thrown @@ -277,7 +277,7 @@ public: * @ingroup errGroup */ #ifndef AssertThrowMsg -# define AssertThrowMsg(expr, procedure, ...) ((expr) ? (void) 0 : throw CanteraError(procedure + std::string(":\nfailed assert: \"") + std::string(#expr) + std::string("\""), __VA_ARGS__)) +# define AssertThrowMsg(expr, procedure, ...) ((expr) ? (void) 0 : throw CanteraError(procedure + string(":\nfailed assert: \"") + string(#expr) + string("\""), __VA_ARGS__)) #endif #endif diff --git a/include/cantera/base/global.h b/include/cantera/base/global.h index 9a0a6686b..1a0cb7301 100644 --- a/include/cantera/base/global.h +++ b/include/cantera/base/global.h @@ -69,17 +69,17 @@ class AnyMap; */ //! @copydoc Application::findInputFile -std::string findInputFile(const std::string& name); +string findInputFile(const string& name); //! @copydoc Application::addDataDirectory -void addDirectory(const std::string& dir); +void addDirectory(const string& dir); //! @copydoc Application::getDataDirectories -std::string getDataDirectories(const std::string& sep); +string getDataDirectories(const string& sep); //! @} //! @copydoc Application::loadExtension -void loadExtension(const std::string& extType, const std::string& name); +void loadExtension(const string& extType, const string& name); //! Load extensions providing user-defined models from the `extensions` section of the //! given node. @see Application::loadExtension @@ -121,7 +121,7 @@ bool usingSharedLibrary(); string version(); //! Returns the hash of the git commit from which %Cantera was compiled, if known -std::string gitCommit(); +string gitCommit(); //! @} @@ -151,11 +151,11 @@ bool usesHDF5(); //! @addtogroup logGroup //! @{ -//! @copydoc Application::Messages::writelog(const std::string&) -void writelog_direct(const std::string& msg); +//! @copydoc Application::Messages::writelog(const string&) +void writelog_direct(const string& msg); //! Write a message to the log only if loglevel > 0 -inline void debuglog(const std::string& msg, int loglevel) +inline void debuglog(const string& msg, int loglevel) { if (loglevel > 0) { writelog_direct(msg); @@ -172,7 +172,7 @@ inline void debuglog(const std::string& msg, int loglevel) //! writelog will display correctly even when %Cantera is used from MATLAB or //! other application that do not have a standard output stream. template -void writelog(const std::string& fmt, const Args&... args) { +void writelog(const string& fmt, const Args&... args) { if (sizeof...(args) == 0) { writelog_direct(fmt); } else { @@ -212,7 +212,7 @@ void writeline(char repeat, size_t count, //! @cond //! helper function passing deprecation warning to global handler -void _warn_deprecated(const std::string& method, const std::string& extra=""); +void _warn_deprecated(const string& method, const string& extra=""); //! @endcond @@ -224,7 +224,7 @@ void _warn_deprecated(const std::string& method, const std::string& extra=""); * @param args arguments for the format string */ template -void warn_deprecated(const std::string& method, const std::string& msg, +void warn_deprecated(const string& method, const string& msg, const Args&... args) { if (sizeof...(args) == 0) { _warn_deprecated(method, msg); @@ -236,8 +236,8 @@ void warn_deprecated(const std::string& method, const std::string& msg, //! @cond //! helper function passing generic warning to global handler -void _warn(const std::string& warning, - const std::string& method, const std::string& extra); +void _warn(const string& warning, + const string& method, const string& extra); //! @endcond @@ -250,8 +250,8 @@ void _warn(const std::string& warning, * @param args arguments for the format string */ template -void warn(const std::string& warning, const std::string& method, - const std::string& msg, const Args&... args) { +void warn(const string& warning, const string& method, + const string& msg, const Args&... args) { if (sizeof...(args) == 0) { _warn(warning, method, msg); } else { @@ -266,7 +266,7 @@ void warn(const std::string& warning, const std::string& method, * @param args arguments for the format string */ template -void warn_user(const std::string& method, const std::string& msg, +void warn_user(const string& method, const string& msg, const Args&... args) { if (sizeof...(args) == 0) { _warn("Cantera", method, msg); @@ -343,7 +343,7 @@ template int sign(T x) { //! Convert a type name to a human readable string, using `boost::core::demangle` if //! available. Also has a set of short names for some common types. //! @note Mainly for internal use by AnyMap and Delegator -std::string demangle(const std::type_info& type); +string demangle(const std::type_info& type); } diff --git a/include/cantera/base/logger.h b/include/cantera/base/logger.h index 9a5056698..852e993cb 100644 --- a/include/cantera/base/logger.h +++ b/include/cantera/base/logger.h @@ -54,7 +54,7 @@ public: * * @param msg String message to be written to cout */ - virtual void write(const std::string& msg) { + virtual void write(const string& msg) { std::cout << msg; } @@ -73,7 +73,7 @@ public: * @param warning String specifying type of warning * @param msg String message to be written to cout */ - virtual void warn(const std::string& warning, const std::string& msg) { + virtual void warn(const string& warning, const string& msg) { std::clog << warning << "Warning: " << msg << std::endl; } @@ -88,7 +88,7 @@ public: * * @param msg Error message to be written to cerr. */ - virtual void error(const std::string& msg) { + virtual void error(const string& msg) { std::cerr << msg << std::endl; exit(EXIT_FAILURE); } diff --git a/include/cantera/base/stringUtils.h b/include/cantera/base/stringUtils.h index 1bf25e5a5..df2adfdce 100644 --- a/include/cantera/base/stringUtils.h +++ b/include/cantera/base/stringUtils.h @@ -25,15 +25,15 @@ namespace Cantera * @param fmt Format to be used (printf style) for each element * @param sep Separator */ -std::string vec2str(const vector& v, const std::string& fmt="%g", - const std::string& sep=", "); +string vec2str(const vector& v, const string& fmt="%g", + const string& sep=", "); //! Strip non-printing characters wherever they are /*! * @param s Input string * @returns a copy of the string, stripped of all non- printing characters. */ -std::string stripnonprint(const std::string& s); +string stripnonprint(const string& s); //! Parse a composition string into a map consisting of individual //! key:composition pairs. @@ -68,7 +68,7 @@ Composition parseCompString(const string& ss, * @param val String value of the double * @returns a double */ -double fpValue(const std::string& val); +double fpValue(const string& val); //! Translate a string into one double value, with error checking /*! @@ -91,7 +91,7 @@ double fpValue(const std::string& val); * @param val String representation of the number * @returns a double */ -double fpValueCheck(const std::string& val); +double fpValueCheck(const string& val); //! This function separates a string up into tokens according to the location of //! white space. @@ -104,8 +104,8 @@ double fpValueCheck(const std::string& val); * @param oval String to be broken up * @param v Output vector of tokens. */ -void tokenizeString(const std::string& oval, - vector& v); +void tokenizeString(const string& oval, + vector& v); //! This function separates a string up into tokens according to the location of //! path separators. @@ -117,35 +117,35 @@ void tokenizeString(const std::string& oval, * * @since New in %Cantera 3.0. */ -void tokenizePath(const std::string& oval, - vector& v); +void tokenizePath(const string& oval, + vector& v); -//! Copy the contents of a std::string into a char array of a given length +//! Copy the contents of a string into a char array of a given length /*! * If *length* is less than the size of *source*, the string will be truncated * and the function will return the length of the buffer required to hold * *source*. Otherwise, returns 0. */ -size_t copyString(const std::string& source, char* dest, size_t length); +size_t copyString(const string& source, char* dest, size_t length); //! Trim. /*! * Remove all leading and trailing spaces (with default locale). */ -std::string trimCopy(const std::string &input); +string trimCopy(const string &input); //! Convert to lower case. /*! * Convert the given string to lower case (with default locale). */ -std::string toLowerCopy(const std::string& input); +string toLowerCopy(const string& input); //! Case insensitive equality predicate. /*! * Returns true if and only if all elements in both strings are the same * when compared case insensitively (with default locale). */ -bool caseInsensitiveEquals(const std::string &input, const std::string &test); +bool caseInsensitiveEquals(const string &input, const string &test); //! @} diff --git a/include/cantera/base/utilities.h b/include/cantera/base/utilities.h index cc7ec2653..c191c3fe7 100644 --- a/include/cantera/base/utilities.h +++ b/include/cantera/base/utilities.h @@ -180,7 +180,7 @@ void checkFinite(const double tmp); * @param values Array of *N* values to be checked * @param N Number of elements in *values* */ -void checkFinite(const std::string& name, double* values, size_t N); +void checkFinite(const string& name, double* values, size_t N); //! Const accessor for a value in a map. /* diff --git a/include/cantera/equil/MultiPhase.h b/include/cantera/equil/MultiPhase.h index fa92e972b..f42862a47 100644 --- a/include/cantera/equil/MultiPhase.h +++ b/include/cantera/equil/MultiPhase.h @@ -111,13 +111,13 @@ public: /*! * @param m index of the global element */ - std::string elementName(size_t m) const; + string elementName(size_t m) const; //! Returns the index of the element with name \a name. /*! * @param name String name of the global element */ - size_t elementIndex(const std::string& name) const; + size_t elementIndex(const string& name) const; //! Number of species, summed over all phases. size_t nSpecies() const { @@ -137,7 +137,7 @@ public: /*! * @param kGlob global species index */ - std::string speciesName(const size_t kGlob) const; + string speciesName(const size_t kGlob) const; //! Returns the Number of atoms of global element \a mGlob in //! global species \a kGlob. @@ -170,14 +170,14 @@ public: /*! * @param iph phase Index */ - std::string phaseName(const size_t iph) const; + string phaseName(const size_t iph) const; //! Returns the index, given the phase name /*! * @param pName Name of the phase * @returns the index. A value of -1 means the phase isn't in the object. */ - int phaseIndex(const std::string& pName) const; + int phaseIndex(const string& pName) const; //! Return the number of moles in phase n. /*! @@ -238,7 +238,7 @@ public: * If the species or phase name is not recognized, this routine throws a * CanteraError. */ - size_t speciesIndex(const std::string& speciesName, const std::string& phaseName); + size_t speciesIndex(const string& speciesName, const string& phaseName); //! Minimum temperature for which all solution phases have valid thermo //! data. Stoichiometric phases are not considered, since they may have @@ -358,7 +358,7 @@ public: * * @ingroup equilGroup */ - void equilibrate(const std::string& XY, const std::string& solver="auto", + void equilibrate(const string& XY, const string& solver="auto", double rtol=1e-9, int max_steps=50000, int max_iter=100, int estimate_equil=0, int log_level=0); @@ -472,7 +472,7 @@ public: * @param x string x in the form of a composition map * where values are the moles of the species. */ - void setMolesByName(const std::string& x); + void setMolesByName(const string& x); //! Get the mole numbers of all species in the multiphase object /*! @@ -599,20 +599,20 @@ private: //! String names of the global elements. This has a length equal to the //! number of global elements. - vector m_enames; + vector m_enames; //! Atomic number of each global element. vector m_atomicNumber; //! Vector of species names in the problem. Vector is over all species //! defined in the object, the global species index. - vector m_snames; + vector m_snames; //! Returns the global element index, given the element string name /*! * -> used in the construction. However, wonder if it needs to be global. */ - map m_enamemap; + map m_enamemap; //! Current value of the temperature (kelvin) double m_temp = 298.15; diff --git a/include/cantera/equil/MultiPhaseEquil.h b/include/cantera/equil/MultiPhaseEquil.h index fc50c2b15..c25b04689 100644 --- a/include/cantera/equil/MultiPhaseEquil.h +++ b/include/cantera/equil/MultiPhaseEquil.h @@ -69,7 +69,7 @@ public: int maxsteps = 1000, int loglevel=-99); double error(); - std::string reactionString(size_t j) { + string reactionString(size_t j) { return ""; } void setInitialMixMoles(int loglevel = 0) { @@ -81,7 +81,7 @@ public: return m_species[m_order[n]]; } - void reportCSV(const std::string& reportFile); + void reportCSV(const string& reportFile); double phaseMoles(size_t iph) const; @@ -154,7 +154,7 @@ protected: double mu(size_t n) const { return m_mu[m_species[m_order[n]]]; } - std::string speciesName(size_t n) const { + string speciesName(size_t n) const { return m_mix->speciesName(m_species[m_order[n]]); } diff --git a/include/cantera/equil/vcs_MultiPhaseEquil.h b/include/cantera/equil/vcs_MultiPhaseEquil.h index 9d772f151..c9e680ade 100644 --- a/include/cantera/equil/vcs_MultiPhaseEquil.h +++ b/include/cantera/equil/vcs_MultiPhaseEquil.h @@ -221,7 +221,7 @@ public: * @param reportFile Base name of the file to get the report. File name is * incremented by 1 for each report. */ - void reportCSV(const std::string& reportFile); + void reportCSV(const string& reportFile); protected: //! Vector that takes into account of the current sorting of the species diff --git a/include/cantera/equil/vcs_SpeciesProperties.h b/include/cantera/equil/vcs_SpeciesProperties.h index ca50517eb..23149022b 100644 --- a/include/cantera/equil/vcs_SpeciesProperties.h +++ b/include/cantera/equil/vcs_SpeciesProperties.h @@ -24,7 +24,7 @@ public: size_t NumElements; //! Name of the species - std::string SpName; + string SpName; //! Pointer to the thermo structure for this species VCS_SPECIES_THERMO* SpeciesThermo = nullptr; diff --git a/include/cantera/equil/vcs_VolPhase.h b/include/cantera/equil/vcs_VolPhase.h index ab4e98051..f313b2210 100644 --- a/include/cantera/equil/vcs_VolPhase.h +++ b/include/cantera/equil/vcs_VolPhase.h @@ -427,7 +427,7 @@ public: /*! * @param e Element index. */ - std::string elementName(const size_t e) const; + string elementName(const size_t e) const; //! Type of the element constraint with index \c e. /*! @@ -469,7 +469,7 @@ public: size_t nSpecies() const; //! Return the name corresponding to the equation of state - std::string eos_name() const; + string eos_name() const; private: //! Evaluate the activity coefficients at the current conditions @@ -579,7 +579,7 @@ private: /*! * Length = nElemConstraints */ - vector m_elementNames; + vector m_elementNames; //! boolean indicating whether an element constraint is active //! for the current problem @@ -623,7 +623,7 @@ private: public: //! String name for the phase - std::string PhaseName; + string PhaseName; private: //! Total moles of inert in the phase diff --git a/include/cantera/equil/vcs_solve.h b/include/cantera/equil/vcs_solve.h index fc6a24b5a..c81a3ef72 100644 --- a/include/cantera/equil/vcs_solve.h +++ b/include/cantera/equil/vcs_solve.h @@ -1039,7 +1039,7 @@ public: */ size_t addElement(const char* elNameNew, int elType, int elactive); - void reportCSV(const std::string& reportFile); + void reportCSV(const string& reportFile); //! Total number of species in the problems size_t m_nsp; @@ -1362,13 +1362,13 @@ public: vector m_SSPhase; //! Species string name for the kth species - vector m_speciesName; + vector m_speciesName; //! Vector of strings containing the element names /*! * ElName[j] = String containing element names */ - vector m_elementName; + vector m_elementName; //! Type of the element constraint /*! diff --git a/include/cantera/extensions/PythonExtensionManager.h b/include/cantera/extensions/PythonExtensionManager.h index 807af20d0..1ac61baa1 100644 --- a/include/cantera/extensions/PythonExtensionManager.h +++ b/include/cantera/extensions/PythonExtensionManager.h @@ -25,7 +25,7 @@ namespace Cantera class PythonExtensionManager : public ExtensionManager { public: - virtual void registerRateBuilders(const std::string& extensionName) override; + virtual void registerRateBuilders(const string& extensionName) override; void registerRateBuilder(const string& moduleName, const string& className, const string& rateName) override; diff --git a/include/cantera/kinetics/Arrhenius.h b/include/cantera/kinetics/Arrhenius.h index 71de76d72..190071fd8 100644 --- a/include/cantera/kinetics/Arrhenius.h +++ b/include/cantera/kinetics/Arrhenius.h @@ -85,9 +85,9 @@ public: virtual void getParameters(AnyMap& node) const override; //! Check rate expression - virtual void check(const std::string& equation) override; + virtual void check(const string& equation) override; - virtual void validate(const std::string& equation, const Kinetics& kin) override; + virtual void validate(const string& equation, const Kinetics& kin) override; //! Return the pre-exponential factor *A* (in m, kmol, s to powers depending //! on the reaction order) @@ -151,10 +151,10 @@ protected: double m_E4_R = 0.; //!< Optional 4th energy parameter (in temperature units) double m_logA = NAN; //!< Logarithm of pre-exponential factor double m_order = NAN; //!< Reaction order - std::string m_A_str = "A"; //!< The string for the pre-exponential factor - std::string m_b_str = "b"; //!< The string for temperature exponent - std::string m_Ea_str = "Ea"; //!< The string for activation energy - std::string m_E4_str = ""; //!< The string for an optional 4th parameter + string m_A_str = "A"; //!< The string for the pre-exponential factor + string m_b_str = "b"; //!< The string for temperature exponent + string m_Ea_str = "Ea"; //!< The string for activation energy + string m_E4_str = ""; //!< The string for an optional 4th parameter }; //! Arrhenius reaction rate type depends only on temperature @@ -176,7 +176,7 @@ public: return make_unique>(); } - virtual const std::string type() const override { + virtual const string type() const override { return "Arrhenius"; } diff --git a/include/cantera/kinetics/BlowersMaselRate.h b/include/cantera/kinetics/BlowersMaselRate.h index 7406f3121..fdf49b198 100644 --- a/include/cantera/kinetics/BlowersMaselRate.h +++ b/include/cantera/kinetics/BlowersMaselRate.h @@ -90,7 +90,7 @@ public: return make_unique>(); } - virtual const std::string type() const override { + virtual const string type() const override { return "Blowers-Masel"; } diff --git a/include/cantera/kinetics/ChebyshevRate.h b/include/cantera/kinetics/ChebyshevRate.h index 1576366a4..637b4e320 100644 --- a/include/cantera/kinetics/ChebyshevRate.h +++ b/include/cantera/kinetics/ChebyshevRate.h @@ -113,7 +113,7 @@ public: return make_unique>(); } - const std::string type() const { return "Chebyshev"; } + const string type() const { return "Chebyshev"; } //! Perform object setup based on AnyMap node information /*! @@ -131,7 +131,7 @@ public: return getParameters(rateNode); } - virtual void validate(const std::string& equation, const Kinetics& kin); + virtual void validate(const string& equation, const Kinetics& kin); //! Update information specific to reaction /*! diff --git a/include/cantera/kinetics/Custom.h b/include/cantera/kinetics/Custom.h index 1f1a39d7c..843d017d0 100644 --- a/include/cantera/kinetics/Custom.h +++ b/include/cantera/kinetics/Custom.h @@ -44,12 +44,12 @@ public: return make_unique>(); } - const std::string type() const override { return "custom-rate-function"; } + const string type() const override { return "custom-rate-function"; } void getParameters(AnyMap& rateNode, const Units& rate_units=Units(0.)) const; using ReactionRate::getParameters; - virtual void validate(const std::string& equation, const Kinetics& kin) override; + virtual void validate(const string& equation, const Kinetics& kin) override; //! Update information specific to reaction /*! diff --git a/include/cantera/kinetics/EdgeKinetics.h b/include/cantera/kinetics/EdgeKinetics.h index ae4d675f7..d4ce4ffe5 100644 --- a/include/cantera/kinetics/EdgeKinetics.h +++ b/include/cantera/kinetics/EdgeKinetics.h @@ -25,7 +25,7 @@ public: m_nDim = 1; } - virtual std::string kineticsType() const { + virtual string kineticsType() const { return "edge"; } }; diff --git a/include/cantera/kinetics/Falloff.h b/include/cantera/kinetics/Falloff.h index ce3e3eac0..2c0336a34 100644 --- a/include/cantera/kinetics/Falloff.h +++ b/include/cantera/kinetics/Falloff.h @@ -152,7 +152,7 @@ public: return 0; } - virtual const std::string type() const override { + virtual const string type() const override { if (m_chemicallyActivated) { return "chemically-activated"; } @@ -206,8 +206,8 @@ public: return pr * m_rc_high; } - virtual void check(const std::string& equation) override; - virtual void validate(const std::string& equation, const Kinetics& kin) override; + virtual void check(const string& equation) override; + virtual void validate(const string& equation, const Kinetics& kin) override; //! Get flag indicating whether negative A values are permitted bool allowNegativePreExponentialFactor() const { @@ -280,7 +280,7 @@ public: return make_unique>(); } - virtual const std::string subType() const override { + virtual const string subType() const override { return "Lindemann"; } }; @@ -353,7 +353,7 @@ public: return 1; } - virtual const std::string subType() const override { + virtual const string subType() const override { return "Troe"; } @@ -453,7 +453,7 @@ public: return 2; } - virtual const std::string subType() const override { + virtual const string subType() const override { return "SRI"; } @@ -559,7 +559,7 @@ public: return 1; } - virtual const std::string subType() const override { + virtual const string subType() const override { return "Tsang"; } diff --git a/include/cantera/kinetics/GasKinetics.h b/include/cantera/kinetics/GasKinetics.h index eaedceea6..580aa163e 100644 --- a/include/cantera/kinetics/GasKinetics.h +++ b/include/cantera/kinetics/GasKinetics.h @@ -40,7 +40,7 @@ public: addPhase(*thermo); } - virtual std::string kineticsType() const { + virtual string kineticsType() const { return "gas"; } diff --git a/include/cantera/kinetics/Group.h b/include/cantera/kinetics/Group.h index ef01cbbd3..78f3cd868 100644 --- a/include/cantera/kinetics/Group.h +++ b/include/cantera/kinetics/Group.h @@ -125,7 +125,7 @@ public: return m_comp[m]; } - std::ostream& fmt(std::ostream& s, const vector& esymbols) const; + std::ostream& fmt(std::ostream& s, const vector& esymbols) const; friend std::ostream& operator<<(std::ostream& s, const Group& g); diff --git a/include/cantera/kinetics/InterfaceKinetics.h b/include/cantera/kinetics/InterfaceKinetics.h index aaa0a320a..55f43646d 100644 --- a/include/cantera/kinetics/InterfaceKinetics.h +++ b/include/cantera/kinetics/InterfaceKinetics.h @@ -73,7 +73,7 @@ public: virtual void resizeReactions(); - virtual std::string kineticsType() const { + virtual string kineticsType() const { return "surface"; } @@ -354,7 +354,7 @@ protected: //! Vector of rate handlers for interface reactions vector> m_interfaceRates; - map m_interfaceTypes; //!< Rate handler mapping + map m_interfaceTypes; //!< Rate handler mapping //! Vector of irreversible reaction numbers /*! diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 8aa106900..87f389862 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -142,7 +142,7 @@ public: //! a meaningful identifier. //! @since Starting in %Cantera 3.0, the name returned by this method corresponds //! to the canonical name used in the YAML input format. - virtual std::string kineticsType() const { + virtual string kineticsType() const { return "none"; } @@ -199,12 +199,12 @@ public: * Return the phase index of a phase in the list of phases defined within * the object. * - * @param ph std::string name of the phase + * @param ph string name of the phase * * If a -1 is returned, then the phase is not defined in the Kinetics * object. */ - size_t phaseIndex(const std::string& ph) const { + size_t phaseIndex(const string& ph) const { if (m_phaseindex.find(ph) == m_phaseindex.end()) { return npos; } else { @@ -298,11 +298,11 @@ public: * * @param k species index */ - std::string kineticsSpeciesName(size_t k) const; + string kineticsSpeciesName(size_t k) const; /** * This routine will look up a species number based on the input - * std::string nm. The lookup of species will occur for all phases + * string nm. The lookup of species will occur for all phases * listed in the kinetics object. * * return @@ -311,11 +311,11 @@ public: * * @param nm Input string name of the species */ - size_t kineticsSpeciesIndex(const std::string& nm) const; + size_t kineticsSpeciesIndex(const string& nm) const; /** * This routine will look up a species number based on the input - * std::string nm. The lookup of species will occur in the specified + * string nm. The lookup of species will occur in the specified * phase of the object, or all phases if ph is "". * * return @@ -327,8 +327,8 @@ public: * @deprecated To be removed after %Cantera 3.0. Species names should be unique * across all phases. */ - size_t kineticsSpeciesIndex(const std::string& nm, - const std::string& ph) const; + size_t kineticsSpeciesIndex(const string& nm, + const string& ph) const; /** * This function looks up the name of a species and returns a @@ -337,8 +337,8 @@ public: * * @param nm String containing the name of the species. */ - ThermoPhase& speciesPhase(const std::string& nm); - const ThermoPhase& speciesPhase(const std::string& nm) const; + ThermoPhase& speciesPhase(const string& nm); + const ThermoPhase& speciesPhase(const string& nm) const; /** * This function takes as an argument the kineticsSpecies index @@ -1235,7 +1235,7 @@ public: * @deprecated To be removed after %Cantera 3.0. Replace with * `kin->reaction(i)->type()` */ - virtual std::string reactionType(size_t i) const; + virtual string reactionType(size_t i) const; /** * String specifying the type of reaction. @@ -1243,7 +1243,7 @@ public: * @param i reaction index * @deprecated To be removed after %Cantera 3.0. */ - virtual std::string reactionTypeStr(size_t i) const; + virtual string reactionTypeStr(size_t i) const; /** * True if reaction i has been declared to be reversible. If isReversible(i) @@ -1263,17 +1263,17 @@ public: * @deprecated To be removed after %Cantera 3.0. Replace with * `kin->reaction(i)->equation()`. */ - std::string reactionString(size_t i) const; + string reactionString(size_t i) const; //! Returns a string containing the reactants side of the reaction equation. //! @deprecated To be removed after %Cantera 3.0. Replace with //! `kin->reaction(i)->reactantString()` - std::string reactantString(size_t i) const; + string reactantString(size_t i) const; //! Returns a string containing the products side of the reaction equation. //! @deprecated To be removed after %Cantera 3.0. Replace with //! `kin->reaction(i)->productString()` - std::string productString(size_t i) const; + string productString(size_t i) const; /** * Return the forward rate constants @@ -1329,7 +1329,7 @@ public: * mechanism. * - #m_thermo -> vector of pointers to ThermoPhase phases that * participate in the kinetics mechanism. - * - #m_phaseindex -> map containing the std::string id of each + * - #m_phaseindex -> map containing the string id of each * ThermoPhase phase as a key and the index of the phase within the * kinetics manager object as the value. * @@ -1580,7 +1580,7 @@ protected: * function, phaseIndex() decrements by one before returning the index * value, so that missing phases return -1. */ - map m_phaseindex; + map m_phaseindex; //! Index in the list of phases of the one surface phase. //! @deprecated To be removed after %Cantera 3.0. diff --git a/include/cantera/kinetics/KineticsFactory.h b/include/cantera/kinetics/KineticsFactory.h index abef4255e..a0fbd8c13 100644 --- a/include/cantera/kinetics/KineticsFactory.h +++ b/include/cantera/kinetics/KineticsFactory.h @@ -28,7 +28,7 @@ public: /** * Return a new, empty kinetics manager. */ - virtual Kinetics* newKinetics(const std::string& model); + virtual Kinetics* newKinetics(const string& model); private: static KineticsFactory* s_factory; @@ -98,8 +98,8 @@ shared_ptr newKinetics(const vector>& phases, //! @deprecated To be removed after %Cantera 3.0; //! superseded by newKinetics() returning shared_ptr unique_ptr newKinetics(const vector& phases, - const std::string& filename, - const std::string& phase_name); + const string& filename, + const string& phase_name); /** * Add reactions to a Kinetics object. diff --git a/include/cantera/kinetics/MultiRate.h b/include/cantera/kinetics/MultiRate.h index 42b54f9f5..7a6e84c30 100644 --- a/include/cantera/kinetics/MultiRate.h +++ b/include/cantera/kinetics/MultiRate.h @@ -26,7 +26,7 @@ class MultiRate final : public MultiRateBase CT_DEFINE_HAS_MEMBER(has_ddM, perturbThirdBodies) public: - virtual std::string type() override { + virtual string type() override { if (!m_rxn_rates.size()) { throw CanteraError("MultiRate::type", "Cannot determine type of empty rate handler."); diff --git a/include/cantera/kinetics/MultiRateBase.h b/include/cantera/kinetics/MultiRateBase.h index f0dd60fdc..33d418294 100644 --- a/include/cantera/kinetics/MultiRateBase.h +++ b/include/cantera/kinetics/MultiRateBase.h @@ -30,7 +30,7 @@ public: virtual ~MultiRateBase() {} //! Identifier of reaction rate type - virtual std::string type() = 0; + virtual string type() = 0; //! Add reaction rate object to the evaluator //! @param rxn_index index of reaction diff --git a/include/cantera/kinetics/PlogRate.h b/include/cantera/kinetics/PlogRate.h index e3b990db3..70775c82b 100644 --- a/include/cantera/kinetics/PlogRate.h +++ b/include/cantera/kinetics/PlogRate.h @@ -89,7 +89,7 @@ public: } //! Identifier of reaction rate type - const std::string type() const { return "pressure-dependent-Arrhenius"; } + const string type() const { return "pressure-dependent-Arrhenius"; } //! Perform object setup based on AnyMap node information /*! @@ -170,11 +170,11 @@ public: //! temperatures at each interpolation pressure. This is potentially an //! issue when one of the Arrhenius expressions at a particular pressure //! has a negative pre-exponential factor. - void validate(const std::string& equation, const Kinetics& kin); + void validate(const string& equation, const Kinetics& kin); //! @deprecated To be removed after %Cantera 3.0; //! superseded by two-parameter version - void validate(const std::string& equation); + void validate(const string& equation); //! Return the pressures and Arrhenius expressions which comprise this //! reaction. diff --git a/include/cantera/kinetics/Reaction.h b/include/cantera/kinetics/Reaction.h index bd54f4364..4072240ae 100644 --- a/include/cantera/kinetics/Reaction.h +++ b/include/cantera/kinetics/Reaction.h @@ -29,7 +29,7 @@ public: Reaction() {} Reaction(const Composition& reactants, const Composition& products, shared_ptr rate, shared_ptr tbody=nullptr); - Reaction(const std::string& equation, + Reaction(const string& equation, shared_ptr rate, shared_ptr tbody=nullptr); //! Construct a Reaction and corresponding ReactionRate based on AnyMap (YAML) @@ -39,20 +39,20 @@ public: virtual ~Reaction() {} //! The reactant side of the chemical equation for this reaction - std::string reactantString() const; + string reactantString() const; //! The product side of the chemical equation for this reaction - std::string productString() const; + string productString() const; //! The chemical equation for this reaction - std::string equation() const; + string equation() const; //! Set the reactants and products based on the reaction equation. If a Kinetics //! object is provided, it is used to check that all reactants and products exist. - void setEquation(const std::string& equation, const Kinetics* kin=0); + void setEquation(const string& equation, const Kinetics* kin=0); //! The type of reaction, including reaction rate information - std::string type() const; + string type() const; //! Calculate the units of the rate constant. These are determined by the units //! of the standard concentration of the reactant species' phases and the phase @@ -141,7 +141,7 @@ public: //! An identification string for the reaction, used in some filtering //! operations - std::string id; + string id; //! True if the current reaction is reversible. False otherwise bool reversible = true; @@ -213,7 +213,7 @@ class ThirdBody { public: explicit ThirdBody() {}; - ThirdBody(const std::string& third_body); + ThirdBody(const string& third_body); ThirdBody(const AnyMap& node); //! @deprecated To be removed after %Cantera 3.0; instantiate using string instead @@ -221,13 +221,13 @@ public: //! Name of the third body collider //! @since New in %Cantera 3.0 - std::string name() const { + string name() const { return m_name; } //! Set name of the third body collider //! @since New in %Cantera 3.0 - void setName(const std::string& third_body); + void setName(const string& third_body); //! Set third-body efficiencies from AnyMap *node* //! @deprecated To be removed after %Cantera 3.0; renamed to setParameters @@ -243,12 +243,12 @@ public: void getParameters(AnyMap& node) const; //! Get the third-body efficiency for species *k* - double efficiency(const std::string& k) const; + double efficiency(const string& k) const; //! Suffix representing the third body collider in reaction equation, for example //! `+ M` or `(+M)` //! @since New in %Cantera 3.0 - std::string collider() const; + string collider() const; //! Verify that all species involved in collision efficiencies are defined in the //! Kinetics object. The function returns true if all species are found, and raises @@ -274,7 +274,7 @@ public: protected: //! Name of the third body collider - std::string m_name = "M"; + string m_name = "M"; }; @@ -314,7 +314,7 @@ public: /*! * @param type string identifying type of reaction. */ -unique_ptr newReaction(const std::string& type); +unique_ptr newReaction(const string& type); //! Create a new Reaction object using the specified parameters /*! @@ -331,7 +331,7 @@ vector> getReactions(const AnyValue& items, Kinetics& kinetics); //! Parse reaction equation -void parseReactionEquation(Reaction& R, const std::string& equation, +void parseReactionEquation(Reaction& R, const string& equation, const AnyBase& reactionNode, const Kinetics* kin); using ThreeBodyReaction3 = ThreeBodyReaction; // @todo: remove after Cantera 3.0 diff --git a/include/cantera/kinetics/ReactionPath.h b/include/cantera/kinetics/ReactionPath.h index dfa2e0984..0a3713cd8 100644 --- a/include/cantera/kinetics/ReactionPath.h +++ b/include/cantera/kinetics/ReactionPath.h @@ -96,7 +96,7 @@ public: * total flow, and the flow associated with this label. */ void addReaction(size_t rxnNumber, double value, - const std::string& label = ""); + const string& label = ""); //! Upstream node. const SpeciesNode* begin() const { @@ -147,7 +147,7 @@ public: void writeLabel(std::ostream& s, double threshold = 0.005); protected: - map m_label; + map m_label; SpeciesNode* m_a, *m_b; rxn_path_map m_rxn; double m_total = 0.0; @@ -220,41 +220,41 @@ public: return m_nodes.size(); } - void addNode(size_t k, const std::string& nm, double x = 0.0); + void addNode(size_t k, const string& nm, double x = 0.0); void displayOnly(size_t k=npos) { m_local = k; } void linkNodes(size_t k1, size_t k2, size_t rxn, double value, - std::string legend = ""); + string legend = ""); - void include(const std::string& aaname) { + void include(const string& aaname) { m_include.push_back(aaname); } - void exclude(const std::string& aaname) { + void exclude(const string& aaname) { m_exclude.push_back(aaname); } - void include(vector& names) { + void include(vector& names) { for (size_t i = 0; i < names.size(); i++) { m_include.push_back(names[i]); } } - void exclude(vector& names) { + void exclude(vector& names) { for (size_t i = 0; i < names.size(); i++) { m_exclude.push_back(names[i]); } } - vector& included() { + vector& included() { return m_include; } - vector& excluded() { + vector& excluded() { return m_exclude; } vector species(); vector reactions(); void findMajorPaths(double threshold, size_t lda, double* a); - void setFont(const std::string& font) { + void setFont(const string& font) { m_font = font; } // public attributes @@ -286,8 +286,8 @@ protected: //! map of species index to SpeciesNode map m_nodes; vector m_pathlist; - vector m_include; - vector m_exclude; + vector m_include; + vector m_exclude; vector m_speciesNumber; //! Indices of reactions that are included in the diagram @@ -304,7 +304,7 @@ public: int init(std::ostream& logfile, Kinetics& s); - int build(Kinetics& s, const std::string& element, std::ostream& output, + int build(Kinetics& s, const string& element, std::ostream& output, ReactionPathDiagram& r, bool quiet=false); //! Analyze a reaction to determine which reactants lead to which products. @@ -324,7 +324,7 @@ protected: DenseMatrix m_elatoms; vector> m_groups; vector m_sgroup; - vector m_elementSymbols; + vector m_elementSymbols; //! m_transfer[reaction][reactant number][product number] where "reactant //! number" means the number of the reactant in the reaction equation. For example, @@ -333,7 +333,7 @@ protected: vector m_determinate; Array2D m_atoms; - map m_enamemap; + map m_enamemap; }; } diff --git a/include/cantera/kinetics/ReactionRate.h b/include/cantera/kinetics/ReactionRate.h index bd09c1369..a59ab1769 100644 --- a/include/cantera/kinetics/ReactionRate.h +++ b/include/cantera/kinetics/ReactionRate.h @@ -88,10 +88,10 @@ public: } //! String identifying reaction rate specialization - virtual const std::string type() const = 0; + virtual const string type() const = 0; //! String identifying sub-type of reaction rate specialization - virtual const std::string subType() const { + virtual const string subType() const { return ""; } @@ -138,24 +138,24 @@ public: } //! Check basic syntax and settings of reaction rate expression - virtual void check(const std::string& equation) {} + virtual void check(const string& equation) {} //! Check basic syntax and settings of reaction rate expression //! @deprecated To be removed after %Cantera 3.0. //! Superseded by single-parameter version - void check(const std::string& equation, const AnyMap& node) { + void check(const string& equation, const AnyMap& node) { warn_deprecated("ReactionRate::check", "To be removed after Cantera 3.0; superseded by single-parameter version."); check(equation); } //! Validate the reaction rate expression - virtual void validate(const std::string& equation, const Kinetics& kin) {} + virtual void validate(const string& equation, const Kinetics& kin) {} //! Validate the reaction rate expression (legacy call) //! @deprecated To be removed after %Cantera 3.0. //! Superseded by two-parameter version - virtual void validate(const std::string& equation) { + virtual void validate(const string& equation) { warn_deprecated("ReactionRate::validate", "To be removed after Cantera 3.0; superseded by two-parameter version."); } diff --git a/include/cantera/kinetics/ReactionRateDelegator.h b/include/cantera/kinetics/ReactionRateDelegator.h index 31705dbf7..8fce3a41a 100644 --- a/include/cantera/kinetics/ReactionRateDelegator.h +++ b/include/cantera/kinetics/ReactionRateDelegator.h @@ -32,7 +32,7 @@ public: //! Set the type of the ReactionData class. This should match the corresponding //! ReactionRate class's type - void setType(const std::string& name) { + void setType(const string& name) { m_rateType = name; } @@ -48,7 +48,7 @@ public: protected: //! The reaction rate type - std::string m_rateType; + string m_rateType; //! An external language's wrapper for the Solution object where this ReactionData //! object is being used @@ -73,11 +73,11 @@ public: virtual unique_ptr newMultiRate() const override; //! Set the reaction type based on the user-provided reaction rate parameterization - void setType(const std::string& type) { + void setType(const string& type) { m_rateType = type; } - virtual const std::string type() const override { + virtual const string type() const override { return m_rateType; } diff --git a/include/cantera/kinetics/ReactionRateFactory.h b/include/cantera/kinetics/ReactionRateFactory.h index 47c25b5a2..bf21617bd 100644 --- a/include/cantera/kinetics/ReactionRateFactory.h +++ b/include/cantera/kinetics/ReactionRateFactory.h @@ -84,7 +84,7 @@ private: /*! * @param type string identifying type of reaction rate. */ -shared_ptr newReactionRate(const std::string& type); +shared_ptr newReactionRate(const string& type); //! Create a new Rate object using the specified parameters /*! diff --git a/include/cantera/kinetics/TwoTempPlasmaRate.h b/include/cantera/kinetics/TwoTempPlasmaRate.h index e7abe3d12..2ba1def31 100644 --- a/include/cantera/kinetics/TwoTempPlasmaRate.h +++ b/include/cantera/kinetics/TwoTempPlasmaRate.h @@ -78,7 +78,7 @@ public: return make_unique>(); } - virtual const std::string type() const override { + virtual const string type() const override { return "two-temperature-plasma"; } diff --git a/include/cantera/numerics/CVodesIntegrator.h b/include/cantera/numerics/CVodesIntegrator.h index 727307105..7d7a2f854 100644 --- a/include/cantera/numerics/CVodesIntegrator.h +++ b/include/cantera/numerics/CVodesIntegrator.h @@ -57,10 +57,10 @@ public: virtual int maxSteps(); virtual void setMaxErrTestFails(int n); virtual AnyMap solverStats() const; - void setLinearSolverType(const std::string& linSolverType) { + void setLinearSolverType(const string& linSolverType) { m_type = linSolverType; } - virtual std::string linearSolverType() const { + virtual string linearSolverType() const { return m_type; } virtual void setBandwidth(int N_Upper, int N_Lower) { @@ -77,10 +77,10 @@ public: //! with each solution component. //! This information can be used to identify which variables are //! responsible for integrator failures or unexpected small timesteps. - virtual std::string getErrorInfo(int N); + virtual string getErrorInfo(int N); //! Error message information provide by CVodes - std::string m_error_message; + string m_error_message; protected: //! Applies user-specified options to the underlying CVODES solver. Called diff --git a/include/cantera/numerics/Func1.h b/include/cantera/numerics/Func1.h index be1855e59..da68133a7 100644 --- a/include/cantera/numerics/Func1.h +++ b/include/cantera/numerics/Func1.h @@ -171,7 +171,7 @@ public: virtual double isProportional(Func1& other); //! Write LaTeX string describing function. - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; //! Accessor function for the stored constant double c() const; @@ -293,7 +293,7 @@ public: return *this; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int ID() const { return SinFuncType; @@ -343,7 +343,7 @@ public: } virtual Func1& duplicate() const; - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int ID() const { return CosFuncType; } @@ -385,7 +385,7 @@ public: Func1::operator=(right); return *this; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int ID() const { return ExpFuncType; } @@ -430,7 +430,7 @@ public: virtual shared_ptr derivative3() const; - virtual std::string write(const string& arg) const; + virtual string write(const string& arg) const; }; //! Implements the \c pow() (power) function. @@ -459,7 +459,7 @@ public: Func1::operator=(right); return *this; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int ID() const { return PowFuncType; } @@ -509,7 +509,7 @@ public: //! @since New in %Cantera 3.0 void setMethod(const string& method); - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int ID() const { return TabulatedFuncType; } @@ -559,7 +559,7 @@ public: return *this; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int ID() const { return ConstFuncType; } @@ -646,7 +646,7 @@ public: return 0; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; }; /** @@ -718,7 +718,7 @@ public: return 0; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; }; @@ -776,7 +776,7 @@ public: return "product"; } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual double eval(double t) const { return m_f1->eval(t) * m_f2->eval(t); @@ -865,7 +865,7 @@ public: return newTimesConstFunction(m_f1_shared->derivative3(), m_c); } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int order() const { return 0; @@ -930,7 +930,7 @@ public: return m_f1_shared->derivative3(); } - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int order() const { return 0; @@ -1000,7 +1000,7 @@ public: virtual shared_ptr derivative3() const; - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int order() const { return 1; @@ -1069,7 +1069,7 @@ public: virtual shared_ptr derivative3() const; - virtual std::string write(const std::string& arg) const; + virtual string write(const string& arg) const; virtual int order() const { return 2; diff --git a/include/cantera/numerics/FuncEval.h b/include/cantera/numerics/FuncEval.h index b2a36700f..f01d2c01d 100644 --- a/include/cantera/numerics/FuncEval.h +++ b/include/cantera/numerics/FuncEval.h @@ -168,7 +168,7 @@ public: }; //! Return a string containing the text of any suppressed errors - std::string getErrors() const; + string getErrors() const; //! Clear any previously-stored suppressed errors void clearErrors() { @@ -188,7 +188,7 @@ protected: bool m_suppress_errors = false; //! Errors occurring during function evaluations - vector m_errors; + vector m_errors; }; } diff --git a/include/cantera/numerics/Integrator.h b/include/cantera/numerics/Integrator.h index 2ccb35376..ae72eaf29 100644 --- a/include/cantera/numerics/Integrator.h +++ b/include/cantera/numerics/Integrator.h @@ -104,7 +104,7 @@ public: /*! * @param linSolverType Type of the linear solver */ - virtual void setLinearSolverType(const std::string& linSolverType) { + virtual void setLinearSolverType(const string& linSolverType) { warn("setLinearSolverType"); } @@ -149,7 +149,7 @@ public: } //! Return the integrator problem type - virtual std::string linearSolverType() const { + virtual string linearSolverType() const { warn("linearSolverType"); return ""; } @@ -324,7 +324,7 @@ protected: private: double m_dummy; - void warn(const std::string& msg) const { + void warn(const string& msg) const { writelog(">>>> Warning: method "+msg+" of base class " +"Integrator called. Nothing done.\n"); } @@ -335,7 +335,7 @@ private: //! Create new Integrator object //! @param itype Integration mode; either \c CVODE or \c IDA //! @ingroup odeGroup -Integrator* newIntegrator(const std::string& itype); +Integrator* newIntegrator(const string& itype); } // namespace diff --git a/include/cantera/numerics/PreconditionerBase.h b/include/cantera/numerics/PreconditionerBase.h index f34da32e9..b735f5833 100644 --- a/include/cantera/numerics/PreconditionerBase.h +++ b/include/cantera/numerics/PreconditionerBase.h @@ -51,11 +51,11 @@ public: } //! Get preconditioner application side for CVODES - std::string preconditionerSide() const { + string preconditionerSide() const { return m_precon_side; } - virtual void setPreconditionerSide(const std::string& preconSide) { + virtual void setPreconditionerSide(const string& preconSide) { m_precon_side = preconSide; } @@ -125,7 +125,7 @@ protected: //! Absolute tolerance of the ODE solver double m_atol = 0; - std::string m_precon_side = "none"; + string m_precon_side = "none"; }; } diff --git a/include/cantera/numerics/funcs.h b/include/cantera/numerics/funcs.h index 5618b8c68..c33a70ac7 100644 --- a/include/cantera/numerics/funcs.h +++ b/include/cantera/numerics/funcs.h @@ -76,7 +76,7 @@ double simpson(const Eigen::ArrayXd& f, const Eigen::ArrayXd& x); * @param x vector of function coordinate * @ingroup mathUtils */ -double numericalQuadrature(const std::string& method, +double numericalQuadrature(const string& method, const Eigen::ArrayXd& f, const Eigen::ArrayXd& x); } diff --git a/include/cantera/oneD/Boundary1D.h b/include/cantera/oneD/Boundary1D.h index 941f3062d..3ad617536 100644 --- a/include/cantera/oneD/Boundary1D.h +++ b/include/cantera/oneD/Boundary1D.h @@ -67,8 +67,8 @@ public: return 0; } - //! Set the mole fractions by specifying a std::string. - virtual void setMoleFractions(const std::string& xin) { + //! Set the mole fractions by specifying a string. + virtual void setMoleFractions(const string& xin) { throw NotImplementedError("Boundary1D::setMoleFractions"); } @@ -154,7 +154,7 @@ public: return m_nsp; } - virtual void setMoleFractions(const std::string& xin); + virtual void setMoleFractions(const string& xin); virtual void setMoleFractions(const double* xin); virtual double massFraction(size_t k) { return m_yin[k]; @@ -170,7 +170,7 @@ protected: double m_V0 = 0.0; size_t m_nsp = 0; vector m_yin; - std::string m_xstr; + string m_xstr; StFlow* m_flow = nullptr; }; @@ -184,7 +184,7 @@ public: m_type = cEmptyType; } - Empty1D(shared_ptr solution, const std::string& id="") : Empty1D() { + Empty1D(shared_ptr solution, const string& id="") : Empty1D() { m_solution = solution; m_id = id; } @@ -215,7 +215,7 @@ public: m_type = cSymmType; } - Symm1D(shared_ptr solution, const std::string& id="") : Symm1D() { + Symm1D(shared_ptr solution, const string& id="") : Symm1D() { m_solution = solution; m_id = id; } @@ -244,7 +244,7 @@ public: m_type = cOutletType; } - Outlet1D(shared_ptr solution, const std::string& id="") : Outlet1D() { + Outlet1D(shared_ptr solution, const string& id="") : Outlet1D() { m_solution = solution; m_id = id; } @@ -283,7 +283,7 @@ public: return m_nsp; } - virtual void setMoleFractions(const std::string& xin); + virtual void setMoleFractions(const string& xin); virtual void setMoleFractions(const double* xin); virtual double massFraction(size_t k) { return m_yres[k]; @@ -297,7 +297,7 @@ public: protected: size_t m_nsp = 0; vector m_yres; - std::string m_xstr; + string m_xstr; StFlow* m_flow = nullptr; }; @@ -313,7 +313,7 @@ public: m_type = cSurfType; } - Surf1D(shared_ptr solution, const std::string& id="") : Surf1D() { + Surf1D(shared_ptr solution, const string& id="") : Surf1D() { m_solution = solution; m_id = id; } @@ -342,7 +342,7 @@ class ReactingSurf1D : public Boundary1D { public: ReactingSurf1D(); - ReactingSurf1D(shared_ptr solution, const std::string& id=""); + ReactingSurf1D(shared_ptr solution, const string& id=""); virtual string type() const { return "reacting-surface"; @@ -361,7 +361,7 @@ public: return m_enabled; } - virtual std::string componentName(size_t n) const; + virtual string componentName(size_t n) const; virtual void init(); virtual void resetBadValues(double* xg); diff --git a/include/cantera/oneD/Domain1D.h b/include/cantera/oneD/Domain1D.h index 02228818c..7a8f57a35 100644 --- a/include/cantera/oneD/Domain1D.h +++ b/include/cantera/oneD/Domain1D.h @@ -201,14 +201,14 @@ public: } //! Name of the nth component. May be overloaded. - virtual std::string componentName(size_t n) const; + virtual string componentName(size_t n) const; - void setComponentName(size_t n, const std::string& name) { + void setComponentName(size_t n, const string& name) { m_name[n] = name; } //! index of component with name \a name. - virtual size_t componentIndex(const std::string& name) const; + virtual size_t componentIndex(const string& name) const; void setBounds(size_t n, double lower, double upper) { m_min[n] = lower; @@ -478,11 +478,11 @@ public: } //! Specify an identifying tag for this domain. - void setID(const std::string& s) { + void setID(const string& s) { m_id = s; } - std::string id() const { + string id() const { if (m_id != "") { return m_id; } else { @@ -513,7 +513,7 @@ public: return m_z[m_points - 1]; } - void setProfile(const std::string& name, double* values, double* soln); + void setProfile(const string& name, double* values, double* soln); vector& grid() { return m_z; @@ -600,9 +600,9 @@ protected: Domain1D* m_right = nullptr; //! Identity tag for the domain - std::string m_id; + string m_id; unique_ptr m_refiner; - vector m_name; + vector m_name; int m_bw = -1; bool m_force_full_update = false; diff --git a/include/cantera/oneD/IonFlow.h b/include/cantera/oneD/IonFlow.h index b68529440..159b4ae25 100644 --- a/include/cantera/oneD/IonFlow.h +++ b/include/cantera/oneD/IonFlow.h @@ -38,7 +38,7 @@ public: //! transport properties //! @param id name of flow domain //! @param points initial number of grid points - IonFlow(shared_ptr sol, const std::string& id="", size_t points = 1); + IonFlow(shared_ptr sol, const string& id="", size_t points = 1); virtual string type() const; diff --git a/include/cantera/oneD/OneDim.h b/include/cantera/oneD/OneDim.h index 01543c247..78f8fc020 100644 --- a/include/cantera/oneD/OneDim.h +++ b/include/cantera/oneD/OneDim.h @@ -70,7 +70,7 @@ public: return *m_dom[i]; } - size_t domainIndex(const std::string& name); + size_t domainIndex(const string& name); //! Check that the specified domain index is in range. //! Throws an exception if n is greater than nDomains()-1 @@ -130,7 +130,7 @@ public: //! Return the domain, local point index, and component name for the i-th //! component of the global solution vector - std::tuple component(size_t i); + std::tuple component(size_t i); //! Jacobian bandwidth. size_t bandwidth() const { diff --git a/include/cantera/oneD/Sim1D.h b/include/cantera/oneD/Sim1D.h index 493a9e421..28ed09231 100644 --- a/include/cantera/oneD/Sim1D.h +++ b/include/cantera/oneD/Sim1D.h @@ -54,7 +54,7 @@ public: * @param vals A vector of values corresponding to the relative position * locations. */ - void setInitialGuess(const std::string& component, vector& locs, + void setInitialGuess(const string& component, vector& locs, vector& vals); /** @@ -138,8 +138,8 @@ public: * @param loglevel Level of diagnostic output * @deprecated To be removed after %Cantera 3.0; loglevel is deprecated. */ - void save(const std::string& fname, const std::string& id, - const std::string& desc, int loglevel); + void save(const string& fname, const string& id, + const string& desc, int loglevel); /** * Save current simulation data to a container file or CSV format. @@ -168,8 +168,8 @@ public: * if not specified (default=""), the native basis of the underlying * ThermoPhase manager is used - @see nativeState (CSV only) */ - void save(const std::string& fname, const std::string& name, - const std::string& desc, bool overwrite=false, int compression=0, + void save(const string& fname, const string& name, + const string& desc, bool overwrite=false, int compression=0, const string& basis=""); /** @@ -180,8 +180,8 @@ public: * @param loglevel Level of diagnostic output * @deprecated To be removed after %Cantera 3.0; loglevel is deprecated. */ - void saveResidual(const std::string& fname, const std::string& id, - const std::string& desc, int loglevel); + void saveResidual(const string& fname, const string& id, + const string& desc, int loglevel); /** * Save the residual of the current solution to a container file. @@ -191,8 +191,8 @@ public: * @param overwrite Force overwrite if name exists; optional (default=false) * @param compression Compression level (optional; HDF only) */ - void saveResidual(const std::string& fname, const std::string& name, - const std::string& desc, bool overwrite=false, int compression=0); + void saveResidual(const string& fname, const string& name, + const string& desc, bool overwrite=false, int compression=0); /** * Initialize the solution with a previously-saved solution. @@ -202,7 +202,7 @@ public: * @deprecated To be removed after %Cantera 3.0; loglevel is deprecated. * @return AnyMap containing header information */ - AnyMap restore(const std::string& fname, const std::string& id, int loglevel); + AnyMap restore(const string& fname, const string& id, int loglevel); /** * Retrieve data and settings from a previously saved simulation. @@ -216,7 +216,7 @@ public: * data * @return AnyMap containing header information */ - AnyMap restore(const std::string& fname, const std::string& name); + AnyMap restore(const string& fname, const string& name); //! @} diff --git a/include/cantera/oneD/StFlow.h b/include/cantera/oneD/StFlow.h index bf971a4c7..7eddd07d9 100644 --- a/include/cantera/oneD/StFlow.h +++ b/include/cantera/oneD/StFlow.h @@ -63,7 +63,7 @@ public: //! transport properties //! @param id name of flow domain //! @param points initial number of grid points - StFlow(shared_ptr sol, const std::string& id="", size_t points=1); + StFlow(shared_ptr sol, const string& id="", size_t points=1); ~StFlow(); @@ -107,11 +107,11 @@ public: //! Set the transport model //! @since New in %Cantera 3.0. - void setTransportModel(const std::string& trans); + void setTransportModel(const string& trans); //! Retrieve transport model //! @since New in %Cantera 3.0. - std::string transportModel() const; + string transportModel() const; //! Enable thermal diffusion, also known as Soret diffusion. //! Requires that multicomponent transport properties be @@ -163,9 +163,9 @@ public: //! @} - virtual std::string componentName(size_t n) const; + virtual string componentName(size_t n) const; - virtual size_t componentIndex(const std::string& name) const; + virtual size_t componentIndex(const string& name) const; //! Returns true if the specified component is an active part of the solver state virtual bool componentActive(size_t n) const; diff --git a/include/cantera/thermo/BinarySolutionTabulatedThermo.h b/include/cantera/thermo/BinarySolutionTabulatedThermo.h index f8159747c..38f526156 100644 --- a/include/cantera/thermo/BinarySolutionTabulatedThermo.h +++ b/include/cantera/thermo/BinarySolutionTabulatedThermo.h @@ -171,9 +171,9 @@ public: * @param id The name of this phase. This is used to look up * the phase in the input file. */ - explicit BinarySolutionTabulatedThermo(const std::string& infile="", const std::string& id=""); + explicit BinarySolutionTabulatedThermo(const string& infile="", const string& id=""); - virtual std::string type() const { + virtual string type() const { return "binary-solution-tabulated"; } diff --git a/include/cantera/thermo/CoverageDependentSurfPhase.h b/include/cantera/thermo/CoverageDependentSurfPhase.h index 807f699da..b03ea9fc6 100644 --- a/include/cantera/thermo/CoverageDependentSurfPhase.h +++ b/include/cantera/thermo/CoverageDependentSurfPhase.h @@ -308,10 +308,10 @@ public: * @param id name of the phase id in the file. If blank, the first phase * in the file is used. */ - explicit CoverageDependentSurfPhase(const std::string& infile="", - const std::string& id=""); + explicit CoverageDependentSurfPhase(const string& infile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "coverage-dependent-surface"; } @@ -324,7 +324,7 @@ public: virtual void initThermo(); virtual bool addSpecies(shared_ptr spec); virtual void getParameters(AnyMap& phaseNode) const; - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; //! @name Methods calculating reference state thermodynamic properties diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index d15c5a05e..6b4d3b5a8 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -422,13 +422,13 @@ public: * If blank, an empty phase will be created. * @param id id attribute containing the name of the phase. */ - explicit DebyeHuckel(const std::string& inputFile="", - const std::string& id=""); + explicit DebyeHuckel(const string& inputFile="", + const string& id=""); //! @name Utilities //! @{ - virtual std::string type() const { + virtual string type() const { return "Debye-Huckel"; } @@ -623,7 +623,7 @@ public: virtual bool addSpecies(shared_ptr spec); virtual void initThermo(); virtual void getParameters(AnyMap& phaseNode) const; - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; //! Return the Debye Huckel constant as a function of temperature @@ -729,7 +729,7 @@ public: //! Set the DebyeHuckel parameterization form. Must be one of //! 'dilute-limit', 'B-dot-with-variable-a', 'B-dot-with-common-a', //! 'beta_ij', or 'Pitzer-with-beta_ij'. - void setDebyeHuckelModel(const std::string& form); + void setDebyeHuckelModel(const string& form); //! Returns the form of the Debye-Huckel parameterization used int formDH() const { @@ -749,7 +749,7 @@ public: void setDefaultIonicRadius(double value); //! Set the value for the beta interaction between species sp1 and sp2. - void setBeta(const std::string& sp1, const std::string& sp2, double value); + void setBeta(const string& sp1, const string& sp2, double value); //! Returns a reference to M_Beta_ij Array2D& get_Beta_ij() { diff --git a/include/cantera/thermo/EdgePhase.h b/include/cantera/thermo/EdgePhase.h index 691fc4229..ac922d621 100644 --- a/include/cantera/thermo/EdgePhase.h +++ b/include/cantera/thermo/EdgePhase.h @@ -36,9 +36,9 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - explicit EdgePhase(const std::string& infile="", const std::string& id=""); + explicit EdgePhase(const string& infile="", const string& id=""); - virtual std::string type() const { + virtual string type() const { return "edge"; } }; diff --git a/include/cantera/thermo/Elements.h b/include/cantera/thermo/Elements.h index f07122d35..dabe1d717 100644 --- a/include/cantera/thermo/Elements.h +++ b/include/cantera/thermo/Elements.h @@ -86,11 +86,11 @@ namespace Cantera //! Get a vector of the atomic symbols of the elements defined in Cantera. //! @since New in version 3.0 -const vector& elementSymbols(); +const vector& elementSymbols(); //! Get a vector of the names of the elements defined in Cantera. //! @since New in version 3.0 -const vector& elementNames(); +const vector& elementNames(); //! Get a map with the element and isotope symbols and names as keys and weights as //! values. @@ -100,7 +100,7 @@ const vector& elementNames(); * * @since New in version 3.0 */ -const map& elementWeights(); +const map& elementWeights(); //! Get the atomic weight of an element. /*! @@ -112,7 +112,7 @@ const map& elementWeights(); * @exception CanteraError if a match for ename is not found or the * element has no stable isotopes, and therefore no standard atomic weight */ -double getElementWeight(const std::string& ename); +double getElementWeight(const string& ename); //! Get the atomic weight of an element. /*! @@ -139,7 +139,7 @@ double getElementWeight(int atomicNumber); * @return The symbol of the element in a string * @exception CanteraError if a match for ename is not found */ -std::string getElementSymbol(const std::string& ename); +string getElementSymbol(const string& ename); //! Get the symbol for an element /*! @@ -153,7 +153,7 @@ std::string getElementSymbol(const std::string& ename); * @exception IndexError if the passed atomic number less than 1 or * larger than the number of elements defined */ -std::string getElementSymbol(int atomicNumber); +string getElementSymbol(int atomicNumber); //! Get the name of an element /*! @@ -164,7 +164,7 @@ std::string getElementSymbol(int atomicNumber); * @return The name of the element, in a string * @exception CanteraError if a match for ename is not found */ -std::string getElementName(const std::string& ename); +string getElementName(const string& ename); //! Get the name of an element /*! @@ -178,7 +178,7 @@ std::string getElementName(const std::string& ename); * @exception CanteraError IndexError if the passed atomic number less than 1 or * larger than the number of elements defined */ -std::string getElementName(int atomicNumber); +string getElementName(int atomicNumber); //! Get the atomic number for an element /*! @@ -189,7 +189,7 @@ std::string getElementName(int atomicNumber); * @return The integer atomic number of the element * @exception CanteraError if a match for ename is not found */ -int getAtomicNumber(const std::string& ename); +int getAtomicNumber(const string& ename); //! Get the number of named elements defined in Cantera. //! This array excludes named isotopes diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 2a8542e6e..3434c32e3 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -791,12 +791,12 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - explicit HMWSoln(const std::string& inputFile="", const std::string& id=""); + explicit HMWSoln(const string& inputFile="", const string& id=""); //! @name Utilities //! @{ - virtual std::string type() const { + virtual string type() const { return "HMW-electrolyte"; } @@ -1160,20 +1160,20 @@ public: * -------------- Utilities ------------------------------- */ - void setBinarySalt(const std::string& sp1, const std::string& sp2, + void setBinarySalt(const string& sp1, const string& sp2, size_t nParams, double* beta0, double* beta1, double* beta2, double* Cphi, double alpha1, double alpha2); - void setTheta(const std::string& sp1, const std::string& sp2, + void setTheta(const string& sp1, const string& sp2, size_t nParams, double* theta); - void setPsi(const std::string& sp1, const std::string& sp2, - const std::string& sp3, size_t nParams, double* psi); - void setLambda(const std::string& sp1, const std::string& sp2, + void setPsi(const string& sp1, const string& sp2, + const string& sp3, size_t nParams, double* psi); + void setLambda(const string& sp1, const string& sp2, size_t nParams, double* lambda); - void setMunnn(const std::string& sp, size_t nParams, double* munnn); - void setZeta(const std::string& sp1, const std::string& sp2, - const std::string& sp3, size_t nParams, double* psi); + void setMunnn(const string& sp, size_t nParams, double* munnn); + void setZeta(const string& sp1, const string& sp2, + const string& sp3, size_t nParams, double* psi); - void setPitzerTempModel(const std::string& model); + void setPitzerTempModel(const string& model); void setPitzerRefTemperature(double Tref) { m_TempPitzerRef = Tref; } diff --git a/include/cantera/thermo/IdealGasPhase.h b/include/cantera/thermo/IdealGasPhase.h index 06c2e5e1d..3daed0218 100644 --- a/include/cantera/thermo/IdealGasPhase.h +++ b/include/cantera/thermo/IdealGasPhase.h @@ -258,10 +258,10 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - explicit IdealGasPhase(const std::string& inputFile="", - const std::string& id=""); + explicit IdealGasPhase(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "ideal-gas"; } @@ -273,7 +273,7 @@ public: /*! * For the `IdealGasPhase`, this string is always `gas`. */ - virtual std::string phaseOfMatter() const { + virtual string phaseOfMatter() const { return "gas"; } diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 1c4b8991a..bfd6fb061 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -76,10 +76,10 @@ public: * about the phase. If blank, an empty phase will be created. * @param id id of the phase within the input file */ - explicit IdealMolalSoln(const std::string& inputFile="", - const std::string& id=""); + explicit IdealMolalSoln(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "ideal-molal-solution"; } @@ -387,10 +387,10 @@ public: * | species-molar-volume | @f$ m_k / (m^{\Delta} V_k) @f$ | @f$ 1.0 / V_k @f$ | * | solvent-molar-volume | @f$ m_k / (m^{\Delta} V^0_0) @f$ | @f$ 1.0 / V^0_0 @f$ | */ - void setStandardConcentrationModel(const std::string& model); + void setStandardConcentrationModel(const string& model); //! Set cutoff model. Must be one of 'none', 'poly', or 'polyExp'. - void setCutoffModel(const std::string& model); + void setCutoffModel(const string& model); //! Report the molar volume of species k /*! diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index 0b70efe20..3f2d3f563 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -53,10 +53,10 @@ public: * @param id The name of this phase. This is used to look up * the phase in the input file. */ - explicit IdealSolidSolnPhase(const std::string& infile="", - const std::string& id=""); + explicit IdealSolidSolnPhase(const string& infile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "ideal-condensed"; } @@ -526,7 +526,7 @@ public: virtual bool addSpecies(shared_ptr spec); virtual void initThermo(); virtual void getParameters(AnyMap& phaseNode) const; - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; virtual void setToEquilState(const double* mu_RT); @@ -544,7 +544,7 @@ public: * The value and form of the generalized concentration will affect * reaction rate constants involving species in this phase. */ - void setStandardConcentrationModel(const std::string& model); + void setStandardConcentrationModel(const string& model); /** * Report the molar volume of species k diff --git a/include/cantera/thermo/IdealSolnGasVPSS.h b/include/cantera/thermo/IdealSolnGasVPSS.h index 323dd52a4..d7d222f66 100644 --- a/include/cantera/thermo/IdealSolnGasVPSS.h +++ b/include/cantera/thermo/IdealSolnGasVPSS.h @@ -28,12 +28,12 @@ class IdealSolnGasVPSS : public VPStandardStateTP { public: //! Create an object from an input file - explicit IdealSolnGasVPSS(const std::string& infile="", std::string id=""); + explicit IdealSolnGasVPSS(const string& infile="", string id=""); //! @name Utilities (IdealSolnGasVPSS) //! @{ - virtual std::string type() const { + virtual string type() const { return "ideal-solution-VPSS"; } @@ -45,7 +45,7 @@ public: /** * Must be one of 'unity', 'species-molar-volume', or 'solvent-molar-volume'. */ - void setStandardConcentrationModel(const std::string& model); + void setStandardConcentrationModel(const string& model); //! @} //! @name Molar Thermodynamic Properties diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index c5606d327..db498d7dd 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -79,14 +79,14 @@ public: * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - explicit IonsFromNeutralVPSSTP(const std::string& inputFile="", - const std::string& id=""); + explicit IonsFromNeutralVPSSTP(const string& inputFile="", + const string& id=""); //! @} //! @name Utilities //! @{ - virtual std::string type() const { + virtual string type() const { return "IonsFromNeutral"; } diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index 8ece6b75a..d33919d84 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -189,10 +189,10 @@ public: * an empty phase will be created. * @param id string id of the phase name */ - explicit LatticePhase(const std::string& inputFile="", - const std::string& id=""); + explicit LatticePhase(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "lattice"; } @@ -200,7 +200,7 @@ public: return false; } - map nativeState() const { + map nativeState() const { return { {"T", 0}, {"P", 1}, {"X", 2} }; } @@ -554,7 +554,7 @@ public: virtual void initThermo(); virtual void getParameters(AnyMap& phaseNode) const; - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; //! @} diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index 25aec81ca..46acb1ac1 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -107,7 +107,7 @@ public: //! Base empty constructor LatticeSolidPhase() = default; - virtual std::string type() const { + virtual string type() const { return "compound-lattice"; } @@ -115,7 +115,7 @@ public: /*! * `LatticeSolid` phases only represent solids. */ - virtual std::string phaseOfMatter() const { + virtual string phaseOfMatter() const { return "solid"; } @@ -123,7 +123,7 @@ public: return false; } - map nativeState() const { + map nativeState() const { return { {"T", 0}, {"P", 1}, {"X", 2} }; } @@ -435,7 +435,7 @@ public: const AnyMap& rootNode=AnyMap()); virtual void initThermo(); virtual void getParameters(AnyMap& phaseNode) const; - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; //! Set the Lattice mole fractions using a string @@ -444,7 +444,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, const std::string& x); + void setLatticeMoleFractionsByName(int n, const string& x); virtual void modifyOneHf298SS(const size_t k, const double Hf298New); virtual void resetHf298(const size_t k=npos); diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index e1f839bc3..c0ba9fdd2 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -221,10 +221,10 @@ public: * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - explicit MargulesVPSSTP(const std::string& inputFile="", - const std::string& id=""); + explicit MargulesVPSSTP(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "Margules"; } @@ -352,8 +352,8 @@ public: * @param vs0 first entropy coefficient for excess volume [m^3/kmol/K] * @param vs1 second entropy coefficient for excess volume [m^3/kmol/K] */ - void addBinaryInteraction(const std::string& speciesA, - const std::string& speciesB, double h0, double h1, double s0, double s1, + void addBinaryInteraction(const string& speciesA, + const string& speciesB, double h0, double h1, double s0, double s1, double vh0, double vh1, double vs0, double vs1); //! @} diff --git a/include/cantera/thermo/MaskellSolidSolnPhase.h b/include/cantera/thermo/MaskellSolidSolnPhase.h index 094931608..8cc683e1e 100644 --- a/include/cantera/thermo/MaskellSolidSolnPhase.h +++ b/include/cantera/thermo/MaskellSolidSolnPhase.h @@ -32,7 +32,7 @@ class MaskellSolidSolnPhase : public VPStandardStateTP public: MaskellSolidSolnPhase(); - virtual std::string type() const { + virtual string type() const { return "MaskellSolidsoln"; } @@ -107,7 +107,7 @@ public: void set_h_mix(const double hmix) { h_mixing = hmix; } //! Set the product Species. Must be called after species have been added. - void setProductSpecies(const std::string& name); + void setProductSpecies(const string& name); //! @} private: diff --git a/include/cantera/thermo/MetalPhase.h b/include/cantera/thermo/MetalPhase.h index d01b16ac3..d8092734e 100644 --- a/include/cantera/thermo/MetalPhase.h +++ b/include/cantera/thermo/MetalPhase.h @@ -25,7 +25,7 @@ public: // Overloaded methods of class ThermoPhase - virtual std::string type() const { + virtual string type() const { return "electron-cloud"; } diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index f4d265e01..9687bea95 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -83,7 +83,7 @@ public: //! @name Utilities //! @{ - virtual std::string type() const { + virtual string type() const { return "MixtureFugacity"; } diff --git a/include/cantera/thermo/MolalityVPSSTP.h b/include/cantera/thermo/MolalityVPSSTP.h index 676265a66..ee9a038e2 100644 --- a/include/cantera/thermo/MolalityVPSSTP.h +++ b/include/cantera/thermo/MolalityVPSSTP.h @@ -243,7 +243,7 @@ public: /*! * All derived phases from `MolalityVPSSTP` always represent liquids. */ - virtual std::string phaseOfMatter() const { + virtual string phaseOfMatter() const { return "liquid"; } @@ -370,7 +370,7 @@ public: * * @param name String containing the information for a composition map. */ - void setMolalitiesByName(const std::string& name); + void setMolalitiesByName(const string& name); //! @} //! @name Activities, Standard States, and Activity Concentrations @@ -525,7 +525,7 @@ public: * @param m String which gets translated into a composition * map for the molalities of the solutes. */ - void setState_TPM(double t, double p, const std::string& m); + void setState_TPM(double t, double p, const string& m); //! @copydoc ThermoPhase::setState /*! @@ -537,11 +537,11 @@ public: getdlnActCoeffdlnN_numderiv(ld, dlnActCoeffdlnN); } - virtual std::string report(bool show_thermo=true, + virtual string report(bool show_thermo=true, double threshold=1e-14) const; protected: - virtual void getCsvReportData(vector& names, + virtual void getCsvReportData(vector& names, vector>& data) const; //! Get the array of unscaled non-dimensional molality based activity diff --git a/include/cantera/thermo/NasaPoly2.h b/include/cantera/thermo/NasaPoly2.h index 2ebd9097b..b7c9b9bb4 100644 --- a/include/cantera/thermo/NasaPoly2.h +++ b/include/cantera/thermo/NasaPoly2.h @@ -165,7 +165,7 @@ public: mnp_high.modifyOneHf298(k, hnew); } - void validate(const std::string& name); + void validate(const string& name); protected: //! Midrange temperature diff --git a/include/cantera/thermo/PDSSFactory.h b/include/cantera/thermo/PDSSFactory.h index 1103db548..324b5a150 100644 --- a/include/cantera/thermo/PDSSFactory.h +++ b/include/cantera/thermo/PDSSFactory.h @@ -29,7 +29,7 @@ public: * Returns NULL if something went wrong. Throws an exception if the string * wasn't matched. */ - virtual PDSS* newPDSS(const std::string& model); + virtual PDSS* newPDSS(const string& model); private: //! static member of a single instance @@ -42,7 +42,7 @@ private: static std::mutex thermo_mutex; }; -PDSS* newPDSS(const std::string& model); +PDSS* newPDSS(const string& model); } diff --git a/include/cantera/thermo/PDSS_HKFT.h b/include/cantera/thermo/PDSS_HKFT.h index 2630d4fc2..083bfc9a4 100644 --- a/include/cantera/thermo/PDSS_HKFT.h +++ b/include/cantera/thermo/PDSS_HKFT.h @@ -245,7 +245,7 @@ private: * @exception CanteraError * If a match is not found, a CanteraError is thrown as well */ - double LookupGe(const std::string& elemName); + double LookupGe(const string& elemName); //! Translate a Gibbs free energy of formation value to a NIST-based Chemical potential /*! diff --git a/include/cantera/thermo/PDSS_IonsFromNeutral.h b/include/cantera/thermo/PDSS_IonsFromNeutral.h index 35f30b5b0..9bdad5bff 100644 --- a/include/cantera/thermo/PDSS_IonsFromNeutral.h +++ b/include/cantera/thermo/PDSS_IonsFromNeutral.h @@ -89,7 +89,7 @@ public: void setParent(VPStandardStateTP* phase, size_t k); - void setNeutralSpeciesMultiplier(const std::string& species, double mult); + void setNeutralSpeciesMultiplier(const string& species, double mult); void setSpecialSpecies(bool special=true); virtual void getParameters(AnyMap& eosNode) const; virtual void initThermo(); @@ -99,7 +99,7 @@ protected: //! Pointer to the Neutral Molecule ThermoPhase object shared_ptr neutralMoleculePhase_; - map neutralSpeciesMultipliers_; + map neutralSpeciesMultipliers_; //! Number of neutral molecule species that make up the stoichiometric //! vector for this species, in terms of calculating thermodynamic functions diff --git a/include/cantera/thermo/PengRobinson.h b/include/cantera/thermo/PengRobinson.h index 4e7ab6f05..580d2ba59 100644 --- a/include/cantera/thermo/PengRobinson.h +++ b/include/cantera/thermo/PengRobinson.h @@ -28,10 +28,10 @@ public: * @param id ID of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - explicit PengRobinson(const std::string& infile="", - const std::string& id=""); + explicit PengRobinson(const string& infile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "Peng-Robinson"; } @@ -154,7 +154,7 @@ public: virtual bool addSpecies(shared_ptr spec); virtual void initThermo(); - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; //! Set the pure fluid interaction parameters for a species @@ -164,7 +164,7 @@ public: * @param b @f$ a @f$ parameter in the Peng-Robinson model [m^3/kmol] * @param w acentric factor */ - void setSpeciesCoeffs(const std::string& species, double a, double b, + void setSpeciesCoeffs(const string& species, double a, double b, double w); //! Set values for the interaction parameter between two species @@ -173,8 +173,8 @@ public: * @param species_j Name of the other species * @param a @f$ a @f$ parameter in the Peng-Robinson model [Pa-m^6/kmol^2] */ - void setBinaryCoeffs(const std::string& species_i, - const std::string& species_j, double a); + void setBinaryCoeffs(const string& species_i, + const string& species_j, double a); //! @} protected: @@ -273,7 +273,7 @@ protected: Array2D m_aAlpha_binary; //! Explicitly-specified binary interaction parameters, to enable serialization - map> m_binaryParameters; + map> m_binaryParameters; int m_NSolns = 0; diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index 55dc9b788..1e7072e7a 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -132,18 +132,18 @@ public: /*! * Names are unique within a %Cantera problem. */ - std::string name() const; + string name() const; //! Sets the string name for the phase. //! @param nm String name of the phase - void setName(const std::string& nm); + void setName(const string& nm); //! String indicating the thermodynamic model implemented. Usually //! corresponds to the name of the derived class, less any suffixes such as //! "Phase", TP", "VPSS", etc. //! @since Starting in %Cantera 3.0, the name returned by this method corresponds //! to the canonical name used in the YAML input format. - virtual std::string type() const { + virtual string type() const { return "Phase"; } @@ -154,16 +154,16 @@ public: //! Name of the element with index m. //! @param m Element index. - std::string elementName(size_t m) const; + string elementName(size_t m) const; //! Return the index of element named 'name'. The index is an integer //! 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(const std::string& name) const; + size_t elementIndex(const string& name) const; //! Return a read-only reference to the vector of element names. - const vector& elementNames() const; + const vector& elementNames() const; //! Atomic weight of element m. //! @param m Element index @@ -237,21 +237,21 @@ public: //! phaseName:speciesName //! @return The index of the species. If the name is not found, //! the value @ref npos is returned. - size_t speciesIndex(const std::string& name) const; + size_t speciesIndex(const string& name) const; //! Name of the species with index k //! @param k index of the species - std::string speciesName(size_t k) const; + string speciesName(size_t k) const; //! Returns the expanded species name of a species, including the phase name //! This is guaranteed to be unique within a %Cantera problem. //! @param k Species index within the phase //! @return The "phaseName:speciesName" string //! @deprecated Unused. To be removed after %Cantera 3.0 - std::string speciesSPName(int k) const; + string speciesSPName(int k) const; //! Return a const reference to the vector of species names - const vector& speciesNames() const; + const vector& speciesNames() const; //! Returns the number of species in the phase size_t nSpecies() const { @@ -290,7 +290,7 @@ public: //! 2, respectively. Mass fractions "Y" are omitted for pure species. //! In all cases, offsets into the state vector are used by saveState() //! and restoreState(). - virtual map nativeState() const; + virtual map nativeState() const; //! Return string acronym representing the native state of a Phase. //! Examples: "TP", "TDY", "TPY". @@ -315,13 +315,13 @@ public: //! "H": specific enthalpy //! "S": specific entropy //! "Q": vapor fraction - virtual vector fullStates() const; + virtual vector fullStates() const; //! Return a vector of settable partial property sets within a phase. //! Partial states encompass all valid combinations of properties that allow //! for the specification of a state while ignoring species concentrations //! (such as "TD", "TP", "SV"). - virtual vector partialStates() const; + virtual vector partialStates() const; //! Return size of vector defining internal state of the phase. //! Used by saveState() and restoreState(). @@ -364,7 +364,7 @@ public: //! Set the mole fractions of a group of species by name. Species which //! are not listed by name in the composition map are set to zero. //! @param x string x in the form of a composition map - void setMoleFractionsByName(const std::string& x); + void setMoleFractionsByName(const string& x); //! Set the species mass fractions by name. //! Species not listed by name in \c yMap are set to zero. @@ -374,7 +374,7 @@ public: //! Set the species mass fractions by name. //! Species not listed by name in \c x are set to zero. //! @param x String containing a composition map - void setMassFractionsByName(const std::string& x); + void setMassFractionsByName(const string& x); //! Set the internally stored temperature (K), density, and mole fractions. //! @param t Temperature in kelvin @@ -501,7 +501,7 @@ public: //! Return the mole fraction of a single species //! @param name String name of the species //! @return Mole fraction of the species - double moleFraction(const std::string& name) const; + double moleFraction(const string& name) const; //! Get the mass fractions by name. //! @param threshold Exclude species with mass fractions less than or @@ -517,7 +517,7 @@ public: //! Return the mass fraction of a single species //! @param name String name of the species //! @return Mass Fraction of the species - double massFraction(const std::string& name) const; + double massFraction(const string& name) const; //! Get the species mole fraction vector. //! @param x On return, x contains the mole fractions. Must have a @@ -789,7 +789,7 @@ public: //! @{ //! Add an element. - //! @param symbol Atomic symbol std::string. + //! @param symbol Atomic symbol string. //! @param weight Atomic mass in amu. //! @param atomicNumber Atomic number of the element (unitless) //! @param entropy298 Entropy of the element at 298 K and 1 bar in its @@ -799,7 +799,7 @@ public: //! @param elem_type Specifies the type of the element constraint //! equation. This defaults to CT_ELEM_TYPE_ABSPOS, that is, an element. //! @return index of the element added - size_t addElement(const std::string& symbol, double weight=-12345.0, + size_t addElement(const string& symbol, double weight=-12345.0, int atomicNumber=0, double entropy298=ENTROPY298_UNKNOWN, int elem_type=CT_ELEM_TYPE_ABSPOS); @@ -828,7 +828,7 @@ public: //! Aliases are case-sensitive. //! @param name original species name //! @param alias alternate name - void addSpeciesAlias(const std::string& name, const std::string& alias); + void addSpeciesAlias(const string& name, const string& alias); //! Return a vector with isomers names matching a given composition map //! @param compMap Composition of the species. @@ -838,12 +838,12 @@ public: //! Return a vector with isomers names matching a given composition string //! @param comp String containing a composition map //! @return A vector of species names for matching species. - virtual vector findIsomers(const std::string& comp) const; + virtual vector findIsomers(const string& comp) const; //! Return the Species object for the named species. Changes to this object //! do not affect the ThermoPhase object until the #modifySpecies function //! is called. - shared_ptr species(const std::string& name) const; + shared_ptr species(const string& name) const; //! Return the Species object for species whose index is *k*. Changes to //! this object do not affect the ThermoPhase object until the @@ -916,7 +916,7 @@ protected: //! Ensure that phase is compressible. //! An error is raised if the state is incompressible //! @param setter name of setter (used for exception handling) - void assertCompressible(const std::string& setter) const { + void assertCompressible(const string& setter) const { if (!isCompressible()) { throw CanteraError("Phase::assertCompressible", "Setter '{}' is not available. Density is not an " @@ -969,7 +969,7 @@ protected: vector m_speciesCharge; //!< Vector of species charges. length m_kk. - map > m_species; + map > m_species; //! Flag determining behavior when adding species with an undefined element UndefElement::behavior m_undefinedElementBehavior = UndefElement::add; @@ -981,12 +981,12 @@ private: //! Find lowercase species name in m_speciesIndices when case sensitive //! species names are not enforced and a user specifies a non-canonical //! species name. Raise exception if lowercase name is not unique. - size_t findSpeciesLower(const std::string& nameStr) const; + size_t findSpeciesLower(const string& nameStr) const; //! Name of the phase. //! Initially, this is the name specified in the YAML input file. It may be changed //! to another value during the course of a calculation. - std::string m_name; + string m_name; double m_temp = 0.001; //!< Temperature (K). This is an independent variable @@ -1018,18 +1018,18 @@ private: int m_stateNum = -1; //! Vector of the species names - vector m_speciesNames; + vector m_speciesNames; //! Map of species names to indices - map m_speciesIndices; + map m_speciesIndices; //! Map of lower-case species names to indices - map m_speciesLower; + map m_speciesLower; size_t m_mm = 0; //!< Number of elements. vector m_atomicWeights; //!< element atomic weights (kg kmol-1) vector m_atomicNumbers; //!< element atomic numbers - vector m_elementNames; //!< element names + vector m_elementNames; //!< element names vector m_elem_type; //!< Vector of element types //! Entropy at 298.15 K and 1 bar of stable state pure elements (J kmol-1) diff --git a/include/cantera/thermo/PlasmaPhase.h b/include/cantera/thermo/PlasmaPhase.h index 6903a3b11..f73179e54 100644 --- a/include/cantera/thermo/PlasmaPhase.h +++ b/include/cantera/thermo/PlasmaPhase.h @@ -69,10 +69,10 @@ public: * @param id ID of the phase in the input file. Defaults to the * empty string. */ - explicit PlasmaPhase(const std::string& inputFile="", - const std::string& id=""); + explicit PlasmaPhase(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "plasma"; } @@ -127,21 +127,21 @@ public: void setMeanElectronEnergy(double energy); //! Get electron energy distribution type - std::string electronEnergyDistributionType() const { + string electronEnergyDistributionType() const { return m_distributionType; } //! Set electron energy distribution type - void setElectronEnergyDistributionType(const std::string& type); + void setElectronEnergyDistributionType(const string& type); //! Numerical quadrature method. Method: #m_quadratureMethod - std::string quadratureMethod() const { + string quadratureMethod() const { return m_quadratureMethod; } //! Set numerical quadrature method for intergating electron //! energy distribution function. Method: #m_quadratureMethod - void setQuadratureMethod(const std::string& method) { + void setQuadratureMethod(const string& method) { m_quadratureMethod = method; } diff --git a/include/cantera/thermo/PureFluidPhase.h b/include/cantera/thermo/PureFluidPhase.h index e827c45a0..47e9f4d1c 100644 --- a/include/cantera/thermo/PureFluidPhase.h +++ b/include/cantera/thermo/PureFluidPhase.h @@ -33,7 +33,7 @@ public: //! Empty Base Constructor PureFluidPhase() = default; - virtual std::string type() const { + virtual string type() const { return "pure-fluid"; } @@ -52,11 +52,11 @@ public: * at the current pressure, the mechanical phase is `gas`. Otherwise, the mechanical * phase is `liquid`. */ - virtual std::string phaseOfMatter() const; + virtual string phaseOfMatter() const; //! Set the name of the TPX substance to use for the equation of state. This //! function should be called before initThermo(). - void setSubstance(const std::string& name) { + void setSubstance(const string& name) { m_tpx_name = name; } @@ -68,8 +68,8 @@ public: return true; } - virtual vector fullStates() const; - virtual vector partialStates() const; + virtual vector fullStates() const; + virtual vector partialStates() const; virtual double minTemp(size_t k=npos) const; virtual double maxTemp(size_t k=npos) const; @@ -186,7 +186,7 @@ public: virtual void initThermo(); virtual void getParameters(AnyMap& phaseNode) const; - virtual std::string report(bool show_thermo=true, + virtual string report(bool show_thermo=true, double threshold=1e-14) const; virtual bool compatibleWithMultiPhase() const { @@ -207,7 +207,7 @@ private: mutable unique_ptr m_sub; //! Name for this substance used by the TPX package - std::string m_tpx_name; + string m_tpx_name; //! Molecular weight of the substance (kg kmol-1) double m_mw = -1.0; diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index 39c63b4e6..2f3387123 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -239,10 +239,10 @@ public: * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - explicit RedlichKisterVPSSTP(const std::string& inputFile="", - const std::string& id=""); + explicit RedlichKisterVPSSTP(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "Redlich-Kister"; } @@ -358,7 +358,7 @@ public: * @param excess_entropy coefficients of the excess entropy polynomial * @param n_entropy number of excess entropy polynomial coefficients */ - void addBinaryInteraction(const std::string& speciesA, const std::string& speciesB, + void addBinaryInteraction(const string& speciesA, const string& speciesB, const double* excess_enthalpy, size_t n_enthalpy, const double* excess_entropy, size_t n_entropy); diff --git a/include/cantera/thermo/RedlichKwongMFTP.h b/include/cantera/thermo/RedlichKwongMFTP.h index 1c361e234..a1a263dd0 100644 --- a/include/cantera/thermo/RedlichKwongMFTP.h +++ b/include/cantera/thermo/RedlichKwongMFTP.h @@ -26,10 +26,10 @@ public: * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - explicit RedlichKwongMFTP(const std::string& infile="", - const std::string& id=""); + explicit RedlichKwongMFTP(const string& infile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "Redlich-Kwong"; } @@ -123,7 +123,7 @@ public: virtual bool addSpecies(shared_ptr spec); virtual void initThermo(); - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; //! Set the pure fluid interaction parameters for a species @@ -139,7 +139,7 @@ public: * "a" parameter of the specified species [Pa-m^6/kmol^2/K] * @param b "b" parameter in the Redlich-Kwong model [m^3/kmol] */ - void setSpeciesCoeffs(const std::string& species, double a0, double a1, + void setSpeciesCoeffs(const string& species, double a0, double a1, double b); //! Set values for the interaction parameter between two species @@ -157,8 +157,8 @@ public: * @param a1 temperature-proportional term in the "a" expression * [Pa-m^6/kmol^2/K] */ - void setBinaryCoeffs(const std::string& species_i, - const std::string& species_j, double a0, double a1); + void setBinaryCoeffs(const string& species_i, + const string& species_j, double a0, double a1); //! @} protected: @@ -238,7 +238,7 @@ protected: Array2D a_coeff_vec; //! Explicitly-specified binary interaction parameters - map>> m_binaryParameters; + map>> m_binaryParameters; enum class CoeffSource { EoS, CritProps, Database }; //! For each species, specifies the source of the a and b coefficients diff --git a/include/cantera/thermo/SingleSpeciesTP.h b/include/cantera/thermo/SingleSpeciesTP.h index 31c165d1a..2914faa8b 100644 --- a/include/cantera/thermo/SingleSpeciesTP.h +++ b/include/cantera/thermo/SingleSpeciesTP.h @@ -59,7 +59,7 @@ public: //! Base empty constructor. SingleSpeciesTP() = default; - virtual std::string type() const { + virtual string type() const { return "SingleSpecies"; } diff --git a/include/cantera/thermo/Species.h b/include/cantera/thermo/Species.h index 66c222187..e77b0e5e7 100644 --- a/include/cantera/thermo/Species.h +++ b/include/cantera/thermo/Species.h @@ -38,7 +38,7 @@ public: AnyMap parameters(const ThermoPhase* phase=0, bool withInput=true) const; //! The name of the species - std::string name; + string name; //! The elemental composition of the species. Keys are element names; values //! are the corresponding atomicities. diff --git a/include/cantera/thermo/SpeciesThermoFactory.h b/include/cantera/thermo/SpeciesThermoFactory.h index 06826fbe3..5206b2802 100644 --- a/include/cantera/thermo/SpeciesThermoFactory.h +++ b/include/cantera/thermo/SpeciesThermoFactory.h @@ -39,7 +39,7 @@ SpeciesThermoInterpType* newSpeciesThermoInterpType(int type, double tlow, * @param coeffs The array of coefficients for the parameterization * @returns the pointer to the newly allocated SpeciesThermoInterpType object */ -SpeciesThermoInterpType* newSpeciesThermoInterpType(const std::string& type, +SpeciesThermoInterpType* newSpeciesThermoInterpType(const string& type, double tlow, double thigh, double pref, const double* coeffs); //! Create a new SpeciesThermoInterpType object using the specified parameters diff --git a/include/cantera/thermo/SpeciesThermoInterpType.h b/include/cantera/thermo/SpeciesThermoInterpType.h index df0393176..1fc3eda72 100644 --- a/include/cantera/thermo/SpeciesThermoInterpType.h +++ b/include/cantera/thermo/SpeciesThermoInterpType.h @@ -156,7 +156,7 @@ public: //! Check for problems with the parameterization, and generate warnings or //! throw and exception if any are found. - virtual void validate(const std::string& name) {} + virtual void validate(const string& name) {} //! Returns an integer representing the type of parameterization virtual int reportType() const { return 0; }; diff --git a/include/cantera/thermo/StoichSubstance.h b/include/cantera/thermo/StoichSubstance.h index 39feab4ee..6ada1734c 100644 --- a/include/cantera/thermo/StoichSubstance.h +++ b/include/cantera/thermo/StoichSubstance.h @@ -96,10 +96,10 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - explicit StoichSubstance(const std::string& infile="", - const std::string& id=""); + explicit StoichSubstance(const string& infile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "fixed-stoichiometry"; } @@ -225,7 +225,7 @@ public: //! @} virtual void initThermo(); - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; }; diff --git a/include/cantera/thermo/SurfPhase.h b/include/cantera/thermo/SurfPhase.h index 8d4664564..3ba5b0f86 100644 --- a/include/cantera/thermo/SurfPhase.h +++ b/include/cantera/thermo/SurfPhase.h @@ -104,9 +104,9 @@ public: * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - explicit SurfPhase(const std::string& infile="", const std::string& id=""); + explicit SurfPhase(const string& infile="", const string& id=""); - virtual std::string type() const { + virtual string type() const { return "ideal-surface"; } @@ -289,7 +289,7 @@ public: /*! * @param cov String containing colon-separated name:value pairs */ - void setCoveragesByName(const std::string& cov); + void setCoveragesByName(const string& cov); //! Set the coverages from a map of name:value pairs void setCoveragesByName(const Composition& cov); diff --git a/include/cantera/thermo/ThermoFactory.h b/include/cantera/thermo/ThermoFactory.h index a88ae0d3b..4553c0631 100644 --- a/include/cantera/thermo/ThermoFactory.h +++ b/include/cantera/thermo/ThermoFactory.h @@ -46,7 +46,7 @@ public: * CanteraError if the named model isn't registered with ThermoFactory. * @deprecated To be removed after %Cantera 3.0; superseded by newThermo() */ - virtual ThermoPhase* newThermoPhase(const std::string& model); + virtual ThermoPhase* newThermoPhase(const string& model); private: //! static member of a single instance @@ -106,7 +106,7 @@ unique_ptr newPhase(const AnyMap& phaseNode, //! @copydoc newThermo(const string&, const string&) //! @deprecated To be removed after %Cantera 3.0; superseded by newThermo() -ThermoPhase* newPhase(const std::string& infile, std::string id=""); +ThermoPhase* newPhase(const string& infile, string id=""); //! Initialize a ThermoPhase object /*! diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 7aa7e0465..e5b96ff61 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -107,7 +107,7 @@ public: //! @name Information Methods //! @{ - virtual std::string type() const { + virtual string type() const { return "none"; } @@ -136,7 +136,7 @@ public: * @todo Needs to be implemented for all phase types. Currently only implemented for * PureFluidPhase. */ - virtual std::string phaseOfMatter() const { + virtual string phaseOfMatter() const { return "unspecified"; } @@ -829,7 +829,7 @@ public: * Species not in the composition map are assumed to have zero * mole fraction */ - virtual void setState_TPX(double t, double p, const std::string& x); + virtual void setState_TPX(double t, double p, const string& x); //! Set the internally stored temperature (K), pressure (Pa), and mass //! fractions of the phase. @@ -869,7 +869,7 @@ public: * Species not in the composition map are assumed to have zero * mass fraction */ - virtual void setState_TPY(double t, double p, const std::string& y); + virtual void setState_TPY(double t, double p, const string& y); //! Set the temperature (K) and pressure (Pa) /*! @@ -1146,7 +1146,7 @@ public: * @deprecated To be removed after %Cantera 3.0; replaceable by calls to * setMoleFractionsByName() and setState_DP(). */ - virtual void setState_RPX(double rho, double p, const std::string& x); + virtual void setState_RPX(double rho, double p, const string& x); //! Set the density (kg/m**3), pressure (Pa) and mass fractions /*! @@ -1192,7 +1192,7 @@ public: * @deprecated To be removed after %Cantera 3.0; replaceable by calls to * setMassFractionsByName() and setState_DP(). */ - virtual void setState_RPY(double rho, double p, const std::string& y); + virtual void setState_RPY(double rho, double p, const string& y); //! Set the state using an AnyMap containing any combination of properties //! supported by the thermodynamic model @@ -1241,8 +1241,8 @@ public: void setMixtureFraction(double mixFrac, const double* fuelComp, const double* oxComp, ThermoBasis basis=ThermoBasis::molar); //! @copydoc ThermoPhase::setMixtureFraction - void setMixtureFraction(double mixFrac, const std::string& fuelComp, - const std::string& oxComp, ThermoBasis basis=ThermoBasis::molar); + void setMixtureFraction(double mixFrac, const string& fuelComp, + const string& oxComp, ThermoBasis basis=ThermoBasis::molar); //! @copydoc ThermoPhase::setMixtureFraction void setMixtureFraction(double mixFrac, const Composition& fuelComp, const Composition& oxComp, ThermoBasis basis=ThermoBasis::molar); @@ -1284,15 +1284,15 @@ public: */ double mixtureFraction(const double* fuelComp, const double* oxComp, ThermoBasis basis=ThermoBasis::molar, - const std::string& element="Bilger") const; + const string& element="Bilger") const; //! @copydoc ThermoPhase::mixtureFraction - double mixtureFraction(const std::string& fuelComp, const std::string& oxComp, + double mixtureFraction(const string& fuelComp, const string& oxComp, ThermoBasis basis=ThermoBasis::molar, - const std::string& element="Bilger") const; + const string& element="Bilger") const; //! @copydoc ThermoPhase::mixtureFraction double mixtureFraction(const Composition& fuelComp, const Composition& oxComp, ThermoBasis basis=ThermoBasis::molar, - const std::string& element="Bilger") const; + const string& element="Bilger") const; //! @} //! @name Set Mixture Composition by Equivalence Ratio //! @{ @@ -1314,8 +1314,8 @@ public: void setEquivalenceRatio(double phi, const double* fuelComp, const double* oxComp, ThermoBasis basis=ThermoBasis::molar); //! @copydoc ThermoPhase::setEquivalenceRatio - void setEquivalenceRatio(double phi, const std::string& fuelComp, - const std::string& oxComp, ThermoBasis basis=ThermoBasis::molar); + void setEquivalenceRatio(double phi, const string& fuelComp, + const string& oxComp, ThermoBasis basis=ThermoBasis::molar); //! @copydoc ThermoPhase::setEquivalenceRatio void setEquivalenceRatio(double phi, const Composition& fuelComp, const Composition& oxComp, ThermoBasis basis=ThermoBasis::molar); @@ -1351,7 +1351,7 @@ public: double equivalenceRatio(const double* fuelComp, const double* oxComp, ThermoBasis basis=ThermoBasis::molar) const; //! @copydoc ThermoPhase::equivalenceRatio - double equivalenceRatio(const std::string& fuelComp, const std::string& oxComp, + double equivalenceRatio(const string& fuelComp, const string& oxComp, ThermoBasis basis=ThermoBasis::molar) const; //! @copydoc ThermoPhase::equivalenceRatio double equivalenceRatio(const Composition& fuelComp, @@ -1406,7 +1406,7 @@ public: double stoichAirFuelRatio(const double* fuelComp, const double* oxComp, ThermoBasis basis=ThermoBasis::molar) const; //! @copydoc ThermoPhase::stoichAirFuelRatio - double stoichAirFuelRatio(const std::string& fuelComp, const std::string& oxComp, + double stoichAirFuelRatio(const string& fuelComp, const string& oxComp, ThermoBasis basis=ThermoBasis::molar) const; //! @copydoc ThermoPhase::stoichAirFuelRatio double stoichAirFuelRatio(const Composition& fuelComp, @@ -1495,7 +1495,7 @@ public: * * @ingroup equilGroup */ - void equilibrate(const std::string& XY, const std::string& solver="auto", + void equilibrate(const string& XY, const string& solver="auto", double rtol=1e-9, int max_steps=50000, int max_iter=100, int estimate_equil=0, int log_level=0); @@ -1651,7 +1651,7 @@ public: * @param id Optional parameter identifying the name of the phase. If * blank, the first phase definition encountered will be used. */ - void initThermoFile(const std::string& inputFile, const std::string& id); + void initThermoFile(const string& inputFile, const string& id); //! Initialize the ThermoPhase object after all species have been set up /*! @@ -1688,7 +1688,7 @@ public: * @param name Name of the species * @param speciesNode Mapping to be populated with parameters */ - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const {} //! Access input data associated with the phase description @@ -1804,7 +1804,7 @@ public: * @param threshold Show information about species with mole fractions * greater than *threshold*. */ - virtual std::string report(bool show_thermo=true, + virtual string report(bool show_thermo=true, double threshold=-1e-14) const; //! returns a summary of the state of the phase to a comma separated file. @@ -1828,7 +1828,7 @@ protected: //! Fills `names` and `data` with the column names and species thermo //! properties to be included in the output of the reportCSV method. //! @deprecated To be removed after %Cantera 3.0. - virtual void getCsvReportData(vector& names, + virtual void getCsvReportData(vector& names, vector>& data) const; //! Pointer to the calculation manager for species reference-state diff --git a/include/cantera/thermo/VPStandardStateTP.h b/include/cantera/thermo/VPStandardStateTP.h index 6c135d3da..9aaadcbb4 100644 --- a/include/cantera/thermo/VPStandardStateTP.h +++ b/include/cantera/thermo/VPStandardStateTP.h @@ -238,7 +238,7 @@ public: //! @{ virtual void initThermo(); - virtual void getSpeciesParameters(const std::string& name, + virtual void getSpeciesParameters(const string& name, AnyMap& speciesNode) const; using Phase::addSpecies; diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index 79196bf23..c196fd984 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -73,14 +73,14 @@ public: * @param inputFile String name of the input file * @param id string id of the phase name */ - explicit WaterSSTP(const std::string& inputFile="", - const std::string& id=""); + explicit WaterSSTP(const string& inputFile="", + const string& id=""); - virtual std::string type() const { + virtual string type() const { return "liquid-water-IAPWS95"; } - virtual std::string phaseOfMatter() const; + virtual string phaseOfMatter() const; //! @name Molar Thermodynamic Properties of the Solution //! @{ diff --git a/include/cantera/transport/DustyGasTransport.h b/include/cantera/transport/DustyGasTransport.h index 6bc06ec75..dc6df117b 100644 --- a/include/cantera/transport/DustyGasTransport.h +++ b/include/cantera/transport/DustyGasTransport.h @@ -63,7 +63,7 @@ public: virtual void setThermo(ThermoPhase& thermo); - virtual std::string transportModel() const { + virtual string transportModel() const { return "DustyGas"; } diff --git a/include/cantera/transport/HighPressureGasTransport.h b/include/cantera/transport/HighPressureGasTransport.h index fb9e75848..e82e630f7 100644 --- a/include/cantera/transport/HighPressureGasTransport.h +++ b/include/cantera/transport/HighPressureGasTransport.h @@ -45,7 +45,7 @@ protected: HighPressureGasTransport(ThermoPhase* thermo=0); public: - virtual std::string transportModel() const { + virtual string transportModel() const { return "HighPressureGas"; } diff --git a/include/cantera/transport/IonGasTransport.h b/include/cantera/transport/IonGasTransport.h index 75cada5bd..733ee86b2 100644 --- a/include/cantera/transport/IonGasTransport.h +++ b/include/cantera/transport/IonGasTransport.h @@ -36,7 +36,7 @@ class IonGasTransport : public MixTransport public: IonGasTransport() = default; - virtual std::string transportModel() const { + virtual string transportModel() const { return "ionized-gas"; } diff --git a/include/cantera/transport/MixTransport.h b/include/cantera/transport/MixTransport.h index 035af54f4..24baf935d 100644 --- a/include/cantera/transport/MixTransport.h +++ b/include/cantera/transport/MixTransport.h @@ -57,7 +57,7 @@ public: //! Default constructor. MixTransport() = default; - virtual std::string transportModel() const { + virtual string transportModel() const { return (m_mode == CK_Mode) ? "mixture-averaged-CK" : "mixture-averaged"; } diff --git a/include/cantera/transport/MultiTransport.h b/include/cantera/transport/MultiTransport.h index 70bf556d3..7250a5123 100644 --- a/include/cantera/transport/MultiTransport.h +++ b/include/cantera/transport/MultiTransport.h @@ -31,7 +31,7 @@ public: */ MultiTransport(ThermoPhase* thermo=0); - virtual std::string transportModel() const { + virtual string transportModel() const { return (m_mode == CK_Mode) ? "multicomponent-CK" : "multicomponent"; } diff --git a/include/cantera/transport/Transport.h b/include/cantera/transport/Transport.h index 3198cb339..c2adfaead 100644 --- a/include/cantera/transport/Transport.h +++ b/include/cantera/transport/Transport.h @@ -171,14 +171,14 @@ public: //! should override this method to return a meaningful identifier. //! @since New in %Cantera 3.0. The name returned by this method corresponds //! to the canonical name used in the YAML input format. - virtual std::string transportModel() const { + virtual string transportModel() const { return "none"; } //! Identifies the Transport object type. Each derived class should override //! this method to return a meaningful identifier. //! @deprecated To be removed after %Cantera 3.0. Replaced by transportModel - std::string transportType() const { + string transportType() const { warn_deprecated("Transport::transportType", "To be removed after Cantera 3.0. Replaced by transportModel()."); return transportModel(); diff --git a/include/cantera/transport/TransportData.h b/include/cantera/transport/TransportData.h index d0db629b0..451c40b70 100644 --- a/include/cantera/transport/TransportData.h +++ b/include/cantera/transport/TransportData.h @@ -48,7 +48,7 @@ public: GasTransportData() = default; //! Construct a GasTransportData object using MKS units for all parameters. - GasTransportData(const std::string& geometry, double diameter, + GasTransportData(const string& geometry, double diameter, double well_depth, double dipole=0.0, double polarizability=0.0, double rot_relax=0.0, double acentric=0.0, double dispersion=0.0, @@ -57,7 +57,7 @@ public: //! Set the parameters using "customary" units: diameter in Angstroms, well //! depth in Kelvin, dipole in Debye, and polarizability in Angstroms^3. //! These are the units used in in CK-style input files. - void setCustomaryUnits(const std::string& geometry, double diameter, + void setCustomaryUnits(const string& geometry, double diameter, double well_depth, double dipole=0.0, double polarizability=0.0, double rot_relax=0.0, double acentric=0.0, double dispersion=0.0, @@ -73,7 +73,7 @@ public: //! A string specifying the molecular geometry. One of `atom`, `linear`, or //! `nonlinear`. - std::string geometry; + string geometry; //! The Lennard-Jones collision diameter [m] double diameter = 0.0; diff --git a/include/cantera/transport/TransportFactory.h b/include/cantera/transport/TransportFactory.h index 8896e00a5..39b3e9527 100644 --- a/include/cantera/transport/TransportFactory.h +++ b/include/cantera/transport/TransportFactory.h @@ -55,7 +55,7 @@ public: * @param thermo ThermoPhase object * @param log_level log level */ - virtual Transport* newTransport(const std::string& model, ThermoPhase* thermo, int log_level=0); + virtual Transport* newTransport(const string& model, ThermoPhase* 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 @@ -83,12 +83,12 @@ private: TransportFactory(); //! Models included in this map are initialized in CK compatibility mode - map m_CK_mode; + map m_CK_mode; }; -//! @copydoc TransportFactory::newTransport(const std::string&, ThermoPhase*, int) +//! @copydoc TransportFactory::newTransport(const string&, ThermoPhase*, int) //! @deprecated To be removed after %Cantera 3.0; superseded by newTransport() -Transport* newTransportMgr(const std::string& model="", ThermoPhase* thermo=0, +Transport* newTransportMgr(const string& model="", ThermoPhase* thermo=0, int log_level=0); //! Create a new Transport instance. diff --git a/include/cantera/transport/UnityLewisTransport.h b/include/cantera/transport/UnityLewisTransport.h index 7bf500d6e..31620d5ac 100644 --- a/include/cantera/transport/UnityLewisTransport.h +++ b/include/cantera/transport/UnityLewisTransport.h @@ -27,7 +27,7 @@ class UnityLewisTransport : public MixTransport public: UnityLewisTransport() = default; - virtual std::string transportModel() const { + virtual string transportModel() const { return "unity-Lewis-number"; } diff --git a/include/cantera/transport/WaterTransport.h b/include/cantera/transport/WaterTransport.h index 5681b8f0e..c3e59e787 100644 --- a/include/cantera/transport/WaterTransport.h +++ b/include/cantera/transport/WaterTransport.h @@ -31,7 +31,7 @@ public: */ WaterTransport(ThermoPhase* thermo = 0, int ndim = -1); - virtual std::string transportModel() const { + virtual string transportModel() const { return "Water"; } diff --git a/include/cantera/zeroD/ConstPressureMoleReactor.h b/include/cantera/zeroD/ConstPressureMoleReactor.h index a34197a7e..f8b611e83 100644 --- a/include/cantera/zeroD/ConstPressureMoleReactor.h +++ b/include/cantera/zeroD/ConstPressureMoleReactor.h @@ -22,13 +22,13 @@ class ConstPressureMoleReactor : public MoleReactor public: ConstPressureMoleReactor() {} - virtual std::string type() const { + virtual string type() const { return "ConstPressureMoleReactor"; }; - virtual size_t componentIndex(const std::string& nm) const; + virtual size_t componentIndex(const string& nm) const; - virtual std::string componentName(size_t k); + virtual string componentName(size_t k); virtual void getState(double* y); diff --git a/include/cantera/zeroD/ConstPressureReactor.h b/include/cantera/zeroD/ConstPressureReactor.h index 4060c23e7..c1201bba2 100644 --- a/include/cantera/zeroD/ConstPressureReactor.h +++ b/include/cantera/zeroD/ConstPressureReactor.h @@ -25,7 +25,7 @@ class ConstPressureReactor : public Reactor public: ConstPressureReactor() {} - virtual std::string type() const { + virtual string type() const { return "ConstPressureReactor"; } @@ -40,8 +40,8 @@ public: //! component named *nm*. Possible values for *nm* are "mass", "enthalpy", //! the name of a homogeneous phase species, or the name of a surface //! species. - virtual size_t componentIndex(const std::string& nm) const; - std::string componentName(size_t k); + virtual size_t componentIndex(const string& nm) const; + string componentName(size_t k); }; } diff --git a/include/cantera/zeroD/FlowDevice.h b/include/cantera/zeroD/FlowDevice.h index 771a447e8..463cdb7a9 100644 --- a/include/cantera/zeroD/FlowDevice.h +++ b/include/cantera/zeroD/FlowDevice.h @@ -31,7 +31,7 @@ public: //! String indicating the flow device implemented. Usually //! corresponds to the name of the derived class. - virtual std::string type() const { + virtual string type() const { return "FlowDevice"; } diff --git a/include/cantera/zeroD/FlowDeviceFactory.h b/include/cantera/zeroD/FlowDeviceFactory.h index ebb94c37b..8e9aa2276 100644 --- a/include/cantera/zeroD/FlowDeviceFactory.h +++ b/include/cantera/zeroD/FlowDeviceFactory.h @@ -31,7 +31,7 @@ public: * @param flowDeviceType the type to be created. * @deprecated To be removed after %Cantera 3.0; replaceable by newFlowDevice3. */ - virtual FlowDevice* newFlowDevice(const std::string& flowDeviceType); + virtual FlowDevice* newFlowDevice(const string& flowDeviceType); private: static FlowDeviceFactory* s_factory; diff --git a/include/cantera/zeroD/IdealGasConstPressureMoleReactor.h b/include/cantera/zeroD/IdealGasConstPressureMoleReactor.h index cd8d42502..ded7342bf 100644 --- a/include/cantera/zeroD/IdealGasConstPressureMoleReactor.h +++ b/include/cantera/zeroD/IdealGasConstPressureMoleReactor.h @@ -22,13 +22,13 @@ class IdealGasConstPressureMoleReactor : public ConstPressureMoleReactor public: IdealGasConstPressureMoleReactor() {} - virtual std::string type() const { + virtual string type() const { return "IdealGasConstPressureMoleReactor"; }; - virtual size_t componentIndex(const std::string& nm) const; + virtual size_t componentIndex(const string& nm) const; - virtual std::string componentName(size_t k); + virtual string componentName(size_t k); virtual void setThermoMgr(ThermoPhase& thermo); diff --git a/include/cantera/zeroD/IdealGasConstPressureReactor.h b/include/cantera/zeroD/IdealGasConstPressureReactor.h index d3ca520d5..fd568101d 100644 --- a/include/cantera/zeroD/IdealGasConstPressureReactor.h +++ b/include/cantera/zeroD/IdealGasConstPressureReactor.h @@ -24,7 +24,7 @@ class IdealGasConstPressureReactor : public ConstPressureReactor public: IdealGasConstPressureReactor() {} - virtual std::string type() const { + virtual string type() const { return "IdealGasConstPressureReactor"; } @@ -41,8 +41,8 @@ public: //! component named *nm*. Possible values for *nm* are "mass", //! "temperature", the name of a homogeneous phase species, or the name of a //! surface species. - virtual size_t componentIndex(const std::string& nm) const; - std::string componentName(size_t k); + virtual size_t componentIndex(const string& nm) const; + string componentName(size_t k); protected: vector m_hk; //!< Species molar enthalpies diff --git a/include/cantera/zeroD/IdealGasMoleReactor.h b/include/cantera/zeroD/IdealGasMoleReactor.h index 66c2373d8..caf982961 100644 --- a/include/cantera/zeroD/IdealGasMoleReactor.h +++ b/include/cantera/zeroD/IdealGasMoleReactor.h @@ -22,13 +22,13 @@ class IdealGasMoleReactor : public MoleReactor public: IdealGasMoleReactor() {} - virtual std::string type() const { + virtual string type() const { return "IdealGasMoleReactor"; } - virtual size_t componentIndex(const std::string& nm) const; + virtual size_t componentIndex(const string& nm) const; - virtual std::string componentName(size_t k); + virtual string componentName(size_t k); virtual void setThermoMgr(ThermoPhase& thermo); diff --git a/include/cantera/zeroD/IdealGasReactor.h b/include/cantera/zeroD/IdealGasReactor.h index 76ab83b54..72f5af35b 100644 --- a/include/cantera/zeroD/IdealGasReactor.h +++ b/include/cantera/zeroD/IdealGasReactor.h @@ -22,7 +22,7 @@ class IdealGasReactor : public Reactor public: IdealGasReactor() {} - virtual std::string type() const { + virtual string type() const { return "IdealGasReactor"; } @@ -40,8 +40,8 @@ public: //! component named *nm*. Possible values for *nm* are "mass", //! "volume", "temperature", the name of a homogeneous phase species, or the //! name of a surface species. - virtual size_t componentIndex(const std::string& nm) const; - std::string componentName(size_t k); + virtual size_t componentIndex(const string& nm) const; + string componentName(size_t k); protected: vector m_uk; //!< Species molar internal energies diff --git a/include/cantera/zeroD/MoleReactor.h b/include/cantera/zeroD/MoleReactor.h index b30827224..716c0bb07 100644 --- a/include/cantera/zeroD/MoleReactor.h +++ b/include/cantera/zeroD/MoleReactor.h @@ -22,7 +22,7 @@ class MoleReactor : public Reactor public: MoleReactor() {} - virtual std::string type() const { + virtual string type() const { return "MoleReactor"; } @@ -34,9 +34,9 @@ public: virtual void eval(double t, double* LHS, double* RHS); - size_t componentIndex(const std::string& nm) const; + size_t componentIndex(const string& nm) const; - std::string componentName(size_t k); + string componentName(size_t k); protected: //! For each surface in the reactor, update vector of triplets with all relevant diff --git a/include/cantera/zeroD/Reactor.h b/include/cantera/zeroD/Reactor.h index 35472d7cd..5d0a139f4 100644 --- a/include/cantera/zeroD/Reactor.h +++ b/include/cantera/zeroD/Reactor.h @@ -45,7 +45,7 @@ class Reactor : public ReactorBase public: Reactor() = default; - virtual std::string type() const { + virtual string type() const { return "Reactor"; } @@ -171,11 +171,11 @@ public: //! component named *nm*. Possible values for *nm* are "mass", "volume", //! "int_energy", the name of a homogeneous phase species, or the name of a //! surface species. - virtual size_t componentIndex(const std::string& nm) const; + virtual size_t componentIndex(const string& nm) const; //! Return the name of the solution component with index *i*. //! @see componentIndex() - virtual std::string componentName(size_t k); + virtual string componentName(size_t k); //! Set absolute step size limits during advance //! @param limits array of step size limits with length neq @@ -195,7 +195,7 @@ public: //! Set individual step size limit for component name *nm* //! @param nm component name //! @param limit value for step size limit - void setAdvanceLimit(const std::string& nm, const double limit); + void setAdvanceLimit(const string& nm, const double limit); //! Calculate the Jacobian of a specific Reactor specialization. //! @warning Depending on the particular implementation, this may return an @@ -242,7 +242,7 @@ protected: //! named *nm*, in either the homogeneous phase or a surface phase, relative //! to the start of the species terms. Used to implement componentIndex for //! specific reactor implementations. - virtual size_t speciesIndex(const std::string& nm) const; + virtual size_t speciesIndex(const string& nm) const; //! Evaluate terms related to Walls. Calculates #m_vdot and #m_Qdot based on //! wall movement and heat transfer. diff --git a/include/cantera/zeroD/ReactorBase.h b/include/cantera/zeroD/ReactorBase.h index b4ded55b9..f5f3a35fe 100644 --- a/include/cantera/zeroD/ReactorBase.h +++ b/include/cantera/zeroD/ReactorBase.h @@ -49,24 +49,24 @@ struct SensitivityParameter class ReactorBase { public: - explicit ReactorBase(const std::string& name = "(none)"); + explicit ReactorBase(const string& name = "(none)"); virtual ~ReactorBase() = default; ReactorBase(const ReactorBase&) = delete; ReactorBase& operator=(const ReactorBase&) = delete; //! String indicating the reactor model implemented. Usually //! corresponds to the name of the derived class. - virtual std::string type() const { + virtual string type() const { return "ReactorBase"; } //! Return the name of this reactor - std::string name() const { + string name() const { return m_name; } //! Set the name of this reactor - void setName(const std::string& name) { + void setName(const string& name) { m_name = name; } @@ -266,7 +266,7 @@ protected: //! Vector of length nWalls(), indicating whether this reactor is on the left (0) //! or right (1) of each wall. vector m_lr; - std::string m_name; + string m_name; //! The ReactorNet that this reactor is part of ReactorNet* m_net = nullptr; diff --git a/include/cantera/zeroD/ReactorDelegator.h b/include/cantera/zeroD/ReactorDelegator.h index b9c39e87d..4fd20810b 100644 --- a/include/cantera/zeroD/ReactorDelegator.h +++ b/include/cantera/zeroD/ReactorDelegator.h @@ -89,9 +89,9 @@ public: install("componentName", m_componentName, [this](size_t k) { return R::componentName(k); }); install("componentIndex", m_componentIndex, - [this](const std::string& nm) { return R::componentIndex(nm); }); + [this](const string& nm) { return R::componentIndex(nm); }); install("speciesIndex", m_speciesIndex, - [this](const std::string& nm) { return R::speciesIndex(nm); }); + [this](const string& nm) { return R::speciesIndex(nm); }); } // Overrides of Reactor methods @@ -143,15 +143,15 @@ public: m_evalSurfaces(sizes, LHS, RHS, sdot); } - virtual std::string componentName(size_t k) override { + virtual string componentName(size_t k) override { return m_componentName(k); } - virtual size_t componentIndex(const std::string& nm) const override { + virtual size_t componentIndex(const string& nm) const override { return m_componentIndex(nm); } - virtual size_t speciesIndex(const std::string& nm) const override { + virtual size_t speciesIndex(const string& nm) const override { return m_speciesIndex(nm); } @@ -196,9 +196,9 @@ private: function, double, double*, double*)> m_eval; function m_evalWalls; function, double*, double*, double*)> m_evalSurfaces; - function m_componentName; - function m_componentIndex; - function m_speciesIndex; + function m_componentName; + function m_componentIndex; + function m_speciesIndex; }; } diff --git a/include/cantera/zeroD/ReactorFactory.h b/include/cantera/zeroD/ReactorFactory.h index b7fb99f50..78eb4e71e 100644 --- a/include/cantera/zeroD/ReactorFactory.h +++ b/include/cantera/zeroD/ReactorFactory.h @@ -31,7 +31,7 @@ public: * @param reactorType the type to be created. * @deprecated To be removed after %Cantera 3.0; replaceable by newReactor3. */ - virtual ReactorBase* newReactor(const std::string& reactorType); + virtual ReactorBase* newReactor(const string& reactorType); private: static ReactorFactory* s_factory; diff --git a/include/cantera/zeroD/ReactorNet.h b/include/cantera/zeroD/ReactorNet.h index 2b792cd06..d6cad0491 100644 --- a/include/cantera/zeroD/ReactorNet.h +++ b/include/cantera/zeroD/ReactorNet.h @@ -40,7 +40,7 @@ public: //! Set the type of linear solver used in the integration. //! @param linSolverType type of linear solver. Default type: "DENSE" //! Other options include: "DIAG", "DENSE", "GMRES", "BAND" - void setLinearSolverType(const std::string& linSolverType="DENSE"); + void setLinearSolverType(const string& linSolverType="DENSE"); //! Set preconditioner used by the linear solver //! @param preconditioner preconditioner object used for the linear solver @@ -107,7 +107,7 @@ public: } //! Problem type of integrator - std::string linearSolverType() const; + string linearSolverType() const; //! Returns the maximum number of internal integration steps the //! integrator will take before reaching the next output point @@ -187,7 +187,7 @@ public: //! Return the sensitivity of the component named *component* with respect to //! the *p*-th sensitivity parameter. //! @copydetails ReactorNet::sensitivity(size_t, size_t) - double sensitivity(const std::string& component, size_t p, int reactor=0) { + double sensitivity(const string& component, size_t p, int reactor=0) { size_t k = globalComponentIndex(component, reactor); return sensitivity(k, p); } @@ -234,12 +234,12 @@ public: //! Return the index corresponding to the component named *component* in the //! reactor with index *reactor* in the global state vector for the //! reactor network. - size_t globalComponentIndex(const std::string& component, size_t reactor=0); + size_t globalComponentIndex(const string& component, size_t reactor=0); //! Return the name of the i-th component of the global state vector. The //! name returned includes both the name of the reactor and the specific //! component, for example `'reactor1: CH4'`. - std::string componentName(size_t i) const; + string componentName(size_t i) const; //! Used by Reactor and Wall objects to register the addition of //! sensitivity parameters so that the ReactorNet can keep track of the @@ -250,7 +250,7 @@ public: //! coefficient //! @returns the index of this parameter in the vector of sensitivity //! parameters (global across all reactors) - size_t registerSensitivityParameter(const std::string& name, double value, + size_t registerSensitivityParameter(const string& name, double value, double scale); //! The name of the p-th sensitivity parameter added to this ReactorNet. @@ -351,7 +351,7 @@ protected: bool m_timeIsIndependent = true; //! Names corresponding to each sensitivity parameter - vector m_paramNames; + vector m_paramNames; vector m_ydot; vector m_yest; diff --git a/include/cantera/zeroD/ReactorSurface.h b/include/cantera/zeroD/ReactorSurface.h index 94776bceb..828ddaa54 100644 --- a/include/cantera/zeroD/ReactorSurface.h +++ b/include/cantera/zeroD/ReactorSurface.h @@ -61,7 +61,7 @@ public: void setCoverages(const Composition& cov); //! Set the surface coverages by name - void setCoverages(const std::string& cov); + void setCoverages(const string& cov); //! Get the surface coverages. Array `cov` should have length equal to the //! number of surface species. diff --git a/include/cantera/zeroD/Reservoir.h b/include/cantera/zeroD/Reservoir.h index 3862dedbc..2d36e194b 100644 --- a/include/cantera/zeroD/Reservoir.h +++ b/include/cantera/zeroD/Reservoir.h @@ -20,7 +20,7 @@ class Reservoir : public ReactorBase public: Reservoir() {} - virtual std::string type() const { + virtual string type() const { return "Reservoir"; } diff --git a/include/cantera/zeroD/Wall.h b/include/cantera/zeroD/Wall.h index 385972ec5..3238cec3e 100644 --- a/include/cantera/zeroD/Wall.h +++ b/include/cantera/zeroD/Wall.h @@ -32,7 +32,7 @@ public: //! String indicating the wall model implemented. Usually //! corresponds to the name of the derived class. - virtual std::string type() const { + virtual string type() const { return "WallBase"; } @@ -143,7 +143,7 @@ public: //! String indicating the wall model implemented. Usually //! corresponds to the name of the derived class. - virtual std::string type() const { + virtual string type() const { return "Wall"; } diff --git a/include/cantera/zeroD/WallFactory.h b/include/cantera/zeroD/WallFactory.h index df22bb21d..cf3e65faa 100644 --- a/include/cantera/zeroD/WallFactory.h +++ b/include/cantera/zeroD/WallFactory.h @@ -31,7 +31,7 @@ public: * @param wallType the type to be created. * @deprecated To be removed after %Cantera 3.0; replaceable by newWall3. */ - virtual WallBase* newWall(const std::string& wallType); + virtual WallBase* newWall(const string& wallType); private: static WallFactory* s_factory; diff --git a/include/cantera/zeroD/flowControllers.h b/include/cantera/zeroD/flowControllers.h index 5b9398baa..1fd22124e 100644 --- a/include/cantera/zeroD/flowControllers.h +++ b/include/cantera/zeroD/flowControllers.h @@ -22,7 +22,7 @@ class MassFlowController : public FlowDevice public: MassFlowController() = default; - virtual std::string type() const { + virtual string type() const { return "MassFlowController"; } @@ -67,7 +67,7 @@ class PressureController : public FlowDevice public: PressureController() = default; - virtual std::string type() const { + virtual string type() const { return "PressureController"; } @@ -128,7 +128,7 @@ class Valve : public FlowDevice public: Valve() = default; - virtual std::string type() const { + virtual string type() const { return "Valve"; } diff --git a/samples/cxx/LiC6_electrode/LiC6_electrode.cpp b/samples/cxx/LiC6_electrode/LiC6_electrode.cpp index 5dbfe8279..cb7d08e6c 100644 --- a/samples/cxx/LiC6_electrode/LiC6_electrode.cpp +++ b/samples/cxx/LiC6_electrode/LiC6_electrode.cpp @@ -23,11 +23,11 @@ void calc_potentials() { double Tk = 273.15 + 25.0; - std::string filename = "LiC6_electrodebulk.yaml"; - std::string phasename = "LiC6_and_Vacancies"; + string filename = "LiC6_electrodebulk.yaml"; + string phasename = "LiC6_and_Vacancies"; auto sol = newSolution(filename, phasename); auto electrodebulk = sol->thermo(); - std::string intercalatingSpeciesName("Li(C6)"); + string intercalatingSpeciesName("Li(C6)"); size_t intercalatingSpeciesIdx = electrodebulk->speciesIndex(intercalatingSpeciesName); size_t nsp_tot = electrodebulk->nSpecies(); diff --git a/samples/cxx/flamespeed/flamespeed.cpp b/samples/cxx/flamespeed/flamespeed.cpp index fe762f800..caf48db3c 100644 --- a/samples/cxx/flamespeed/flamespeed.cpp +++ b/samples/cxx/flamespeed/flamespeed.cpp @@ -118,7 +118,7 @@ int flamespeed(double phi, bool refine_grid, int loglevel) // Save initial guess to container file // Solution is saved in HDF5 or YAML file format - std::string fileName; + string fileName; if (usesHDF5()) { // Cantera is compiled with native HDF5 support fileName = "flamespeed.h5"; diff --git a/samples/cxx/gas_transport/gas_transport.cpp b/samples/cxx/gas_transport/gas_transport.cpp index 27466306f..8a8fffa45 100644 --- a/samples/cxx/gas_transport/gas_transport.cpp +++ b/samples/cxx/gas_transport/gas_transport.cpp @@ -23,7 +23,7 @@ using namespace Cantera; using std::cout; using std::endl; -void write_csv(const std::string& name, const vector& names, +void write_csv(const string& name, const vector& names, const Array2D& data) { std::ofstream s(name); @@ -71,7 +71,7 @@ void transport_example() } // Create a list of labels for the CSV output file - vector labels { + vector labels { "Temperature (K)", "Viscosity (Pa*s)", "Thermal Conductivity (W/m*K)" diff --git a/samples/cxx/jacobian/derivative_speed.cpp b/samples/cxx/jacobian/derivative_speed.cpp index 56be5b04d..dcb5b3285 100644 --- a/samples/cxx/jacobian/derivative_speed.cpp +++ b/samples/cxx/jacobian/derivative_speed.cpp @@ -95,8 +95,8 @@ void timeit_matrix(Eigen::SparseMatrix (Kinetics::*function)(), statistics(times, loops, runs); } -void benchmark(const std::string& mech, const std::string& phase, - const std::string& fuel) +void benchmark(const string& mech, const string& phase, + const string& fuel) { auto sol = newSolution(mech, phase, "none"); auto& gas = *(sol->thermo()); diff --git a/samples/cxx/rankine/rankine.cpp b/samples/cxx/rankine/rankine.cpp index e62be4873..212687441 100644 --- a/samples/cxx/rankine/rankine.cpp +++ b/samples/cxx/rankine/rankine.cpp @@ -17,11 +17,11 @@ using namespace Cantera; -map h, s, T, P, x; -vector states; +map h, s, T, P, x; +vector states; template -void saveState(F& fluid, std::string name) +void saveState(F& fluid, string name) { h[name] = fluid.enthalpy_mass(); s[name] = fluid.entropy_mass(); @@ -35,7 +35,7 @@ void printStates() { int nStates = states.size(); for (int n = 0; n < nStates; n++) { - std::string name = states[n]; + string name = states[n]; writelog(" {:5s} {:10.6g} {:10.6g} {:12.6g} {:12.6g} {:5.2g}\n", name, T[name], P[name], h[name], s[name], x[name]); } diff --git a/src/base/AnyMap.cpp b/src/base/AnyMap.cpp index 46ba76f21..011715552 100644 --- a/src/base/AnyMap.cpp +++ b/src/base/AnyMap.cpp @@ -22,11 +22,11 @@ std::mutex yaml_cache_mutex; std::mutex yaml_field_order_mutex; using namespace Cantera; -bool isFloat(const std::string& val) +bool isFloat(const string& val) { // This function duplicates the logic of fpValueCheck, but doesn't throw // exceptions if the string isn't a float - std::string str = ba::trim_copy(val); + string str = ba::trim_copy(val); if (str.empty()) { return false; } @@ -72,9 +72,9 @@ bool isFloat(const std::string& val) return true; } -bool isInt(const std::string& val) +bool isInt(const string& val) { - std::string str = ba::trim_copy(val); + string str = ba::trim_copy(val); if (str.empty()) { return false; } @@ -94,8 +94,8 @@ bool isInt(const std::string& val) return true; } -bool isBool(const std::string& val) { - std::string str = ba::trim_copy(val); +bool isBool(const string& val) { + string str = ba::trim_copy(val); return (val == "true" || val == "True" || val == "false" || val == "False"); } @@ -124,7 +124,7 @@ Type elementTypes(const YAML::Node& node) } else if (el.IsSequence()) { types = types | Type::Sequence; } else if (el.IsScalar()) { - std::string nodestr = el.as(); + string nodestr = el.as(); if (isInt(nodestr)) { types = types | Type::Integer; } else if (isFloat(nodestr)) { @@ -251,7 +251,7 @@ struct convert { target["items"] = node.as(); return true; } else if (!node.IsMap()) { - std::string text = YAML::Dump(node); + string text = YAML::Dump(node); if (text.size() > 300) { text.resize(300); } @@ -259,7 +259,7 @@ struct convert { "YAML node is not a map. Node begins with:\n'''\n{}\n'''", text); } for (const auto& child : node) { - std::string key = child.first.as(); + string key = child.first.as(); const auto& loc = child.second.Mark(); AnyValue& value = target.createForYaml(key, loc.line, loc.column); if (child.second.IsMap()) { @@ -327,7 +327,7 @@ YAML::Emitter& operator<<(YAML::Emitter& out, const AnyMap& rhs) //! Write YAML strings spanning multiple lines if input includes endline '\n' void emitString(YAML::Emitter& out, const string& str0) { size_t endline = str0.rfind('\n'); - if (endline == std::string::npos) { + if (endline == string::npos) { out << str0; return; } @@ -340,7 +340,7 @@ void emitString(YAML::Emitter& out, const string& str0) { } // Deblank lines (remove whitespace surrounding line breaks) - while (endline != std::string::npos) { + while (endline != string::npos) { size_t len = 1; while (str1[endline + len] == ' ') { len++; // account for whitespace after line break @@ -479,7 +479,7 @@ struct convert { target.setLoc(node.Mark().line, node.Mark().column); if (node.IsScalar()) { // Scalar nodes are int, doubles, or strings - std::string nodestr = node.as(); + string nodestr = node.as(); if (node.Tag() == "!") { // Prevent quoted strings from being implicitly converted to // numeric types. For example, the quoted YAML string '12345' should not @@ -514,7 +514,7 @@ struct convert { } target = std::move(values); } else if (types == Type::String) { - target = node.as>(); + target = node.as>(); } else if (types == Type::Bool) { target = node.as>(); } else if (types == Type::Map) { @@ -537,7 +537,7 @@ struct convert { } target = std::move(values); } else if (subtypes == Type::String) { - target = node.as>>(); + target = node.as>>(); } else if (subtypes == Type::Bool) { target = node.as>>(); } else { @@ -566,8 +566,8 @@ namespace Cantera { std::unordered_map> AnyMap::s_cache; -std::unordered_map> AnyMap::s_headFields; -std::unordered_map> AnyMap::s_tailFields; +std::unordered_map> AnyMap::s_headFields; +std::unordered_map> AnyMap::s_tailFields; // Methods of class AnyBase @@ -577,7 +577,7 @@ void AnyBase::setLoc(int line, int column) m_column = column; } -const AnyValue& AnyBase::getMetadata(const std::string& key) const +const AnyValue& AnyBase::getMetadata(const string& key) const { if (m_metadata && m_metadata->hasKey(key)) { return m_metadata->at(key); @@ -604,21 +604,21 @@ bool AnyValue::operator!=(const AnyValue& other) const return !m_equals(m_value, other.m_value); } -AnyValue& AnyValue::operator[](const std::string& key) +AnyValue& AnyValue::operator[](const string& key) { return as()[key]; } -const AnyValue& AnyValue::operator[](const std::string& key) const +const AnyValue& AnyValue::operator[](const string& key) const { return as().at(key); } -bool AnyValue::hasKey(const std::string& key) const { +bool AnyValue::hasKey(const string& key) const { return (is() && as().hasKey(key)); } -void AnyValue::setKey(const std::string &key) { m_key = key; } +void AnyValue::setKey(const string &key) { m_key = key; } const std::type_info &AnyValue::type() const { return m_value.type(); @@ -640,7 +640,7 @@ void AnyValue::propagateMetadata(shared_ptr& metadata) } } -std::string AnyValue::type_str() const { +string AnyValue::type_str() const { return demangle(type()); } @@ -649,7 +649,7 @@ bool AnyValue::empty() const { } bool AnyValue::isScalar() const { - return is() || is() || is() || is(); + return is() || is() || is() || is(); } size_t AnyValue::vectorSize() const { @@ -712,7 +712,7 @@ pair AnyValue::matrixShape() const { return {npos, npos}; } -// Specializations for "std::string" and "const char*" +// Specializations for "string" and "const char*" AnyValue::AnyValue(const string& value) : m_value{value} @@ -736,11 +736,11 @@ AnyValue &AnyValue::operator=(const char *value) { return *this; } -const std::string &AnyValue::asString() const { - return as(); +const string &AnyValue::asString() const { + return as(); } -bool AnyValue::operator==(const std::string& other) const +bool AnyValue::operator==(const string& other) const { if (m_value.type() == typeid(string)) { return std::any_cast(m_value) == other; @@ -749,24 +749,24 @@ bool AnyValue::operator==(const std::string& other) const } } -bool AnyValue::operator!=(const std::string& other) const +bool AnyValue::operator!=(const string& other) const { return !(*this == other); } -bool operator==(const std::string& lhs, const AnyValue& rhs) +bool operator==(const string& lhs, const AnyValue& rhs) { return rhs == lhs; } -bool operator!=(const std::string& lhs, const AnyValue& rhs) +bool operator!=(const string& lhs, const AnyValue& rhs) { return rhs != lhs; } // Specialization for "Quantity" -void AnyValue::setQuantity(double value, const std::string& units, bool is_act_energy) { +void AnyValue::setQuantity(double value, const string& units, bool is_act_energy) { m_value = Quantity{AnyValue(value), Units(units), is_act_energy}; m_equals = eq_comparer; } @@ -776,7 +776,7 @@ void AnyValue::setQuantity(double value, const Units& units) { m_equals = eq_comparer; } -void AnyValue::setQuantity(const vector& values, const std::string& units) { +void AnyValue::setQuantity(const vector& values, const string& units) { AnyValue v; v = values; m_value = Quantity{v, Units(units), false}; @@ -973,10 +973,10 @@ AnyValue& AnyValue::operator=(AnyMap&& value) { return *this; } -std::unordered_map AnyValue::asMap( - const std::string& name) const +std::unordered_map AnyValue::asMap( + const string& name) const { - std::unordered_map mapped; + std::unordered_map mapped; for (const auto& item : asVector()) { auto key = item[name].asString(); if (mapped.count(key)) { @@ -988,9 +988,9 @@ std::unordered_map AnyValue::asMap( return mapped; } -std::unordered_map AnyValue::asMap(const std::string& name) +std::unordered_map AnyValue::asMap(const string& name) { - std::unordered_map mapped; + std::unordered_map mapped; for (auto& item : asVector()) { auto key = item.at(name).asString(); if (mapped.count(key)) { @@ -1002,7 +1002,7 @@ std::unordered_map AnyValue::asMap(const std::string& name return mapped; } -const AnyMap& AnyValue::getMapWhere(const std::string& key, const std::string& value) const +const AnyMap& AnyValue::getMapWhere(const string& key, const string& value) const { if (is>()) { if (value == "") { @@ -1032,7 +1032,7 @@ const AnyMap& AnyValue::getMapWhere(const std::string& key, const std::string& v } } -AnyMap& AnyValue::getMapWhere(const std::string& key, const std::string& value, +AnyMap& AnyValue::getMapWhere(const string& key, const string& value, bool create) { if (is>()) { @@ -1083,7 +1083,7 @@ AnyMap& AnyValue::getMapWhere(const std::string& key, const std::string& value, } } -bool AnyValue::hasMapWhere(const std::string& key, const std::string& value) const +bool AnyValue::hasMapWhere(const string& key, const string& value) const { if (is>()) { if (value == "") { @@ -1230,8 +1230,8 @@ const vector& AnyValue::asVector(size_t nMin, size_t nMax) c v.push_back(AnyValue(el)); } const_cast(this)->m_value = v; - } else if (is>()) { - for (const auto& el : asVector()) { + } else if (is>()) { + for (const auto& el : asVector()) { v.push_back(AnyValue(el)); } const_cast(this)->m_value = v; @@ -1361,7 +1361,7 @@ AnyMap::AnyMap() { } -AnyValue& AnyMap::operator[](const std::string& key) +AnyValue& AnyMap::operator[](const string& key) { const auto& iter = m_data.find(key); if (iter == m_data.end()) { @@ -1385,7 +1385,7 @@ AnyValue& AnyMap::operator[](const std::string& key) } } -const AnyValue& AnyMap::operator[](const std::string& key) const +const AnyValue& AnyMap::operator[](const string& key) const { try { return m_data.at(key); @@ -1395,7 +1395,7 @@ const AnyValue& AnyMap::operator[](const std::string& key) const } } -AnyValue& AnyMap::createForYaml(const std::string& key, int line, int column) +AnyValue& AnyMap::createForYaml(const string& key, int line, int column) { AnyValue& value = m_data.emplace(key, AnyValue()).first->second; value.setKey(key); @@ -1407,7 +1407,7 @@ AnyValue& AnyMap::createForYaml(const std::string& key, int line, int column) return value; } -const AnyValue& AnyMap::at(const std::string& key) const +const AnyValue& AnyMap::at(const string& key) const { try { return m_data.at(key); @@ -1422,12 +1422,12 @@ bool AnyMap::empty() const return m_data.size() == 0; } -bool AnyMap::hasKey(const std::string& key) const +bool AnyMap::hasKey(const string& key) const { return (m_data.find(key) != m_data.end()); } -void AnyMap::erase(const std::string& key) +void AnyMap::erase(const string& key) { m_data.erase(key); } @@ -1446,7 +1446,7 @@ void AnyMap::update(const AnyMap& other, bool keepExisting) } } -std::string AnyMap::keys_str() const +string AnyMap::keys_str() const { fmt::memory_buffer b; auto iter = this->begin(); @@ -1480,7 +1480,7 @@ void AnyMap::propagateMetadata(shared_ptr& metadata) } } -void AnyMap::setMetadata(const std::string& key, const AnyValue& value) +void AnyMap::setMetadata(const string& key, const AnyValue& value) { if (m_metadata) { // Fork the metadata tree at this point to avoid affecting parent nodes @@ -1514,38 +1514,38 @@ void AnyMap::copyMetadata(const AnyMap& other) propagateMetadata(m_metadata); } -bool AnyMap::getBool(const std::string& key, bool default_) const +bool AnyMap::getBool(const string& key, bool default_) const { return (hasKey(key)) ? m_data.at(key).asBool() : default_; } -double AnyMap::getDouble(const std::string& key, double default_) const +double AnyMap::getDouble(const string& key, double default_) const { return (hasKey(key)) ? m_data.at(key).asDouble() : default_; } -long int AnyMap::getInt(const std::string& key, long int default_) const +long int AnyMap::getInt(const string& key, long int default_) const { return (hasKey(key)) ? m_data.at(key).asInt() : default_; } -const std::string& AnyMap::getString(const std::string& key, - const std::string& default_) const +const string& AnyMap::getString(const string& key, + const string& default_) const { return (hasKey(key)) ? m_data.at(key).asString() : default_; } -double AnyMap::convert(const std::string& key, const std::string& dest) const +double AnyMap::convert(const string& key, const string& dest) const { return units().convert(at(key), dest); } -double AnyMap::convert(const std::string& key, const Units& dest) const +double AnyMap::convert(const string& key, const Units& dest) const { return units().convert(at(key), dest); } -double AnyMap::convert(const std::string& key, const std::string& dest, +double AnyMap::convert(const string& key, const string& dest, double default_) const { if (hasKey(key)) { @@ -1555,15 +1555,15 @@ double AnyMap::convert(const std::string& key, const std::string& dest, } } -vector AnyMap::convertVector(const std::string& key, const std::string& dest, +vector AnyMap::convertVector(const string& key, const string& dest, size_t nMin, size_t nMax) const { return units().convert(at(key).asVector(nMin, nMax), dest); } AnyMap::Iterator::Iterator( - const std::unordered_map::const_iterator& start, - const std::unordered_map::const_iterator& stop) + const std::unordered_map::const_iterator& start, + const std::unordered_map::const_iterator& stop) { m_iter = start; m_stop = stop; @@ -1705,7 +1705,7 @@ void AnyMap::applyUnits(shared_ptr& units) { } if (hasKey("__units__")) { m_units = make_shared(*units); - m_units->setDefaults(m_data["__units__"].asMap()); + m_units->setDefaults(m_data["__units__"].asMap()); } else { m_units = units; } @@ -1747,15 +1747,15 @@ bool AnyMap::addOrderingRules(const string& objectType, return true; } -void AnyMap::clearCachedFile(const std::string& filename) +void AnyMap::clearCachedFile(const string& filename) { - std::string fullName = findInputFile(filename); + string fullName = findInputFile(filename); if (s_cache.count(fullName)) { s_cache.erase(fullName); } } -AnyMap AnyMap::fromYamlString(const std::string& yaml) { +AnyMap AnyMap::fromYamlString(const string& yaml) { AnyMap amap; try { YAML::Node node = YAML::Load(yaml); @@ -1771,14 +1771,14 @@ AnyMap AnyMap::fromYamlString(const std::string& yaml) { return amap; } -AnyMap AnyMap::fromYamlFile(const std::string& name, - const std::string& parent_name) +AnyMap AnyMap::fromYamlFile(const string& name, + const string& parent_name) { - std::string fullName; + string fullName; // See if a file with this name exists in a path relative to the parent file size_t islash = parent_name.find_last_of("/\\"); if (islash != npos) { - std::string parent_path = parent_name.substr(0, islash); + string parent_path = parent_name.substr(0, islash); if (std::ifstream(parent_path + "/" + name).good()) { fullName = parent_path + "/" + name; } @@ -1830,7 +1830,7 @@ AnyMap AnyMap::fromYamlFile(const std::string& name, return cache_item; } -std::string AnyMap::toYamlString() const +string AnyMap::toYamlString() const { YAML::Emitter out; const_cast(this)->applyUnits(); @@ -1849,7 +1849,7 @@ AnyMap::Iterator end(const AnyValue& v) { namespace { void formatInputFile(fmt::memory_buffer& b, const shared_ptr& metadata, - const std::string& filename, int lineno, int column, int lineno2=-1, int column2=-1) + const string& filename, int lineno, int column, int lineno2=-1, int column2=-1) { if (lineno2 == -1) { lineno2 = lineno; @@ -1863,7 +1863,7 @@ void formatInputFile(fmt::memory_buffer& b, const shared_ptr& metadata, buffer << infile.rdbuf(); (*metadata)["file-contents"] = buffer.str(); } - std::string line; + string line; int i = 0; int lastShown = -1; std::stringstream contents((*metadata)["file-contents"].asString()); @@ -1885,14 +1885,14 @@ void formatInputFile(fmt::memory_buffer& b, const shared_ptr& metadata, } } -std::string InputFileError::formatError(const std::string& message, +string InputFileError::formatError(const string& message, int lineno, int column, const shared_ptr& metadata) { if (!metadata) { return message; } - std::string filename = metadata->getString("filename", "input string"); + string filename = metadata->getString("filename", "input string"); fmt::memory_buffer b; fmt_append(b, "Error on line {} of {}:\n{}\n", lineno+1, filename, message); @@ -1900,7 +1900,7 @@ std::string InputFileError::formatError(const std::string& message, return to_string(b); } -std::string InputFileError::formatError2(const std::string& message, +string InputFileError::formatError2(const string& message, int line1, int column1, const shared_ptr& metadata1, int line2, int column2, @@ -1909,8 +1909,8 @@ std::string InputFileError::formatError2(const std::string& message, if (!metadata1 || !metadata2) { return message; } - std::string filename1 = metadata1->getString("filename", "input string"); - std::string filename2 = metadata2->getString("filename", "input string"); + string filename1 = metadata1->getString("filename", "input string"); + string filename2 = metadata2->getString("filename", "input string"); fmt::memory_buffer b; if (filename1 == filename2) { @@ -1929,15 +1929,15 @@ std::string InputFileError::formatError2(const std::string& message, return to_string(b); } -void warn_deprecated(const std::string& source, const AnyBase& node, - const std::string& message) +void warn_deprecated(const string& source, const AnyBase& node, + const string& message) { if (!node.m_metadata) { warn_deprecated(source, message); return; } - std::string filename = node.m_metadata->getString("filename", "input string"); + string filename = node.m_metadata->getString("filename", "input string"); fmt::memory_buffer b; fmt_append(b, message); fmt_append(b, "\n"); diff --git a/src/base/Interface.cpp b/src/base/Interface.cpp index 7afd5ca95..87998da98 100644 --- a/src/base/Interface.cpp +++ b/src/base/Interface.cpp @@ -32,8 +32,8 @@ void Interface::setKinetics(shared_ptr kinetics) { m_surfkin = surfkin; } -shared_ptr newInterface(const std::string& infile, - const std::string& name, const vector& adjacent) +shared_ptr newInterface(const string& infile, + const string& name, const vector& adjacent) { auto sol = newSolution(infile, name, "", adjacent); auto iface = std::dynamic_pointer_cast(sol); @@ -46,8 +46,8 @@ shared_ptr newInterface(const std::string& infile, return iface; } -shared_ptr newInterface(const std::string& infile, - const std::string& name, const vector>& adjacent) +shared_ptr newInterface(const string& infile, + const string& name, const vector>& adjacent) { auto rootNode = AnyMap::fromYamlFile(infile); AnyMap& phaseNode = rootNode["phases"].getMapWhere("name", name); diff --git a/src/base/Solution.cpp b/src/base/Solution.cpp index 48ddb1439..074162f56 100644 --- a/src/base/Solution.cpp +++ b/src/base/Solution.cpp @@ -22,7 +22,7 @@ namespace Cantera { -std::string Solution::name() const { +string Solution::name() const { if (m_thermo) { return m_thermo->name(); } else { @@ -31,7 +31,7 @@ std::string Solution::name() const { } } -void Solution::setName(const std::string& name) { +void Solution::setName(const string& name) { if (m_thermo) { m_thermo->setName(name); } else { @@ -70,7 +70,7 @@ void Solution::setTransport(shared_ptr transport) { } } -void Solution::setTransportModel(const std::string& model) { +void Solution::setTransportModel(const string& model) { if (!m_thermo) { throw CanteraError("Solution::setTransportModel", "Unable to set Transport model without valid ThermoPhase object."); @@ -144,23 +144,23 @@ AnyMap& Solution::header() return m_header; } -const std::string Solution::source() const { +const string Solution::source() const { AnyValue source = m_header.getMetadata("filename"); return source.empty() ? "" : source.asString(); } -void Solution::setSource(const std::string& source) { +void Solution::setSource(const string& source) { AnyValue filename(source); m_header.setMetadata("filename", filename); } -void Solution::holdExternalHandle(const std::string& name, +void Solution::holdExternalHandle(const string& name, shared_ptr handle) { m_externalHandles[name] = handle; } -shared_ptr Solution::getExternalHandle(const std::string& name) const +shared_ptr Solution::getExternalHandle(const string& name) const { if (m_externalHandles.count(name)) { return m_externalHandles.at(name); @@ -179,14 +179,14 @@ void Solution::removeChangedCallback(void* id) m_changeCallbacks.erase(id); } -shared_ptr newSolution(const std::string &infile, - const std::string &name, - const std::string &transport, +shared_ptr newSolution(const string &infile, + const string &name, + const string &transport, const vector> &adjacent) { // get file extension size_t dot = infile.find_last_of("."); - std::string extension; + string extension; if (dot != npos) { extension = toLowerCopy(infile.substr(dot+1)); } @@ -204,8 +204,8 @@ shared_ptr newSolution(const std::string &infile, return sol; } -shared_ptr newSolution(const std::string& infile, const std::string& name, - const std::string& transport, const vector& adjacent) +shared_ptr newSolution(const string& infile, const string& name, + const string& transport, const vector& adjacent) { auto rootNode = AnyMap::fromYamlFile(infile); AnyMap& phaseNode = rootNode["phases"].getMapWhere("name", name); @@ -221,9 +221,9 @@ shared_ptr newSolution(const std::string& infile, const std::string& n shared_ptr newSolution(const AnyMap& phaseNode, const AnyMap& rootNode, - const std::string& transport, + const string& transport, const vector>& adjacent, - const map>& related) + const map>& related) { // thermo phase auto thermo = newThermo(phaseNode, rootNode); @@ -255,7 +255,7 @@ shared_ptr newSolution(const AnyMap& phaseNode, // Helper function for adding individual phases auto addPhase = [&](const AnyValue& phases, const AnyMap& root, - const std::string& name) + const string& name) { if (!all_related.count(name)) { // Create a new phase only if there isn't already one with the same name @@ -270,9 +270,9 @@ shared_ptr newSolution(const AnyMap& phaseNode, }; auto& adjPhases = phaseNode["adjacent-phases"]; - if (adjPhases.is>()) { + if (adjPhases.is>()) { // 'adjacent' is a list of bulk phases from the current input file - for (auto& phase : adjPhases.as>()) { + for (auto& phase : adjPhases.as>()) { addPhase(rootNode["phases"], rootNode, phase); } } else if (adjPhases.is>()) { @@ -280,13 +280,13 @@ shared_ptr newSolution(const AnyMap& phaseNode, // a section in this file or another YAML file, and the value is a list of // phase names to read from that section for (auto& item : adjPhases.asVector()) { - const std::string& source = item.begin()->first; - const auto& names = item.begin()->second.asVector(); + const string& source = item.begin()->first; + const auto& names = item.begin()->second.asVector(); const auto& slash = boost::ifind_last(source, "/"); if (slash) { // source is a different input file - std::string fileName(source.begin(), slash.begin()); - std::string node(slash.end(), source.end()); + string fileName(source.begin(), slash.begin()); + string node(slash.end(), source.end()); AnyMap phaseSource = AnyMap::fromYamlFile(fileName, rootNode.getString("__file__", "")); for (auto& phase : names) { diff --git a/src/base/Units.cpp b/src/base/Units.cpp index 3979c12e4..57ebea324 100644 --- a/src/base/Units.cpp +++ b/src/base/Units.cpp @@ -14,7 +14,7 @@ namespace { using namespace Cantera; -const map knownUnits{ +const map knownUnits{ {"", Units(1.0)}, {"1", Units(1.0)}, @@ -80,7 +80,7 @@ const map knownUnits{ {"J/kmol", Units(1.0, 1, 2, -2, 0, 0, -1)}, }; -const map prefixes{ +const map prefixes{ {"Y", 1e24}, {"Z", 1e21}, {"E", 1e18}, @@ -128,7 +128,7 @@ Units::Units(double factor, double mass, double length, double time, } } -Units::Units(const std::string& name, bool force_unity) +Units::Units(const string& name, bool force_unity) { size_t start = 0; @@ -137,7 +137,7 @@ Units::Units(const std::string& name, bool force_unity) std::smatch matched; std::regex_search(name, matched, regexp); if (matched.size()) { - std::string factor = *matched.begin(); + string factor = *matched.begin(); if (name.find(factor) == 0) { m_factor = fpValueCheck(factor); start = factor.size(); @@ -152,7 +152,7 @@ Units::Units(const std::string& name, bool force_unity) // No caret in this group caret = npos; } - std::string unit = trimCopy( + string unit = trimCopy( name.substr(start, std::min(caret, stop) - start)); double exponent = 1.0; @@ -169,8 +169,8 @@ Units::Units(const std::string& name, bool force_unity) *this *= knownUnits.at(unit).pow(exponent); } else { // See if the unit looks like a prefix + base unit - std::string prefix = unit.substr(0, 1); - std::string suffix = unit.substr(1); + string prefix = unit.substr(0, 1); + string suffix = unit.substr(1); if (prefixes.find(prefix) != prefixes.end() && knownUnits.find(suffix) != knownUnits.end()) { Units u = knownUnits.at(suffix); @@ -231,9 +231,9 @@ Units Units::pow(double exponent) const m_quantity_dim * exponent); } -std::string Units::str(bool skip_unity) const +string Units::str(bool skip_unity) const { - map dims{ + map dims{ {"kg", m_mass_dim}, {"m", m_length_dim}, {"s", m_time_dim}, @@ -242,8 +242,8 @@ std::string Units::str(bool skip_unity) const {"kmol", m_quantity_dim}, }; - std::string num = ""; - std::string den = ""; + string num = ""; + string den = ""; for (auto const& [dimension, exponent] : dims) { int rounded = (int)round(exponent); if (exponent == 0.) { @@ -271,7 +271,7 @@ std::string Units::str(bool skip_unity) const return fmt::format("1{}", den); } - std::string factor; + string factor; if (m_factor == round(m_factor)) { // ensure that fmt::format does not round to integer factor = fmt::format("{:.1f}", m_factor); @@ -300,7 +300,7 @@ bool Units::operator==(const Units& other) const && m_energy_dim == other.m_energy_dim; } -double Units::dimension(const std::string& primary) const +double Units::dimension(const string& primary) const { if (primary == "mass") { return m_mass_dim; @@ -390,15 +390,15 @@ Units UnitStack::product() const return out; } -UnitSystem::UnitSystem(std::initializer_list units) +UnitSystem::UnitSystem(std::initializer_list units) { setDefaults(units); } -map UnitSystem::defaults() const +map UnitSystem::defaults() const { // Unit system defaults - map units{ + map units{ {"mass", "kg"}, {"length", "m"}, {"time", "s"}, @@ -425,7 +425,7 @@ map UnitSystem::defaults() const return units; } -void UnitSystem::setDefaults(std::initializer_list units) +void UnitSystem::setDefaults(std::initializer_list units) { for (const auto& name : units) { auto unit = Units(name); @@ -469,7 +469,7 @@ void UnitSystem::setDefaults(std::initializer_list units) } } -void UnitSystem::setDefaults(const map& units) +void UnitSystem::setDefaults(const map& units) { for (const auto& [dimension, name] : units) { Units unit(name); @@ -518,7 +518,7 @@ void UnitSystem::setDefaults(const map& units) } } -void UnitSystem::setDefaultActivationEnergy(const std::string& e_units) +void UnitSystem::setDefaultActivationEnergy(const string& e_units) { Units u(e_units); m_defaults["activation-energy"] = e_units; @@ -535,8 +535,8 @@ void UnitSystem::setDefaultActivationEnergy(const std::string& e_units) m_explicit_activation_energy = true; } -double UnitSystem::convert(double value, const std::string& src, - const std::string& dest) const +double UnitSystem::convert(double value, const string& src, + const string& dest) const { return convert(value, Units(src), Units(dest)); } @@ -552,7 +552,7 @@ double UnitSystem::convert(double value, const Units& src, return value * src.factor() / dest.factor(); } -double UnitSystem::convertTo(double value, const std::string& dest) const +double UnitSystem::convertTo(double value, const string& dest) const { return convertTo(value, Units(dest)); } @@ -568,7 +568,7 @@ double UnitSystem::convertTo(double value, const Units& dest) const * pow(m_energy_factor, dest.m_energy_dim); } -double UnitSystem::convertFrom(double value, const std::string& dest) const +double UnitSystem::convertFrom(double value, const string& dest) const { return convertFrom(value, Units(dest)); } @@ -584,10 +584,10 @@ double UnitSystem::convertFrom(double value, const Units& src) const * pow(m_energy_factor, -src.m_energy_dim); } -static pair split_unit(const AnyValue& v) { - if (v.is()) { +static pair split_unit(const AnyValue& v) { + if (v.is()) { // Should be a value and units, separated by a space, for example '2e4 J/kmol' - std::string val_units = v.asString(); + string val_units = v.asString(); size_t space = val_units.find(" "); if (space == npos) { throw CanteraError("split_unit (UnitSystem)", @@ -602,7 +602,7 @@ static pair split_unit(const AnyValue& v) { } } -double UnitSystem::convert(const AnyValue& v, const std::string& dest) const +double UnitSystem::convert(const AnyValue& v, const string& dest) const { try { return convert(v, Units(dest)); @@ -656,7 +656,7 @@ double UnitSystem::convertRateCoeff(const AnyValue& v, const Units& dest) const } vector UnitSystem::convert(const vector& vals, - const std::string& dest) const + const string& dest) const { return convert(vals, Units(dest)); } @@ -671,8 +671,8 @@ vector UnitSystem::convert(const vector& vals, return out; } -double UnitSystem::convertActivationEnergy(double value, const std::string& src, - const std::string& dest) const +double UnitSystem::convertActivationEnergy(double value, const string& src, + const string& dest) const { // Convert to J/kmol Units usrc(src); @@ -704,7 +704,7 @@ double UnitSystem::convertActivationEnergy(double value, const std::string& src, } double UnitSystem::convertActivationEnergyTo(double value, - const std::string& dest) const + const string& dest) const { return convertActivationEnergyTo(value, Units(dest)); } @@ -725,7 +725,7 @@ double UnitSystem::convertActivationEnergyTo(double value, } double UnitSystem::convertActivationEnergyFrom(double value, - const std::string& src) const + const string& src) const { Units usrc(src); if (usrc.convertible(Units("J/kmol"))) { @@ -741,7 +741,7 @@ double UnitSystem::convertActivationEnergyFrom(double value, } double UnitSystem::convertActivationEnergy(const AnyValue& v, - const std::string& dest) const + const string& dest) const { try { auto [value, units] = split_unit(v); @@ -763,7 +763,7 @@ AnyMap UnitSystem::getDelta(const UnitSystem& other) const AnyMap delta; // Create a local alias because the template specialization can't be deduced // automatically - const auto& get = getValue; + const auto& get = getValue; if (m_mass_factor != other.m_mass_factor) { delta["mass"] = get(m_defaults, "mass", "kg"); } diff --git a/src/base/YamlWriter.cpp b/src/base/YamlWriter.cpp index 62655054f..4bbda7e45 100644 --- a/src/base/YamlWriter.cpp +++ b/src/base/YamlWriter.cpp @@ -52,7 +52,7 @@ void YamlWriter::addPhase(shared_ptr thermo, addPhase(soln); } -std::string YamlWriter::toYamlString() const +string YamlWriter::toYamlString() const { AnyMap output; bool hasDescription = m_header.hasKey("description"); @@ -87,7 +87,7 @@ std::string YamlWriter::toYamlString() const for (size_t i = 0; i < m_phases.size(); i++) { phaseDefs[i] = m_phases[i]->parameters(!m_skip_user_defined); if (m_phases[i]->nAdjacent()) { - vector adj_names; + vector adj_names; for (size_t j = 0; j < m_phases[i]->nAdjacent(); j++) { adj_names.push_back(m_phases[i]->adjacent(j)->name()); } @@ -100,7 +100,7 @@ std::string YamlWriter::toYamlString() const // Build species definitions for all phases vector speciesDefs; speciesDefs.reserve(nspecies_total); - std::unordered_map speciesDefIndex; + std::unordered_map speciesDefIndex; for (const auto& phase : m_phases) { const auto thermo = phase->thermo(); for (const auto& name : thermo->speciesNames()) { @@ -122,7 +122,7 @@ std::string YamlWriter::toYamlString() const output["species"] = speciesDefs; // build reaction definitions for all phases - map> allReactions; + map> allReactions; for (const auto& phase : m_phases) { const auto kin = phase->kinetics(); if (!kin || !kin->nReactions()) { @@ -140,11 +140,11 @@ std::string YamlWriter::toYamlString() const // key: canonical phase in allReactions // value: phases using this reaction set - map> phaseGroups; + map> phaseGroups; for (const auto& phase : m_phases) { const auto kin = phase->kinetics(); - std::string name = phase->name(); + string name = phase->name(); if (!kin || !kin->nReactions()) { continue; } @@ -167,7 +167,7 @@ std::string YamlWriter::toYamlString() const output["reactions"] = std::move(allReactions[phaseGroups.begin()->first]); } else { for (const auto& [canonicalPhase, dependentPhases] : phaseGroups) { - std::string groupName; + string groupName; for (auto& name : dependentPhases) { groupName += name + "-"; } @@ -176,7 +176,7 @@ std::string YamlWriter::toYamlString() const for (auto& name : dependentPhases) { AnyMap& phaseDef = output["phases"].getMapWhere("name", name); - phaseDef["reactions"] = vector{groupName}; + phaseDef["reactions"] = vector{groupName}; } } } @@ -186,13 +186,13 @@ std::string YamlWriter::toYamlString() const return output.toYamlString(); } -void YamlWriter::toYamlFile(const std::string& filename) const +void YamlWriter::toYamlFile(const string& filename) const { std::ofstream out(filename); out << toYamlString(); } -void YamlWriter::setUnits(const map& units) +void YamlWriter::setUnits(const map& units) { m_output_units = UnitSystem(); m_output_units.setDefaults(units); diff --git a/src/base/application.cpp b/src/base/application.cpp index 777d5b061..ff3346ddb 100644 --- a/src/base/application.cpp +++ b/src/base/application.cpp @@ -42,7 +42,7 @@ Application::Messages::Messages() logwriter = make_unique(); } -void Application::Messages::addError(const std::string& r, const std::string& msg) +void Application::Messages::addError(const string& r, const string& msg) { if (msg.size() != 0) { errorMessage.push_back( @@ -66,7 +66,7 @@ void Application::Messages::setLogger(Logger* _logwriter) logwriter.reset(_logwriter); } -void Application::Messages::writelog(const std::string& msg) +void Application::Messages::writelog(const string& msg) { logwriter->write(msg); } @@ -76,7 +76,7 @@ void Application::Messages::writelogendl() logwriter->writeendl(); } -void Application::Messages::warnlog(const std::string& warning, const std::string& msg) +void Application::Messages::warnlog(const string& warning, const string& msg) { logwriter->warn(warning, msg); } @@ -132,8 +132,8 @@ void Application::ApplicationDestroy() } } -void Application::warn_deprecated(const std::string& method, - const std::string& extra) +void Application::warn_deprecated(const string& method, + const string& extra) { if (m_fatal_deprecation_warnings) { throw CanteraError(method, "Deprecated: " + extra); @@ -144,9 +144,9 @@ void Application::warn_deprecated(const std::string& method, warnlog("Deprecation", fmt::format("{}: {}", method, extra)); } -void Application::warn(const std::string& warning, - const std::string& method, - const std::string& extra) +void Application::warn(const string& warning, + const string& method, + const string& extra) { if (m_fatal_warnings) { throw CanteraError(method, extra); @@ -162,8 +162,8 @@ void Application::thread_complete() } #ifdef _WIN32 -long int Application::readStringRegistryKey(const std::string& keyName, const std::string& valueName, - std::string& value, const std::string& defaultValue) +long int Application::readStringRegistryKey(const string& keyName, const string& valueName, + string& value, const string& defaultValue) { HKEY key; long open_error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName.c_str(), 0, KEY_READ, &key); @@ -190,7 +190,7 @@ void Application::Messages::popError() } } -std::string Application::Messages::lastErrorMessage() +string Application::Messages::lastErrorMessage() { if (!errorMessage.empty()) { return errorMessage.back(); @@ -226,9 +226,9 @@ void Application::setDefaultDirectories() // the OS-dependent path separator (in the same manner as the PATH // environment variable). #ifdef _WIN32 - std::string pathsep = ";"; + string pathsep = ";"; #else - std::string pathsep = ":"; + string pathsep = ":"; #endif if (getenv("CANTERA_DATA") != 0) { @@ -247,7 +247,7 @@ void Application::setDefaultDirectories() // Under Windows, the Cantera setup utility records the installation // directory in the registry. Data files are stored in the 'data' // subdirectory of the main installation directory. - std::string installDir; + string installDir; readStringRegistryKey("SOFTWARE\\Cantera\\Cantera " CANTERA_SHORT_VERSION, "InstallDir", installDir, ""); if (installDir != "") { @@ -256,7 +256,7 @@ void Application::setDefaultDirectories() // Scripts for converting mechanisms to YAML are installed in // the 'bin' subdirectory. Add that directory to the PYTHONPATH. const char* old_pythonpath = getenv("PYTHONPATH"); - std::string pythonpath = "PYTHONPATH=" + installDir + "\\bin"; + string pythonpath = "PYTHONPATH=" + installDir + "\\bin"; if (old_pythonpath) { pythonpath += ";"; pythonpath.append(old_pythonpath); @@ -275,7 +275,7 @@ void Application::setDefaultDirectories() #endif } -void Application::addDataDirectory(const std::string& dir) +void Application::addDataDirectory(const string& dir) { std::unique_lock dirLock(dir_mutex); if (inputDirs.empty()) { @@ -304,7 +304,7 @@ void Application::addDataDirectory(const std::string& dir) inputDirs.insert(inputDirs.begin(), d); } -std::string Application::findInputFile(const std::string& name) +string Application::findInputFile(const string& name) { std::unique_lock dirLock(dir_mutex); string::size_type islash = name.find('/'); diff --git a/src/base/application.h b/src/base/application.h index 312de134f..42ac37d6f 100644 --- a/src/base/application.h +++ b/src/base/application.h @@ -62,7 +62,7 @@ protected: * entire message. * @ingroup errGroup */ - void addError(const std::string& r, const std::string& msg=""); + void addError(const string& r, const string& msg=""); //! Return the number of errors that have been encountered so far. /*! @@ -87,7 +87,7 @@ protected: * * @ingroup errGroup */ - std::string lastErrorMessage(); + string lastErrorMessage(); //! Prints all of the error messages to an ostream /*! @@ -127,7 +127,7 @@ protected: * @param msg c++ string to be written to the screen * @ingroup logGroup */ - void writelog(const std::string& msg); + void writelog(const string& msg); //! Write an end of line character to the screen and flush output void writelogendl(); @@ -138,7 +138,7 @@ protected: * @param msg String to be written to the screen * @ingroup logGroup */ - void warnlog(const std::string& warning, const std::string& msg); + void warnlog(const string& warning, const string& msg); //! Install a logger. /*! @@ -153,7 +153,7 @@ protected: protected: //! Current list of error messages - vector errorMessage; + vector errorMessage; //! Current pointer to the logwriter unique_ptr logwriter; @@ -206,7 +206,7 @@ public: static void ApplicationDestroy(); //! @copydoc Messages::addError - void addError(const std::string& r, const std::string& msg="") { + void addError(const string& r, const string& msg="") { pMessenger->addError(r, msg); } @@ -221,7 +221,7 @@ public: } //! @copydoc Messages::lastErrorMessage - std::string lastErrorMessage() { + string lastErrorMessage() { return pMessenger->lastErrorMessage(); } @@ -241,7 +241,7 @@ public: * * @param dir String name for the directory to be added to the search path */ - void addDataDirectory(const std::string& dir); + void addDataDirectory(const string& dir); //! Find an input file. /*! @@ -264,7 +264,7 @@ public: * * @ingroup inputGroup */ - std::string findInputFile(const std::string& name); + string findInputFile(const string& name); //! Get the %Cantera data directories /*! @@ -276,7 +276,7 @@ public: * * @ingroup inputGroup */ - std::string getDataDirectories(const std::string& sep) { + string getDataDirectories(const string& sep) { return boost::algorithm::join(inputDirs, sep); } @@ -288,7 +288,7 @@ public: //! Python extensions, this is the name of the Python module containing the //! models. //! @since New in %Cantera 3.0 - void loadExtension(const std::string& extType, const std::string& name); + void loadExtension(const string& extType, const string& name); //! Set the versions of Python to try when loading user-defined extensions, //! in order of preference. Separate multiple versions with commas, for example @@ -297,12 +297,12 @@ public: void searchPythonVersions(const string& versions); #ifdef _WIN32 - long int readStringRegistryKey(const std::string& keyName, const std::string& valueName, - std::string& value, const std::string& defaultValue); + long int readStringRegistryKey(const string& keyName, const string& valueName, + string& value, const string& defaultValue); #endif //! @copydoc Messages::writelog - void writelog(const std::string& msg) { + void writelog(const string& msg) { pMessenger->writelog(msg); } @@ -312,7 +312,7 @@ public: } //! @copydoc Messages::warnlog - void warnlog(const std::string& warning, const std::string& msg) { + void warnlog(const string& warning, const string& msg) { pMessenger->warnlog(warning, msg); } @@ -320,7 +320,7 @@ public: //! information (removal version, alternatives) can be specified in //! *extra*. Deprecation warnings are printed once per method per //! invocation of the application. - void warn_deprecated(const std::string& method, const std::string& extra=""); + void warn_deprecated(const string& method, const string& extra=""); //! Globally disable printing of deprecation warnings. Used primarily to //! prevent certain tests from failing. @@ -339,8 +339,8 @@ public: //! @param warning Warning type; see Logger::warn() //! @param method Name of method triggering the warning //! @param extra Additional information printed for the warning - void warn(const std::string& warning, - const std::string& method, const std::string& extra=""); + void warn(const string& warning, + const string& method, const string& extra=""); //! Globally disable printing of (user) warnings. Used primarily to //! prevent certain tests from failing. @@ -432,7 +432,7 @@ protected: void setDefaultDirectories(); //! Current vector of input directories to search for input files - vector inputDirs; + vector inputDirs; //! Versions of Python to consider when attempting to load user extensions vector m_pythonSearchVersions = {"3.11", "3.10", "3.9", "3.8"}; diff --git a/src/base/checkFinite.cpp b/src/base/checkFinite.cpp index 85ed3aee1..cc97e2a09 100644 --- a/src/base/checkFinite.cpp +++ b/src/base/checkFinite.cpp @@ -25,11 +25,11 @@ void checkFinite(const double tmp) } } -void checkFinite(const std::string& name, double* values, size_t N) +void checkFinite(const string& name, double* values, size_t N) { for (size_t i = 0; i < N; i++) { if (!std::isfinite(values[i])) { - std::string message = name + " contains non-finite elements:\n\n"; + string message = name + " contains non-finite elements:\n\n"; for (size_t j = 0; j < N; j++) { if (!std::isfinite(values[j])) { message += fmt::format("{}[{}] = {}\n", name, j, values[j]); diff --git a/src/base/ctexceptions.cpp b/src/base/ctexceptions.cpp index cbe7039b4..06e697cc6 100644 --- a/src/base/ctexceptions.cpp +++ b/src/base/ctexceptions.cpp @@ -17,7 +17,7 @@ namespace Cantera static const char* stars = ("*****************************************" "**************************************\n"); -CanteraError::CanteraError(const std::string& procedure) : +CanteraError::CanteraError(const string& procedure) : procedure_(procedure) { } @@ -42,23 +42,23 @@ const char* CanteraError::what() const throw() return formattedMessage_.c_str(); } -std::string CanteraError::getMessage() const +string CanteraError::getMessage() const { return msg_; } -std::string CanteraError::getMethod() const +string CanteraError::getMethod() const { return procedure_; } -std::string ArraySizeError::getMessage() const +string ArraySizeError::getMessage() const { return fmt::format("Array size ({}) too small. Must be at least {}.", sz_, reqd_); } -std::string IndexError::getMessage() const +string IndexError::getMessage() const { return fmt::format("IndexError: {}[{}] outside valid range of 0 to {}.", arrayName_, m_, mmax_); diff --git a/src/base/global.cpp b/src/base/global.cpp index e416eaff3..72d5845da 100644 --- a/src/base/global.cpp +++ b/src/base/global.cpp @@ -33,7 +33,7 @@ void setLogger(Logger* logwriter) } } -void writelog_direct(const std::string& msg) +void writelog_direct(const string& msg) { app()->writelog(msg); } @@ -48,19 +48,19 @@ void writeline(char repeat, size_t count, bool endl_after, bool endl_before) if (endl_before) { writelogendl(); } - writelog_direct(std::string(count, repeat)); + writelog_direct(string(count, repeat)); if (endl_after) { writelogendl(); } } -void _warn_deprecated(const std::string& method, const std::string& extra) +void _warn_deprecated(const string& method, const string& extra) { app()->warn_deprecated(method, extra); } -void _warn(const std::string& warning, - const std::string& method, const std::string& extra) +void _warn(const string& warning, + const string& method, const string& extra) { app()->warn(warning, method, extra); } @@ -148,7 +148,7 @@ string version() return CANTERA_VERSION; } -std::string gitCommit() +string gitCommit() { #ifdef GIT_COMMIT return GIT_COMMIT; @@ -157,22 +157,22 @@ std::string gitCommit() #endif } -void addDirectory(const std::string& dir) +void addDirectory(const string& dir) { app()->addDataDirectory(dir); } -std::string getDataDirectories(const std::string& sep) +string getDataDirectories(const string& sep) { return app()->getDataDirectories(sep); } -std::string findInputFile(const std::string& name) +string findInputFile(const string& name) { return app()->findInputFile(name); } -void loadExtension(const std::string& extType, const std::string& name) +void loadExtension(const string& extType, const string& name) { app()->loadExtension(extType, name); } @@ -211,14 +211,14 @@ bool usesHDF5() vector FactoryBase::s_vFactoryRegistry; -std::string demangle(const std::type_info& type) +string demangle(const std::type_info& type) { - static map typenames = { + static map typenames = { {typeid(void).name(), "void"}, {typeid(double).name(), "double"}, {typeid(long int).name(), "long int"}, {typeid(bool).name(), "bool"}, - {typeid(std::string).name(), "string"}, + {typeid(string).name(), "string"}, {typeid(vector).name(), "vector"}, {typeid(vector).name(), "vector"}, {typeid(vector).name(), "vector"}, diff --git a/src/base/stringUtils.cpp b/src/base/stringUtils.cpp index 8b43de71e..ba5f36d06 100644 --- a/src/base/stringUtils.cpp +++ b/src/base/stringUtils.cpp @@ -30,8 +30,8 @@ namespace ba = boost::algorithm; namespace Cantera { -std::string vec2str(const vector& v, const std::string& fmt, - const std::string& sep) +string vec2str(const vector& v, const string& fmt, + const string& sep) { char buf[64]; std::stringstream o; @@ -45,9 +45,9 @@ std::string vec2str(const vector& v, const std::string& fmt, return o.str(); } -std::string stripnonprint(const std::string& s) +string stripnonprint(const string& s) { - std::string ss = ""; + string ss = ""; for (size_t i = 0; i < s.size(); i++) { if (isprint(s[i])) { ss += s[i]; @@ -73,7 +73,7 @@ Composition parseCompString(const string& ss, const vector& names) } size_t valstart = ss.find_first_not_of(" \t\n", colon+1); stop = ss.find_first_of(", ;\n\t", valstart); - std::string name = ba::trim_copy(ss.substr(start, colon-start)); + string name = ba::trim_copy(ss.substr(start, colon-start)); if (!names.empty() && x.find(name) == x.end()) { throw CanteraError("parseCompString", "unknown species '" + name + "'"); @@ -87,7 +87,7 @@ Composition parseCompString(const string& ss, const vector& names) // this case, take the current substring as part of the key and look // to the right of the next colon for the corresponding value. // Otherwise, this is an invalid composition string. - std::string testname = ss.substr(start, stop-start); + string testname = ss.substr(start, stop-start); if (testname.find_first_of(" \n\t") != npos) { // Space, tab, and newline are never allowed in names throw; @@ -119,7 +119,7 @@ Composition parseCompString(const string& ss, const vector& names) return x; } -double fpValue(const std::string& val) +double fpValue(const string& val) { double rval; std::stringstream ss(val); @@ -128,9 +128,9 @@ double fpValue(const std::string& val) return rval; } -double fpValueCheck(const std::string& val) +double fpValueCheck(const string& val) { - std::string str = ba::trim_copy(val); + string str = ba::trim_copy(val); if (str.empty()) { throw CanteraError("fpValueCheck", "string has zero length"); } @@ -182,9 +182,9 @@ double fpValueCheck(const std::string& val) return fpValue(str); } -void tokenizeString(const std::string& in_val, vector& v) +void tokenizeString(const string& in_val, vector& v) { - std::string val = ba::trim_copy(in_val); + string val = ba::trim_copy(in_val); v.clear(); if (val.empty()) { // In this case, prefer v to be empty instead of split's behavior of @@ -194,14 +194,14 @@ void tokenizeString(const std::string& in_val, vector& v) ba::split(v, val, ba::is_space(), ba::token_compress_on); } -void tokenizePath(const std::string& in_val, vector& v) +void tokenizePath(const string& in_val, vector& v) { - std::string val = ba::trim_copy(in_val); + string val = ba::trim_copy(in_val); v.clear(); ba::split(v, val, ba::is_any_of("/\\"), ba::token_compress_on); } -size_t copyString(const std::string& source, char* dest, size_t length) +size_t copyString(const string& source, char* dest, size_t length) { const char* c_src = source.c_str(); size_t N = std::min(length, source.length()+1); @@ -213,15 +213,15 @@ size_t copyString(const std::string& source, char* dest, size_t length) return ret; } -std::string trimCopy(const std::string &input) { +string trimCopy(const string &input) { return ba::trim_copy(input); } -std::string toLowerCopy(const std::string &input) { +string toLowerCopy(const string &input) { return ba::to_lower_copy(input); } -bool caseInsensitiveEquals(const std::string &input, const std::string &test) { +bool caseInsensitiveEquals(const string &input, const string &test) { return ba::iequals(input, test); } diff --git a/src/equil/MultiPhase.cpp b/src/equil/MultiPhase.cpp index 8f50a3ba1..7403506bb 100644 --- a/src/equil/MultiPhase.cpp +++ b/src/equil/MultiPhase.cpp @@ -201,7 +201,7 @@ double MultiPhase::charge() const return sum; } -size_t MultiPhase::speciesIndex(const std::string& speciesName, const std::string& phaseName) +size_t MultiPhase::speciesIndex(const string& speciesName, const string& phaseName) { if (!m_init) { init(); @@ -350,7 +350,7 @@ void MultiPhase::setMolesByName(const Composition& xMap) setMoles(moles.data()); } -void MultiPhase::setMolesByName(const std::string& x) +void MultiPhase::setMolesByName(const string& x) { // build the composition map from the string, and then set the moles. Composition xx = parseCompString(x, m_snames); @@ -630,7 +630,7 @@ double MultiPhase::equilibrate_MultiPhaseEquil(int XY, double err, return -1.0; } -void MultiPhase::equilibrate(const std::string& XY, const std::string& solver, +void MultiPhase::equilibrate(const string& XY, const string& solver, double rtol, int max_steps, int max_iter, int estimate_equil, int log_level) { @@ -717,12 +717,12 @@ void MultiPhase::checkElementArraySize(size_t mm) const } } -std::string MultiPhase::elementName(size_t m) const +string MultiPhase::elementName(size_t m) const { return m_enames[m]; } -size_t MultiPhase::elementIndex(const std::string& name) const +size_t MultiPhase::elementIndex(const string& name) const { for (size_t e = 0; e < m_nel; e++) { if (m_enames[e] == name) { @@ -746,7 +746,7 @@ void MultiPhase::checkSpeciesArraySize(size_t kk) const } } -std::string MultiPhase::speciesName(const size_t k) const +string MultiPhase::speciesName(const size_t k) const { return m_snames[k]; } @@ -761,12 +761,12 @@ void MultiPhase::getMoleFractions(double* const x) const std::copy(m_moleFractions.begin(), m_moleFractions.end(), x); } -std::string MultiPhase::phaseName(const size_t iph) const +string MultiPhase::phaseName(const size_t iph) const { return m_phase[iph]->name(); } -int MultiPhase::phaseIndex(const std::string& pName) const +int MultiPhase::phaseIndex(const string& pName) const { for (int iph = 0; iph < (int) nPhases(); iph++) { if (m_phase[iph]->name() == pName) { diff --git a/src/equil/MultiPhaseEquil.cpp b/src/equil/MultiPhaseEquil.cpp index fe0082cb6..0ee83ad07 100644 --- a/src/equil/MultiPhaseEquil.cpp +++ b/src/equil/MultiPhaseEquil.cpp @@ -657,7 +657,7 @@ double MultiPhaseEquil::phaseMoles(size_t iph) const return m_mix->phaseMoles(iph); } -void MultiPhaseEquil::reportCSV(const std::string& reportFile) +void MultiPhaseEquil::reportCSV(const string& reportFile) { FILE* FP = fopen(reportFile.c_str(), "w"); if (!FP) { diff --git a/src/equil/vcs_MultiPhaseEquil.cpp b/src/equil/vcs_MultiPhaseEquil.cpp index 66d5b427e..297aa6b2e 100644 --- a/src/equil/vcs_MultiPhaseEquil.cpp +++ b/src/equil/vcs_MultiPhaseEquil.cpp @@ -488,7 +488,7 @@ int vcs_MultiPhaseEquil::equilibrate_TP(int estimateEquil, return iSuccess; } -void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) +void vcs_MultiPhaseEquil::reportCSV(const string& reportFile) { size_t nphase = m_vsolve.m_numPhases; @@ -569,7 +569,7 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) " (J/kmol), (J/kmol), (kmol), (m**3/kmol), (m**3)\n"); } for (size_t k = 0; k < nSpecies; k++) { - std::string sName = tref.speciesName(k); + string sName = tref.speciesName(k); fprintf(FP,"%12s, %11s, %11.3e, %11.3e, %11.3e, %11.3e, %11.3e," "%11.3e, %11.3e, %11.3e, %11.3e, %11.3e\n", sName.c_str(), @@ -593,7 +593,7 @@ void vcs_MultiPhaseEquil::reportCSV(const std::string& reportFile) molalities[k] = 0.0; } for (size_t k = 0; k < nSpecies; k++) { - std::string sName = tref.speciesName(k); + string sName = tref.speciesName(k); fprintf(FP,"%12s, %11s, %11.3e, %11.3e, %11.3e, %11.3e, %11.3e, " "%11.3e, %11.3e,% 11.3e, %11.3e, %11.3e\n", sName.c_str(), diff --git a/src/equil/vcs_VolPhase.cpp b/src/equil/vcs_VolPhase.cpp index a2f1dd649..6d5c444b1 100644 --- a/src/equil/vcs_VolPhase.cpp +++ b/src/equil/vcs_VolPhase.cpp @@ -753,7 +753,7 @@ size_t vcs_VolPhase::nElemConstraints() const return m_numElemConstraints; } -std::string vcs_VolPhase::elementName(const size_t e) const +string vcs_VolPhase::elementName(const size_t e) const { return m_elementNames[e]; } @@ -831,7 +831,7 @@ size_t vcs_VolPhase::transferElementsFM(const ThermoPhase* const tPhase) eFound = ne; m_elementType[ne] = VCS_ELEM_TYPE_ELECTRONCHARGE; m_elementActive[ne] = 0; - std::string ename = "E"; + string ename = "E"; m_elementNames[ne] = ename; ne++; elemResize(ne); @@ -850,7 +850,7 @@ size_t vcs_VolPhase::transferElementsFM(const ThermoPhase* const tPhase) } if (cne) { - std::string pname = tPhase->name(); + string pname = tPhase->name(); if (pname == "") { pname = fmt::format("phase{}", VP_ID_); } @@ -911,7 +911,7 @@ size_t vcs_VolPhase::nSpecies() const return m_numSpecies; } -std::string vcs_VolPhase::eos_name() const +string vcs_VolPhase::eos_name() const { switch (m_eqnState) { case VCS_EOS_CONSTANT: diff --git a/src/equil/vcs_solve.cpp b/src/equil/vcs_solve.cpp index 1d1163547..f385d1267 100644 --- a/src/equil/vcs_solve.cpp +++ b/src/equil/vcs_solve.cpp @@ -152,7 +152,7 @@ VCS_SOLVE::VCS_SOLVE(MultiPhase* mphase, int printLvl) : size_t nelem = tPhase->nElements(); // Query Cantera for the equation of state type of the current phase. - std::string eos = tPhase->type(); + string eos = tPhase->type(); bool gasPhase = (eos == "ideal-gas"); // Find out the number of species in the phase @@ -857,7 +857,7 @@ size_t VCS_SOLVE::vcs_RxnStepSizes(int& forceComponentCalc, size_t& kSpecial) { size_t iphDel = npos; size_t k = 0; - std::string ANOTE; + string ANOTE; if (m_debug_print_lvl >= 2) { plogf(" "); for (int j = 0; j < 82; j++) { @@ -3384,12 +3384,12 @@ void VCS_SOLVE::addPhaseElements(vcs_VolPhase* volPhase) // Loop through the elements in the vol phase object for (size_t eVP = 0; eVP < neVP; eVP++) { size_t foundPos = npos; - std::string enVP = volPhase->elementName(eVP); + string enVP = volPhase->elementName(eVP); // Search for matches with the existing elements. If found, then fill in // the entry in the global mapping array. for (size_t e = 0; e < m_nelem; e++) { - std::string en = m_elementName[e]; + string en = m_elementName[e]; if (!strcmp(enVP.c_str(), en.c_str())) { volPhase->setElemGlobalIndex(eVP, e); foundPos = e; diff --git a/src/fortran/fct.cpp b/src/fortran/fct.cpp index 36922f69d..f6fdc514e 100644 --- a/src/fortran/fct.cpp +++ b/src/fortran/fct.cpp @@ -64,10 +64,10 @@ Transport* _ftrans(const integer* n) } // unnamed namespace -std::string f2string(const char* s, ftnlen n) +string f2string(const char* s, ftnlen n) { int k; - std::string ss = ""; + string ss = ""; for (k = 0; k < n; k++) { if (s[k] == '\0') { break; @@ -85,8 +85,8 @@ extern "C" { status_t cantera_error_(const char* proc, const char* msg, ftnlen proclen, ftnlen msglen) { - std::string sproc = f2string(proc, proclen); - std::string smsg = f2string(msg, msglen); + string sproc = f2string(proc, proclen); + string smsg = f2string(msg, msglen); throw CanteraError(sproc, smsg); return -1; } @@ -102,7 +102,7 @@ extern "C" { ftnlen lennm) { try { - std::string pnm = _fph(n)->name(); + string pnm = _fph(n)->name(); int lout = std::min(lennm, (int) pnm.size()); std::copy(pnm.c_str(), pnm.c_str() + lout, nm); for (int nn = lout; nn < lennm; nn++) { @@ -191,7 +191,7 @@ extern "C" { integer phase_elementindex_(const integer* n, char* nm, ftnlen lennm) { try { - std::string elnm = f2string(nm, lennm); + string elnm = f2string(nm, lennm); return _fph(n)->elementIndex(elnm) + 1; } catch (...) { return handleAllExceptions(-1, ERR); @@ -201,7 +201,7 @@ extern "C" { integer phase_speciesindex_(const integer* n, char* nm, ftnlen lennm) { try { - std::string spnm = f2string(nm, lennm); + string spnm = f2string(nm, lennm); return _fph(n)->speciesIndex(spnm) + 1; } catch (...) { return handleAllExceptions(-1, ERR); @@ -327,7 +327,7 @@ extern "C" { status_t phase_getspeciesname_(const integer* n, integer* k, char* nm, ftnlen lennm) { try { - std::string spnm = _fph(n)->speciesName(*k-1); + string spnm = _fph(n)->speciesName(*k-1); int lout = std::min(lennm, (int) spnm.size()); std::copy(spnm.c_str(), spnm.c_str() + lout, nm); for (int nn = lout; nn < lennm; nn++) { @@ -342,7 +342,7 @@ extern "C" { status_t phase_getelementname_(const integer* n, integer* m, char* nm, ftnlen lennm) { try { - std::string elnm = _fph(n)->elementName(*m-1); + string elnm = _fph(n)->elementName(*m-1); int lout = std::min(lennm, (int) elnm.size()); std::copy(elnm.c_str(), elnm.c_str() + lout, nm); for (int nn = lout; nn < lennm; nn++) { @@ -793,7 +793,7 @@ extern "C" { status_t kin_getreactiontype_(const integer* n, integer* i, char* buf, ftnlen lenbuf) { try { - std::string r = _fkin(n)->reaction(*i-1)->type(); + string r = _fkin(n)->reaction(*i-1)->type(); int lout = std::min(lenbuf, (int) r.size()); std::copy(r.c_str(), r.c_str() + lout, buf); for (int nn = lout; nn < lenbuf; nn++) { @@ -904,7 +904,7 @@ extern "C" { { try { Kinetics* k = _fkin(n); - std::string r = k->reaction(*i-1)->equation(); + string r = k->reaction(*i-1)->equation(); int lout = std::min(lenbuf, (int) r.size()); std::copy(r.c_str(), r.c_str() + lout, buf); for (int nn = lout; nn < lenbuf; nn++) { @@ -948,7 +948,7 @@ extern "C" { integer* loglevel, ftnlen lenmodel) { try { - std::string mstr = f2string(model, lenmodel); + string mstr = f2string(model, lenmodel); auto t = _fthermo(ith); auto tr = newTransport(t, mstr); return TransportCabinet::add(tr); @@ -1072,7 +1072,7 @@ extern "C" { { try { bool stherm = (*show_thermo != 0); - std::string s = _fth(nth)->report(stherm); + string s = _fth(nth)->report(stherm); if (int(s.size()) > buflen - 1) { return -(s.size() + 1); } @@ -1089,7 +1089,7 @@ extern "C" { status_t ctgetcanteraerror_(char* buf, ftnlen buflen) { try { - std::string e; + string e; e = Application::Instance()->lastErrorMessage(); int n = std::min((int) e.size(), buflen-1); copy(e.begin(), e.begin() + n, buf); @@ -1105,7 +1105,7 @@ extern "C" { status_t ctaddcanteradirectory_(integer* buflen, char* buf) { try { - addDirectory(std::string(buf)); + addDirectory(string(buf)); } catch (...) { return handleAllExceptions(-1, ERR); } diff --git a/src/kinetics/Arrhenius.cpp b/src/kinetics/Arrhenius.cpp index 32cbece71..ecd89b203 100644 --- a/src/kinetics/Arrhenius.cpp +++ b/src/kinetics/Arrhenius.cpp @@ -120,7 +120,7 @@ void ArrheniusBase::getParameters(AnyMap& node) const { } } -void ArrheniusBase::check(const std::string& equation) +void ArrheniusBase::check(const string& equation) { if (!m_negativeA_ok && m_A < 0) { if (equation == "") { @@ -135,7 +135,7 @@ void ArrheniusBase::check(const std::string& equation) } } -void ArrheniusBase::validate(const std::string& equation, const Kinetics& kin) +void ArrheniusBase::validate(const string& equation, const Kinetics& kin) { if (!valid()) { throw InputFileError("ArrheniusBase::validate", m_input, diff --git a/src/kinetics/ChebyshevRate.cpp b/src/kinetics/ChebyshevRate.cpp index 370aac13c..3fcd72cf2 100644 --- a/src/kinetics/ChebyshevRate.cpp +++ b/src/kinetics/ChebyshevRate.cpp @@ -157,7 +157,7 @@ void ChebyshevRate::getParameters(AnyMap& rateNode) const rateNode["data"].setQuantity(coeffs, converter); } -void ChebyshevRate::validate(const std::string& equation, const Kinetics& kin) +void ChebyshevRate::validate(const string& equation, const Kinetics& kin) { if (!valid()) { throw InputFileError("ChebyshevRate::validate", m_input, diff --git a/src/kinetics/Custom.cpp b/src/kinetics/Custom.cpp index 70c69fa66..79202285f 100644 --- a/src/kinetics/Custom.cpp +++ b/src/kinetics/Custom.cpp @@ -21,7 +21,7 @@ void CustomFunc1Rate::setRateFunction(shared_ptr f) m_valid = true; } -void CustomFunc1Rate::validate(const std::string& equation, const Kinetics& kin) +void CustomFunc1Rate::validate(const string& equation, const Kinetics& kin) { if (!m_ratefunc) { throw InputFileError("CustomFunc1Rate::validate", m_input, diff --git a/src/kinetics/Falloff.cpp b/src/kinetics/Falloff.cpp index 80f1a0032..11bf7340c 100644 --- a/src/kinetics/Falloff.cpp +++ b/src/kinetics/Falloff.cpp @@ -182,7 +182,7 @@ void FalloffRate::getParameters(AnyMap& node) const } } -void FalloffRate::check(const std::string& equation) +void FalloffRate::check(const string& equation) { m_lowRate.check(equation); m_highRate.check(equation); @@ -197,7 +197,7 @@ void FalloffRate::check(const std::string& equation) } } -void FalloffRate::validate(const std::string& equation, const Kinetics& kin) +void FalloffRate::validate(const string& equation, const Kinetics& kin) { try { m_lowRate.validate(equation, kin); diff --git a/src/kinetics/Group.cpp b/src/kinetics/Group.cpp index 719cc09ca..e55955a33 100644 --- a/src/kinetics/Group.cpp +++ b/src/kinetics/Group.cpp @@ -37,7 +37,7 @@ void Group::validate() } std::ostream& Group::fmt(std::ostream& s, - const vector& esymbols) const + const vector& esymbols) const { s << "("; bool first = true; diff --git a/src/kinetics/InterfaceKinetics.cpp b/src/kinetics/InterfaceKinetics.cpp index bb3aafa9a..24c53548c 100644 --- a/src/kinetics/InterfaceKinetics.cpp +++ b/src/kinetics/InterfaceKinetics.cpp @@ -423,7 +423,7 @@ bool InterfaceKinetics::addReaction(shared_ptr r_base, bool resize) rate->setRateIndex(nReactions() - 1); rate->setContext(*r_base, *this); - std::string rtype = rate->subType(); + string rtype = rate->subType(); if (rtype == "") { rtype = rate->type(); } @@ -460,7 +460,7 @@ void InterfaceKinetics::modifyReaction(size_t i, shared_ptr r_base) rate->setRateIndex(i); rate->setContext(*r_base, *this); - std::string rtype = rate->subType(); + string rtype = rate->subType(); if (rtype == "") { rtype = rate->type(); } diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 95cbab878..86b1c01d0 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -266,7 +266,7 @@ string Kinetics::kineticsSpeciesName(size_t k) const return ""; } -size_t Kinetics::kineticsSpeciesIndex(const std::string& nm) const +size_t Kinetics::kineticsSpeciesIndex(const string& nm) const { for (size_t n = 0; n < m_thermo.size(); n++) { // Check the ThermoPhase object for a match @@ -278,8 +278,8 @@ size_t Kinetics::kineticsSpeciesIndex(const std::string& nm) const return npos; } -size_t Kinetics::kineticsSpeciesIndex(const std::string& nm, - const std::string& ph) const +size_t Kinetics::kineticsSpeciesIndex(const string& nm, + const string& ph) const { warn_deprecated("Kinetics::kineticsSpeciesIndex(species_name, phase_name)", "To be removed after Cantera 3.0. Use kineticsSpeciesIndex(species_name).\n" @@ -301,7 +301,7 @@ size_t Kinetics::kineticsSpeciesIndex(const std::string& nm, return npos; } -ThermoPhase& Kinetics::speciesPhase(const std::string& nm) +ThermoPhase& Kinetics::speciesPhase(const string& nm) { for (size_t n = 0; n < m_thermo.size(); n++) { size_t k = thermo(n).speciesIndex(nm); @@ -312,7 +312,7 @@ ThermoPhase& Kinetics::speciesPhase(const std::string& nm) throw CanteraError("Kinetics::speciesPhase", "unknown species '{}'", nm); } -const ThermoPhase& Kinetics::speciesPhase(const std::string& nm) const +const ThermoPhase& Kinetics::speciesPhase(const string& nm) const { for (const auto thermo : m_thermo) { if (thermo->speciesIndex(nm) != npos) { @@ -343,31 +343,31 @@ double Kinetics::productStoichCoeff(size_t kSpec, size_t irxn) const return m_productStoich.stoichCoeffs().coeff(kSpec, irxn); } -std::string Kinetics::reactionType(size_t i) const { +string Kinetics::reactionType(size_t i) const { warn_deprecated("Kinetics::reactionType", "To be removed after Cantera 3.0."); return m_reactions[i]->type(); } -std::string Kinetics::reactionTypeStr(size_t i) const { +string Kinetics::reactionTypeStr(size_t i) const { warn_deprecated("Kinetics::reactionTypeStr", "To be removed after Cantera 3.0."); return reactionType(i); } -std::string Kinetics::reactionString(size_t i) const +string Kinetics::reactionString(size_t i) const { warn_deprecated("Kinetics::reactionString", "To be removed after Cantera 3.0."); return m_reactions[i]->equation(); } //! Returns a string containing the reactants side of the reaction equation. -std::string Kinetics::reactantString(size_t i) const +string Kinetics::reactantString(size_t i) const { warn_deprecated("Kinetics::reactantString", "To be removed after Cantera 3.0."); return m_reactions[i]->reactantString(); } //! Returns a string containing the products side of the reaction equation. -std::string Kinetics::productString(size_t i) const +string Kinetics::productString(size_t i) const { warn_deprecated("Kinetics::productString", "To be removed after Cantera 3.0."); return m_reactions[i]->productString(); diff --git a/src/kinetics/KineticsFactory.cpp b/src/kinetics/KineticsFactory.cpp index 5b2e586f8..e29693ae2 100644 --- a/src/kinetics/KineticsFactory.cpp +++ b/src/kinetics/KineticsFactory.cpp @@ -79,7 +79,7 @@ shared_ptr newKinetics(const vector>& phases, const AnyMap& rootNode, shared_ptr soln) { - std::string kinType = phaseNode.getString("kinetics", "none"); + string kinType = phaseNode.getString("kinetics", "none"); kinType = KineticsFactory::factory()->canonicalize(kinType); if (kinType == "none") { // determine phase with minimum number of dimensions @@ -114,7 +114,7 @@ unique_ptr newKinetics(const vector& phases, warn_deprecated("newKinetics(vector&, AnyMap&, AnyMap&)", "To be removed after Cantera 3.0; superseded by\nnewKinetics" "(const vector>&, const AnyMap&, const AnyMap&)."); - std::string kinType = phaseNode.getString("kinetics", "none"); + string kinType = phaseNode.getString("kinetics", "none"); kinType = KineticsFactory::factory()->canonicalize(kinType); if (kinType == "none") { // determine phase with minimum number of dimensions @@ -155,8 +155,8 @@ shared_ptr newKinetics(const vector>& phases, } unique_ptr newKinetics(const vector& phases, - const std::string& filename, - const std::string& phase_name) + const string& filename, + const string& phase_name) { warn_deprecated("newKinetics(vector&, const string&, const string&)", "To be removed after Cantera 3.0; superseded by\nnewKinetics" diff --git a/src/kinetics/PlogRate.cpp b/src/kinetics/PlogRate.cpp index d679aad7d..9ed006e75 100644 --- a/src/kinetics/PlogRate.cpp +++ b/src/kinetics/PlogRate.cpp @@ -125,7 +125,7 @@ void PlogRate::setRates(const std::multimap& rates) pressures_.insert({1000.0, pressures_.rbegin()->second}); } -void PlogRate::validate(const std::string& equation, const Kinetics& kin) +void PlogRate::validate(const string& equation, const Kinetics& kin) { if (!valid()) { throw InputFileError("PlogRate::validate", m_input, @@ -157,7 +157,7 @@ void PlogRate::validate(const std::string& equation, const Kinetics& kin) } } -void PlogRate::validate(const std::string& equation) { +void PlogRate::validate(const string& equation) { warn_deprecated("PlogRate::validate", "To be removed after Cantera 3.0; superseded by two-parameter version."); validate(equation, Kinetics()); diff --git a/src/kinetics/Reaction.cpp b/src/kinetics/Reaction.cpp index 0bcb2cf29..6812af8dd 100644 --- a/src/kinetics/Reaction.cpp +++ b/src/kinetics/Reaction.cpp @@ -54,7 +54,7 @@ Reaction::Reaction(const Composition& reactants_, } } -Reaction::Reaction(const std::string& equation, +Reaction::Reaction(const string& equation, shared_ptr rate_, shared_ptr tbody_) : m_third_body(tbody_) @@ -68,7 +68,7 @@ Reaction::Reaction(const std::string& equation, Reaction::Reaction(const AnyMap& node, const Kinetics& kin) { - std::string rate_type = node.getString("type", "Arrhenius"); + string rate_type = node.getString("type", "Arrhenius"); if (!kin.nPhases()) { throw InputFileError("Reaction", node, "Cannot instantiate Reaction with empty Kinetics object."); @@ -191,7 +191,7 @@ void Reaction::getParameters(AnyMap& reactionNode) const reactionNode.update(m_rate->parameters()); // strip information not needed for reconstruction - std::string rtype = reactionNode["type"].asString(); + string rtype = reactionNode["type"].asString(); if (rtype == "pressure-dependent-Arrhenius") { // skip } else if (m_explicit_type && ba::ends_with(rtype, "Arrhenius")) { @@ -260,7 +260,7 @@ void Reaction::setRate(shared_ptr rate) } m_rate = rate; - std::string rate_type = m_rate->type(); + string rate_type = m_rate->type(); if (m_third_body) { if (rate_type == "falloff" || rate_type == "chemically-activated") { if (m_third_body->mass_action && !m_from_composition) { @@ -294,7 +294,7 @@ void Reaction::setRate(shared_ptr rate) } } -std::string Reaction::reactantString() const +string Reaction::reactantString() const { std::ostringstream result; for (auto iter = reactants.begin(); iter != reactants.end(); ++iter) { @@ -312,7 +312,7 @@ std::string Reaction::reactantString() const return result.str(); } -std::string Reaction::productString() const +string Reaction::productString() const { std::ostringstream result; for (auto iter = products.begin(); iter != products.end(); ++iter) { @@ -330,7 +330,7 @@ std::string Reaction::productString() const return result.str(); } -std::string Reaction::equation() const +string Reaction::equation() const { if (reversible) { return reactantString() + " <=> " + productString(); @@ -339,11 +339,11 @@ std::string Reaction::equation() const } } -void Reaction::setEquation(const std::string& equation, const Kinetics* kin) +void Reaction::setEquation(const string& equation, const Kinetics* kin) { parseReactionEquation(*this, equation, input, kin); - std::string rate_type = input.getString("type", ""); + string rate_type = input.getString("type", ""); if (ba::starts_with(rate_type, "three-body")) { // state type when serializing m_explicit_type = true; @@ -356,7 +356,7 @@ void Reaction::setEquation(const std::string& equation, const Kinetics* kin) return; } - std::string third_body; + string third_body; size_t count = 0; size_t countM = 0; for (const auto& [name, stoich] : reactants) { @@ -461,7 +461,7 @@ void Reaction::setEquation(const std::string& equation, const Kinetics* kin) } if (m_third_body) { - std::string tName = m_third_body->name(); + string tName = m_third_body->name(); if (tName != third_body && third_body != "M" && tName != "M") { throw InputFileError("Reaction::setEquation", input, "Detected incompatible third body colliders in reaction '{}'\n" @@ -489,14 +489,14 @@ void Reaction::setEquation(const std::string& equation, const Kinetics* kin) } } -std::string Reaction::type() const +string Reaction::type() const { if (!m_rate) { throw CanteraError("Reaction::type", "Empty Reaction does not have a type"); } - std::string rate_type = m_rate->type(); - std::string sub_type = m_rate->subType(); + string rate_type = m_rate->type(); + string sub_type = m_rate->subType(); if (sub_type != "") { return rate_type + "-" + sub_type; } @@ -552,7 +552,7 @@ UnitStack Reaction::calculateRateCoeffUnits(const Kinetics& kin) return rate_units; } -void updateUndeclared(vector& undeclared, +void updateUndeclared(vector& undeclared, const Composition& comp, const Kinetics& kin) { for (const auto& [name, stoich]: comp) { @@ -583,7 +583,7 @@ void Reaction::checkBalance(const Kinetics& kin) const } } - std::string msg; + string msg; bool ok = true; for (const auto& [elem, balance] : balr) { double elemsum = balr[elem] + balp[elem]; @@ -632,7 +632,7 @@ void Reaction::checkBalance(const Kinetics& kin) const bool Reaction::checkSpecies(const Kinetics& kin) const { // Check for undeclared species - vector undeclared; + vector undeclared; updateUndeclared(undeclared, reactants, kin); updateUndeclared(undeclared, products, kin); if (!undeclared.empty()) { @@ -712,14 +712,14 @@ ThirdBody::ThirdBody(double default_eff) "after Cantera 3.0. Instantiate with collider name instead."); } -ThirdBody::ThirdBody(const std::string& third_body) +ThirdBody::ThirdBody(const string& third_body) { setName(third_body); } -void ThirdBody::setName(const std::string& third_body) +void ThirdBody::setName(const string& third_body) { - std::string name = third_body; + string name = third_body; if (ba::starts_with(third_body, "(+ ")) { mass_action = false; name = third_body.substr(3, third_body.size() - 4); @@ -792,12 +792,12 @@ void ThirdBody::getParameters(AnyMap& node) const } } -double ThirdBody::efficiency(const std::string& k) const +double ThirdBody::efficiency(const string& k) const { return getValue(efficiencies, k, default_efficiency); } -std::string ThirdBody::collider() const +string ThirdBody::collider() const { if (mass_action) { return " + " + m_name; @@ -807,7 +807,7 @@ std::string ThirdBody::collider() const bool ThirdBody::checkSpecies(const Reaction& rxn, const Kinetics& kin) const { - vector undeclared; + vector undeclared; updateUndeclared(undeclared, efficiencies, kin); if (!undeclared.empty()) { @@ -878,7 +878,7 @@ FalloffReaction::FalloffReaction(const Composition& reactants_, m_third_body = make_shared(tbody_); AnyMap node = rate_.parameters(); node.applyUnits(); - std::string rate_type = node["type"].asString(); + string rate_type = node["type"].asString(); setRate(newReactionRate(node)); } @@ -893,7 +893,7 @@ FalloffReaction::FalloffReaction(const AnyMap& node, const Kinetics& kin) } } -unique_ptr newReaction(const std::string& type) +unique_ptr newReaction(const string& type) { return make_unique(); } @@ -903,12 +903,12 @@ unique_ptr newReaction(const AnyMap& rxn_node, const Kinetics& kin) return make_unique(rxn_node, kin); } -void parseReactionEquation(Reaction& R, const std::string& equation, +void parseReactionEquation(Reaction& R, const string& equation, const AnyBase& reactionNode, const Kinetics* kin) { // Parse the reaction equation to determine participating species and // stoichiometric coefficients - vector tokens; + vector tokens; tokenizeString(equation, tokens); tokens.push_back("+"); // makes parsing last species not a special case @@ -917,7 +917,7 @@ void parseReactionEquation(Reaction& R, const std::string& equation, for (size_t i = 1; i < tokens.size(); i++) { if (tokens[i] == "+" || ba::starts_with(tokens[i], "(+") || tokens[i] == "<=>" || tokens[i] == "=" || tokens[i] == "=>") { - std::string species = tokens[i-1]; + string species = tokens[i-1]; double stoich = 1.0; bool mass_action = true; diff --git a/src/kinetics/ReactionRateFactory.cpp b/src/kinetics/ReactionRateFactory.cpp index b39b3f7ab..55dc46381 100644 --- a/src/kinetics/ReactionRateFactory.cpp +++ b/src/kinetics/ReactionRateFactory.cpp @@ -114,7 +114,7 @@ void ReactionRateFactory::deleteFactory() { s_factory = 0; } -shared_ptr newReactionRate(const std::string& type) +shared_ptr newReactionRate(const string& type) { return shared_ptr ( ReactionRateFactory::factory()->create(type, AnyMap(), UnitStack({}))); @@ -123,7 +123,7 @@ shared_ptr newReactionRate(const std::string& type) shared_ptr newReactionRate( const AnyMap& rate_node, const UnitStack& rate_units) { - std::string type = ""; // default is to create Arrhenius from empty + string type = ""; // default is to create Arrhenius from empty if (rate_node.hasKey("type")) { type = rate_node["type"].asString(); } diff --git a/src/matlab/ctmatutils.h b/src/matlab/ctmatutils.h index 3d96418a0..edbd7a45e 100644 --- a/src/matlab/ctmatutils.h +++ b/src/matlab/ctmatutils.h @@ -39,13 +39,13 @@ inline char* getString(const mxArray* p) size_t m = mxGetM(p); size_t n = mxGetN(p); mwSize buflen = (mwSize)(m*n + 1); - std::string msg; + string msg; if (m == 1) { input_buf = (char*)mxCalloc(buflen, sizeof(char)); status = mxGetString(p, input_buf, buflen); if (status != 0) { - msg = std::string(input_buf) + msg = string(input_buf) + "\nNot enough space. String is truncated."; mexWarnMsgTxt(msg.c_str()); } diff --git a/src/matlab/kineticsmethods.cpp b/src/matlab/kineticsmethods.cpp index c4d4abe38..9ae152347 100644 --- a/src/matlab/kineticsmethods.cpp +++ b/src/matlab/kineticsmethods.cpp @@ -22,8 +22,8 @@ void kineticsmethods(int nlhs, mxArray* plhs[], // construct a new instance if (job == 0) { checkNArgs(10, nrhs); - std::string fileName = getString(prhs[3]); - std::string phaseName = getString(prhs[4]); + string fileName = getString(prhs[3]); + string phaseName = getString(prhs[4]); if (phaseName == "-") { phaseName = ""; } diff --git a/src/matlab/mllogger.h b/src/matlab/mllogger.h index 1cc220bfb..cc07686c1 100644 --- a/src/matlab/mllogger.h +++ b/src/matlab/mllogger.h @@ -20,7 +20,7 @@ public: ML_Logger() {} virtual ~ML_Logger() {} - virtual void write(const std::string& s) { + virtual void write(const string& s) { mexPrintf("%s", s.c_str()); } @@ -28,7 +28,7 @@ public: mexPrintf("\n"); } - virtual void error(const std::string& msg) { + virtual void error(const string& msg) { mexErrMsgTxt(msg.c_str()); } }; diff --git a/src/matlab/thermomethods.cpp b/src/matlab/thermomethods.cpp index f9876b652..b98debfb3 100644 --- a/src/matlab/thermomethods.cpp +++ b/src/matlab/thermomethods.cpp @@ -121,8 +121,8 @@ static void thermoget(int nlhs, mxArray* plhs[], if (job == 0) { checkNArgs(5, nrhs); - std::string fileName = getString(prhs[3]); - std::string phaseName = getString(prhs[4]); + string fileName = getString(prhs[3]); + string phaseName = getString(prhs[4]); if (phaseName == "-") { phaseName = ""; } diff --git a/src/numerics/Func1.cpp b/src/numerics/Func1.cpp index 6acab36ae..7630f010c 100644 --- a/src/numerics/Func1.cpp +++ b/src/numerics/Func1.cpp @@ -225,7 +225,7 @@ shared_ptr Cos1::derivative3() const return newTimesConstFunction(s, -m_c); } -std::string Cos1::write(const std::string& arg) const +string Cos1::write(const string& arg) const { if (m_c == 1.0) { return fmt::format("\\cos({})", arg); @@ -272,7 +272,7 @@ shared_ptr Exp1::derivative3() const return f; } -std::string Exp1::write(const std::string& arg) const +string Exp1::write(const string& arg) const { if (m_c == 1.0) { return fmt::format("\\exp({})", arg); @@ -299,7 +299,7 @@ shared_ptr Log1::derivative3() const return f; } -std::string Log1::write(const std::string& arg) const +string Log1::write(const string& arg) const { if (m_c == 1.0) { return fmt::format("\\log({})", arg); @@ -427,7 +427,7 @@ Arrhenius1::Arrhenius1(const vector& params) } Tabulated1::Tabulated1(size_t n, const double* tvals, const double* fvals, - const std::string& method) + const string& method) { m_tvec.resize(n); std::copy(tvals, tvals + n, m_tvec.begin()); @@ -615,12 +615,12 @@ Func1& Periodic1::duplicate() const { return *((Func1*)np); } -string Func1::write(const std::string& arg) const +string Func1::write(const string& arg) const { return fmt::format("\\mathrm{{{}}}({})", type(), arg); } -string Pow1::write(const std::string& arg) const +string Pow1::write(const string& arg) const { if (m_c == 0.5) { return "\\sqrt{" + arg + "}"; @@ -635,12 +635,12 @@ string Pow1::write(const std::string& arg) const } } -string Tabulated1::write(const std::string& arg) const +string Tabulated1::write(const string& arg) const { return fmt::format("\\mathrm{{Tabulated}}({})", arg); } -string Const1::write(const std::string& arg) const +string Const1::write(const string& arg) const { return fmt::format("{}", m_c); } @@ -658,7 +658,7 @@ Func1& Const1::derivative() const { return *z; } -string Ratio1::write(const std::string& arg) const +string Ratio1::write(const string& arg) const { return "\\frac{" + m_f1->write(arg) + "}{" + m_f2->write(arg) + "}"; @@ -690,7 +690,7 @@ shared_ptr Ratio1::derivative3() const { return newRatioFunction(s, p); } -string Product1::write(const std::string& arg) const +string Product1::write(const string& arg) const { string s = m_f1->write(arg); if (m_f1->order() < order()) { @@ -725,7 +725,7 @@ shared_ptr Product1::derivative3() const { return newSumFunction(a1, a2); } -string Sum1::write(const std::string& arg) const +string Sum1::write(const string& arg) const { string s1 = m_f1->write(arg); string s2 = m_f2->write(arg); @@ -752,7 +752,7 @@ Func1& Sum1::derivative() const { return newSumFunction(d1, d2); } -string Diff1::write(const std::string& arg) const +string Diff1::write(const string& arg) const { string s1 = m_f1->write(arg); string s2 = m_f2->write(arg); @@ -777,7 +777,7 @@ Func1& Diff1::derivative() const { return newDiffFunction(m_f1->derivative(), m_f2->derivative()); } -string Composite1::write(const std::string& arg) const +string Composite1::write(const string& arg) const { string g = m_f2->write(arg); return m_f1->write(g); @@ -808,7 +808,7 @@ shared_ptr Composite1::derivative3() const { return newProdFunction(d3, d2); } -string TimesConstant1::write(const std::string& arg) const +string TimesConstant1::write(const string& arg) const { string s = m_f1->write(arg); if (m_f1->order() < order()) { @@ -843,7 +843,7 @@ Func1& TimesConstant1::derivative() const { return *d; } -string PlusConstant1::write(const std::string& arg) const +string PlusConstant1::write(const string& arg) const { if (m_c == 0.0) { return m_f1->write(arg); diff --git a/src/numerics/FuncEval.cpp b/src/numerics/FuncEval.cpp index 823af9419..0a20ba3b4 100644 --- a/src/numerics/FuncEval.cpp +++ b/src/numerics/FuncEval.cpp @@ -25,7 +25,7 @@ int FuncEval::evalNoThrow(double t, double* y, double* ydot) } return -1; // unrecoverable error } catch (...) { - std::string msg = "FuncEval::eval_nothrow: unhandled exception" + string msg = "FuncEval::eval_nothrow: unhandled exception" " of unknown type\n"; if (suppressErrors()) { m_errors.push_back(msg); @@ -58,7 +58,7 @@ int FuncEval::evalDaeNoThrow(double t, double* y, double* ydot, double* r) } return -1; // unrecoverable error } catch (...) { - std::string msg = "FuncEval::eval_nothrow: unhandled exception" + string msg = "FuncEval::eval_nothrow: unhandled exception" " of unknown type\n"; if (suppressErrors()) { m_errors.push_back(msg); @@ -70,7 +70,7 @@ int FuncEval::evalDaeNoThrow(double t, double* y, double* ydot, double* r) return 0; // successful evaluation } -std::string FuncEval::getErrors() const { +string FuncEval::getErrors() const { std::stringstream errs; for (const auto& err : m_errors) { errs << err; @@ -100,7 +100,7 @@ int FuncEval::preconditioner_setup_nothrow(double t, double* y, double gamma) } return -1; // unrecoverable error } catch (...) { - std::string msg = "FuncEval::preconditioner_setup_nothrow: unhandled exception" + string msg = "FuncEval::preconditioner_setup_nothrow: unhandled exception" " of unknown type\n"; if (suppressErrors()) { m_errors.push_back(msg); @@ -133,7 +133,7 @@ int FuncEval::preconditioner_solve_nothrow(double* rhs, double* output) } return -1; // unrecoverable error } catch (...) { - std::string msg = "FuncEval::preconditioner_solve_nothrow: unhandled exception" + string msg = "FuncEval::preconditioner_solve_nothrow: unhandled exception" " of unknown type\n"; if (suppressErrors()) { m_errors.push_back(msg); diff --git a/src/numerics/Integrators.cpp b/src/numerics/Integrators.cpp index f500bedf1..4e9405dfe 100644 --- a/src/numerics/Integrators.cpp +++ b/src/numerics/Integrators.cpp @@ -11,7 +11,7 @@ namespace Cantera { -Integrator* newIntegrator(const std::string& itype) +Integrator* newIntegrator(const string& itype) { if (itype == "CVODE") { return new CVodesIntegrator(); diff --git a/src/numerics/funcs.cpp b/src/numerics/funcs.cpp index c59770bd9..60e58d1c7 100644 --- a/src/numerics/funcs.cpp +++ b/src/numerics/funcs.cpp @@ -110,7 +110,7 @@ double simpson(const Eigen::ArrayXd& f, const Eigen::ArrayXd& x) } } -double numericalQuadrature(const std::string& method, +double numericalQuadrature(const string& method, const Eigen::ArrayXd& f, const Eigen::ArrayXd& x) { diff --git a/src/oneD/Boundary1D.cpp b/src/oneD/Boundary1D.cpp index 34c47896e..83a29c366 100644 --- a/src/oneD/Boundary1D.cpp +++ b/src/oneD/Boundary1D.cpp @@ -116,7 +116,7 @@ void Inlet1D::show(const double* x) writelog("\n"); } -void Inlet1D::setMoleFractions(const std::string& xin) +void Inlet1D::setMoleFractions(const string& xin) { m_xstr = xin; if (m_flow) { @@ -410,7 +410,7 @@ shared_ptr Outlet1D::asArray(const double* soln) const // -------- OutletRes1D -------- -void OutletRes1D::setMoleFractions(const std::string& xres) +void OutletRes1D::setMoleFractions(const string& xres) { m_xstr = xres; if (m_flow) { @@ -600,7 +600,7 @@ ReactingSurf1D::ReactingSurf1D() m_type = cSurfType; } -ReactingSurf1D::ReactingSurf1D(shared_ptr solution, const std::string& id) +ReactingSurf1D::ReactingSurf1D(shared_ptr solution, const string& id) { auto phase = std::dynamic_pointer_cast(solution->thermo()); if (!phase) { diff --git a/src/oneD/Domain1D.cpp b/src/oneD/Domain1D.cpp index 34bcdf60c..f1ff73b96 100644 --- a/src/oneD/Domain1D.cpp +++ b/src/oneD/Domain1D.cpp @@ -53,7 +53,7 @@ void Domain1D::resize(size_t nv, size_t np) locate(); } -std::string Domain1D::componentName(size_t n) const +string Domain1D::componentName(size_t n) const { if (m_name[n] != "") { return m_name[n]; @@ -62,7 +62,7 @@ std::string Domain1D::componentName(size_t n) const } } -size_t Domain1D::componentIndex(const std::string& name) const +size_t Domain1D::componentIndex(const string& name) const { for (size_t n = 0; n < nComponents(); n++) { if (name == componentName(n)) { @@ -181,7 +181,7 @@ void Domain1D::setMeta(const AnyMap& meta) out.assign(nComponents(), tol.asDouble()); } else { for (size_t i = 0; i < nComponents(); i++) { - std::string name = componentName(i); + string name = componentName(i); if (tol.hasKey(name)) { out[i] = tol[name].asDouble(); } else { @@ -290,7 +290,7 @@ void Domain1D::show(const double* x) writelog("\n"); } -void Domain1D::setProfile(const std::string& name, double* values, double* soln) +void Domain1D::setProfile(const string& name, double* values, double* soln) { for (size_t n = 0; n < m_nv; n++) { if (name == componentName(n)) { diff --git a/src/oneD/IonFlow.cpp b/src/oneD/IonFlow.cpp index aedf5db84..8eb6b3c64 100644 --- a/src/oneD/IonFlow.cpp +++ b/src/oneD/IonFlow.cpp @@ -53,7 +53,7 @@ IonFlow::IonFlow(ThermoPhase* ph, size_t nsp, size_t points) : m_do_electric_field.resize(m_points,false); } -IonFlow::IonFlow(shared_ptr sol, const std::string& id, size_t points) +IonFlow::IonFlow(shared_ptr sol, const string& id, size_t points) : IonFlow(sol->thermo().get(), sol->thermo()->nSpecies(), points) { m_solution = sol; diff --git a/src/oneD/OneDim.cpp b/src/oneD/OneDim.cpp index f0c9b8fa9..d90954960 100644 --- a/src/oneD/OneDim.cpp +++ b/src/oneD/OneDim.cpp @@ -53,7 +53,7 @@ OneDim::~OneDim() { } -size_t OneDim::domainIndex(const std::string& name) +size_t OneDim::domainIndex(const string& name) { for (size_t n = 0; n < m_dom.size(); n++) { if (domain(n).id() == name) { @@ -63,7 +63,7 @@ size_t OneDim::domainIndex(const std::string& name) throw CanteraError("OneDim::domainIndex","no domain named >>"+name+"<<"); } -std::tuple OneDim::component(size_t i) { +std::tuple OneDim::component(size_t i) { size_t n; for (n = nDomains()-1; n != npos; n--) { if (i >= start(n)) { diff --git a/src/oneD/Sim1D.cpp b/src/oneD/Sim1D.cpp index 57af85f3d..76e25d7bd 100644 --- a/src/oneD/Sim1D.cpp +++ b/src/oneD/Sim1D.cpp @@ -58,7 +58,7 @@ Sim1D::Sim1D(vector& domains) : m_steps = { 10 }; } -void Sim1D::setInitialGuess(const std::string& component, vector& locs, vector& vals) +void Sim1D::setInitialGuess(const string& component, vector& locs, vector& vals) { for (size_t dom=0; dom res(m_state->size(), -999); OneDim::eval(npos, m_state->data(), &res[0], 0.0); @@ -207,7 +207,7 @@ AnyMap legacyH5(shared_ptr arr, const AnyMap& header={}) auto meta = arr->meta(); AnyMap out; - map meta_pairs = { + map meta_pairs = { {"type", "Domain1D_type"}, {"name", "name"}, {"emissivity-left", "emissivity_left"}, @@ -219,7 +219,7 @@ AnyMap legacyH5(shared_ptr arr, const AnyMap& header={}) } } - map tol_pairs = { + map tol_pairs = { {"transient-abstol", "transient_abstol"}, {"steady-abstol", "steady_abstol"}, {"transient-reltol", "transient_reltol"}, @@ -240,7 +240,7 @@ AnyMap legacyH5(shared_ptr arr, const AnyMap& header={}) return out; } - map header_pairs = { + map header_pairs = { {"transport-model", "transport_model"}, {"radiation-enabled", "radiation_enabled"}, {"energy-enabled", "energy_enabled"}, @@ -253,7 +253,7 @@ AnyMap legacyH5(shared_ptr arr, const AnyMap& header={}) } } - map refiner_pairs = { + map refiner_pairs = { {"ratio", "ratio"}, {"slope", "slope"}, {"curve", "curve"}, @@ -286,14 +286,14 @@ AnyMap legacyH5(shared_ptr arr, const AnyMap& header={}) } // end unnamed namespace -AnyMap Sim1D::restore(const std::string& fname, const std::string& id, int loglevel) +AnyMap Sim1D::restore(const string& fname, const string& id, int loglevel) { warn_deprecated("Sim1D::saveResidual", "To be removed after Cantera 3.0; use version without loglevel instead."); return restore(fname, id); } -AnyMap Sim1D::restore(const std::string& fname, const std::string& name) +AnyMap Sim1D::restore(const string& fname, const string& name) { size_t dot = fname.find_last_of("."); string extension = (dot != npos) ? toLowerCopy(fname.substr(dot+1)) : ""; @@ -303,7 +303,7 @@ AnyMap Sim1D::restore(const std::string& fname, const std::string& name) } AnyMap header; if (extension == "h5" || extension == "hdf" || extension == "hdf5") { - map> arrs; + map> arrs; header = SolutionArray::readHeader(fname, name); for (auto dom : m_dom) { @@ -323,7 +323,7 @@ AnyMap Sim1D::restore(const std::string& fname, const std::string& name) finalize(); } else if (extension == "yaml" || extension == "yml") { AnyMap root = AnyMap::fromYamlFile(fname); - map> arrs; + map> arrs; header = SolutionArray::readHeader(root, name); for (auto dom : m_dom) { diff --git a/src/oneD/StFlow.cpp b/src/oneD/StFlow.cpp index 198c21b9d..65920d491 100644 --- a/src/oneD/StFlow.cpp +++ b/src/oneD/StFlow.cpp @@ -97,7 +97,7 @@ StFlow::StFlow(shared_ptr th, size_t nsp, size_t points) m_solution->setThermo(th); } -StFlow::StFlow(shared_ptr sol, const std::string& id, size_t points) +StFlow::StFlow(shared_ptr sol, const string& id, size_t points) : StFlow(sol->thermo().get(), sol->thermo()->nSpecies(), points) { m_solution = sol; @@ -234,7 +234,7 @@ void StFlow::resetBadValues(double* xg) } } -void StFlow::setTransportModel(const std::string& trans) +void StFlow::setTransportModel(const string& trans) { if (!m_solution) { // @todo remove after Cantera 3.0 @@ -245,7 +245,7 @@ void StFlow::setTransportModel(const std::string& trans) m_solution->setTransportModel(trans); } -std::string StFlow::transportModel() const { +string StFlow::transportModel() const { return m_trans->transportModel(); } @@ -685,7 +685,7 @@ string StFlow::componentName(size_t n) const } } -size_t StFlow::componentIndex(const std::string& name) const +size_t StFlow::componentIndex(const string& name) const { if (name=="velocity") { return c_offset_U; @@ -819,7 +819,7 @@ void StFlow::fromArray(SolutionArray& arr, double* soln) if (!componentActive(i)) { continue; } - std::string name = componentName(i); + string name = componentName(i); if (arr.hasComponent(name)) { const vector data = arr.getComponent(name).as>(); for (size_t j = 0; j < nPoints(); j++) { diff --git a/src/thermo/BinarySolutionTabulatedThermo.cpp b/src/thermo/BinarySolutionTabulatedThermo.cpp index 3d49aaae8..31b543247 100644 --- a/src/thermo/BinarySolutionTabulatedThermo.cpp +++ b/src/thermo/BinarySolutionTabulatedThermo.cpp @@ -19,8 +19,8 @@ namespace Cantera { -BinarySolutionTabulatedThermo::BinarySolutionTabulatedThermo(const std::string& inputFile, - const std::string& id_) +BinarySolutionTabulatedThermo::BinarySolutionTabulatedThermo(const string& inputFile, + const string& id_) { initThermoFile(inputFile, id_); } diff --git a/src/thermo/CoverageDependentSurfPhase.cpp b/src/thermo/CoverageDependentSurfPhase.cpp index 7ab10cfeb..c24c39a6e 100644 --- a/src/thermo/CoverageDependentSurfPhase.cpp +++ b/src/thermo/CoverageDependentSurfPhase.cpp @@ -22,8 +22,8 @@ using namespace std; namespace Cantera { -CoverageDependentSurfPhase::CoverageDependentSurfPhase(const std::string& infile, - const std::string& id_): +CoverageDependentSurfPhase::CoverageDependentSurfPhase(const string& infile, + const string& id_): m_theta_ref(1.0), m_stateNumlast(-2) { @@ -136,7 +136,7 @@ void CoverageDependentSurfPhase::getParameters(AnyMap& phaseNode) const phaseNode["reference-state-coverage"] = m_theta_ref; } -void CoverageDependentSurfPhase::getSpeciesParameters(const std::string& name, +void CoverageDependentSurfPhase::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { SurfPhase::getSpeciesParameters(name, speciesNode); diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index e1cb2e41e..217b4dac9 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -253,7 +253,7 @@ void DebyeHuckel::getPartialMolarCp(double* cpbar) const /*! * @param estString input string that will be interpreted */ -static int interp_est(const std::string& estString) +static int interp_est(const string& estString) { if (caseInsensitiveEquals(estString, "solvent")) { return cEST_solvent; @@ -278,7 +278,7 @@ static int interp_est(const std::string& estString) } } -void DebyeHuckel::setDebyeHuckelModel(const std::string& model) { +void DebyeHuckel::setDebyeHuckelModel(const string& model) { if (model == "" || model == "dilute-limit" || caseInsensitiveEquals(model, "Dilute_limit")) { @@ -339,7 +339,7 @@ void DebyeHuckel::setDefaultIonicRadius(double value) } } -void DebyeHuckel::setBeta(const std::string& sp1, const std::string& sp2, +void DebyeHuckel::setBeta(const string& sp1, const string& sp2, double value) { size_t k1 = speciesIndex(sp1); @@ -465,7 +465,7 @@ void DebyeHuckel::getParameters(AnyMap& phaseNode) const for (size_t j = i; j < m_kk; j++) { if (m_Beta_ij(i, j) != 0) { AnyMap entry; - entry["species"] = vector{ + entry["species"] = vector{ speciesName(i), speciesName(j)}; entry["beta"] = m_Beta_ij(i, j); beta.push_back(std::move(entry)); @@ -477,7 +477,7 @@ void DebyeHuckel::getParameters(AnyMap& phaseNode) const phaseNode["activity-data"] = std::move(activityNode); } -void DebyeHuckel::getSpeciesParameters(const std::string& name, +void DebyeHuckel::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { MolalityVPSSTP::getSpeciesParameters(name, speciesNode); diff --git a/src/thermo/Elements.cpp b/src/thermo/Elements.cpp index 8d29dcc55..ebe9da8b1 100644 --- a/src/thermo/Elements.cpp +++ b/src/thermo/Elements.cpp @@ -248,7 +248,7 @@ const map& elementWeights() { return symMap; } -double getElementWeight(const std::string& ename) +double getElementWeight(const string& ename) { const auto& elementMap = elementWeights(); double elementWeight = 0.0; @@ -286,7 +286,7 @@ double getElementWeight(int atomicNumber) return elementWeight; } -string getElementSymbol(const std::string& ename) +string getElementSymbol(const string& ename) { string name = toLowerCopy(trimCopy(ename)); for (const auto& atom : atomicWeightTable) { @@ -311,7 +311,7 @@ string getElementSymbol(int atomicNumber) return atomicWeightTable[atomicNumber - 1].symbol; } -string getElementName(const std::string& ename) +string getElementName(const string& ename) { string symbol = trimCopy(ename); for (const auto& atom : atomicWeightTable) { @@ -336,7 +336,7 @@ string getElementName(int atomicNumber) return atomicWeightTable[atomicNumber - 1].fullName; } -int getAtomicNumber(const std::string& ename) +int getAtomicNumber(const string& ename) { size_t numElements = numElementsDefined(); size_t numIsotopes = numIsotopesDefined(); diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index 924426348..43f8362a6 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -38,7 +38,7 @@ HMWSoln::~HMWSoln() // Defined in .cpp to limit dependence on WaterProps.h } -HMWSoln::HMWSoln(const std::string& inputFile, const std::string& id_) : +HMWSoln::HMWSoln(const string& inputFile, const string& id_) : m_maxIionicStrength(maxIionicStrength_default), CROP_ln_gamma_o_min(crop_ln_gamma_o_min_default), CROP_ln_gamma_o_max(crop_ln_gamma_o_max_default), @@ -325,7 +325,7 @@ double HMWSoln::satPressure(double t) { return pres; } -static void check_nParams(const std::string& method, size_t nParams, +static void check_nParams(const string& method, size_t nParams, size_t m_formPitzerTemp) { if (m_formPitzerTemp == PITZER_TEMP_CONSTANT && nParams != 1) { @@ -341,7 +341,7 @@ static void check_nParams(const std::string& method, size_t nParams, } } -void HMWSoln::setBinarySalt(const std::string& sp1, const std::string& sp2, +void HMWSoln::setBinarySalt(const string& sp1, const string& sp2, size_t nParams, double* beta0, double* beta1, double* beta2, double* Cphi, double alpha1, double alpha2) { @@ -376,7 +376,7 @@ void HMWSoln::setBinarySalt(const std::string& sp1, const std::string& sp2, m_Alpha2MX_ij[c] = alpha2; } -void HMWSoln::setTheta(const std::string& sp1, const std::string& sp2, +void HMWSoln::setTheta(const string& sp1, const string& sp2, size_t nParams, double* theta) { size_t k1 = speciesIndex(sp1); @@ -399,8 +399,8 @@ void HMWSoln::setTheta(const std::string& sp1, const std::string& sp2, } } -void HMWSoln::setPsi(const std::string& sp1, const std::string& sp2, - const std::string& sp3, size_t nParams, double* psi) +void HMWSoln::setPsi(const string& sp1, const string& sp2, + const string& sp3, size_t nParams, double* psi) { size_t k1 = speciesIndex(sp1); size_t k2 = speciesIndex(sp2); @@ -435,7 +435,7 @@ void HMWSoln::setPsi(const std::string& sp1, const std::string& sp2, } } -void HMWSoln::setLambda(const std::string& sp1, const std::string& sp2, +void HMWSoln::setLambda(const string& sp1, const string& sp2, size_t nParams, double* lambda) { size_t k1 = speciesIndex(sp1); @@ -462,7 +462,7 @@ void HMWSoln::setLambda(const std::string& sp1, const std::string& sp2, m_Lambda_nj(k1, k2) = lambda[0]; } -void HMWSoln::setMunnn(const std::string& sp, size_t nParams, double* munnn) +void HMWSoln::setMunnn(const string& sp, size_t nParams, double* munnn) { size_t k = speciesIndex(sp); if (k == npos) { @@ -480,8 +480,8 @@ void HMWSoln::setMunnn(const std::string& sp, size_t nParams, double* munnn) m_Mu_nnn[k] = munnn[0]; } -void HMWSoln::setZeta(const std::string& sp1, const std::string& sp2, - const std::string& sp3, size_t nParams, double* psi) +void HMWSoln::setZeta(const string& sp1, const string& sp2, + const string& sp3, size_t nParams, double* psi) { size_t k1 = speciesIndex(sp1); size_t k2 = speciesIndex(sp2); @@ -523,7 +523,7 @@ void HMWSoln::setZeta(const std::string& sp1, const std::string& sp2, m_Psi_ijk[c] = psi[0]; } -void HMWSoln::setPitzerTempModel(const std::string& model) +void HMWSoln::setPitzerTempModel(const string& model) { if (caseInsensitiveEquals(model, "constant") || caseInsensitiveEquals(model, "default")) { m_formPitzerTemp = PITZER_TEMP_CONSTANT; @@ -556,7 +556,7 @@ void HMWSoln::setCroppingCoefficients(double ln_gamma_k_min, CROP_ln_gamma_o_max = ln_gamma_o_max; } -vector getSizedVector(const AnyMap& item, const std::string& key, size_t nCoeffs) +vector getSizedVector(const AnyMap& item, const string& key, size_t nCoeffs) { vector v; if (item[key].is()) { @@ -739,7 +739,7 @@ void HMWSoln::initThermo() setMoleFSolventMin(1.0E-5); } -void assignTrimmed(AnyMap& interaction, const std::string& key, vector& values) { +void assignTrimmed(AnyMap& interaction, const string& key, vector& values) { while (values.size() > 1 && values.back() == 0) { values.pop_back(); } @@ -788,7 +788,7 @@ void HMWSoln::getParameters(AnyMap& phaseNode) const } if (lambda_found) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(i), speciesName(j)}; vector lambda(nParams); for (size_t n = 0; n < nParams; n++) { @@ -816,7 +816,7 @@ void HMWSoln::getParameters(AnyMap& phaseNode) const } if (salt_found) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(i), speciesName(j)}; vector beta0(nParams), beta1(nParams), beta2(nParams), Cphi(nParams); size_t last_nonzero = 0; @@ -862,7 +862,7 @@ void HMWSoln::getParameters(AnyMap& phaseNode) const } if (theta_found) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(i), speciesName(j)}; vector theta(nParams); for (size_t n = 0; n < nParams; n++) { @@ -894,7 +894,7 @@ void HMWSoln::getParameters(AnyMap& phaseNode) const for (size_t n = 0; n < nParams; n++) { if (m_Psi_ijk_coeff(n, c) != 0) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(i), speciesName(j), speciesName(k)}; vector psi(nParams); for (size_t m = 0; m < nParams; m++) { @@ -926,7 +926,7 @@ void HMWSoln::getParameters(AnyMap& phaseNode) const for (size_t n = 0; n < nParams; n++) { if (m_Psi_ijk_coeff(n, c) != 0) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(i), speciesName(j), speciesName(k)}; vector zeta(nParams); for (size_t m = 0; m < nParams; m++) { @@ -946,7 +946,7 @@ void HMWSoln::getParameters(AnyMap& phaseNode) const for (size_t n = 0; n < nParams; n++) { if (m_Mu_nnn_coeff(n, i) != 0) { AnyMap interaction; - interaction["species"] = vector{speciesName(i)}; + interaction["species"] = vector{speciesName(i)}; vector mu(nParams); for (size_t m = 0; m < nParams; m++) { mu[m] = m_Mu_nnn_coeff(m, i); diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index dda26b89d..b8059a1f0 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -34,8 +34,8 @@ double cCut_default = .05; namespace Cantera { -IdealMolalSoln::IdealMolalSoln(const std::string& inputFile, - const std::string& id_) : +IdealMolalSoln::IdealMolalSoln(const string& inputFile, + const string& id_) : IMS_X_o_cutoff_(X_o_cutoff_default), IMS_gamma_o_min_(gamma_o_min_default), IMS_gamma_k_min_(gamma_k_min_default), @@ -371,7 +371,7 @@ void IdealMolalSoln::getParameters(AnyMap& phaseNode) const } } -void IdealMolalSoln::setStandardConcentrationModel(const std::string& model) +void IdealMolalSoln::setStandardConcentrationModel(const string& model) { if (caseInsensitiveEquals(model, "unity")) { m_formGC = 0; @@ -387,7 +387,7 @@ void IdealMolalSoln::setStandardConcentrationModel(const std::string& model) } } -void IdealMolalSoln::setCutoffModel(const std::string& model) +void IdealMolalSoln::setCutoffModel(const string& model) { if (caseInsensitiveEquals(model, "none")) { IMS_typeCutoff_ = 0; diff --git a/src/thermo/IdealSolidSolnPhase.cpp b/src/thermo/IdealSolidSolnPhase.cpp index d386d213c..c521606ee 100644 --- a/src/thermo/IdealSolidSolnPhase.cpp +++ b/src/thermo/IdealSolidSolnPhase.cpp @@ -362,7 +362,7 @@ void IdealSolidSolnPhase::getParameters(AnyMap& phaseNode) const } } -void IdealSolidSolnPhase::getSpeciesParameters(const std::string &name, +void IdealSolidSolnPhase::getSpeciesParameters(const string &name, AnyMap& speciesNode) const { ThermoPhase::getSpeciesParameters(name, speciesNode); @@ -419,7 +419,7 @@ void IdealSolidSolnPhase::setToEquilState(const double* mu_RT) setPressure(pres); } -void IdealSolidSolnPhase::setStandardConcentrationModel(const std::string& model) +void IdealSolidSolnPhase::setStandardConcentrationModel(const string& model) { if (caseInsensitiveEquals(model, "unity")) { m_formGC = 0; diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index 028aa6d43..c8defce06 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -23,7 +23,7 @@ IdealSolnGasVPSS::IdealSolnGasVPSS(const string& infile, string id_) initThermoFile(infile, id_); } -void IdealSolnGasVPSS::setStandardConcentrationModel(const std::string& model) +void IdealSolnGasVPSS::setStandardConcentrationModel(const string& model) { if (caseInsensitiveEquals(model, "unity")) { m_formGC = 0; diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index 65789f656..acda87dd1 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -432,10 +432,10 @@ void IonsFromNeutralVPSSTP::compositionChanged() * @param elemVectorI * @param nElementsI */ -static double factorOverlap(const vector& elnamesVN , +static double factorOverlap(const vector& elnamesVN , const vector& elemVectorN, const size_t nElementsN, - const vector& elnamesVI , + const vector& elnamesVI , const vector& elemVectorI, const size_t nElementsI) { @@ -490,11 +490,11 @@ void IonsFromNeutralVPSSTP::initThermo() } size_t nElementsN = neutralMoleculePhase_->nElements(); - const vector& elnamesVN = neutralMoleculePhase_->elementNames(); + const vector& elnamesVN = neutralMoleculePhase_->elementNames(); vector elemVectorN(nElementsN); size_t nElementsI = nElements(); - const vector& elnamesVI = elementNames(); + const vector& elnamesVI = elementNames(); vector elemVectorI(nElementsI); if (indexSpecialSpecies_ == npos) { diff --git a/src/thermo/LatticePhase.cpp b/src/thermo/LatticePhase.cpp index f4db286fe..bbf7fbd2a 100644 --- a/src/thermo/LatticePhase.cpp +++ b/src/thermo/LatticePhase.cpp @@ -18,7 +18,7 @@ namespace Cantera { -LatticePhase::LatticePhase(const std::string& inputFile, const std::string& id_) +LatticePhase::LatticePhase(const string& inputFile, const string& id_) { initThermoFile(inputFile, id_); } @@ -288,7 +288,7 @@ void LatticePhase::getParameters(AnyMap& phaseNode) const phaseNode["site-density"].setQuantity(m_site_density, "kmol/m^3"); } -void LatticePhase::getSpeciesParameters(const std::string& name, +void LatticePhase::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { ThermoPhase::getSpeciesParameters(name, speciesNode); diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index 41281c28d..90c1b97fa 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -320,8 +320,8 @@ void LatticeSolidPhase::getParameters(AnyMap& phaseNode) const // Remove fields not used in this model phaseNode.erase("species"); - vector elements; - for (auto& el : phaseNode["elements"].asVector()) { + vector elements; + for (auto& el : phaseNode["elements"].asVector()) { if (!ba::starts_with(el, "LC_")) { elements.push_back(el); } @@ -329,7 +329,7 @@ void LatticeSolidPhase::getParameters(AnyMap& phaseNode) const phaseNode["elements"] = elements; } -void LatticeSolidPhase::getSpeciesParameters(const std::string& name, +void LatticeSolidPhase::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { // Use child lattice phases to determine species parameters so that these @@ -411,7 +411,7 @@ void LatticeSolidPhase::_updateThermo() const } } -void LatticeSolidPhase::setLatticeMoleFractionsByName(int nn, const std::string& x) +void LatticeSolidPhase::setLatticeMoleFractionsByName(int nn, const string& x) { m_lattice[nn]->setMoleFractionsByName(x); size_t loc = 0; diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index 75c1c0d41..b5ea86d96 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -208,7 +208,7 @@ void MargulesVPSSTP::getParameters(AnyMap& phaseNode) const vector interactions; for (size_t n = 0; n < m_pSpecies_A_ij.size(); n++) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(m_pSpecies_A_ij[n]), speciesName(m_pSpecies_B_ij[n])}; if (m_HE_b_ij[n] != 0 || m_HE_c_ij[n] != 0) { interaction["excess-enthalpy"].setQuantity( @@ -236,8 +236,8 @@ void MargulesVPSSTP::initLengths() dlnActCoeffdlnN_.resize(m_kk, m_kk); } -void MargulesVPSSTP::addBinaryInteraction(const std::string& speciesA, - const std::string& speciesB, double h0, double h1, double s0, double s1, +void MargulesVPSSTP::addBinaryInteraction(const string& speciesA, + const string& speciesB, double h0, double h1, double s0, double s1, double vh0, double vh1, double vs0, double vs1) { size_t kA = speciesIndex(speciesA); diff --git a/src/thermo/MaskellSolidSolnPhase.cpp b/src/thermo/MaskellSolidSolnPhase.cpp index 861d6e3ff..2a78a7fc2 100644 --- a/src/thermo/MaskellSolidSolnPhase.cpp +++ b/src/thermo/MaskellSolidSolnPhase.cpp @@ -172,7 +172,7 @@ void MaskellSolidSolnPhase::getParameters(AnyMap& phaseNode) const phaseNode["product-species"] = speciesName(product_species_index); } -void MaskellSolidSolnPhase::setProductSpecies(const std::string& name) +void MaskellSolidSolnPhase::setProductSpecies(const string& name) { product_species_index = static_cast(speciesIndex(name)); if (product_species_index == -1) { diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index d1126f838..c77c93af9 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -170,7 +170,7 @@ void MolalityVPSSTP::setMolalitiesByName(const Composition& mMap) calcMolalities(); } -void MolalityVPSSTP::setMolalitiesByName(const std::string& x) +void MolalityVPSSTP::setMolalitiesByName(const string& x) { Composition xx = parseCompString(x, speciesNames()); setMolalitiesByName(xx); @@ -244,7 +244,7 @@ void MolalityVPSSTP::setState_TPM(double t, double p, const Composition& m) setState_TP(t, p); } -void MolalityVPSSTP::setState_TPM(double t, double p, const std::string& m) +void MolalityVPSSTP::setState_TPM(double t, double p, const string& m) { setMolalitiesByName(m); setState_TP(t, p); @@ -355,7 +355,7 @@ bool MolalityVPSSTP::addSpecies(shared_ptr spec) return added; } -std::string MolalityVPSSTP::report(bool show_thermo, double threshold) const +string MolalityVPSSTP::report(bool show_thermo, double threshold) const { fmt::memory_buffer b; try { @@ -463,7 +463,7 @@ std::string MolalityVPSSTP::report(bool show_thermo, double threshold) const return to_string(b); } -void MolalityVPSSTP::getCsvReportData(vector& names, +void MolalityVPSSTP::getCsvReportData(vector& names, vector>& data) const { names.clear(); diff --git a/src/thermo/NasaPoly2.cpp b/src/thermo/NasaPoly2.cpp index f202e82e2..085217bcd 100644 --- a/src/thermo/NasaPoly2.cpp +++ b/src/thermo/NasaPoly2.cpp @@ -28,7 +28,7 @@ void NasaPoly2::getParameters(AnyMap& thermo) const mnp_high.getParameters(thermo); } -void NasaPoly2::validate(const std::string& name) +void NasaPoly2::validate(const string& name) { if (thermo_warnings_suppressed()) { return; diff --git a/src/thermo/PDSSFactory.cpp b/src/thermo/PDSSFactory.cpp index 665245b5a..016908f00 100644 --- a/src/thermo/PDSSFactory.cpp +++ b/src/thermo/PDSSFactory.cpp @@ -51,12 +51,12 @@ void PDSSFactory::deleteFactory() { s_factory = 0; } -PDSS* PDSSFactory::newPDSS(const std::string& model) +PDSS* PDSSFactory::newPDSS(const string& model) { return create(model); } -PDSS* newPDSS(const std::string& model) +PDSS* newPDSS(const string& model) { return PDSSFactory::factory()->newPDSS(model); } diff --git a/src/thermo/PDSS_HKFT.cpp b/src/thermo/PDSS_HKFT.cpp index 749aff2a9..1baecffc9 100644 --- a/src/thermo/PDSS_HKFT.cpp +++ b/src/thermo/PDSS_HKFT.cpp @@ -285,7 +285,7 @@ void PDSS_HKFT::initThermo() // If the discrepancy is greater than 100 cal gmol-1, print // an error and exit. if (fabs(Hcalc -DHjmol) > m_units.convertTo(100, "J/kmol")) { - std::string sname = m_tp->speciesName(m_spindex); + string sname = m_tp->speciesName(m_spindex); if (s_InputInconsistencyErrorExit) { throw CanteraError("PDSS_HKFT::initThermo", "For {}, DHjmol is" " not consistent with G and S: {} vs {} J/kmol", @@ -614,7 +614,7 @@ double PDSS_HKFT::gstar(const double temp, const double pres, const int ifunc) c return res; } -double PDSS_HKFT::LookupGe(const std::string& elemName) +double PDSS_HKFT::LookupGe(const string& elemName) { size_t iE = m_tp->elementIndex(elemName); if (iE == npos) { diff --git a/src/thermo/PDSS_IonsFromNeutral.cpp b/src/thermo/PDSS_IonsFromNeutral.cpp index 432b28c7b..6e242e33f 100644 --- a/src/thermo/PDSS_IonsFromNeutral.cpp +++ b/src/thermo/PDSS_IonsFromNeutral.cpp @@ -25,7 +25,7 @@ void PDSS_IonsFromNeutral::setParent(VPStandardStateTP* phase, size_t k) neutralMoleculePhase_ = dynamic_cast(*phase).getNeutralMoleculePhase(); } -void PDSS_IonsFromNeutral::setNeutralSpeciesMultiplier(const std::string& species, double mult) +void PDSS_IonsFromNeutral::setNeutralSpeciesMultiplier(const string& species, double mult) { neutralSpeciesMultipliers_[species] = mult; numMult_++; diff --git a/src/thermo/PengRobinson.cpp b/src/thermo/PengRobinson.cpp index d60e4918f..1b50e01d0 100644 --- a/src/thermo/PengRobinson.cpp +++ b/src/thermo/PengRobinson.cpp @@ -26,7 +26,7 @@ PengRobinson::PengRobinson(const string& infile, const string& id_) initThermoFile(infile, id_); } -void PengRobinson::setSpeciesCoeffs(const std::string& species, double a, double b, +void PengRobinson::setSpeciesCoeffs(const string& species, double a, double b, double w) { size_t k = speciesIndex(species); @@ -72,8 +72,8 @@ void PengRobinson::setSpeciesCoeffs(const std::string& species, double a, double m_b_coeffs[k] = b; } -void PengRobinson::setBinaryCoeffs(const std::string& species_i, - const std::string& species_j, double a0) +void PengRobinson::setBinaryCoeffs(const string& species_i, + const string& species_j, double a0) { size_t ki = speciesIndex(species_i); if (ki == npos) { @@ -340,7 +340,7 @@ void PengRobinson::initThermo() { // Contents of 'critical-properties.yaml', loaded later if needed AnyMap critPropsDb; - std::unordered_map dbSpecies; + std::unordered_map dbSpecies; for (auto& [name, species] : m_species) { auto& data = species->input; @@ -421,7 +421,7 @@ void PengRobinson::initThermo() } } -void PengRobinson::getSpeciesParameters(const std::string& name, +void PengRobinson::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { MixtureFugacityTP::getSpeciesParameters(name, speciesNode); diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index 621158de1..be99e748e 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -17,12 +17,12 @@ using namespace std; namespace Cantera { -std::string Phase::name() const +string Phase::name() const { return m_name; } -void Phase::setName(const std::string& name) +void Phase::setName(const string& name) { m_name = name; } @@ -52,7 +52,7 @@ string Phase::elementName(size_t m) const return m_elementNames[m]; } -size_t Phase::elementIndex(const std::string& elementName) const +size_t Phase::elementIndex(const string& elementName) const { for (size_t i = 0; i < m_mm; i++) { if (m_elementNames[i] == elementName) { @@ -116,9 +116,9 @@ void Phase::getAtoms(size_t k, double* atomArray) const } } -size_t Phase::findSpeciesLower(const std::string& name) const +size_t Phase::findSpeciesLower(const string& name) const { - std::string nLower = toLowerCopy(name); + string nLower = toLowerCopy(name); size_t loc = npos; auto it = m_speciesLower.find(nLower); if (it == m_speciesLower.end()) { @@ -135,7 +135,7 @@ size_t Phase::findSpeciesLower(const std::string& name) const return loc; } -size_t Phase::speciesIndex(const std::string& nameStr) const +size_t Phase::speciesIndex(const string& nameStr) const { size_t loc = npos; @@ -173,13 +173,13 @@ void Phase::checkSpeciesArraySize(size_t kk) const } } -std::string Phase::speciesSPName(int k) const +string Phase::speciesSPName(int k) const { warn_deprecated("Phase::speciesSPName", "To be removed after Cantera 3.0"); return m_name + ":" + speciesName(k); } -map Phase::nativeState() const +map Phase::nativeState() const { if (isPure()) { if (isCompressible()) { @@ -209,7 +209,7 @@ string Phase::nativeMode() const return out; } -vector Phase::fullStates() const +vector Phase::fullStates() const { if (isPure()) { if (isCompressible()) { @@ -227,7 +227,7 @@ vector Phase::fullStates() const } } -vector Phase::partialStates() const +vector Phase::partialStates() const { if (isPure()) { return {}; @@ -348,7 +348,7 @@ void Phase::setMoleFractionsByName(const Composition& xMap) setMoleFractions(mf.data()); } -void Phase::setMoleFractionsByName(const std::string& x) +void Phase::setMoleFractionsByName(const string& x) { setMoleFractionsByName(parseCompString(x)); } @@ -384,7 +384,7 @@ void Phase::setMassFractionsByName(const Composition& yMap) setMassFractions(mf.data()); } -void Phase::setMassFractionsByName(const std::string& y) +void Phase::setMassFractionsByName(const string& y) { setMassFractionsByName(parseCompString(y)); } @@ -548,7 +548,7 @@ double Phase::moleFraction(size_t k) const return m_ym[k] * m_mmw; } -double Phase::moleFraction(const std::string& nameSpec) const +double Phase::moleFraction(const string& nameSpec) const { size_t iloc = speciesIndex(nameSpec); if (iloc != npos) { @@ -571,7 +571,7 @@ double Phase::massFraction(size_t k) const return m_y[k]; } -double Phase::massFraction(const std::string& nameSpec) const +double Phase::massFraction(const string& nameSpec) const { size_t iloc = speciesIndex(nameSpec); if (iloc != npos) { @@ -753,7 +753,7 @@ double Phase::sum_xlogx() const return m_mmw * sumxlogx + std::log(m_mmw); } -size_t Phase::addElement(const std::string& symbol, double weight, +size_t Phase::addElement(const string& symbol, double weight, int atomic_number, double entropy298, int elem_type) { @@ -901,7 +901,7 @@ bool Phase::addSpecies(shared_ptr spec) { m_speciesIndices[spec->name] = m_kk; m_speciesCharge.push_back(spec->charge); - std::string nLower = toLowerCopy(spec->name); + string nLower = toLowerCopy(spec->name); if (m_speciesLower.find(nLower) == m_speciesLower.end()) { m_speciesLower[nLower] = m_kk; } else { @@ -941,7 +941,7 @@ void Phase::modifySpecies(size_t k, shared_ptr spec) invalidateCache(); } -void Phase::addSpeciesAlias(const std::string& name, const std::string& alias) +void Phase::addSpeciesAlias(const string& name, const string& alias) { if (speciesIndex(alias) != npos) { throw CanteraError("Phase::addSpeciesAlias", @@ -957,9 +957,9 @@ void Phase::addSpeciesAlias(const std::string& name, const std::string& alias) } } -vector Phase::findIsomers(const Composition& compMap) const +vector Phase::findIsomers(const Composition& compMap) const { - vector isomerNames; + vector isomerNames; for (const auto& [name, species] : m_species) { if (species->composition == compMap) { @@ -970,12 +970,12 @@ vector Phase::findIsomers(const Composition& compMap) const return isomerNames; } -vector Phase::findIsomers(const std::string& comp) const +vector Phase::findIsomers(const string& comp) const { return findIsomers(parseCompString(comp)); } -shared_ptr Phase::species(const std::string& name) const +shared_ptr Phase::species(const string& name) const { size_t k = speciesIndex(name); if (k != npos) { diff --git a/src/thermo/PlasmaPhase.cpp b/src/thermo/PlasmaPhase.cpp index c1e22c8d1..afd3fe48c 100644 --- a/src/thermo/PlasmaPhase.cpp +++ b/src/thermo/PlasmaPhase.cpp @@ -11,7 +11,7 @@ namespace Cantera { -PlasmaPhase::PlasmaPhase(const std::string& inputFile, const std::string& id_) +PlasmaPhase::PlasmaPhase(const string& inputFile, const string& id_) { initThermoFile(inputFile, id_); @@ -44,7 +44,7 @@ void PlasmaPhase::normalizeElectronEnergyDistribution() { m_electronEnergyDist /= norm; } -void PlasmaPhase::setElectronEnergyDistributionType(const std::string& type) +void PlasmaPhase::setElectronEnergyDistributionType(const string& type) { if (type == "discretized" || type == "isotropic") { diff --git a/src/thermo/PureFluidPhase.cpp b/src/thermo/PureFluidPhase.cpp index 091acb0a7..65e27c52d 100644 --- a/src/thermo/PureFluidPhase.cpp +++ b/src/thermo/PureFluidPhase.cpp @@ -54,18 +54,18 @@ void PureFluidPhase::getParameters(AnyMap& phaseNode) const phaseNode["pure-fluid-name"] = m_sub->name(); } -vector PureFluidPhase::fullStates() const +vector PureFluidPhase::fullStates() const { return {"TD", "UV", "DP", "HP", "SP", "SV", "ST", "TV", "PV", "UP", "VH", "TH", "SH", "TPQ"}; } -vector PureFluidPhase::partialStates() const +vector PureFluidPhase::partialStates() const { return {"TP", "TQ", "PQ"}; } -std::string PureFluidPhase::phaseOfMatter() const +string PureFluidPhase::phaseOfMatter() const { if (temperature() >= critTemperature() || pressure() >= critPressure()) { return "supercritical"; @@ -383,7 +383,7 @@ void PureFluidPhase::setState_Psat(double p, double x) ThermoPhase::setDensity(1.0/m_sub->v()); } -std::string PureFluidPhase::report(bool show_thermo, double threshold) const +string PureFluidPhase::report(bool show_thermo, double threshold) const { fmt::memory_buffer b; // This is the width of the first column of names in the report. diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 81041c537..304029d97 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -17,8 +17,8 @@ using namespace std; namespace Cantera { -RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile, - const std::string& id_) +RedlichKisterVPSSTP::RedlichKisterVPSSTP(const string& inputFile, + const string& id_) { initThermoFile(inputFile, id_); } @@ -169,7 +169,7 @@ void RedlichKisterVPSSTP::getParameters(AnyMap& phaseNode) const vector interactions; for (size_t n = 0; n < m_pSpecies_A_ij.size(); n++) { AnyMap interaction; - interaction["species"] = vector{ + interaction["species"] = vector{ speciesName(m_pSpecies_A_ij[n]), speciesName(m_pSpecies_B_ij[n])}; vector h = m_HE_m_ij[n]; vector s = m_SE_m_ij[n]; @@ -454,7 +454,7 @@ void RedlichKisterVPSSTP::getdlnActCoeffdlnN(const size_t ld, double* dlnActCoef } void RedlichKisterVPSSTP::addBinaryInteraction( - const std::string& speciesA, const std::string& speciesB, + const string& speciesA, const string& speciesB, const double* excess_enthalpy, size_t n_enthalpy, const double* excess_entropy, size_t n_entropy) { diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index a92378a68..11880c8c7 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -26,7 +26,7 @@ RedlichKwongMFTP::RedlichKwongMFTP(const string& infile, const string& id_) initThermoFile(infile, id_); } -void RedlichKwongMFTP::setSpeciesCoeffs(const std::string& species, +void RedlichKwongMFTP::setSpeciesCoeffs(const string& species, double a0, double a1, double b) { size_t k = speciesIndex(species); @@ -68,8 +68,8 @@ void RedlichKwongMFTP::setSpeciesCoeffs(const std::string& species, b_vec_Curr_[k] = b; } -void RedlichKwongMFTP::setBinaryCoeffs(const std::string& species_i, - const std::string& species_j, double a0, double a1) +void RedlichKwongMFTP::setBinaryCoeffs(const string& species_i, + const string& species_j, double a0, double a1) { size_t ki = speciesIndex(species_i); if (ki == npos) { @@ -383,7 +383,7 @@ void RedlichKwongMFTP::initThermo() { // Contents of 'critical-properties.yaml', loaded later if needed AnyMap critPropsDb; - std::unordered_map dbSpecies; + std::unordered_map dbSpecies; for (auto& [name, species] : m_species) { auto& data = species->input; @@ -478,7 +478,7 @@ void RedlichKwongMFTP::initThermo() } } -void RedlichKwongMFTP::getSpeciesParameters(const std::string& name, +void RedlichKwongMFTP::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { MixtureFugacityTP::getSpeciesParameters(name, speciesNode); diff --git a/src/thermo/Species.cpp b/src/thermo/Species.cpp index 8c5b5aad2..44fcf3c3e 100644 --- a/src/thermo/Species.cpp +++ b/src/thermo/Species.cpp @@ -17,7 +17,7 @@ using namespace std; namespace Cantera { -Species::Species(const std::string& name_, const Composition& comp_, +Species::Species(const string& name_, const Composition& comp_, double charge_, double size_) : name(name_) , composition(comp_) diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 4a141723e..600021f7c 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -49,11 +49,11 @@ SpeciesThermoInterpType* newSpeciesThermoInterpType(int type, double tlow, } } -SpeciesThermoInterpType* newSpeciesThermoInterpType(const std::string& stype, +SpeciesThermoInterpType* newSpeciesThermoInterpType(const string& stype, double tlow, double thigh, double pref, const double* coeffs) { int itype = -1; - std::string type = toLowerCopy(stype); + string type = toLowerCopy(stype); if (type == "nasa2" || type == "nasa") { itype = NASA2; // two-region 7-coefficient NASA polynomials } else if (type == "const_cp" || type == "simple") { @@ -185,7 +185,7 @@ void setupMu0(Mu0Poly& thermo, const AnyMap& node) unique_ptr newSpeciesThermo(const AnyMap& node) { - std::string model = node["model"].asString(); + string model = node["model"].asString(); if (model == "NASA7") { auto thermo = make_unique(); setupNasaPoly(*thermo, node); diff --git a/src/thermo/StoichSubstance.cpp b/src/thermo/StoichSubstance.cpp index 66a7708f4..4b4b6307d 100644 --- a/src/thermo/StoichSubstance.cpp +++ b/src/thermo/StoichSubstance.cpp @@ -17,7 +17,7 @@ namespace Cantera // ---- Constructors ------- -StoichSubstance::StoichSubstance(const std::string& infile, const std::string& id_) +StoichSubstance::StoichSubstance(const string& infile, const string& id_) { initThermoFile(infile, id_); } @@ -150,7 +150,7 @@ void StoichSubstance::initThermo() SingleSpeciesTP::initThermo(); } -void StoichSubstance::getSpeciesParameters(const std::string& name, +void StoichSubstance::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { SingleSpeciesTP::getSpeciesParameters(name, speciesNode); diff --git a/src/thermo/SurfPhase.cpp b/src/thermo/SurfPhase.cpp index 69dd38049..895328b66 100644 --- a/src/thermo/SurfPhase.cpp +++ b/src/thermo/SurfPhase.cpp @@ -268,7 +268,7 @@ void SurfPhase::getCoverages(double* theta) const } } -void SurfPhase::setCoveragesByName(const std::string& cov) +void SurfPhase::setCoveragesByName(const string& cov) { setCoveragesByName(parseCompString(cov, speciesNames())); } @@ -340,7 +340,7 @@ void SurfPhase::getParameters(AnyMap& phaseNode) const m_n0, Units(1.0, 0, -static_cast(m_ndim), 0, 0, 0, 1)); } -EdgePhase::EdgePhase(const std::string& infile, const std::string& id_) +EdgePhase::EdgePhase(const string& infile, const string& id_) { setNDim(1); initThermoFile(infile, id_); diff --git a/src/thermo/ThermoFactory.cpp b/src/thermo/ThermoFactory.cpp index 0a4859f99..d639fd41b 100644 --- a/src/thermo/ThermoFactory.cpp +++ b/src/thermo/ThermoFactory.cpp @@ -124,7 +124,7 @@ void ThermoFactory::deleteFactory() s_factory = 0; } -ThermoPhase* ThermoFactory::newThermoPhase(const std::string& model) +ThermoPhase* ThermoFactory::newThermoPhase(const string& model) { warn_deprecated("newThermoPhase", "To be removed after Cantera 3.0; superseded by newThermoModel."); @@ -197,11 +197,11 @@ unique_ptr newPhase(const AnyMap& phaseNode, const AnyMap& rootNode return t; } -ThermoPhase* newPhase(const std::string& infile, std::string id) +ThermoPhase* newPhase(const string& infile, string id) { warn_deprecated("newPhase", "To be removed after Cantera 3.0; superseded by\n" - "newThermo(const std::string&, const std::string&)."); + "newThermo(const string&, const string&)."); return newThermo(infile, id).get(); } @@ -292,8 +292,8 @@ void setupPhase(ThermoPhase& thermo, const AnyMap& phaseNode, const AnyMap& root const auto& names = elemNode.begin()->second.asVector(); const auto& slash = boost::ifind_last(source, "/"); if (slash) { - std::string fileName(source.begin(), slash.begin()); - std::string node(slash.end(), source.end()); + string fileName(source.begin(), slash.begin()); + string node(slash.end(), source.end()); const AnyMap elements = AnyMap::fromYamlFile(fileName, rootNode.getString("__file__", "")); addElements(thermo, names, elements.at(node), false); @@ -337,8 +337,8 @@ void setupPhase(ThermoPhase& thermo, const AnyMap& phaseNode, const AnyMap& root const auto& slash = boost::ifind_last(source, "/"); if (slash) { // source is a different input file - std::string fileName(source.begin(), slash.begin()); - std::string node(slash.end(), source.end()); + string fileName(source.begin(), slash.begin()); + string node(slash.end(), source.end()); AnyMap species = AnyMap::fromYamlFile(fileName, rootNode.getString("__file__", "")); addSpecies(thermo, names, species[node]); diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 71597069a..959a25608 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -94,7 +94,7 @@ void ThermoPhase::setState_TPX(double t, double p, const Composition& x) setState_TP(t,p); } -void ThermoPhase::setState_TPX(double t, double p, const std::string& x) +void ThermoPhase::setState_TPX(double t, double p, const string& x) { setMoleFractionsByName(x); setState_TP(t,p); @@ -112,7 +112,7 @@ void ThermoPhase::setState_TPY(double t, double p, const Composition& y) setState_TP(t,p); } -void ThermoPhase::setState_TPY(double t, double p, const std::string& y) +void ThermoPhase::setState_TPY(double t, double p, const string& y) { setMassFractionsByName(y); setState_TP(t,p); @@ -149,7 +149,7 @@ void ThermoPhase::setState_RPX(double rho, double p, const Composition& x) setState_DP(rho, p); } -void ThermoPhase::setState_RPX(double rho, double p, const std::string& x) +void ThermoPhase::setState_RPX(double rho, double p, const string& x) { warn_deprecated("ThermoPhase::setState_RPX", "To be removed after Cantera 3.0. Replaceable by calls to " @@ -176,7 +176,7 @@ void ThermoPhase::setState_RPY(double rho, double p, const Composition& y) setState_DP(rho, p); } -void ThermoPhase::setState_RPY(double rho, double p, const std::string& y) +void ThermoPhase::setState_RPY(double rho, double p, const string& y) { warn_deprecated("ThermoPhase::setState_RPY", "To be removed after Cantera 3.0. Replaceable by calls to " @@ -765,13 +765,13 @@ double ThermoPhase::stoichAirFuelRatio(const Composition& fuelComp, return stoichAirFuelRatio(fuel.data(), ox.data(), basis); } -double ThermoPhase::stoichAirFuelRatio(const std::string& fuelComp, - const std::string& oxComp, +double ThermoPhase::stoichAirFuelRatio(const string& fuelComp, + const string& oxComp, ThermoBasis basis) const { return stoichAirFuelRatio( - parseCompString(fuelComp.find(":") != std::string::npos ? fuelComp : fuelComp+":1.0"), - parseCompString(oxComp.find(":") != std::string::npos ? oxComp : oxComp+":1.0"), + parseCompString(fuelComp.find(":") != string::npos ? fuelComp : fuelComp+":1.0"), + parseCompString(oxComp.find(":") != string::npos ? oxComp : oxComp+":1.0"), basis); } @@ -840,12 +840,12 @@ void ThermoPhase::setEquivalenceRatio(double phi, const double* fuelComp, setPressure(p); } -void ThermoPhase::setEquivalenceRatio(double phi, const std::string& fuelComp, - const std::string& oxComp, ThermoBasis basis) +void ThermoPhase::setEquivalenceRatio(double phi, const string& fuelComp, + const string& oxComp, ThermoBasis basis) { setEquivalenceRatio(phi, - parseCompString(fuelComp.find(":") != std::string::npos ? fuelComp : fuelComp+":1.0"), - parseCompString(oxComp.find(":") != std::string::npos ? oxComp : oxComp+":1.0"), + parseCompString(fuelComp.find(":") != string::npos ? fuelComp : fuelComp+":1.0"), + parseCompString(oxComp.find(":") != string::npos ? oxComp : oxComp+":1.0"), basis); } @@ -878,13 +878,13 @@ double ThermoPhase::equivalenceRatio(const Composition& fuelComp, return equivalenceRatio(fuel.data(), ox.data(), basis); } -double ThermoPhase::equivalenceRatio(const std::string& fuelComp, - const std::string& oxComp, +double ThermoPhase::equivalenceRatio(const string& fuelComp, + const string& oxComp, ThermoBasis basis) const { return equivalenceRatio( - parseCompString(fuelComp.find(":") != std::string::npos ? fuelComp : fuelComp+":1.0"), - parseCompString(oxComp.find(":") != std::string::npos ? oxComp : oxComp+":1.0"), + parseCompString(fuelComp.find(":") != string::npos ? fuelComp : fuelComp+":1.0"), + parseCompString(oxComp.find(":") != string::npos ? oxComp : oxComp+":1.0"), basis); } @@ -925,12 +925,12 @@ void ThermoPhase::setMixtureFraction(double mixFrac, const Composition& fuelComp setMixtureFraction(mixFrac, fuel.data(), ox.data(), basis); } -void ThermoPhase::setMixtureFraction(double mixFrac, const std::string& fuelComp, - const std::string& oxComp, ThermoBasis basis) +void ThermoPhase::setMixtureFraction(double mixFrac, const string& fuelComp, + const string& oxComp, ThermoBasis basis) { setMixtureFraction(mixFrac, - parseCompString(fuelComp.find(":") != std::string::npos ? fuelComp : fuelComp+":1.0"), - parseCompString(oxComp.find(":") != std::string::npos ? oxComp : oxComp+":1.0"), + parseCompString(fuelComp.find(":") != string::npos ? fuelComp : fuelComp+":1.0"), + parseCompString(oxComp.find(":") != string::npos ? oxComp : oxComp+":1.0"), basis); } @@ -975,28 +975,28 @@ void ThermoPhase::setMixtureFraction(double mixFrac, const double* fuelComp, double ThermoPhase::mixtureFraction(const Composition& fuelComp, const Composition& oxComp, ThermoBasis basis, - const std::string& element) const + const string& element) const { vector fuel(getCompositionFromMap(fuelComp)); vector ox(getCompositionFromMap(oxComp)); return mixtureFraction(fuel.data(), ox.data(), basis, element); } -double ThermoPhase::mixtureFraction(const std::string& fuelComp, - const std::string& oxComp, +double ThermoPhase::mixtureFraction(const string& fuelComp, + const string& oxComp, ThermoBasis basis, - const std::string& element) const + const string& element) const { return mixtureFraction( - parseCompString(fuelComp.find(":") != std::string::npos ? fuelComp : fuelComp+":1.0"), - parseCompString(oxComp.find(":") != std::string::npos ? oxComp : oxComp+":1.0"), + parseCompString(fuelComp.find(":") != string::npos ? fuelComp : fuelComp+":1.0"), + parseCompString(oxComp.find(":") != string::npos ? oxComp : oxComp+":1.0"), basis, element); } double ThermoPhase::mixtureFraction(const double* fuelComp, const double* oxComp, ThermoBasis basis, - const std::string& element) const + const string& element) const { vector fuel, ox; if (basis == ThermoBasis::molar) { // convert input compositions to mass fractions @@ -1075,8 +1075,8 @@ const MultiSpeciesThermo& ThermoPhase::speciesThermo(int k) const } -void ThermoPhase::initThermoFile(const std::string& inputFile, - const std::string& id) +void ThermoPhase::initThermoFile(const string& inputFile, + const string& id) { if (inputFile.empty()) { // No input file specified - nothing to set up @@ -1248,7 +1248,7 @@ void ThermoPhase::invalidateCache() { m_tlast += 0.1234; } -void ThermoPhase::equilibrate(const std::string& XY, const std::string& solver, +void ThermoPhase::equilibrate(const string& XY, const string& solver, double rtol, int max_steps, int max_iter, int estimate_equil, int log_level) { @@ -1357,7 +1357,7 @@ void ThermoPhase::getdlnActCoeffdlnN_numderiv(const size_t ld, double* const dln setPressure(pres); } -std::string ThermoPhase::report(bool show_thermo, double threshold) const +string ThermoPhase::report(bool show_thermo, double threshold) const { if (type() == "none") { throw NotImplementedError("ThermoPhase::report", @@ -1498,7 +1498,7 @@ void ThermoPhase::reportCSV(std::ofstream& csvFile) const csvFile.precision(8); vector X(nSpecies()); getMoleFractions(&X[0]); - vector pNames; + vector pNames; vector> data; getCsvReportData(pNames, data); @@ -1523,7 +1523,7 @@ void ThermoPhase::reportCSV(std::ofstream& csvFile) const } } -void ThermoPhase::getCsvReportData(vector& names, +void ThermoPhase::getCsvReportData(vector& names, vector>& data) const { warn_deprecated("ThermoPhase::getCsvReportData", "To be removed after Cantera 3.0."); diff --git a/src/thermo/VPStandardStateTP.cpp b/src/thermo/VPStandardStateTP.cpp index 1a19c606e..8515b60bc 100644 --- a/src/thermo/VPStandardStateTP.cpp +++ b/src/thermo/VPStandardStateTP.cpp @@ -162,7 +162,7 @@ void VPStandardStateTP::initThermo() } } -void VPStandardStateTP::getSpeciesParameters(const std::string& name, +void VPStandardStateTP::getSpeciesParameters(const string& name, AnyMap& speciesNode) const { AnyMap eos; diff --git a/src/thermo/WaterSSTP.cpp b/src/thermo/WaterSSTP.cpp index a68569fba..cf8f09c50 100644 --- a/src/thermo/WaterSSTP.cpp +++ b/src/thermo/WaterSSTP.cpp @@ -18,8 +18,8 @@ WaterSSTP::WaterSSTP(const string& inputFile, const string& id) initThermoFile(inputFile, id); } -std::string WaterSSTP::phaseOfMatter() const { - const vector phases = { +string WaterSSTP::phaseOfMatter() const { + const vector phases = { "gas", "liquid", "supercritical", "unstable-liquid", "unstable-gas" }; return phases[m_sub.phaseState()]; diff --git a/src/tpx/Sub.cpp b/src/tpx/Sub.cpp index 201296615..b9c9ea881 100644 --- a/src/tpx/Sub.cpp +++ b/src/tpx/Sub.cpp @@ -15,7 +15,7 @@ using namespace Cantera; namespace { // these correspond to ordering withing propertyFlag::type -std::string propertySymbols[] = {"H", "S", "U", "V", "P", "T"}; +string propertySymbols[] = {"H", "S", "U", "V", "P", "T"}; } namespace tpx @@ -708,7 +708,7 @@ void Substance::set_xy(propertyFlag::type ifx, propertyFlag::type ify, Set(PropertyPair::TV, t_here, v_here); LoopCount++; if (LoopCount > 200) { - std::string msg = fmt::format("No convergence. {} = {}, {} = {}", + string msg = fmt::format("No convergence. {} = {}, {} = {}", propertySymbols[ifx], X, propertySymbols[ify], Y); if (t_here == Tmin()) { msg += fmt::format("\nAt temperature limit (Tmin = {})", Tmin()); diff --git a/src/transport/HighPressureGasTransport.cpp b/src/transport/HighPressureGasTransport.cpp index 9a61a5574..a11c2ac93 100644 --- a/src/transport/HighPressureGasTransport.cpp +++ b/src/transport/HighPressureGasTransport.cpp @@ -324,7 +324,7 @@ double HighPressureGasTransport::viscosity() // been named in this specific way. They are perhaps the most obvious // names, but it would of course be preferred to have a more general // approach, here. - vector spnames = m_thermo->speciesNames(); + vector spnames = m_thermo->speciesNames(); if (spnames[i] == "He") { FQ_mix_o += molefracs[i]*FQ_i(1.38,Tr,m_mw[i]); } else if (spnames[i] == "H2") { diff --git a/src/transport/Transport.cpp b/src/transport/Transport.cpp index ddf2bb58e..d93e18188 100644 --- a/src/transport/Transport.cpp +++ b/src/transport/Transport.cpp @@ -80,8 +80,8 @@ void Transport::setThermo(ThermoPhase& thermo) "the transport manager has been constructed because num species isn't the same."); } for (size_t i = 0; i < newNum; i++) { - std::string newS0 = thermo.speciesName(i); - std::string oldS0 = m_thermo->speciesName(i); + string newS0 = thermo.speciesName(i); + string oldS0 = m_thermo->speciesName(i); if (newNum != oldNum) { throw CanteraError("Transport::setThermo", "base object cannot be changed after " diff --git a/src/transport/TransportData.cpp b/src/transport/TransportData.cpp index 41cb7cc46..0e03b7486 100644 --- a/src/transport/TransportData.cpp +++ b/src/transport/TransportData.cpp @@ -26,7 +26,7 @@ void TransportData::getParameters(AnyMap &transportNode) const } GasTransportData::GasTransportData( - const std::string& geometry_, + const string& geometry_, double diameter_, double well_depth_, double dipole_, double polarizability_, double rot_relax, double acentric, double dispersion, double quad_polar) @@ -43,7 +43,7 @@ GasTransportData::GasTransportData( } void GasTransportData::setCustomaryUnits( - const std::string& geometry_, + const string& geometry_, double diameter_, double well_depth_, double dipole_, double polarizability_, double rot_relax, double acentric, double dispersion, double quad_polar) @@ -160,7 +160,7 @@ void GasTransportData::getParameters(AnyMap& transportNode) const void setupGasTransportData(GasTransportData& tr, const AnyMap& node) { - std::string geometry = node["geometry"].asString(); + string geometry = node["geometry"].asString(); double welldepth = node["well-depth"].asDouble(); double diameter = node["diameter"].asDouble(); double dipole = node.getDouble("dipole", 0.0); diff --git a/src/transport/TransportFactory.cpp b/src/transport/TransportFactory.cpp index e92c48121..70183c71c 100644 --- a/src/transport/TransportFactory.cpp +++ b/src/transport/TransportFactory.cpp @@ -65,7 +65,7 @@ void TransportFactory::deleteFactory() s_factory = 0; } -Transport* TransportFactory::newTransport(const std::string& transportModel, +Transport* TransportFactory::newTransport(const string& transportModel, ThermoPhase* phase, int log_level) { if (transportModel != "DustyGas" && canonicalize(transportModel) == "none") { @@ -98,7 +98,7 @@ Transport* TransportFactory::newTransport(const std::string& transportModel, Transport* TransportFactory::newTransport(ThermoPhase* phase, int log_level) { - std::string transportModel = "none"; + string transportModel = "none"; AnyMap& input = phase->input(); if (input.hasKey("transport")) { transportModel = input["transport"].asString(); @@ -106,7 +106,7 @@ Transport* TransportFactory::newTransport(ThermoPhase* phase, int log_level) return newTransport(transportModel, phase,log_level); } -Transport* newTransportMgr(const std::string& model, ThermoPhase* thermo, int log_level) +Transport* newTransportMgr(const string& model, ThermoPhase* thermo, int log_level) { warn_deprecated("newTransportMgr", "To be removed after Cantera 3.0; superseded by newTransport."); diff --git a/src/zeroD/ConstPressureMoleReactor.cpp b/src/zeroD/ConstPressureMoleReactor.cpp index d0deb5d97..6eb427843 100644 --- a/src/zeroD/ConstPressureMoleReactor.cpp +++ b/src/zeroD/ConstPressureMoleReactor.cpp @@ -118,7 +118,7 @@ size_t ConstPressureMoleReactor::componentIndex(const string& nm) const } } -std::string ConstPressureMoleReactor::componentName(size_t k) { +string ConstPressureMoleReactor::componentName(size_t k) { if (k == 0) { return "enthalpy"; } else if (k >= m_sidx && k < neq()) { diff --git a/src/zeroD/ConstPressureReactor.cpp b/src/zeroD/ConstPressureReactor.cpp index 8e1f45016..ccb0a6d43 100644 --- a/src/zeroD/ConstPressureReactor.cpp +++ b/src/zeroD/ConstPressureReactor.cpp @@ -131,7 +131,7 @@ size_t ConstPressureReactor::componentIndex(const string& nm) const } } -std::string ConstPressureReactor::componentName(size_t k) { +string ConstPressureReactor::componentName(size_t k) { if (k == 0) { return "mass"; } else if (k == 1) { diff --git a/src/zeroD/FlowDevice.cpp b/src/zeroD/FlowDevice.cpp index 2384e860b..d298a933c 100644 --- a/src/zeroD/FlowDevice.cpp +++ b/src/zeroD/FlowDevice.cpp @@ -27,7 +27,7 @@ bool FlowDevice::install(ReactorBase& in, ReactorBase& out) m_nspin = mixin.nSpecies(); m_nspout = mixout.nSpecies(); - std::string nm; + string nm; size_t ki, ko; for (ki = 0; ki < m_nspin; ki++) { nm = mixin.speciesName(ki); diff --git a/src/zeroD/FlowDeviceFactory.cpp b/src/zeroD/FlowDeviceFactory.cpp index 26b1e5022..429bb375e 100644 --- a/src/zeroD/FlowDeviceFactory.cpp +++ b/src/zeroD/FlowDeviceFactory.cpp @@ -34,7 +34,7 @@ void FlowDeviceFactory::deleteFactory() { } -FlowDevice* FlowDeviceFactory::newFlowDevice(const std::string& flowDeviceType) +FlowDevice* FlowDeviceFactory::newFlowDevice(const string& flowDeviceType) { warn_deprecated("FlowDeviceFactory::newFlowDevice", "To be removed after Cantera 3.0; for new behavior, see 'newFlowDevice3'."); diff --git a/src/zeroD/IdealGasConstPressureMoleReactor.cpp b/src/zeroD/IdealGasConstPressureMoleReactor.cpp index 47536e7b5..0ada81904 100644 --- a/src/zeroD/IdealGasConstPressureMoleReactor.cpp +++ b/src/zeroD/IdealGasConstPressureMoleReactor.cpp @@ -248,7 +248,7 @@ size_t IdealGasConstPressureMoleReactor::componentIndex(const string& nm) const } } -std::string IdealGasConstPressureMoleReactor::componentName(size_t k) { +string IdealGasConstPressureMoleReactor::componentName(size_t k) { if (k == 0) { return "temperature"; } else if (k >= m_sidx && k < neq()) { diff --git a/src/zeroD/IdealGasConstPressureReactor.cpp b/src/zeroD/IdealGasConstPressureReactor.cpp index b0ec40839..c9681f94a 100644 --- a/src/zeroD/IdealGasConstPressureReactor.cpp +++ b/src/zeroD/IdealGasConstPressureReactor.cpp @@ -144,7 +144,7 @@ size_t IdealGasConstPressureReactor::componentIndex(const string& nm) const } } -std::string IdealGasConstPressureReactor::componentName(size_t k) { +string IdealGasConstPressureReactor::componentName(size_t k) { if (k == 1) { return "temperature"; } else { diff --git a/src/zeroD/IdealGasMoleReactor.cpp b/src/zeroD/IdealGasMoleReactor.cpp index cdfb61756..902b336ee 100644 --- a/src/zeroD/IdealGasMoleReactor.cpp +++ b/src/zeroD/IdealGasMoleReactor.cpp @@ -64,7 +64,7 @@ size_t IdealGasMoleReactor::componentIndex(const string& nm) const } } -std::string IdealGasMoleReactor::componentName(size_t k) +string IdealGasMoleReactor::componentName(size_t k) { if (k == 0) { return "temperature"; diff --git a/src/zeroD/IdealGasReactor.cpp b/src/zeroD/IdealGasReactor.cpp index d0df8152b..4716a2242 100644 --- a/src/zeroD/IdealGasReactor.cpp +++ b/src/zeroD/IdealGasReactor.cpp @@ -151,7 +151,7 @@ size_t IdealGasReactor::componentIndex(const string& nm) const } } -std::string IdealGasReactor::componentName(size_t k) { +string IdealGasReactor::componentName(size_t k) { if (k == 2) { return "temperature"; } else { diff --git a/src/zeroD/MoleReactor.cpp b/src/zeroD/MoleReactor.cpp index 0490a9b8b..9d5c38e80 100644 --- a/src/zeroD/MoleReactor.cpp +++ b/src/zeroD/MoleReactor.cpp @@ -297,7 +297,7 @@ size_t MoleReactor::componentIndex(const string& nm) const } } -std::string MoleReactor::componentName(size_t k) { +string MoleReactor::componentName(size_t k) { if (k == 0) { return "int_energy"; } else if (k == 1) { diff --git a/src/zeroD/Reactor.cpp b/src/zeroD/Reactor.cpp index 55cca20f6..2d9c04d51 100644 --- a/src/zeroD/Reactor.cpp +++ b/src/zeroD/Reactor.cpp @@ -465,7 +465,7 @@ size_t Reactor::componentIndex(const string& nm) const } } -std::string Reactor::componentName(size_t k) { +string Reactor::componentName(size_t k) { if (k == 0) { return "mass"; } else if (k == 1) { diff --git a/src/zeroD/ReactorFactory.cpp b/src/zeroD/ReactorFactory.cpp index 8512ceb45..65a15e031 100644 --- a/src/zeroD/ReactorFactory.cpp +++ b/src/zeroD/ReactorFactory.cpp @@ -66,7 +66,7 @@ void ReactorFactory::deleteFactory() { s_factory = 0; } -ReactorBase* ReactorFactory::newReactor(const std::string& reactorType) +ReactorBase* ReactorFactory::newReactor(const string& reactorType) { warn_deprecated("ReactorFactory::newReactor", "To be removed after Cantera 3.0; for new behavior, see 'newReactor3'."); diff --git a/src/zeroD/ReactorNet.cpp b/src/zeroD/ReactorNet.cpp index 99dbd99ab..520936c9c 100644 --- a/src/zeroD/ReactorNet.cpp +++ b/src/zeroD/ReactorNet.cpp @@ -148,7 +148,7 @@ void ReactorNet::reinitialize() } } -void ReactorNet::setLinearSolverType(const std::string& linSolverType) +void ReactorNet::setLinearSolverType(const string& linSolverType) { m_linearSolverType = linSolverType; m_integrator_init = false; @@ -465,7 +465,7 @@ size_t ReactorNet::globalComponentIndex(const string& component, size_t reactor) return m_start[reactor] + m_reactors[reactor]->componentIndex(component); } -std::string ReactorNet::componentName(size_t i) const +string ReactorNet::componentName(size_t i) const { for (auto r : m_reactors) { if (i < r->neq()) { @@ -478,7 +478,7 @@ std::string ReactorNet::componentName(size_t i) const } size_t ReactorNet::registerSensitivityParameter( - const std::string& name, double value, double scale) + const string& name, double value, double scale) { if (m_integrator_init) { throw CanteraError("ReactorNet::registerSensitivityParameter", @@ -508,7 +508,7 @@ AnyMap ReactorNet::solverStats() const } } -std::string ReactorNet::linearSolverType() const +string ReactorNet::linearSolverType() const { if (m_integ) { return m_integ->linearSolverType(); diff --git a/src/zeroD/ReactorSurface.cpp b/src/zeroD/ReactorSurface.cpp index 81d2b6c32..6e0d4bf8e 100644 --- a/src/zeroD/ReactorSurface.cpp +++ b/src/zeroD/ReactorSurface.cpp @@ -55,7 +55,7 @@ void ReactorSurface::setCoverages(const Composition& cov) m_thermo->getCoverages(m_cov.data()); } -void ReactorSurface::setCoverages(const std::string& cov) +void ReactorSurface::setCoverages(const string& cov) { m_thermo->setCoveragesByName(cov); m_thermo->getCoverages(m_cov.data()); diff --git a/src/zeroD/WallFactory.cpp b/src/zeroD/WallFactory.cpp index be404b574..37145abdc 100644 --- a/src/zeroD/WallFactory.cpp +++ b/src/zeroD/WallFactory.cpp @@ -31,7 +31,7 @@ void WallFactory::deleteFactory() { s_factory = 0; } -WallBase* WallFactory::newWall(const std::string& wallType) +WallBase* WallFactory::newWall(const string& wallType) { warn_deprecated("WallFactory::newWall", "To be removed after Cantera 3.0; for new behavior, see 'newWall3'."); diff --git a/test/equil/equil_gas.cpp b/test/equil/equil_gas.cpp index f8c33873a..472c9500a 100644 --- a/test/equil/equil_gas.cpp +++ b/test/equil/equil_gas.cpp @@ -21,7 +21,7 @@ class OverconstrainedEquil : public testing::Test { public: OverconstrainedEquil() {} - void setup(const std::string& elements="H, C, O, N, Ar") { + void setup(const string& elements="H, C, O, N, Ar") { AnyMap phase = AnyMap::fromYamlString( "{name: gas, thermo: ideal-gas, elements: [" + elements + "], " " species: [{gri30.yaml/species: [CH, C2H2]}]}"); @@ -136,11 +136,11 @@ public: continue; } shared_ptr s = gas.species(k); - double muk = mu_C * getValue(s->composition, std::string("C"), 0.0) + - mu_H * getValue(s->composition, std::string("H"), 0.0) + - mu_O * getValue(s->composition, std::string("O"), 0.0) + - mu_N * getValue(s->composition, std::string("N"), 0.0) + - mu_Ar * getValue(s->composition, std::string("AR"), 0.0); + double muk = mu_C * getValue(s->composition, string("C"), 0.0) + + mu_H * getValue(s->composition, string("H"), 0.0) + + mu_O * getValue(s->composition, string("O"), 0.0) + + mu_N * getValue(s->composition, string("N"), 0.0) + + mu_Ar * getValue(s->composition, string("AR"), 0.0); EXPECT_CLOSE(muk, mu[k], 1e-7); } } @@ -159,7 +159,7 @@ public: check(); } - void check_CH4_N2(const std::string& solver) { + void check_CH4_N2(const string& solver) { for (int i = 0; i < 5; i++) { double T = 500 + 300 * i; gas.setState_TPX(T, OneAtm, "CH4:3, N2:2"); @@ -169,7 +169,7 @@ public: } } - void check_O2_N2(const std::string& solver) { + void check_O2_N2(const string& solver) { for (int i = 0; i < 5; i++) { double T = 500 + 300 * i; gas.setState_TPX(T, OneAtm, "O2:3, N2:2"); @@ -179,7 +179,7 @@ public: } } - void check_CH4_O2_N2(const std::string& solver) { + void check_CH4_O2_N2(const string& solver) { for (int i = 0; i < 6; i++) { double T = 500 + 300 * i; gas.setState_TPX(T, OneAtm, "CH4:3, O2:3, N2:4"); @@ -189,7 +189,7 @@ public: } } - void check_CH4_O2(const std::string& solver) { + void check_CH4_O2(const string& solver) { for (int i = 0; i < 5; i++) { Composition comp; comp["CH4"] = i * 0.6 / 5.0; @@ -227,7 +227,7 @@ TEST_F(GriMatrix, SLOW_TEST(VcsNonideal_CH4_O2)) { check_CH4_O2("vcs"); } class PropertyPairs : public GriEquilibriumTest { public: - void check_TP(const std::string& solver) { + void check_TP(const string& solver) { gas.setState_TPX(500, 1e5, "CH4:0.3, O2:0.3, N2:0.4"); save_elemental_mole_fractions(); gas.equilibrate("TP", solver); @@ -236,7 +236,7 @@ public: check(); } - void check_HP(const std::string& solver) { + void check_HP(const string& solver) { gas.setState_TPX(500, 1e5, "CH4:0.3, O2:0.3, N2:0.4"); double h0 = gas.enthalpy_mass(); save_elemental_mole_fractions(); @@ -246,7 +246,7 @@ public: check(); } - void check_SP(const std::string& solver) { + void check_SP(const string& solver) { gas.setState_TPX(500, 3e5, "CH4:0.3, O2:0.3, N2:0.4"); double s0 = gas.entropy_mass(); save_elemental_mole_fractions(); @@ -256,7 +256,7 @@ public: check(); } - void check_SV(const std::string& solver) { + void check_SV(const string& solver) { gas.setState_TPX(500, 3e5, "CH4:0.3, O2:0.3, N2:0.4"); double s0 = gas.entropy_mass(); double rho0 = gas.density(); @@ -267,7 +267,7 @@ public: check(); } - void check_TV(const std::string& solver) { + void check_TV(const string& solver) { gas.setState_TPX(500, 3e5, "CH4:0.3, O2:0.3, N2:0.4"); double rho0 = gas.density(); save_elemental_mole_fractions(); @@ -279,7 +279,7 @@ public: check(5e-8); } - void check_UV(const std::string& solver) { + void check_UV(const string& solver) { gas.setState_TPX(500, 3e5, "CH4:0.3, O2:0.3, N2:0.4"); double u0 = gas.intEnergy_mass(); double rho0 = gas.density(); diff --git a/test/general/string_processing.cpp b/test/general/string_processing.cpp index 56b872263..bb4b5c6db 100644 --- a/test/general/string_processing.cpp +++ b/test/general/string_processing.cpp @@ -51,7 +51,7 @@ TEST(parseCompString, name_with_final_colon) TEST(parseCompString, default_values) { - vector x = { "foo", "bar", "baz" }; + vector x = { "foo", "bar", "baz" }; Composition c = parseCompString("foo:1.0 baz:2", x); ASSERT_EQ((size_t) 3, c.size()); ASSERT_FALSE(c.find("bar") == c.end()); @@ -70,7 +70,7 @@ TEST(parseCompString, delimiters) TEST(parseCompString, missing_element) { - vector x = { "foo", "bar" }; + vector x = { "foo", "bar" }; ASSERT_THROW(parseCompString("foo:1.0 bar:2 baz:1e-4", x), CanteraError); } diff --git a/test/general/test_containers.cpp b/test/general/test_containers.cpp index f6bcd480c..b36346cf6 100644 --- a/test/general/test_containers.cpp +++ b/test/general/test_containers.cpp @@ -104,7 +104,7 @@ TEST(AnyMap, paths) { EXPECT_TRUE(m["compound"].hasKey("second")); EXPECT_EQ(m["compound"]["first"].asString(), "bar"); - EXPECT_EQ(m["compound"]["second"].as(), "baz"); + EXPECT_EQ(m["compound"]["second"].as(), "baz"); EXPECT_EQ(m["several"]["layers"]["deep"].asString(), "foo"); EXPECT_THROW(m.at("missing"), std::exception); EXPECT_FALSE(m.hasKey("missing")); @@ -141,7 +141,7 @@ TEST(AnyMap, equality2) { m["bool"] = true; m["int"] = 33; m["vector_any_int"] = vector{3, 9, -1}; - m["strings"] = vector{"spam", "eggs", "spam"}; + m["strings"] = vector{"spam", "eggs", "spam"}; } EXPECT_EQ(M[0], M[1]); @@ -180,17 +180,17 @@ TEST(AnyMap, map_conversion) { m["compound"]["second"] = "baz"; m["empty"] = AnyMap(); - auto x = m["compound"].asMap(); + auto x = m["compound"].asMap(); EXPECT_EQ(x.size(), (size_t) 2); EXPECT_EQ(x["first"], "bar"); EXPECT_EQ(x["second"], "baz"); - std::string keys = m["compound"].as().keys_str(); + string keys = m["compound"].as().keys_str(); EXPECT_NE(keys.find("first"), npos); EXPECT_NE(keys.find("second"), npos); EXPECT_EQ(keys.size(), (size_t) 13); EXPECT_EQ(m["empty"].as().keys_str(), ""); - map zz{{"a", 9.1}, {"b", 13.5}}; + map zz{{"a", 9.1}, {"b", 13.5}}; m["foo"] = zz; EXPECT_TRUE(m["foo"].hasKey("a")); EXPECT_DOUBLE_EQ(m["foo"]["b"].asDouble(), 13.5); @@ -246,7 +246,7 @@ TEST(AnyMap, vector_length) TEST(AnyMap, getters_with_defaults) { AnyMap m; - map zz{{"a", 9.0}, {"b", 13.5}}; + map zz{{"a", 9.0}, {"b", 13.5}}; m["foo"] = zz; m["foo"]["c"] = 4; m["bar"] = "baz"; @@ -304,7 +304,7 @@ TEST(AnyMap, iterators) { AnyMap m = AnyMap::fromYamlString( "{a: 1, b: two, c: 3.01, d: {foo: 1, bar: 2}}"); - vector keys; + vector keys; for (const auto& [key, value] : m) { keys.push_back(key); } @@ -390,7 +390,7 @@ TEST(AnyMap, missingKeyAt) TEST(AnyMap, dumpYamlString) { AnyMap original = AnyMap::fromYamlFile("h2o2.yaml"); - std::string serialized = original.toYamlString(); + string serialized = original.toYamlString(); AnyMap generated = AnyMap::fromYamlString(serialized); for (const auto& [key, value] : original) { EXPECT_TRUE(generated.hasKey(key)); @@ -406,7 +406,7 @@ TEST(AnyMap, YamlFlowStyle) original["y"] = true; original["z"] = AnyMap::fromYamlString("{zero: 1, half: 2}"); original.setFlowStyle(); - std::string serialized = original.toYamlString(); + string serialized = original.toYamlString(); // The serialized version should contain two lines, and end with a newline. EXPECT_EQ(std::count(serialized.begin(), serialized.end(), '\n'), 2); AnyMap generated = AnyMap::fromYamlString(serialized); @@ -417,8 +417,8 @@ TEST(AnyMap, YamlFlowStyle) TEST(AnyMap, nestedVectorsToYaml) { - vector words{"foo", "bar", "baz", "qux", "foobar"}; - vector> strings; + vector words{"foo", "bar", "baz", "qux", "foobar"}; + vector> strings; vector> booleans; vector> integers; for (size_t i = 0; i < 3; i++) { @@ -435,10 +435,10 @@ TEST(AnyMap, nestedVectorsToYaml) original["strings"] = strings; original["booleans"] = booleans; original["integers"] = integers; - std::string serialized = original.toYamlString(); + string serialized = original.toYamlString(); AnyMap generated = AnyMap::fromYamlString(serialized); - EXPECT_EQ(generated["strings"].asVector>(), strings); + EXPECT_EQ(generated["strings"].asVector>(), strings); EXPECT_EQ(generated["booleans"].asVector>(), booleans); EXPECT_EQ(generated["integers"].asVector>(), integers); } @@ -457,8 +457,8 @@ TEST(AnyMap, definedKeyOrdering) {"tail", "one"} }); - std::string result = m.toYamlString(); - std::unordered_map loc; + string result = m.toYamlString(); + std::unordered_map loc; for (auto& [key, value] : m) { loc[key] = result.find(key); } diff --git a/test/general/test_serialization.cpp b/test/general/test_serialization.cpp index ac3c5bd45..3c6f1e606 100644 --- a/test/general/test_serialization.cpp +++ b/test/general/test_serialization.cpp @@ -197,7 +197,7 @@ TEST(YamlWriter, reaction_units_from_Yaml) writer.addPhase(original); writer.setPrecision(14); auto units = UnitSystem(); - map defaults{ + map defaults{ {"activation-energy", "K"}, {"quantity", "mol"}, {"length", "cm"} diff --git a/test/general/test_units.cpp b/test/general/test_units.cpp index c96892280..cf091f7bd 100644 --- a/test/general/test_units.cpp +++ b/test/general/test_units.cpp @@ -93,7 +93,7 @@ TEST(Units, with_defaults2) { } TEST(Units, with_defaults_map) { - map defaults{ + map defaults{ {"length", "cm"}, {"mass", "g"}, {"quantity", "mol"}, {"pressure", "atm"}, {"energy", "J"} }; @@ -111,9 +111,9 @@ TEST(Units, with_defaults_map) { TEST(Units, bad_defaults) { UnitSystem U; - map bad_key{{"length", "m"}, {"joy", "MJ"}}; + map bad_key{{"length", "m"}, {"joy", "MJ"}}; EXPECT_THROW(U.setDefaults(bad_key), CanteraError); - map bad_value{{"length", "m"}, {"time", "J"}}; + map bad_value{{"length", "m"}, {"time", "J"}}; EXPECT_THROW(U.setDefaults(bad_value), CanteraError); } @@ -153,7 +153,7 @@ TEST(Units, activation_energies4) { TEST(Units, activation_energies5) { UnitSystem U; - map defaults{ + map defaults{ {"quantity", "mol"}, {"energy", "cal"}, {"activation-energy", "K"} }; U.setDefaults(defaults); @@ -163,7 +163,7 @@ TEST(Units, activation_energies5) { TEST(Units, activation_energies6) { UnitSystem U; - map defaults{ + map defaults{ {"activation-energy", "eV"} }; U.setDefaults(defaults); diff --git a/test/kinetics/kineticsFromScratch.cpp b/test/kinetics/kineticsFromScratch.cpp index 80455a513..e11304dc1 100644 --- a/test/kinetics/kineticsFromScratch.cpp +++ b/test/kinetics/kineticsFromScratch.cpp @@ -43,7 +43,7 @@ public: void check_rates(int iRef) { ASSERT_EQ((size_t) 1, kin.nReactions()); - std::string X = "O:0.02 H2:0.2 O2:0.5 H:0.03 OH:0.05 H2O:0.1 HO2:0.01"; + string X = "O:0.02 H2:0.2 O2:0.5 H:0.03 OH:0.05 H2O:0.1 HO2:0.01"; pp->setState_TPX(1200, 5*OneAtm, X); pp_ref->setState_TPX(1200, 5*OneAtm, X); @@ -78,7 +78,7 @@ TEST_F(KineticsFromScratch, add_elementary_reaction2) // reaction 0: // equation: O + H2 <=> H + OH # Reaction 1 // rate-constant: {A: 38.7, b: 2.7, Ea: 6260.0} - std::string equation = "O + H2 <=> H + OH"; + string equation = "O + H2 <=> H + OH"; auto rate = make_shared(3.87e1, 2.7, 2.619184e+07); auto R = make_shared(equation, rate); @@ -111,7 +111,7 @@ TEST_F(KineticsFromScratch, add_three_body_reaction2) // type: three-body // rate-constant: {A: 1.2e+11, b: -1.0, Ea: 0.0} // efficiencies: {AR: 0.83, H2: 2.4, H2O: 15.4} - std::string equation = "2 O + M <=> O2 + M"; + string equation = "2 O + M <=> O2 + M"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto tbody = make_shared(); tbody->efficiencies = parseCompString("AR:0.83 H2:2.4 H2O:15.4"); @@ -123,7 +123,7 @@ TEST_F(KineticsFromScratch, add_three_body_reaction2) TEST_F(KineticsFromScratch, add_three_body_reaction3) { - std::string equation = "2 O + M <=> O2 + M"; + string equation = "2 O + M <=> O2 + M"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto R = make_shared(equation, rate); EXPECT_TRUE(R->usesThirdBody()); @@ -131,7 +131,7 @@ TEST_F(KineticsFromScratch, add_three_body_reaction3) TEST_F(KineticsFromScratch, multiple_third_bodies1) { - std::string equation = "2 H + 2 O2 <=> H2 + 2 O2"; + string equation = "2 H + 2 O2 <=> H2 + 2 O2"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto R = make_shared(equation, rate); EXPECT_FALSE(R->usesThirdBody()); @@ -139,14 +139,14 @@ TEST_F(KineticsFromScratch, multiple_third_bodies1) TEST_F(KineticsFromScratch, multiple_third_bodies2) { - std::string equation = "2 H + 2 M <=> H2 + 2 M"; + string equation = "2 H + 2 M <=> H2 + 2 M"; auto rate = make_shared(1.2e11, -1.0, 0.0); ASSERT_THROW(Reaction(equation, rate), CanteraError); } TEST_F(KineticsFromScratch, multiple_third_bodies3) { - std::string equation = "2 H + O2 + M <=> H2 + O2 + M"; + string equation = "2 H + O2 + M <=> H2 + O2 + M"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto R = make_shared(equation, rate); EXPECT_TRUE(R->usesThirdBody()); @@ -154,7 +154,7 @@ TEST_F(KineticsFromScratch, multiple_third_bodies3) TEST_F(KineticsFromScratch, multiple_third_bodies4) { - std::string equation = "H2 + O2 => H2 + O2"; + string equation = "H2 + O2 => H2 + O2"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto tbody = make_shared("O2"); auto R = make_shared(equation, rate, tbody); @@ -172,7 +172,7 @@ TEST_F(KineticsFromScratch, multiple_third_bodies4) TEST_F(KineticsFromScratch, multiple_third_bodies5) { - std::string equation = "H2 + O2 => H2 + O2"; + string equation = "H2 + O2 => H2 + O2"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto tbody = make_shared("AR"); // incompatible third body ASSERT_THROW(Reaction(equation, rate, tbody), CanteraError); @@ -199,7 +199,7 @@ TEST_F(KineticsFromScratch, multiple_third_bodies6) TEST_F(KineticsFromScratch, multiple_third_bodies7) { - std::string equation = "CH2OCH + M <=> CH2CHO + M"; + string equation = "CH2OCH + M <=> CH2CHO + M"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto tbody = make_shared("O2"); auto R = make_shared(equation, rate, tbody); @@ -217,7 +217,7 @@ TEST_F(KineticsFromScratch, multiple_third_bodies7) TEST_F(KineticsFromScratch, multiple_third_bodies8) { - std::string equation = "CH2OCH + M <=> CH2CHO + M"; + string equation = "CH2OCH + M <=> CH2CHO + M"; auto rate = make_shared(1.2e11, -1.0, 0.0); auto tbody = make_shared(); tbody->efficiencies = parseCompString("O2:1"); @@ -237,7 +237,7 @@ TEST_F(KineticsFromScratch, multiple_third_bodies8) TEST_F(KineticsFromScratch, add_two_temperature_plasma) { - std::string equation = "O + H => O + H"; + string equation = "O + H => O + H"; auto rate = make_shared(17283, -3.1, -5820000, 1081000); auto R = make_shared(equation, rate); EXPECT_FALSE(R->usesThirdBody()); @@ -303,7 +303,7 @@ TEST_F(KineticsFromScratch, add_falloff_reaction2) // high-P-rate-constant: {A: 7.4e+10, b: -0.37, Ea: 0.0} // Troe: {A: 0.7346, T3: 94.0, T1: 1756.0, T2: 5182.0} // efficiencies: {AR: 0.7, H2: 2.0, H2O: 6.0} - std::string equation = "2 OH (+ M) <=> H2O2 (+ M)"; + string equation = "2 OH (+ M) <=> H2O2 (+ M)"; ArrheniusRate high_rate(7.4e10, -0.37, 0.0); ArrheniusRate low_rate(2.3e12, -0.9, -7112800.0); vector falloff_params { 0.7346, 94.0, 1756.0, 5182.0 }; @@ -318,7 +318,7 @@ TEST_F(KineticsFromScratch, add_falloff_reaction2) TEST_F(KineticsFromScratch, missing_third_body) { - std::string equation = "2 OH <=> H2O2"; + string equation = "2 OH <=> H2O2"; ArrheniusRate high_rate(7.4e10, -0.37, 0.0); ArrheniusRate low_rate(2.3e12, -0.9, -7112800.0); vector falloff_params { 0.7346, 94.0, 1756.0, 5182.0 }; @@ -536,8 +536,8 @@ public: void check_rates(int iRef) { ASSERT_EQ((size_t) 1, kin.nReactions()); - std::string X = "H2:0.2 O2:0.5 H2O:0.1 N2:0.2"; - std::string Xs = "H(m):0.1 O(m):0.2 OH(m):0.3 (m):0.4"; + string X = "H2:0.2 O2:0.5 H2O:0.1 N2:0.2"; + string Xs = "H(m):0.1 O(m):0.2 OH(m):0.3 (m):0.4"; gas->setState_TPX(1200, 5*OneAtm, X); gas_ref->setState_TPX(1200, 5*OneAtm, X); surf->setState_TP(1200, 5*OneAtm); @@ -621,9 +621,9 @@ public: BulkKinetics kin; shared_ptr kin_ref; vector> reactions; - map> species; + map> species; - void check_rates(size_t N, const std::string& X) { + void check_rates(size_t N, const string& X) { for (size_t i = 0; i < kin_ref->nReactions(); i++) { if (i >= N) { kin_ref->setMultiplier(i, 0); diff --git a/test/kinetics/pdep.cpp b/test/kinetics/pdep.cpp index 893bb7ebb..0ac183581 100644 --- a/test/kinetics/pdep.cpp +++ b/test/kinetics/pdep.cpp @@ -21,7 +21,7 @@ public: } void SetUp() { - std::string Xref = "H:1.0, R1A:1.0, R1B:1.0, R2:1.0, " + string Xref = "H:1.0, R1A:1.0, R1B:1.0, R2:1.0, " "R3:1.0, R4:1.0, R5:1.0, R6:1.0"; soln_->thermo()->setState_TPX(900.0, 101325 * 8.0, Xref); diff --git a/test/kinetics/rates.cpp b/test/kinetics/rates.cpp index 5017c2e75..a38925783 100644 --- a/test/kinetics/rates.cpp +++ b/test/kinetics/rates.cpp @@ -121,7 +121,7 @@ class NegativePreexponentialFactor : public testing::Test { public: NegativePreexponentialFactor() {} - void setup(const std::string& infile) { + void setup(const string& infile) { soln = newSolution(infile); soln->thermo()->setState_TPX(2000, OneAtm, "H2O:1.0, H:0.2, O2:0.3, NH:0.05, NO:0.05, N2O:0.05"); diff --git a/test/thermo/MaskellSolidSolnPhase_Test.cpp b/test/thermo/MaskellSolidSolnPhase_Test.cpp index 9a82e6c5d..fe1e585f0 100644 --- a/test/thermo/MaskellSolidSolnPhase_Test.cpp +++ b/test/thermo/MaskellSolidSolnPhase_Test.cpp @@ -25,7 +25,7 @@ public: make_deprecation_warnings_fatal(); } - void setup(const std::string & filename) + void setup(const string & filename) { test_phase = newThermo(filename); } diff --git a/test/thermo/ThermoPhase_Test.cpp b/test/thermo/ThermoPhase_Test.cpp index a699fd58f..af857d0a2 100644 --- a/test/thermo/ThermoPhase_Test.cpp +++ b/test/thermo/ThermoPhase_Test.cpp @@ -238,8 +238,8 @@ public: void test_stoich_mixture(ThermoBasis basis, double mf, double AFR_st) { auto& gas = *m_sol->thermo(); - std::string sfuel = "CH4"; - std::string sox = "O2:21,N2:79"; + string sfuel = "CH4"; + string sox = "O2:21,N2:79"; gas.setState_TP(300.0, 1e5); gas.setEquivalenceRatio(1.0, sfuel, sox, basis); gas.setMixtureFraction(gas.mixtureFraction(sfuel, sox, basis, "Bilger"), sfuel, sox, basis); diff --git a/test/thermo/phaseConstructors.cpp b/test/thermo/phaseConstructors.cpp index d8a66d445..6af658480 100644 --- a/test/thermo/phaseConstructors.cpp +++ b/test/thermo/phaseConstructors.cpp @@ -33,32 +33,32 @@ namespace Cantera { -shared_ptr make_species(const std::string& name, - const std::string& composition, const double* nasa_coeffs) +shared_ptr make_species(const string& name, + const string& composition, const double* nasa_coeffs) { auto species = make_shared(name, parseCompString(composition)); species->thermo = make_shared(200, 3500, 101325, nasa_coeffs); return species; } -shared_ptr make_shomate_species(const std::string& name, - const std::string& composition, const double* shomate_coeffs) +shared_ptr make_shomate_species(const string& name, + const string& composition, const double* shomate_coeffs) { auto species = make_shared(name, parseCompString(composition)); species->thermo = make_shared(200, 3500, 101325, shomate_coeffs); return species; } -shared_ptr make_shomate2_species(const std::string& name, - const std::string& composition, const double* shomate_coeffs) +shared_ptr make_shomate2_species(const string& name, + const string& composition, const double* shomate_coeffs) { auto species = make_shared(name, parseCompString(composition)); species->thermo = make_shared(200, 3500, 101325, shomate_coeffs); return species; } -shared_ptr make_species(const std::string& name, - const std::string& composition, double h298, +shared_ptr make_species(const string& name, + const string& composition, double h298, double T1, double mu1, double T2, double mu2, double pref=101325) { auto species = make_shared(name, parseCompString(composition)); @@ -67,8 +67,8 @@ shared_ptr make_species(const std::string& name, return species; } -shared_ptr make_const_cp_species(const std::string& name, - const std::string& composition, double T0, double h0, double s0, double cp) +shared_ptr make_const_cp_species(const string& name, + const string& composition, double T0, double h0, double s0, double cp) { auto species = make_shared(name, parseCompString(composition)); double coeffs[] = {T0, h0, s0, cp}; diff --git a/test/thermo/thermoToYaml.cpp b/test/thermo/thermoToYaml.cpp index 0ab6a48f8..a3594454d 100644 --- a/test/thermo/thermoToYaml.cpp +++ b/test/thermo/thermoToYaml.cpp @@ -6,12 +6,12 @@ #include "cantera/thermo/PlasmaPhase.h" using namespace Cantera; -typedef vector strvec; +typedef vector strvec; class ThermoToYaml : public testing::Test { public: - void setup(const std::string& fileName, const std::string& phaseName="") { + void setup(const string& fileName, const string& phaseName="") { thermo = newThermo(fileName, phaseName); // Because ThermoPhase::input may already contain the data we are trying // to check for here, clear it so that the only parameters are those @@ -55,7 +55,7 @@ TEST_F(ThermoToYaml, IdealSolidSoln) { setup("thermo-models.yaml", "IdealSolidSolnPhase2"); EXPECT_EQ(data["name"], "IdealSolidSolnPhase2"); - EXPECT_EQ(data["species"].asVector().size(), thermo->nSpecies()); + EXPECT_EQ(data["species"].asVector().size(), thermo->nSpecies()); EXPECT_EQ(data["standard-concentration-basis"], "solvent-molar-volume"); EXPECT_DOUBLE_EQ(eosData[0]["molar-volume"].asDouble(), 1.5); @@ -190,7 +190,7 @@ TEST_F(ThermoToYaml, Margules) setup("thermo-models.yaml", "molten-salt-Margules"); auto& interactions = data["interactions"].asVector(); EXPECT_EQ(interactions.size(), (size_t) 1); - EXPECT_EQ(interactions[0]["species"].asVector()[0], "KCl(l)"); + EXPECT_EQ(interactions[0]["species"].asVector()[0], "KCl(l)"); EXPECT_EQ(interactions[0]["excess-enthalpy"].asVector()[1], -377e3); } @@ -242,7 +242,7 @@ TEST_F(ThermoToYaml, DebyeHuckel_beta_ij) auto& beta = data["activity-data"]["beta"].asVector(); ASSERT_EQ(beta.size(), (size_t) 3); for (size_t i = 0; i < 3; i++) { - auto species = beta[i]["species"].asVector(); + auto species = beta[i]["species"].asVector(); std::sort(species.begin(), species.end()); if (species[0] == "Cl-" && species[1] == "H+") { EXPECT_DOUBLE_EQ(beta[i]["beta"].asDouble(), 0.27); @@ -263,7 +263,7 @@ TEST_F(ThermoToYaml, HMWSoln1) auto& interactions = data["activity-data"]["interactions"].asVector(); EXPECT_EQ(interactions.size(), (size_t) 7); for (auto& item : interactions) { - auto species = item["species"].asVector(); + auto species = item["species"].asVector(); std::sort(species.begin(), species.end()); if (species == strvec{"Cl-", "Na+"}) { auto& beta0 = item["beta0"].asVector(); @@ -298,7 +298,7 @@ TEST_F(ThermoToYaml, HMWSoln2) auto& interactions = data["activity-data"]["interactions"].asVector(); EXPECT_EQ(interactions.size(), (size_t) 4); for (auto& item : interactions) { - auto species = item["species"].asVector(); + auto species = item["species"].asVector(); std::sort(species.begin(), species.end()); if (species == strvec{"Cl-", "NaCl(aq)"}) { EXPECT_DOUBLE_EQ(item["lambda"].asVector()[0], 0.3); @@ -365,8 +365,8 @@ TEST_F(ThermoToYaml, DiscretizedElectronEnergyPlasma) class ThermoYamlRoundTrip : public testing::Test { public: - void roundtrip(const std::string& fileName, const std::string& phaseName="", - const vector extraPhases={}) { + void roundtrip(const string& fileName, const string& phaseName="", + const vector extraPhases={}) { original = newThermo(fileName, phaseName); YamlWriter writer; writer.addPhase(original); @@ -383,7 +383,7 @@ public: rtol = 1e-14; } - void compareThermo(double T, double P, const std::string& X="") { + void compareThermo(double T, double P, const string& X="") { size_t kk = original->nSpecies(); ASSERT_EQ(original->nSpecies(), duplicate->nSpecies()); diff --git a/test/transport/transportPolynomials.cpp b/test/transport/transportPolynomials.cpp index d90247faa..666296dff 100644 --- a/test/transport/transportPolynomials.cpp +++ b/test/transport/transportPolynomials.cpp @@ -15,7 +15,7 @@ public: ck_tran.init(phase.get(), CK_Mode); } - void check_viscosity_poly(const std::string& speciek, const vector& visc_coeff_expected, int cmode) { + void check_viscosity_poly(const string& speciek, const vector& visc_coeff_expected, int cmode) { size_t k = phase->speciesIndex(speciek); vector coeffs (cmode == CK_Mode ? 4 : 5); if (cmode == CK_Mode) { @@ -28,7 +28,7 @@ public: } } - void check_cond_poly(const std::string& speciek, const vector& cond_coeff_expected, int cmode) { + void check_cond_poly(const string& speciek, const vector& cond_coeff_expected, int cmode) { MixTransport tran; tran.init(phase.get(), cmode); size_t k = phase->speciesIndex(speciek); @@ -43,7 +43,7 @@ public: } } - void check_bindiff_poly(const std::string& speciek, const std::string& speciej, const vector& bindiff_coeff_expected, int cmode) { + void check_bindiff_poly(const string& speciek, const string& speciej, const vector& bindiff_coeff_expected, int cmode) { size_t k = phase->speciesIndex(speciek); size_t j = phase->speciesIndex(speciej); vector coeffs (cmode == CK_Mode ? 4 : 5); diff --git a/test/zeroD/test_zeroD.cpp b/test/zeroD/test_zeroD.cpp index 880ef7ca6..2be649b88 100644 --- a/test/zeroD/test_zeroD.cpp +++ b/test/zeroD/test_zeroD.cpp @@ -45,7 +45,7 @@ TEST(zerodim, test_individual_reactor_initialization) double T0 = 1100.0; double P0 = 10 * OneAtm; double tol = 1e-7; - std::string X0 = "H2:1.0, O2:0.5, AR:8.0"; + string X0 = "H2:1.0, O2:0.5, AR:8.0"; // reactor solution, phase, and kinetics objects shared_ptr sol1 = newSolution("h2o2.yaml"); sol1->thermo()->setState_TPX(T0, P0, X0); diff --git a/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp b/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp index c27783cca..823e90213 100644 --- a/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp +++ b/test_problems/cathermo/DH_graph_1/DH_graph_1.cpp @@ -18,8 +18,8 @@ int main(int argc, char** argv) string fName = "DH_graph_1.log"; fileLog* fl = new fileLog(fName); try { - std::string phaseName = (argc > 1) ? argv[1] : "NaCl_electrolyte"; - std::string iFile = (argc > 2) ? argv[2] : "DH_NaCl.yaml"; + string phaseName = (argc > 1) ? argv[1] : "NaCl_electrolyte"; + string iFile = (argc > 2) ? argv[2] : "DH_NaCl.yaml"; setLogger(fl); DebyeHuckel* DH = new DebyeHuckel(iFile, phaseName); diff --git a/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp b/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp index 57176e6f8..962fbc544 100644 --- a/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp +++ b/test_problems/cathermo/HMW_graph_CpvT/HMW_graph_CpvT.cpp @@ -18,7 +18,7 @@ int main(int argc, char** argv) size_t i; try { - std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; + string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; double Cp0_R[20], pmCp[20]; HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte"); diff --git a/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp b/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp index f3ec0b431..8fd8e593c 100644 --- a/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp +++ b/test_problems/cathermo/HMW_graph_GvT/HMW_graph_GvT.cpp @@ -21,7 +21,7 @@ int main(int argc, char** argv) int extraCols = 1; try { - std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; + string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte"); diff --git a/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp b/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp index f63433bb0..afcce3d44 100644 --- a/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp +++ b/test_problems/cathermo/HMW_graph_HvT/HMW_graph_HvT.cpp @@ -18,7 +18,7 @@ int main(int argc, char** argv) size_t i; try { - std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; + string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; double Enth0_RT[20], pmEnth[20], molarEnth; HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte"); diff --git a/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp b/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp index 1f8262995..c7742a6fd 100644 --- a/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp +++ b/test_problems/cathermo/HMW_graph_VvT/HMW_graph_VvT.cpp @@ -17,7 +17,7 @@ int main(int argc, char** argv) size_t i; try { - std::string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; + string iFile = (argc > 1) ? argv[1] : "HMW_NaCl.yaml"; double V0[20], pmV[20]; HMWSoln* HMW = new HMWSoln(iFile, "NaCl_electrolyte"); diff --git a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp index 3f2baaffe..c791278f2 100644 --- a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp +++ b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp @@ -12,7 +12,7 @@ using namespace std; std::stringstream ss; -void printValue(const std::string& label, double value) +void printValue(const string& label, double value) { ss.str(""); ss.clear();