Loading [MathJax]/extensions/tex2jax.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ConnectorNode.h
Go to the documentation of this file.
1//! @file ConnectorNode.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 CT_CONNECTOR_H
7#define CT_CONNECTOR_H
8
10#include "cantera/base/global.h"
11
12namespace Cantera
13{
14class ReactorBase;
15
16/**
17 * Base class for walls and flow devices connecting reactors.
18 * In a reactor network, walls and flow devices (e.g., valves, pressure regulators)
19 * represent nodes in a directed bipartite graph - a graph whose vertices can be
20 * divided into two disjoint sets such that no two vertices within the same set are
21 * adjacent - with reactors forming the second set of nodes.
22 *
23 * @since New in %Cantera 3.2.
24 *
25 * @ingroup connectorGroup
26 */
28{
29public:
30 //! Transitional constructor.
31 //! @todo Implement deprecation warning.
32 ConnectorNode(const string& name="(none)") : m_name(name) {}
33
34 //! Instantiate a ConnectorNode object with associated ReactorBase objects.
35 //! @param r0 First reactor.
36 //! @param r1 Second reactor.
37 //! @param name Name of the connector.
38 ConnectorNode(shared_ptr<ReactorBase> r0, shared_ptr<ReactorBase> r1,
39 const string& name="(none)") : m_nodes({r0, r1}), m_name(name) {}
40
41 virtual ~ConnectorNode() = default;
42 ConnectorNode(const ConnectorNode&) = delete;
43 ConnectorNode& operator=(const ConnectorNode&) = delete;
44
45 //! String indicating the connector implemented. Usually
46 //! corresponds to the name of the derived class.
47 virtual string type() const {
48 return "ConnectorNode";
49 }
50
51 //! Retrieve connector name.
52 string name() const {
53 return m_name;
54 }
55
56 //! Set connector name.
57 void setName(const string& name) {
58 m_name = name;
59 }
60
61 //! Set the default name of a connector. Returns `false` if it was previously set.
62 void setDefaultName(map<string, int>& counts);
63
64protected:
65 //! Pair of reactors forming end points of the connector.
66 pair<shared_ptr<ReactorBase>, shared_ptr<ReactorBase>> m_nodes;
67
68 string m_name; //!< ConnectorNode name.
69 bool m_defaultNameSet = false; //!< `true` if default name has been previously set.
70};
71
72}
73
74#endif
Base class for walls and flow devices connecting reactors.
ConnectorNode(shared_ptr< ReactorBase > r0, shared_ptr< ReactorBase > r1, const string &name="(none)")
Instantiate a ConnectorNode object with associated ReactorBase objects.
bool m_defaultNameSet
true if default name has been previously set.
void setDefaultName(map< string, int > &counts)
Set the default name of a connector. Returns false if it was previously set.
virtual string type() const
String indicating the connector implemented.
void setName(const string &name)
Set connector name.
pair< shared_ptr< ReactorBase >, shared_ptr< ReactorBase > > m_nodes
Pair of reactors forming end points of the connector.
string m_name
ConnectorNode name.
string name() const
Retrieve connector name.
ConnectorNode(const string &name="(none)")
Transitional constructor.
This file contains definitions of constants, types and terms that are used in internal routines and a...
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595