[TPX] Add factory function for Substance from species name
This function had been defined but not declared.
This commit is contained in:
parent
ed8de04e5b
commit
62c67e4ad1
2 changed files with 19 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue