Cantera  3.2.0a4
Loading...
Searching...
No Matches
ReactorFactory.h
Go to the documentation of this file.
1//! @file ReactorFactory.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 REACTOR_FACTORY_H
7#define REACTOR_FACTORY_H
8
11
12namespace Cantera
13{
14
15class Reactor;
16class Reservoir;
17
18//! Factory class to create reactor objects
19//!
20//! This class is mainly used via the newReactor() function, for example:
21//!
22//! ```cpp
23//! shared_ptr<ReactorBase> r1 = newReactor("IdealGasReactor");
24//! ```
25class ReactorFactory : public Factory<ReactorBase, shared_ptr<Solution>, bool, const string&>
26{
27public:
28 static ReactorFactory* factory();
29
30 void deleteFactory() override;
31
32private:
33 static ReactorFactory* s_factory;
34 static std::mutex reactor_mutex;
36};
37
38//! @defgroup reactorGroup Reactors
39//! Zero-dimensional objects representing stirred reactors.
40//! Reactors simulate time-dependent behavior considering gas-phase chemistry.
41//! Reactor objects should be instantiated via the newReactor() function, for example:
42//!
43//! ```cpp
44//! shared_ptr<ReactorBase> r1 = newReactor("IdealGasReactor");
45//! ```
46//! @ingroup zerodGroup
47//! @{
48
49//! Create a ReactorBase object of the specified type and contents.
50//! @since New in %Cantera 3.2.
51shared_ptr<ReactorBase> newReactorBase(
52 const string& model, shared_ptr<Solution> contents, bool clone=true,
53 const string& name="(none)");
54
55//! Create a Reactor object of the specified type and contents
56//! @since Starting in %Cantera 3.1, this method requires a valid Solution object and
57//! returns a `shared_ptr<ReactorBase>` instead of a `ReactorBase*`.
58//! @deprecated Behavior changes after %Cantera 3.2, when a `shared_ptr<Reactor>` will
59//! be returned. For new behavior, see `newReactor4`.
60shared_ptr<ReactorBase> newReactor(
61 const string& model, shared_ptr<Solution> contents, const string& name="(none)");
62
63//! Create a Reactor object of the specified type and contents
64//! @param model Reactor type to be created. See [this list of reactor
65//! types](../reference/reactors/index.html) for available options.
66//! @param contents Solution object to model the thermodynamic properties and
67//! reactions occurring in the reactor
68//! @param clone Determines whether to clone `sol` so that the internal state of this
69//! reactor is independent of the original Solution object and any Solution objects
70//! used by other reactors in the network.
71//! @param name Name of the reactor.
72//! @since New in %Cantera 3.2. Transitional method returning a `Reactor` object.
73shared_ptr<Reactor> newReactor4(
74 const string& model, shared_ptr<Solution> contents, bool clone=true,
75 const string& name="(none)");
76
77//! Create a Reservoir object with the specified contents
78//! @param contents Solution object to model the contents of this reservoir
79//! @param clone Determines whether to clone `sol` so that the internal state of this
80//! reservoir is independent of the original Solution object and any Solution
81//! objects used by other reactors in the network.
82//! @param name Name of the reservoir.
83//! @since New in %Cantera 3.2.
84shared_ptr<Reservoir> newReservoir(
85 shared_ptr<Solution> contents, bool clone=true, const string& name="(none)");
86
87//! Create a ReactorSurface object with the specified contents and adjacent reactors
88//! participating in surface reactions.
89//! @param contents Solution (Interface) object to model the thermodynamic properties
90//! and reactions occurring in the reactor
91//! @param reactors List of Reactors adjacent to this surface, whose contents
92//! participate in reactions occurring on this surface.
93//! @param clone Determines whether to clone `sol` so that the internal state of this
94//! surface is independent of the original Interface object and any Solution objects
95//! used by other reactors in the network except those in the `reactors` list.
96//! @param name Name of the reactor surface.
97//! @since New in %Cantera 3.2.
98shared_ptr<ReactorSurface> newReactorSurface(
99 shared_ptr<Solution> contents, const vector<shared_ptr<ReactorBase>>& reactors,
100 bool clone=true, const string& name="(none)");
101
102//! @}
103
104}
105
106#endif
File contains the FactoryBase class declarations.
Factory class that supports registering functions to create objects.
Definition FactoryBase.h:69
Factory class to create reactor objects.
void deleteFactory() override
Virtual abstract function that deletes the factory.
shared_ptr< ReactorBase > newReactor(const string &model, shared_ptr< Solution > contents, const string &name)
Create a Reactor object of the specified type and contents.
shared_ptr< Reactor > newReactor4(const string &model, shared_ptr< Solution > contents, bool clone, const string &name)
Create a Reactor object of the specified type and contents.
shared_ptr< ReactorBase > newReactorBase(const string &model, shared_ptr< Solution > contents, bool clone, const string &name)
Create a ReactorBase object of the specified type and contents.
shared_ptr< ReactorSurface > newReactorSurface(shared_ptr< Solution > contents, const vector< shared_ptr< ReactorBase > > &reactors, bool clone, const string &name)
Create a ReactorSurface object with the specified contents and adjacent reactors participating in sur...
shared_ptr< Reservoir > newReservoir(shared_ptr< Solution > contents, bool clone, const string &name)
Create a Reservoir object with the specified contents.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595