Loading [MathJax]/extensions/tex2jax.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ConnectorFactory.h
Go to the documentation of this file.
1//! @file ConnectorFactory.h
2
3// This file is part of Cantera. See License.txt in the top-level directory or
4// at https://cantera.org/license.txt for license and copyright information.
5
6#ifndef CONNECTOR_FACTORY_H
7#define CONNECTOR_FACTORY_H
8
11
12namespace Cantera
13{
14
15class FlowDevice;
16class WallBase;
17
18//! Factory class to create ConnectorNode objects.
19//!
20//! This class is mainly used via the newConnectorNode() function, for example:
21//!
22//! ```cpp
23//! shared_ptr<ConnectorNode> valve = newConnectorNode("Valve", r0, r1, "my_valve");
24//! ```
25//!
26//! where `r0` and `r1` are reactor objects.
28 public Factory<ConnectorNode,
29 shared_ptr<ReactorBase>, shared_ptr<ReactorBase>, const string&>
30{
31public:
32 static ConnectorFactory* factory();
33
34 void deleteFactory() override;
35
36private:
37 static ConnectorFactory* s_factory;
38 static std::mutex connector_mutex;
40};
41
42//! @defgroup connectorGroup Connectors
43//! %ConnectorNode objects connect zero-dimensional reactors.
44//! ConnectorNode objects should be instantiated via the newConnectorNode() function,
45//! for example:
46//!
47//! ```cpp
48//! shared_ptr<ConnectorNode> valve = newConnectorNode("Valve", r0, r1, "my_valve");
49//! ```
50//!
51//! where `r0` and `r1` are reactor objects.
52//!
53//! @since New in %Cantera 3.2.
54//!
55//! @ingroup zerodGroup
56//! @{
57
58//! Create a ConnectorNode object of the specified type
59//! @param model String specifying reactor type.
60//! @param r0 First reactor.
61//! @param r1 Second reactor.
62//! @param name Name of the connector.
63//! @since New in %Cantera 3.2.
64shared_ptr<ConnectorNode> newConnectorNode(const string& model,
65 shared_ptr<ReactorBase> r0,
66 shared_ptr<ReactorBase> r1,
67 const string& name="(none)");
68
69//! Create a FlowDevice object of the specified type
70//! @since Starting in %Cantera 3.1, this method returns a `shared_ptr<FlowDevice>`
71//! @deprecated To be removed after %Cantera 3.2. Use version that provides reactors
72//! as parameter instead.
73shared_ptr<FlowDevice> newFlowDevice(const string& model, const string& name="(none)");
74
75//! Create a FlowDevice object of the specified type.
76//! @copydetails newConnectorNode
77shared_ptr<FlowDevice> newFlowDevice(const string& model,
78 shared_ptr<ReactorBase> r0,
79 shared_ptr<ReactorBase> r1,
80 const string& name="(none)");
81
82//! Create a WallBase object of the specified type
83//! @since Starting in %Cantera 3.1, this method returns a `shared_ptr<WallBase>`
84//! @deprecated To be removed after %Cantera 3.2. Use version that provides reactors
85//! as parameter instead.
86shared_ptr<WallBase> newWall(const string& model, const string& name="(none)");
87
88//! Create a WallBase object of the specified type.
89//! @copydetails newConnectorNode
90shared_ptr<WallBase> newWall(const string& model,
91 shared_ptr<ReactorBase> r0,
92 shared_ptr<ReactorBase> r1,
93 const string& name="(none)");
94
95//! @}
96}
97
98#endif
File contains the FactoryBase class declarations.
Factory class to create ConnectorNode objects.
void deleteFactory() override
Virtual abstract function that deletes the factory.
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
shared_ptr< FlowDevice > newFlowDevice(const string &model, shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name)
Create a FlowDevice object of the specified type.
shared_ptr< WallBase > newWall(const string &model, shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name)
Create a WallBase object of the specified type.
shared_ptr< ConnectorNode > newConnectorNode(const string &model, shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name)
Create a ConnectorNode object of the specified type.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595