Cantera
Loading...
Searching...
No Matches
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.
27class ConnectorFactory :
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;
39 ConnectorFactory();
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//! @copydetails newConnectorNode
71shared_ptr<FlowDevice> newFlowDevice(const string& model,
72 shared_ptr<ReactorBase> r0,
73 shared_ptr<ReactorBase> r1,
74 const string& name="(none)");
75
76//! Create a WallBase object of the specified type.
77//! @copydetails newConnectorNode
78shared_ptr<WallBase> newWall(const string& model,
79 shared_ptr<ReactorBase> r0,
80 shared_ptr<ReactorBase> r1,
81 const string& name="(none)");
82
83//! @}
84}
85
86#endif
File contains the FactoryBase class declarations.
void deleteFactory() override
Virtual abstract function that deletes the factory.
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
Base class for 'flow devices' (valves, pressure regulators, etc.) connecting reactors.
Definition FlowDevice.h:26
Base class for 'walls' (walls, pistons, etc.) connecting reactors.
Definition Wall.h:24
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