Skip to content

Commit

Permalink
[zeroD] Update deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Aug 23, 2024
1 parent 706457d commit 7a1c37c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 28 deletions.
6 changes: 4 additions & 2 deletions include/cantera/zeroD/ConnectorFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ class ConnectorFactory :
//! @param name Name of the connector.
//! @since New in %Cantera 3.1.
shared_ptr<Connector> newConnector(const string& model,
shared_ptr<ReactorNode> r0=nullptr,
shared_ptr<ReactorNode> r1=nullptr,
shared_ptr<ReactorNode> r0,
shared_ptr<ReactorNode> 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<FlowDevice>`
//! @deprecated Replaced by newConnector. To be removed after %Cantera 3.1.
shared_ptr<FlowDevice> newFlowDevice(const string& model, const string& name="(none)");

//! Create a FlowDevice object of the specified type
Expand All @@ -76,6 +77,7 @@ shared_ptr<FlowDevice> newFlowDevice3(const string& model);

//! Create a WallBase object of the specified type
//! @since Starting in %Cantera 3.1, this method returns a `shared_ptr<WallBase>`
//! @deprecated Replaced by newConnector. To be removed after %Cantera 3.1.
shared_ptr<WallBase> newWall(const string& model, const string& name="(none)");

//! Create a WallBase object of the specified type
Expand Down
12 changes: 1 addition & 11 deletions include/cantera/zeroD/ReactorFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,14 @@ class ReactorFactory : public Factory<ReactorNode, shared_ptr<Solution>, const s
//! @param name Name of reactor.
//! @since New in %Cantera 3.1.
shared_ptr<ReactorNode> newReactorNode(
const string& model, shared_ptr<Solution> contents,
const string& model, shared_ptr<Solution> 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<ReactorNode> newReactorNode(const string& model);

//! Create a Reactor object of the specified type
//! @since Starting in %Cantera 3.1, this method returns a `shared_ptr<ReactorBase>`
//! @deprecated Transitional method. Use newReactor() with contents instead.
shared_ptr<ReactorBase> newReactor(const string& model);

//! Create a Reactor object of the specified type and contents
//! @since New in %Cantera 3.1.
shared_ptr<ReactorBase> newReactor(
const string& model, shared_ptr<Solution> 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.
Expand Down
8 changes: 6 additions & 2 deletions src/zeroD/ConnectorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ shared_ptr<Connector> newConnector(

shared_ptr<FlowDevice> 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<FlowDevice>(
newConnector(model, nullptr, nullptr, name));
if (!dev) {
Expand All @@ -66,12 +68,14 @@ shared_ptr<FlowDevice> newFlowDevice(const string& model, const string& name)
shared_ptr<FlowDevice> 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<WallBase> 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<WallBase>(
newConnector(model, nullptr, nullptr, name));
if (!wall) {
Expand All @@ -84,7 +88,7 @@ shared_ptr<WallBase> newWall(const string& model, const string& name)
shared_ptr<WallBase> 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);
}

Expand Down
16 changes: 3 additions & 13 deletions src/zeroD/ReactorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,12 @@ shared_ptr<ReactorNode> newReactorNode(
ReactorFactory::factory()->create(model, contents, name));
}

shared_ptr<ReactorNode> newReactorNode(const string& model)
{
return newReactorNode(model, nullptr, "");
}

shared_ptr<ReactorBase> newReactor(const string& model)
{
return newReactor(model, nullptr, "");
}

shared_ptr<ReactorBase> newReactor(
const string& model, shared_ptr<Solution> 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<ReactorBase>(
newReactorNode(model, contents, name));
newReactorNode(model, nullptr, ""));
if (!reactor) {
throw CanteraError("newReactor",
"Detected incompatible ReactorBase type '{}'", model);
Expand All @@ -129,7 +120,6 @@ shared_ptr<ReactorBase> newReactor(

shared_ptr<ReactorBase> newReactor3(const string& model)
{
warn_deprecated("newReactor3", "To be removed after Cantera 3.1.");
return newReactor(model);
}

Expand Down

0 comments on commit 7a1c37c

Please sign in to comment.