Using std::string

This commit is contained in:
Ingmar Schoegl 2023-08-03 17:41:51 -05:00 committed by Ray Speth
parent 0df90be93e
commit 64ade35c22
241 changed files with 1382 additions and 1382 deletions

View File

@ -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<AnyMap> 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<AnyMap>& 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<size_t, size_t> 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<double>& values, const std::string& units);
void setQuantity(const vector<double>& values, const string& units);
typedef function<void(AnyValue&, const UnitSystem&)> unitConverter;
@ -245,15 +245,15 @@ public:
AnyValue& operator=(AnyMap&& value);
template<class T>
AnyValue& operator=(const std::unordered_map<std::string, T> items);
AnyValue& operator=(const std::unordered_map<string, T> items);
template<class T>
AnyValue& operator=(const map<std::string, T> items);
AnyValue& operator=(const map<string, T> items);
//! Return the held `AnyMap` as a `map` where all of the values have
//! the specified type.
template<class T>
map<std::string, T> asMap() const;
map<string, T> asMap() const;
//! Access a `vector<AnyMap>` 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<std::string, const AnyMap*> asMap(const std::string& name) const;
std::unordered_map<std::string, AnyMap*> asMap(const std::string& name);
std::unordered_map<string, const AnyMap*> asMap(const string& name) const;
std::unordered_map<string, AnyMap*> asMap(const string& name);
//! Treating the value as `vector<AnyMap>`, 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 <int, int> order() const;
@ -298,7 +298,7 @@ private:
void checkSize(const vector<T>& 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<AnyMap>& AnyValue::asVector<AnyMap>(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<double>
@ -372,7 +372,7 @@ vector<AnyMap>& AnyValue::asVector<AnyMap>(size_t nMin, size_t nMax);
* breakfast["beans"]["baked"] = v;
*
* // Create a nested AnyMap with values of the same type
* map<std::string, double> breads{{"wheat", 4.0}, {"white", 2.5}};
* map<string, double> breads{{"wheat", 4.0}, {"white", 2.5}};
* breakfast["toast"] = breads;
* // Equivalent to:
* breakfast["toast"]["wheat"] = 4.0
@ -383,10 +383,10 @@ vector<AnyMap>& AnyValue::asVector<AnyMap>(size_t nMin, size_t nMax);
*
* ```
* double val1 = breakfast["spam"].asDouble();
* std::string val2 = breakfast["eggs"].asString();
* string val2 = breakfast["eggs"].asString();
* vector<double> val3 = breakfast["beans"]["baked"].asVector<double>();
*
* map<std::string, double> = breakfast["toast"].asMap<double>();
* map<string, double> = breakfast["toast"].asMap<double>();
* ```
*
* ## Checking for elements
@ -416,8 +416,8 @@ vector<AnyMap>& AnyValue::asVector<AnyMap>(size_t nMin, size_t nMax);
* ```
* if (breakfast["sausage"].is<vector<double>>()) {
* // access using asVector<double>
* } else if (breakfast["sausage"].type() == typeid(vector<std::string>)) {
* // access using asVector<std::string>
* } else if (breakfast["sausage"].type() == typeid(vector<string>)) {
* // access using asVector<string>
* }
* ```
* @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<AnyMap>& 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<double> convertVector(const std::string& key, const std::string& units,
vector<double> 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<std::string, AnyValue>::const_iterator& start,
const std::unordered_map<std::string, AnyValue>::const_iterator& stop);
Iterator(const std::unordered_map<string, AnyValue>::const_iterator& start,
const std::unordered_map<string, AnyValue>::const_iterator& stop);
const pair<const std::string, AnyValue>& operator*() const {
const pair<const string, AnyValue>& operator*() const {
return *m_iter;
}
const pair<const std::string, AnyValue>* operator->() const {
const pair<const string, AnyValue>* operator->() const {
return &*m_iter;
}
bool operator!=(const Iterator& right) const {
@ -554,8 +554,8 @@ public:
Iterator& operator++();
private:
std::unordered_map<std::string, AnyValue>::const_iterator m_iter;
std::unordered_map<std::string, AnyValue>::const_iterator m_stop;
std::unordered_map<string, AnyValue>::const_iterator m_iter;
std::unordered_map<string, AnyValue>::const_iterator m_stop;
};
//! Defined to allow use with range-based for loops
@ -581,11 +581,11 @@ public:
typedef vector<pair<
pair<int, int>,
const pair<const std::string, AnyValue>*>> OrderVector;
const pair<const string, AnyValue>*>> OrderVector;
private:
const AnyMap* m_data;
OrderVector m_ordered;
unique_ptr<pair<const std::string, AnyValue>> m_units;
unique_ptr<pair<const string, AnyValue>> 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<const std::string, AnyValue>& operator*() const {
const pair<const string, AnyValue>& operator*() const {
return *m_iter->second;
}
const pair<const std::string, AnyValue>* operator->() const {
const pair<const string, AnyValue>* 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<vector<std::string>>& specs);
static bool addOrderingRules(const string& objectType,
const vector<vector<string>>& 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<std::string, AnyValue> m_data;
std::unordered_map<string, AnyValue> m_data;
//! The default units that are used to convert stored values
shared_ptr<UnitSystem> 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<std::string, vector<std::string>> s_headFields;
static std::unordered_map<string, vector<string>> 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<std::string, vector<std::string>> s_tailFields;
static std::unordered_map<string, vector<string>> 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 <typename... Args>
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 <typename... Args>
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<AnyMap>& metadata);
static std::string formatError2(const std::string& message,
static string formatError2(const string& message,
int line1, int column1, const shared_ptr<AnyMap>& metadata1,
int line2, int column2, const shared_ptr<AnyMap>& 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);
}

View File

@ -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<T> &AnyValue::asVector(size_t nMin, size_t nMax) {
}
template<class T>
AnyValue& AnyValue::operator=(const std::unordered_map<std::string, T> items) {
AnyValue& AnyValue::operator=(const std::unordered_map<string, T> items) {
m_value = AnyMap();
m_equals = eq_comparer<AnyMap>;
AnyMap& dest = as<AnyMap>();
@ -131,7 +131,7 @@ AnyValue& AnyValue::operator=(const std::unordered_map<std::string, T> items) {
}
template<class T>
AnyValue& AnyValue::operator=(const map<std::string, T> items) {
AnyValue& AnyValue::operator=(const map<string, T> items) {
m_value = AnyMap();
m_equals = eq_comparer<AnyMap>;
AnyMap& dest = as<AnyMap>();
@ -159,9 +159,9 @@ inline AnyMap& AnyValue::as<AnyMap>() {
}
template<class T>
map<std::string, T> AnyValue::asMap() const
map<string, T> AnyValue::asMap() const
{
map<std::string, T> dest;
map<string, T> dest;
for (const auto& item : as<AnyMap>()) {
dest[item.first] = item.second.as<T>();
}
@ -219,7 +219,7 @@ bool AnyValue::eq_comparer(const std::any& lhs, const std::any& rhs)
typedef vector<double> vd;
typedef vector<long int> vi;
typedef vector<AnyValue> va;
typedef vector<std::string> vs;
typedef vector<string> vs;
auto& ltype = lhs.type();
auto& rtype = rhs.type();

View File

@ -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<void()>& func,
const std::string& when)
void setDelegate(const string& name, const function<void()>& 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<void(bool)>& func,
const std::string& when)
void setDelegate(const string& name, const function<void(bool)>& 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<void(double)>& func,
const std::string& when)
void setDelegate(const string& name, const function<void(double)>& 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<void(const AnyMap&, const UnitStack&)>& 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<void(std::array<size_t, 1>, 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<void(std::array<size_t, 1>, 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<void(std::array <size_t, 2>, 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<void(std::array<size_t, 3>, 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<int(double&, void*)>& 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<int(std::string&, size_t)>& func,
const std::string& when)
void setDelegate(const string& name,
const function<int(string&, size_t)>& 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<int(size_t&, const std::string&)>& func,
const std::string& when)
void setDelegate(const string& name,
const function<int(size_t&, const string&)>& 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<void()>& target,
void install(const string& name, function<void()>& target,
const function<void()>& 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<void(bool)>& target,
void install(const string& name, function<void(bool)>& target,
const function<void(bool)>& 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<void(double)>& target,
void install(const string& name, function<void(double)>& target,
const function<void(double)>& 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<void(const AnyMap&, const UnitStack&)>& target,
const function<void(const AnyMap&, const UnitStack&)>& 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<void(std::array<size_t, 1>, double*)>& target,
const function<void(std::array<size_t, 1>, 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<void(std::array<size_t, 1>, double, double*)>& target,
const function<void(std::array<size_t, 1>, 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<void(std::array<size_t, 2>, double, double*, double*)>& target,
const function<void(std::array<size_t, 2>, 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<void(std::array<size_t, 3>, double*, double*, double*)>& target,
const function<void(std::array<size_t, 3>, 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<double(void*)>& target,
void install(const string& name, function<double(void*)>& target,
const function<double(void*)>& 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<std::string(size_t)>& target,
const function<std::string(size_t)>& base)
void install(const string& name,
function<string(size_t)>& target,
const function<string(size_t)>& base)
{
target = base;
m_funcs_s_sz[name] = &target;
@ -405,9 +405,9 @@ protected:
}
//! Install a function with the signature `size_t(string)` as being delegatable
void install(const std::string& name,
function<size_t(const std::string&)>& target,
const function<size_t(const std::string&)>& base)
void install(const string& name,
function<size_t(const string&)>& target,
const function<size_t(const string&)>& base)
{
target = base;
m_funcs_sz_csr[name] = &target;
@ -418,7 +418,7 @@ protected:
template <typename BaseFunc, class ... Args>
function<void(Args ...)> makeDelegate(
const function<void(Args ...)>& 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 <typename ReturnType, class ... Args>
function<ReturnType(Args ...)> makeDelegate(
const std::string& name,
const string& name,
const function<int(ReturnType&, Args ...)>& func,
const std::string& when,
const string& when,
const function<ReturnType(Args ...)>& 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<std::string, function<void()>*> m_funcs_v;
map<std::string, function<void(bool)>*> m_funcs_v_b;
map<std::string, function<void(double)>*> m_funcs_v_d;
map<string, function<void()>*> m_funcs_v;
map<string, function<void(bool)>*> m_funcs_v_b;
map<string, function<void(double)>*> m_funcs_v_d;
map<string, function<void(AnyMap&)>*> m_funcs_v_AMr;
map<std::string,
map<string,
function<void(const AnyMap&, const UnitStack&)>*> m_funcs_v_cAMr_cUSr;
map<string, function<void(const string&, void*)>*> m_funcs_v_csr_vp;
map<std::string,
map<string,
function<void(std::array<size_t, 1>, double*)>*> m_funcs_v_dp;
map<std::string,
map<string,
function<void(std::array<size_t, 1>, double, double*)>*> m_funcs_v_d_dp;
map<std::string,
map<string,
function<void(std::array<size_t, 2>, double, double*, double*)>*> m_funcs_v_d_dp_dp;
map<std::string,
map<string,
function<void(std::array<size_t, 3>, double*, double*, double*)>*> m_funcs_v_dp_dp_dp;
// Delegates with a return value
map<std::string, function<double(void*)>> m_base_d_vp;
map<std::string, function<double(void*)>*> m_funcs_d_vp;
map<string, function<double(void*)>> m_base_d_vp;
map<string, function<double(void*)>*> m_funcs_d_vp;
map<std::string,
function<std::string(size_t)>> m_base_s_sz;
map<std::string,
function<std::string(size_t)>*> m_funcs_s_sz;
map<string,
function<string(size_t)>> m_base_s_sz;
map<string,
function<string(size_t)>*> m_funcs_s_sz;
map<std::string,
function<size_t(const std::string&)>> m_base_sz_csr;
map<std::string,
function<size_t(const std::string&)>*> m_funcs_sz_csr;
map<string,
function<size_t(const string&)>> m_base_sz_csr;
map<string,
function<size_t(const string&)>*> m_funcs_sz_csr;
//! @}
//! Handles to wrappers for the delegated object in external language interfaces.
@ -557,7 +557,7 @@ protected:
map<string, shared_ptr<ExternalHandle>> m_handles;
//! Name of the class in the extension language
std::string m_delegatorName;
string m_delegatorName;
};
}

View File

@ -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<ExternalHandle> wrapSolution(const std::string& wrapperType,
static shared_ptr<ExternalHandle> wrapSolution(const string& wrapperType,
shared_ptr<Solution> 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<ExternalHandle>(shared_ptr<Solution>)> 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<std::string,
static map<string,
function<void(ReactionDataDelegator&)>> s_ReactionData_linkers;
//! Functions for wrapping and linking Solution objects
static map<std::string,
static map<string,
function<shared_ptr<ExternalHandle>(shared_ptr<Solution>)>> s_Solution_linkers;
//! Mapping from user-defined rate types to Solution wrapper types

View File

@ -19,7 +19,7 @@ class ExtensionManagerFactory : public Factory<ExtensionManager>
{
public:
//! Create a new ExtensionManager
static shared_ptr<ExtensionManager> build(const std::string& extensionType) {
static shared_ptr<ExtensionManager> build(const string& extensionType) {
return shared_ptr<ExtensionManager>(factory().create(extensionType));
}

View File

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

View File

@ -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<T*(Args...)> f) {
void reg(const string& name, function<T*(Args...)> 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<std::string, function<T*(Args...)>> m_creators;
std::unordered_map<string, function<T*(Args...)>> m_creators;
//! Map of synonyms to canonical names
std::unordered_map<std::string, std::string> m_synonyms;
std::unordered_map<string, string> m_synonyms;
//! Map of deprecated synonyms to canonical names. Use of these names will
//! show a deprecation warning.
std::unordered_map<std::string, std::string> m_deprecated_names;
std::unordered_map<string, string> m_deprecated_names;
};
}

View File

@ -68,8 +68,8 @@ protected:
* @returns an initialized Interface object.
* @ingroup solnGroup
*/
shared_ptr<Interface> newInterface(const std::string& infile,
const std::string& name="", const vector<std::string>& adjacent={});
shared_ptr<Interface> newInterface(const string& infile,
const string& name="", const vector<string>& adjacent={});
//! Create and initialize a new Interface from an input file
@ -84,8 +84,8 @@ shared_ptr<Interface> newInterface(const std::string& infile,
* @returns an initialized Interface object.
* @ingroup solnGroup
*/
shared_ptr<Interface> newInterface(const std::string& infile,
const std::string& name, const vector<shared_ptr<Solution>>& adjacent);
shared_ptr<Interface> newInterface(const string& infile,
const string& name, const vector<shared_ptr<Solution>>& adjacent);
//! Create and initialize a new Interface from AnyMap objects
/*!

View File

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

View File

@ -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<ThermoPhase> 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<ThermoPhase> thermo() {
@ -100,7 +100,7 @@ public:
}
//! Get the Solution object for an adjacent phase by name
shared_ptr<Solution> adjacent(const std::string& name) {
shared_ptr<Solution> 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<ExternalHandle> handle);
void holdExternalHandle(const string& name, shared_ptr<ExternalHandle> 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<ExternalHandle> getExternalHandle(const std::string& name) const;
shared_ptr<ExternalHandle> 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<shared_ptr<Solution>> m_adjacent;
//! Adjacent phases, for access by name
map<std::string, shared_ptr<Solution>> m_adjacentByName;
map<string, shared_ptr<Solution>> 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<std::string, shared_ptr<ExternalHandle>> m_externalHandles;
map<string, shared_ptr<ExternalHandle>> 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<Solution> newSolution(const std::string& infile, const std::string& name,
const std::string& transport, const vector<std::string>& adjacent);
shared_ptr<Solution> newSolution(const string& infile, const string& name,
const string& transport, const vector<string>& adjacent);
//! Create and initialize a new Solution manager from an input file
/*!
@ -201,9 +201,9 @@ shared_ptr<Solution> newSolution(const std::string& infile, const std::string& n
* @returns an initialized Solution object.
* @ingroup solnGroup
*/
shared_ptr<Solution> newSolution(const std::string& infile,
const std::string& name="",
const std::string& transport="",
shared_ptr<Solution> newSolution(const string& infile,
const string& name="",
const string& transport="",
const vector<shared_ptr<Solution>>& adjacent={});
//! Create and initialize a new Solution manager from AnyMap objects
@ -227,9 +227,9 @@ shared_ptr<Solution> newSolution(const std::string& infile,
*/
shared_ptr<Solution> newSolution(
const AnyMap& phaseNode, const AnyMap& rootNode=AnyMap(),
const std::string& transport="",
const string& transport="",
const vector<shared_ptr<Solution>>& adjacent={},
const map<std::string, shared_ptr<Solution>>& related={});
const map<string, shared_ptr<Solution>>& related={});
}

View File

@ -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<std::string> units);
UnitSystem(std::initializer_list<string> 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<std::string, std::string> defaults() const;
map<string, string> 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<std::string> units);
void setDefaults(std::initializer_list<string> units);
//! Set the default units using a map of dimension to unit pairs.
//!
@ -200,32 +200,32 @@ public:
//! };
//! setDefaults(defaults);
//! ```
void setDefaults(const map<std::string, std::string>& units);
void setDefaults(const map<string, string>& 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<double> convert(const vector<AnyValue>& vals,
const std::string& dest) const;
const string& dest) const;
vector<double> convert(const vector<AnyValue>& 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<std::string, std::string> m_defaults;
map<string, string> m_defaults;
};
}

View File

@ -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<std::string, std::string>& units={});
void setUnits(const map<string, string>& units={});
//! Set the units to be used in the output file. Dimensions not specified
//! will use Cantera's defaults.

View File

@ -80,7 +80,7 @@ public:
* @param args Arguments which will be used to interpolate the format string
*/
template <typename... Args>
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 <typename... Args>
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

View File

@ -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 <typename... Args>
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 <typename... Args>
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 <typename... Args>
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 <typename... Args>
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 <typename T> 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);
}

View File

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

View File

@ -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<double>& v, const std::string& fmt="%g",
const std::string& sep=", ");
string vec2str(const vector<double>& 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<std::string>& v);
void tokenizeString(const string& oval,
vector<string>& 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<std::string>& v);
void tokenizePath(const string& oval,
vector<string>& 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);
//! @}

View File

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

View File

@ -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<std::string> m_enames;
vector<string> m_enames;
//! Atomic number of each global element.
vector<int> m_atomicNumber;
//! Vector of species names in the problem. Vector is over all species
//! defined in the object, the global species index.
vector<std::string> m_snames;
vector<string> 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<std::string, size_t> m_enamemap;
map<string, size_t> m_enamemap;
//! Current value of the temperature (kelvin)
double m_temp = 298.15;

View File

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

View File

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

View File

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

View File

@ -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<std::string> m_elementNames;
vector<string> 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

View File

@ -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<char> m_SSPhase;
//! Species string name for the kth species
vector<std::string> m_speciesName;
vector<string> m_speciesName;
//! Vector of strings containing the element names
/*!
* ElName[j] = String containing element names
*/
vector<std::string> m_elementName;
vector<string> m_elementName;
//! Type of the element constraint
/*!

View File

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

View File

@ -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<MultiRate<ArrheniusRate, ArrheniusData>>();
}
virtual const std::string type() const override {
virtual const string type() const override {
return "Arrhenius";
}

View File

@ -90,7 +90,7 @@ public:
return make_unique<MultiRate<BlowersMaselRate, BlowersMaselData>>();
}
virtual const std::string type() const override {
virtual const string type() const override {
return "Blowers-Masel";
}

View File

@ -113,7 +113,7 @@ public:
return make_unique<MultiRate<ChebyshevRate, ChebyshevData>>();
}
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
/*!

View File

@ -44,12 +44,12 @@ public:
return make_unique<MultiRate<CustomFunc1Rate, ArrheniusData>>();
}
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
/*!

View File

@ -25,7 +25,7 @@ public:
m_nDim = 1;
}
virtual std::string kineticsType() const {
virtual string kineticsType() const {
return "edge";
}
};

View File

@ -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<MultiRate<LindemannRate, FalloffData>>();
}
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";
}

View File

@ -40,7 +40,7 @@ public:
addPhase(*thermo);
}
virtual std::string kineticsType() const {
virtual string kineticsType() const {
return "gas";
}

View File

@ -125,7 +125,7 @@ public:
return m_comp[m];
}
std::ostream& fmt(std::ostream& s, const vector<std::string>& esymbols) const;
std::ostream& fmt(std::ostream& s, const vector<string>& esymbols) const;
friend std::ostream& operator<<(std::ostream& s,
const Group& g);

View File

@ -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<unique_ptr<MultiRateBase>> m_interfaceRates;
map<std::string, size_t> m_interfaceTypes; //!< Rate handler mapping
map<string, size_t> m_interfaceTypes; //!< Rate handler mapping
//! Vector of irreversible reaction numbers
/*!

View File

@ -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 "<any>".
*
* 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<std::string, size_t> m_phaseindex;
map<string, size_t> m_phaseindex;
//! Index in the list of phases of the one surface phase.
//! @deprecated To be removed after %Cantera 3.0.

View File

@ -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<Kinetics> newKinetics(const vector<shared_ptr<ThermoPhase>>& phases,
//! @deprecated To be removed after %Cantera 3.0;
//! superseded by newKinetics() returning shared_ptr
unique_ptr<Kinetics> newKinetics(const vector<ThermoPhase*>& phases,
const std::string& filename,
const std::string& phase_name);
const string& filename,
const string& phase_name);
/**
* Add reactions to a Kinetics object.

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@ public:
Reaction() {}
Reaction(const Composition& reactants, const Composition& products,
shared_ptr<ReactionRate> rate, shared_ptr<ThirdBody> tbody=nullptr);
Reaction(const std::string& equation,
Reaction(const string& equation,
shared_ptr<ReactionRate> rate, shared_ptr<ThirdBody> 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<Reaction> newReaction(const std::string& type);
unique_ptr<Reaction> newReaction(const string& type);
//! Create a new Reaction object using the specified parameters
/*!
@ -331,7 +331,7 @@ vector<shared_ptr<Reaction>> 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

View File

@ -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<std::string, double> m_label;
map<string, double> 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<std::string>& names) {
void include(vector<string>& names) {
for (size_t i = 0; i < names.size(); i++) {
m_include.push_back(names[i]);
}
}
void exclude(vector<std::string>& names) {
void exclude(vector<string>& names) {
for (size_t i = 0; i < names.size(); i++) {
m_exclude.push_back(names[i]);
}
}
vector<std::string>& included() {
vector<string>& included() {
return m_include;
}
vector<std::string>& excluded() {
vector<string>& excluded() {
return m_exclude;
}
vector<size_t> species();
vector<int> 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<size_t, SpeciesNode*> m_nodes;
vector<Path*> m_pathlist;
vector<std::string> m_include;
vector<std::string> m_exclude;
vector<string> m_include;
vector<string> m_exclude;
vector<size_t> 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<vector<int>> m_groups;
vector<Group> m_sgroup;
vector<std::string> m_elementSymbols;
vector<string> 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<bool> m_determinate;
Array2D m_atoms;
map<std::string, size_t> m_enamemap;
map<string, size_t> m_enamemap;
};
}

View File

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

View File

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

View File

@ -84,7 +84,7 @@ private:
/*!
* @param type string identifying type of reaction rate.
*/
shared_ptr<ReactionRate> newReactionRate(const std::string& type);
shared_ptr<ReactionRate> newReactionRate(const string& type);
//! Create a new Rate object using the specified parameters
/*!

View File

@ -78,7 +78,7 @@ public:
return make_unique<MultiRate<TwoTempPlasmaRate, TwoTempPlasmaData>>();
}
virtual const std::string type() const override {
virtual const string type() const override {
return "two-temperature-plasma";
}

View File

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

View File

@ -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<Func1> 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<Func1> 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<Func1> derivative3() const;
virtual std::string write(const std::string& arg) const;
virtual string write(const string& arg) const;
virtual int order() const {
return 2;

View File

@ -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<std::string> m_errors;
vector<string> m_errors;
};
}

View File

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

View File

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

View File

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

View File

@ -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<double> 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> solution, const std::string& id="") : Empty1D() {
Empty1D(shared_ptr<Solution> solution, const string& id="") : Empty1D() {
m_solution = solution;
m_id = id;
}
@ -215,7 +215,7 @@ public:
m_type = cSymmType;
}
Symm1D(shared_ptr<Solution> solution, const std::string& id="") : Symm1D() {
Symm1D(shared_ptr<Solution> solution, const string& id="") : Symm1D() {
m_solution = solution;
m_id = id;
}
@ -244,7 +244,7 @@ public:
m_type = cOutletType;
}
Outlet1D(shared_ptr<Solution> solution, const std::string& id="") : Outlet1D() {
Outlet1D(shared_ptr<Solution> 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<double> 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> solution, const std::string& id="") : Surf1D() {
Surf1D(shared_ptr<Solution> 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> solution, const std::string& id="");
ReactingSurf1D(shared_ptr<Solution> 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);

View File

@ -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<double>& 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<Refiner> m_refiner;
vector<std::string> m_name;
vector<string> m_name;
int m_bw = -1;
bool m_force_full_update = false;

View File

@ -38,7 +38,7 @@ public:
//! transport properties
//! @param id name of flow domain
//! @param points initial number of grid points
IonFlow(shared_ptr<Solution> sol, const std::string& id="", size_t points = 1);
IonFlow(shared_ptr<Solution> sol, const string& id="", size_t points = 1);
virtual string type() const;

View File

@ -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<std::string, size_t, std::string> component(size_t i);
std::tuple<string, size_t, string> component(size_t i);
//! Jacobian bandwidth.
size_t bandwidth() const {

View File

@ -54,7 +54,7 @@ public:
* @param vals A vector of values corresponding to the relative position
* locations.
*/
void setInitialGuess(const std::string& component, vector<double>& locs,
void setInitialGuess(const string& component, vector<double>& locs,
vector<double>& 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);
//! @}

View File

@ -63,7 +63,7 @@ public:
//! transport properties
//! @param id name of flow domain
//! @param points initial number of grid points
StFlow(shared_ptr<Solution> sol, const std::string& id="", size_t points=1);
StFlow(shared_ptr<Solution> 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;

View File

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

View File

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

View File

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

View File

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

View File

@ -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<std::string>& elementSymbols();
const vector<string>& elementSymbols();
//! Get a vector of the names of the elements defined in Cantera.
//! @since New in version 3.0
const vector<std::string>& elementNames();
const vector<string>& elementNames();
//! Get a map with the element and isotope symbols and names as keys and weights as
//! values.
@ -100,7 +100,7 @@ const vector<std::string>& elementNames();
*
* @since New in version 3.0
*/
const map<std::string, double>& elementWeights();
const map<string, double>& elementWeights();
//! Get the atomic weight of an element.
/*!
@ -112,7 +112,7 @@ const map<std::string, double>& 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<std::string, size_t> nativeState() const {
map<string, size_t> 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;
//! @}

View File

@ -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<std::string, size_t> nativeState() const {
map<string, size_t> 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);

View File

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

View File

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

View File

@ -25,7 +25,7 @@ public:
// Overloaded methods of class ThermoPhase
virtual std::string type() const {
virtual string type() const {
return "electron-cloud";
}

View File

@ -83,7 +83,7 @@ public:
//! @name Utilities
//! @{
virtual std::string type() const {
virtual string type() const {
return "MixtureFugacity";
}

View File

@ -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<std::string>& names,
virtual void getCsvReportData(vector<string>& names,
vector<vector<double>>& data) const;
//! Get the array of unscaled non-dimensional molality based activity

View File

@ -165,7 +165,7 @@ public:
mnp_high.modifyOneHf298(k, hnew);
}
void validate(const std::string& name);
void validate(const string& name);
protected:
//! Midrange temperature

View File

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

View File

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

View File

@ -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<ThermoPhase> neutralMoleculePhase_;
map<std::string, double> neutralSpeciesMultipliers_;
map<string, double> neutralSpeciesMultipliers_;
//! Number of neutral molecule species that make up the stoichiometric
//! vector for this species, in terms of calculating thermodynamic functions

View File

@ -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<Species> 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<std::string, map<std::string, double>> m_binaryParameters;
map<string, map<string, double>> m_binaryParameters;
int m_NSolns = 0;

View File

@ -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<std::string>& elementNames() const;
const vector<string>& 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<std::string>& speciesNames() const;
const vector<string>& 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<std::string, size_t> nativeState() const;
virtual map<string, size_t> 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<std::string> fullStates() const;
virtual vector<string> 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<std::string> partialStates() const;
virtual vector<string> 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<std::string> findIsomers(const std::string& comp) const;
virtual vector<string> 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> species(const std::string& name) const;
shared_ptr<Species> 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<double> m_speciesCharge; //!< Vector of species charges. length m_kk.
map<std::string, shared_ptr<Species> > m_species;
map<string, shared_ptr<Species> > 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<std::string> m_speciesNames;
vector<string> m_speciesNames;
//! Map of species names to indices
map<std::string, size_t> m_speciesIndices;
map<string, size_t> m_speciesIndices;
//! Map of lower-case species names to indices
map<std::string, size_t> m_speciesLower;
map<string, size_t> m_speciesLower;
size_t m_mm = 0; //!< Number of elements.
vector<double> m_atomicWeights; //!< element atomic weights (kg kmol-1)
vector<int> m_atomicNumbers; //!< element atomic numbers
vector<std::string> m_elementNames; //!< element names
vector<string> m_elementNames; //!< element names
vector<int> m_elem_type; //!< Vector of element types
//! Entropy at 298.15 K and 1 bar of stable state pure elements (J kmol-1)

View File

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

View File

@ -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<std::string> fullStates() const;
virtual vector<std::string> partialStates() const;
virtual vector<string> fullStates() const;
virtual vector<string> 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<tpx::Substance> 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;

View File

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

View File

@ -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<Species> 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<std::string, map<std::string, pair<double, double>>> m_binaryParameters;
map<string, map<string, pair<double, double>>> m_binaryParameters;
enum class CoeffSource { EoS, CritProps, Database };
//! For each species, specifies the source of the a and b coefficients

View File

@ -59,7 +59,7 @@ public:
//! Base empty constructor.
SingleSpeciesTP() = default;
virtual std::string type() const {
virtual string type() const {
return "SingleSpecies";
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<std::string>& names,
virtual void getCsvReportData(vector<string>& names,
vector<vector<double>>& data) const;
//! Pointer to the calculation manager for species reference-state

View File

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

View File

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

View File

@ -63,7 +63,7 @@ public:
virtual void setThermo(ThermoPhase& thermo);
virtual std::string transportModel() const {
virtual string transportModel() const {
return "DustyGas";
}

View File

@ -45,7 +45,7 @@ protected:
HighPressureGasTransport(ThermoPhase* thermo=0);
public:
virtual std::string transportModel() const {
virtual string transportModel() const {
return "HighPressureGas";
}

View File

@ -36,7 +36,7 @@ class IonGasTransport : public MixTransport
public:
IonGasTransport() = default;
virtual std::string transportModel() const {
virtual string transportModel() const {
return "ionized-gas";
}

View File

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

View File

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

View File

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

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