Cantera  3.2.0a2
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>, 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, const string& name="(none)");
53
54//! Create a Reactor object of the specified type and contents
55//! @since Starting in %Cantera 3.1, this method requires a valid Solution object and
56//! returns a `shared_ptr<ReactorBase>` instead of a `ReactorBase*`.
57//! @deprecated Behavior changes after %Cantera 3.2, when a `shared_ptr<Reactor>` will
58//! be returned. For new behavior, see `newReactor4`.
59shared_ptr<ReactorBase> newReactor(
60 const string& model, shared_ptr<Solution> contents, const string& name="(none)");
61
62//! Create a Reactor object of the specified type and contents
63//! @since New in %Cantera 3.2. Transitional method returning a `Reactor` object.
64shared_ptr<Reactor> newReactor4(
65 const string& model, shared_ptr<Solution> contents, const string& name="(none)");
66
67//! Create a Reservoir object with the specified contents
68//! @since New in %Cantera 3.2.
69shared_ptr<Reservoir> newReservoir(
70 shared_ptr<Solution> contents, const string& name="(none)");
71
72//! @}
73
74}
75
76#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< ReactorBase > newReactorBase(const string &model, shared_ptr< Solution > contents, const string &name)
Create a ReactorBase object of the specified type and contents.
shared_ptr< Reactor > newReactor4(const string &model, shared_ptr< Solution > contents, const string &name)
Create a Reactor object of the specified type and contents.
shared_ptr< Reservoir > newReservoir(shared_ptr< Solution > contents, const string &name)
Create a Reservoir object with the specified contents.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595