From c348fef4a900dbe6f24588dc6472ce25d10ba79c Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Sat, 20 Jan 2024 18:17:38 -0600 Subject: [PATCH] [0D] Consolidate zeroD insert methods --- include/cantera/zeroD/Reactor.h | 4 +++- include/cantera/zeroD/ReactorBase.h | 3 +++ include/cantera/zeroD/Reservoir.h | 7 ++++--- src/zeroD/Reactor.cpp | 5 ----- src/zeroD/ReactorBase.cpp | 7 +++++++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/include/cantera/zeroD/Reactor.h b/include/cantera/zeroD/Reactor.h index 80bdbb455..f553acab7 100644 --- a/include/cantera/zeroD/Reactor.h +++ b/include/cantera/zeroD/Reactor.h @@ -68,14 +68,16 @@ public: /** * Insert something into the reactor. The 'something' must belong to a class * that is a subclass of both ThermoPhase and Kinetics. + * @deprecated Unused; to be removed after %Cantera 3.1. */ template void insert(G& contents) { + warn_deprecated("Reactor::insert", "Unused; to be removed after Cantera 3.1."); setThermoMgr(contents); setKineticsMgr(contents); } - void insert(shared_ptr sol); + using ReactorBase::insert; void setKineticsMgr(Kinetics& kin) override; diff --git a/include/cantera/zeroD/ReactorBase.h b/include/cantera/zeroD/ReactorBase.h index 018e8485b..bfe6be1ad 100644 --- a/include/cantera/zeroD/ReactorBase.h +++ b/include/cantera/zeroD/ReactorBase.h @@ -89,6 +89,9 @@ public: m_vol = vol; } + //! @deprecated To be removed after %Cantera 3.1. Superseded by setSolution. + void insert(shared_ptr sol); + //! Specify the mixture contained in the reactor. Note that a pointer to //! this substance is stored, and as the integration proceeds, the state of //! the substance is modified. diff --git a/include/cantera/zeroD/Reservoir.h b/include/cantera/zeroD/Reservoir.h index 60a484ebb..77b72c8eb 100644 --- a/include/cantera/zeroD/Reservoir.h +++ b/include/cantera/zeroD/Reservoir.h @@ -26,13 +26,14 @@ public: void initialize(double t0=0.0) override {} + //! @deprecated Unused; to be removed after %Cantera 3.1. void insert(ThermoPhase& contents) { + warn_deprecated("Reservoir::insert", + "Unused; to be removed after Cantera 3.1."); setThermoMgr(contents); } - void insert(shared_ptr sol) { - setThermoMgr(*sol->thermo()); - } + using ReactorBase::insert; }; } diff --git a/src/zeroD/Reactor.cpp b/src/zeroD/Reactor.cpp index 49ae58844..fcbdce26e 100644 --- a/src/zeroD/Reactor.cpp +++ b/src/zeroD/Reactor.cpp @@ -22,11 +22,6 @@ namespace bmt = boost::math::tools; namespace Cantera { -void Reactor::insert(shared_ptr sol) { - setThermoMgr(*sol->thermo()); - setKineticsMgr(*sol->kinetics()); -} - void Reactor::setDerivativeSettings(AnyMap& settings) { m_kin->setDerivativeSettings(settings); diff --git a/src/zeroD/ReactorBase.cpp b/src/zeroD/ReactorBase.cpp index 5e31539b2..dec8cd6c0 100644 --- a/src/zeroD/ReactorBase.cpp +++ b/src/zeroD/ReactorBase.cpp @@ -34,6 +34,13 @@ void ReactorBase::setSolution(shared_ptr sol) { } } +void ReactorBase::insert(shared_ptr sol) +{ + // warn_deprecated("ReactorBase::insert", + // "To be removed after Cantera 3.1. Superseded by 'setSolution'."); + setSolution(sol); +} + void ReactorBase::setThermoMgr(ThermoPhase& thermo) { m_thermo = &thermo;