Cantera  3.3.0a1
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> phase, bool clone=true,
53 const string& name="(none)");
54
55//! Create a Reactor object of the specified type and contents
56//! @param model Reactor type to be created. See [this list of reactor
57//! types](../reference/reactors/index.html) for available options.
58//! @param phase Solution object to model the thermodynamic properties and
59//! reactions occurring in the reactor
60//! @param clone Determines whether to clone `sol` so that the internal state of this
61//! reactor is independent of the original Solution object and any Solution objects
62//! used by other reactors in the network.
63//! @param name Name of the reactor.
64//! @since Starting in %Cantera 3.3, returns a `shared_ptr<Reactor>` instead of a
65//! `shared_ptr<ReactorBase>`.
66shared_ptr<Reactor> newReactor(
67 const string& model, shared_ptr<Solution> phase, bool clone=true,
68 const string& name="(none)");
69
70//! @copydoc newReactor
71//! @deprecated Transitional method; to be removed after %Cantera 3.3.
72inline shared_ptr<Reactor> newReactor4(const string& model, shared_ptr<Solution> phase,
73 bool clone=true, const string& name="(none)")
74{
75 return newReactor(model, phase, clone, name);
76}
77
78//! Create a Reservoir object with the specified contents
79//! @param phase Solution object to model the contents of this reservoir
80//! @param clone Determines whether to clone `sol` so that the internal state of this
81//! reservoir is independent of the original Solution object and any Solution
82//! objects used by other reactors in the network.
83//! @param name Name of the reservoir.
84//! @since New in %Cantera 3.2.
85shared_ptr<Reservoir> newReservoir(
86 shared_ptr<Solution> phase, bool clone=true, const string& name="(none)");
87
88//! Create a ReactorSurface object with the specified contents and adjacent reactors
89//! participating in surface reactions.
90//! @param phase Solution (Interface) object to model the thermodynamic properties
91//! and reactions occurring in the reactor
92//! @param reactors List of Reactors adjacent to this surface, whose contents
93//! participate in reactions occurring on this surface.
94//! @param clone Determines whether to clone `sol` so that the internal state of this
95//! surface is independent of the original Interface object and any Solution objects
96//! used by other reactors in the network except those in the `reactors` list.
97//! @param name Name of the reactor surface.
98//! @since New in %Cantera 3.2.
99shared_ptr<ReactorSurface> newReactorSurface(
100 shared_ptr<Solution> phase, const vector<shared_ptr<ReactorBase>>& reactors,
101 bool clone=true, const string& name="(none)");
102
103//! @}
104
105}
106
107#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< Reactor > newReactor(const string &model, shared_ptr< Solution > phase, 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 > phase, bool clone, const string &name)
Create a ReactorBase object of the specified type and contents.
shared_ptr< Reactor > newReactor4(const string &model, shared_ptr< Solution > phase, bool clone=true, const string &name="(none)")
Create a Reactor object of the specified type and contents.
shared_ptr< Reservoir > newReservoir(shared_ptr< Solution > phase, bool clone, const string &name)
Create a Reservoir object with the specified contents.
shared_ptr< ReactorSurface > newReactorSurface(shared_ptr< Solution > phase, 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...
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595