Skip to content

Commit

Permalink
Deprecate integer-based instantiation of tpx::Substance
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Mar 14, 2023
1 parent adb49c3 commit 7ce825a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
10 changes: 1 addition & 9 deletions include/cantera/thermo/PureFluidPhase.h
Expand Up @@ -206,15 +206,7 @@ class PureFluidPhase : public ThermoPhase
//! Pointer to the underlying tpx object Substance that does the work
mutable std::unique_ptr<tpx::Substance> m_sub;

//! Int indicating the type of the fluid
/*!
* The tpx package uses an int to indicate what fluid is being sought. Used
* only if #m_tpx_name is not set.
*/
int m_subflag = -1;

//! Name for this substance used by the TPX package. If this is not set,
//! #m_subflag is used instead.
//! Name for this substance used by the TPX package
std::string m_tpx_name;

//! Molecular weight of the substance (kg kmol-1)
Expand Down
6 changes: 1 addition & 5 deletions src/thermo/PureFluidPhase.cpp
Expand Up @@ -24,11 +24,7 @@ void PureFluidPhase::initThermo()
setSubstance(m_input["pure-fluid-name"].asString());
}

if (m_tpx_name != "") {
m_sub.reset(tpx::newSubstance(m_tpx_name));
} else {
m_sub.reset(tpx::GetSub(m_subflag));
}
m_sub.reset(tpx::newSubstance(m_tpx_name));

m_mw = m_sub->MolWt();
setMolecularWeight(0,m_mw);
Expand Down
3 changes: 3 additions & 0 deletions src/tpx/utils.cpp
Expand Up @@ -5,6 +5,7 @@

#include "cantera/tpx/utils.h"
#include "cantera/base/stringUtils.h"
#include "cantera/base/global.h"

#include "CarbonDioxide.h"
#include "Heptane.h"
Expand Down Expand Up @@ -44,6 +45,8 @@ Substance* newSubstance(const std::string& name)

Substance* GetSub(int isub)
{
Cantera::warn_deprecated("tpx::GetSub", "To be removed after Cantera 3.0. "
"Use tpx::newSubstance(string) instead.");
if (isub == 0) {
return new water;
} else if (isub == 1) {
Expand Down

0 comments on commit 7ce825a

Please sign in to comment.