[Reactor] Deprecate possibly-ambiguous names in componentIndex

Resolves #274.
This commit is contained in:
Ray Speth 2015-06-22 18:11:32 -04:00
parent eb75e8b6cc
commit 0590b2cda8
8 changed files with 63 additions and 6 deletions

View file

@ -39,8 +39,9 @@ public:
virtual void updateState(doublereal* y);
//! Return the index in the solution vector for this reactor of the
//! component named *nm*. Possible values for *nm* are "m", "H", the name
//! of a homogeneous phase species, or the name of a surface species.
//! component named *nm*. Possible values for *nm* are "mass", "enthalpy",
//! the name of a homogeneous phase species, or the name of a surface
//! species.
virtual size_t componentIndex(const std::string& nm) const;
};

View file

@ -41,8 +41,9 @@ public:
virtual void updateState(doublereal* y);
//! Return the index in the solution vector for this reactor of the
//! component named *nm*. Possible values for *nm* are "m", "T", the name
//! of a homogeneous phase species, or the name of a surface species.
//! component named *nm*. Possible values for *nm* are "mass",
//! "temperature", the name of a homogeneous phase species, or the name of a
//! surface species.
virtual size_t componentIndex(const std::string& nm) const;
protected:

View file

@ -38,6 +38,10 @@ public:
virtual void updateState(doublereal* y);
//! Return the index in the solution vector for this reactor of the
//! component named *nm*. Possible values for *nm* are "mass",
//! "volume", "temperature", the name of a homogeneous phase species, or the
//! name of a surface species.
virtual size_t componentIndex(const std::string& nm) const;
protected:

View file

@ -142,8 +142,9 @@ public:
std::vector<std::pair<void*, int> > getSensitivityOrder() const;
//! Return the index in the solution vector for this reactor of the
//! component named *nm*. Possible values for *nm* are "m", "V", "T", the
//! name of a homogeneous phase species, or the name of a surface species.
//! component named *nm*. Possible values for *nm* are "mass", "volume",
//! "int_energy", the name of a homogeneous phase species, or the name of a
//! surface species.
virtual size_t componentIndex(const std::string& nm) const;
protected:

View file

@ -127,8 +127,18 @@ size_t ConstPressureReactor::componentIndex(const string& nm) const
if (k != npos) {
return k + 2;
} else if (nm == "m" || nm == "mass") {
if (nm == "m") {
warn_deprecated("ConstPressureReactor::componentIndex(\"m\")",
"Using the name 'm' for mass is deprecated, and will be "
"disabled after Cantera 2.3. Use 'mass' instead.");
}
return 0;
} else if (nm == "H" || nm == "enthalpy") {
if (nm == "H") {
warn_deprecated("ConstPressureReactor::componentIndex(\"H\")",
"Using the name 'H' for enthalpy is deprecated, and will be "
"disabled after Cantera 2.3. Use 'enthalpy' instead.");
}
return 1;
} else {
return npos;

View file

@ -139,8 +139,18 @@ size_t IdealGasConstPressureReactor::componentIndex(const string& nm) const
if (k != npos) {
return k + 2;
} else if (nm == "m" || nm == "mass") {
if (nm == "m") {
warn_deprecated("IdealGasConstPressureReactor::componentIndex(\"m\")",
"Using the name 'm' for mass is deprecated, and will be "
"disabled after Cantera 2.3. Use 'mass' instead.");
}
return 0;
} else if (nm == "T" || nm == "temperature") {
if (nm == "T") {
warn_deprecated("IdealGasConstPressureReactor::componentIndex(\"T\")",
"Using the name 'T' for temperature is deprecated, and will be "
"disabled after Cantera 2.3. Use 'temperature' instead.");
}
return 1;
} else {
return npos;

View file

@ -156,10 +156,25 @@ size_t IdealGasReactor::componentIndex(const string& nm) const
if (k != npos) {
return k + 3;
} else if (nm == "m" || nm == "mass") {
if (nm == "m") {
warn_deprecated("IdealGasReactor::componentIndex(\"m\")",
"Using the name 'm' for mass is deprecated, and will be "
"disabled after Cantera 2.3. Use 'mass' instead.");
}
return 0;
} else if (nm == "V" || nm == "volume") {
if (nm == "V") {
warn_deprecated("IdealGasReactor::componentIndex(\"V\")",
"Using the name 'V' for volume is deprecated, and will be "
"disabled after Cantera 2.3. Use 'volume' instead.");
}
return 1;
} else if (nm == "T" || nm == "temperature") {
if (nm == "T") {
warn_deprecated("IdealGasReactor::componentIndex(\"T\")",
"Using the name 'T' for temperature is deprecated, and will be "
"disabled after Cantera 2.3. Use 'temperature' instead.");
}
return 2;
} else {
return npos;

View file

@ -382,10 +382,25 @@ size_t Reactor::componentIndex(const string& nm) const
if (k != npos) {
return k + 3;
} else if (nm == "m" || nm == "mass") {
if (nm == "m") {
warn_deprecated("Reactor::componentIndex(\"m\")",
"Using the name 'm' for mass is deprecated, and will be "
"disabled after Cantera 2.3. Use 'mass' instead.");
}
return 0;
} else if (nm == "V" || nm == "volume") {
if (nm == "V") {
warn_deprecated("Reactor::componentIndex(\"V\")",
"Using the name 'V' for volume is deprecated, and will be "
"disabled after Cantera 2.3. Use 'volume' instead.");
}
return 1;
} else if (nm == "U" || nm == "int_energy") {
if (nm == "U") {
warn_deprecated("Reactor::componentIndex(\"U\")",
"Using the name 'U' for internal energy is deprecated, and "
"will be disabled after Cantera 2.3. Use 'int_energy' instead.");
}
return 2;
} else {
return npos;