[TPX] Add factory function for Substance from species name

This function had been defined but not declared.
This commit is contained in:
Ray Speth 2017-01-30 23:24:58 -05:00
parent ed8de04e5b
commit 62c67e4ad1
2 changed files with 19 additions and 2 deletions

View file

@ -7,6 +7,22 @@
namespace tpx
{
Substance* GetSub(int isub);
//! Create a new Substance object corresponding to the specified name.
/*
* Currently valid substances are:
*
* - water
* - nitrogen
* - methane
* - hydrogen
* - oxygen
* - hfc134a
* - carbondioxide
* - heptane
*/
Substance* newSubstance(const std::string& name);
}
#endif

View file

@ -18,7 +18,7 @@
namespace tpx
{
Substance* GetSubstanceByName(std::string name)
Substance* newSubstance(const std::string& name)
{
std::string lcname = boost::algorithm::to_lower_copy(name);
if (lcname == "water") {
@ -40,7 +40,8 @@ Substance* GetSubstanceByName(std::string name)
} else if (lcname == "heptane") {
return new Heptane;
} else {
return 0;
throw Cantera::CanteraError("tpx::newSubstance", "No Substance"
" definition known for '{}'.", name);
}
}