[zeroD] Add deprecations

This commit is contained in:
Ingmar Schoegl 2024-08-22 17:05:47 -05:00
parent f5455271c2
commit ad81e209e7
4 changed files with 20 additions and 9 deletions

View File

@ -80,6 +80,8 @@ public:
//! Set the Solution specifying the ReactorBase content.
//! @param sol Solution object to be set.
//! @since New in %Cantera 3.1.
//! @deprecated To be removed after %Cantera 3.2. Superseded by instantiation of
//! ReactorBase with Solution object.
void setSolution(shared_ptr<Solution> sol);
//! @name Methods to set up a simulation

View File

@ -48,6 +48,10 @@ shared_ptr<ConnectorNode> newConnectorNode(
const string& model,
shared_ptr<ReactorBase> r0, shared_ptr<ReactorBase> r1, const string& name)
{
if (!r0 || !r1) {
warn_deprecated("newConnectorNode",
"Instantiation of empty connector nodes to be removed after Cantera 3.2.");
}
return shared_ptr<ConnectorNode>(
ConnectorFactory::factory()->create(model, r0, r1, name));
}

View File

@ -23,14 +23,8 @@ namespace Cantera
{
Reactor::Reactor(shared_ptr<Solution> sol, const string& name)
: ReactorBase(name)
: ReactorBase(sol, name)
{
if (!sol || !(sol->thermo())) {
throw CanteraError("Reactor::Reactor",
"Reactor contents must be provided as constructor arguments");
}
setSolution(sol);
setThermo(*sol->thermo());
setKinetics(*sol->kinetics());
}

View File

@ -24,7 +24,14 @@ ReactorBase::ReactorBase(shared_ptr<Solution> sol, const string& name)
throw CanteraError("ReactorBase::ReactorBase",
"Missing or incomplete Solution object.");
}
setSolution(sol);
m_solution = sol;
setThermo(*sol->thermo());
try {
setKinetics(*sol->kinetics());
} catch (NotImplementedError&) {
// kinetics not used (example: Reservoir)
}
m_solution->thermo()->addSpeciesLock();
}
ReactorBase::~ReactorBase()
@ -47,7 +54,11 @@ bool ReactorBase::setDefaultName(map<string, int>& counts)
return true;
}
void ReactorBase::setSolution(shared_ptr<Solution> sol) {
void ReactorBase::setSolution(shared_ptr<Solution> sol)
{
warn_deprecated("ReactorBase::setSolution",
"After Cantera 3.2, a change of reactor contents after instantiation "
"will be disabled.");
if (!sol || !(sol->thermo())) {
throw CanteraError("ReactorBase::setSolution",
"Missing or incomplete Solution object.");