From 7a1c37c29da1bd37e46f1fb0f0220b4d231097d9 Mon Sep 17 00:00:00 2001 From: Ingmar Schoegl Date: Fri, 23 Aug 2024 07:34:37 -0500 Subject: [PATCH] [zeroD] Update deprecation warnings --- include/cantera/zeroD/ConnectorFactory.h | 6 ++++-- include/cantera/zeroD/ReactorFactory.h | 12 +----------- src/zeroD/ConnectorFactory.cpp | 8 ++++++-- src/zeroD/ReactorFactory.cpp | 16 +++------------- 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/include/cantera/zeroD/ConnectorFactory.h b/include/cantera/zeroD/ConnectorFactory.h index d5bad3249c4..87df103b8a8 100644 --- a/include/cantera/zeroD/ConnectorFactory.h +++ b/include/cantera/zeroD/ConnectorFactory.h @@ -61,12 +61,13 @@ class ConnectorFactory : //! @param name Name of the connector. //! @since New in %Cantera 3.1. shared_ptr newConnector(const string& model, - shared_ptr r0=nullptr, - shared_ptr r1=nullptr, + shared_ptr r0, + shared_ptr r1, const string& name="(none)"); //! Create a FlowDevice object of the specified type //! @since Starting in %Cantera 3.1, this method returns a `shared_ptr` +//! @deprecated Replaced by newConnector. To be removed after %Cantera 3.1. shared_ptr newFlowDevice(const string& model, const string& name="(none)"); //! Create a FlowDevice object of the specified type @@ -76,6 +77,7 @@ shared_ptr newFlowDevice3(const string& model); //! Create a WallBase object of the specified type //! @since Starting in %Cantera 3.1, this method returns a `shared_ptr` +//! @deprecated Replaced by newConnector. To be removed after %Cantera 3.1. shared_ptr newWall(const string& model, const string& name="(none)"); //! Create a WallBase object of the specified type diff --git a/include/cantera/zeroD/ReactorFactory.h b/include/cantera/zeroD/ReactorFactory.h index 4b368271657..c9705da8cfa 100644 --- a/include/cantera/zeroD/ReactorFactory.h +++ b/include/cantera/zeroD/ReactorFactory.h @@ -49,24 +49,14 @@ class ReactorFactory : public Factory, const s //! @param name Name of reactor. //! @since New in %Cantera 3.1. shared_ptr newReactorNode( - const string& model, shared_ptr contents, + const string& model, shared_ptr contents=nullptr, const string& name="(none)"); -//! Create a ReactorNode object of the specified type -//! @since New in %Cantera 3.1. -//! @deprecated Transitional method. Use newReactorNode() with contents instead. -shared_ptr newReactorNode(const string& model); - //! Create a Reactor object of the specified type //! @since Starting in %Cantera 3.1, this method returns a `shared_ptr` //! @deprecated Transitional method. Use newReactor() with contents instead. shared_ptr newReactor(const string& model); -//! Create a Reactor object of the specified type and contents -//! @since New in %Cantera 3.1. -shared_ptr newReactor( - const string& model, shared_ptr contents, const string& name="(none)"); - //! Create a Reactor object of the specified type //! @since New in %Cantera 3.0. //! @deprecated Transitional method. Use newReactor() instead. diff --git a/src/zeroD/ConnectorFactory.cpp b/src/zeroD/ConnectorFactory.cpp index f9614ba834b..6bce8a73607 100644 --- a/src/zeroD/ConnectorFactory.cpp +++ b/src/zeroD/ConnectorFactory.cpp @@ -54,6 +54,8 @@ shared_ptr newConnector( shared_ptr newFlowDevice(const string& model, const string& name) { + warn_deprecated("newFlowDevice", + "Replaced by newConnector; to be removed after Cantera 3.1."); auto dev = std::dynamic_pointer_cast( newConnector(model, nullptr, nullptr, name)); if (!dev) { @@ -66,12 +68,14 @@ shared_ptr newFlowDevice(const string& model, const string& name) shared_ptr newFlowDevice3(const string& model) { warn_deprecated("newFlowDevice3", - "Use newFlowDevice instead; to be removed after Cantera 3.1."); + "Replaced by newConnector; to be removed after Cantera 3.1."); return newFlowDevice(model); } shared_ptr newWall(const string& model, const string& name) { + warn_deprecated("newWall", + "Replaced by newConnector; to be removed after Cantera 3.1."); auto wall = std::dynamic_pointer_cast( newConnector(model, nullptr, nullptr, name)); if (!wall) { @@ -84,7 +88,7 @@ shared_ptr newWall(const string& model, const string& name) shared_ptr newWall3(const string& model) { warn_deprecated("newWall3", - "Use newWall instead; to be removed after Cantera 3.1."); + "Replaced by newConnector; to be removed after Cantera 3.1."); return newWall(model); } diff --git a/src/zeroD/ReactorFactory.cpp b/src/zeroD/ReactorFactory.cpp index f0c68acf214..a58aacd239a 100644 --- a/src/zeroD/ReactorFactory.cpp +++ b/src/zeroD/ReactorFactory.cpp @@ -105,21 +105,12 @@ shared_ptr newReactorNode( ReactorFactory::factory()->create(model, contents, name)); } -shared_ptr newReactorNode(const string& model) -{ - return newReactorNode(model, nullptr, ""); -} - shared_ptr newReactor(const string& model) { - return newReactor(model, nullptr, ""); -} - -shared_ptr newReactor( - const string& model, shared_ptr contents, const string& name) -{ + warn_deprecated("newReactor", + "Replaced by newReactor with contents; to be removed after Cantera 3.1."); auto reactor = std::dynamic_pointer_cast( - newReactorNode(model, contents, name)); + newReactorNode(model, nullptr, "")); if (!reactor) { throw CanteraError("newReactor", "Detected incompatible ReactorBase type '{}'", model); @@ -129,7 +120,6 @@ shared_ptr newReactor( shared_ptr newReactor3(const string& model) { - warn_deprecated("newReactor3", "To be removed after Cantera 3.1."); return newReactor(model); }