Cantera 2.6.0

ReactorFactory.cpp
Go to the documentation of this file.
1//! @file ReactorFactory.cpp
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#include "cantera/zeroD/ReactorFactory.h"
7#include "cantera/zeroD/Reservoir.h"
8#include "cantera/zeroD/Reactor.h"
9#include "cantera/zeroD/FlowReactor.h"
10#include "cantera/zeroD/ConstPressureReactor.h"
11#include "cantera/zeroD/IdealGasReactor.h"
12#include "cantera/zeroD/IdealGasConstPressureReactor.h"
13#include "cantera/zeroD/ReactorDelegator.h"
14
15 using namespace std;
16 namespace Cantera
17{
18
19 class Reservoir;
20
21ReactorFactory* ReactorFactory::s_factory = 0;
22std::mutex ReactorFactory::reactor_mutex;
23
24ReactorFactory::ReactorFactory()
25{
26 reg("Reservoir", []() { return new Reservoir(); });
27 reg("Reactor", []() { return new Reactor(); });
28 reg("ConstPressureReactor", []() { return new ConstPressureReactor(); });
29 reg("FlowReactor", []() { return new FlowReactor(); });
30 reg("IdealGasReactor", []() { return new IdealGasReactor(); });
31 reg("IdealGasConstPressureReactor", []() { return new IdealGasConstPressureReactor(); });
32 reg("ExtensibleReactor", []() { return new ReactorDelegator<Reactor>(); });
33 reg("ExtensibleIdealGasReactor",
34 []() { return new ReactorDelegator<IdealGasReactor>(); });
35 reg("ExtensibleConstPressureReactor",
36 []() { return new ReactorDelegator<ConstPressureReactor>(); });
37 reg("ExtensibleIdealGasConstPressureReactor",
38 []() { return new ReactorDelegator<IdealGasConstPressureReactor>(); });
39}
40
41 ReactorBase* ReactorFactory::newReactor(const std::string& reactorType)
42{
43 return create(reactorType);
44}
45
46}
ConstPressureReactor.h
FlowReactor.h
IdealGasReactor.h
ReactorDelegator.h
ReactorFactory.h
Reactor.h
Reservoir.h
Cantera::Factory< ReactorBase >::create
ReactorBase * create(const std::string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
Definition: FactoryBase.h:76
Cantera::Factory< ReactorBase >::reg
void reg(const std::string &name, std::function< ReactorBase *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:81
Cantera::ReactorBase
Base class for stirred reactors.
Definition: ReactorBase.h:49
Cantera::ReactorFactory::newReactor
virtual ReactorBase * newReactor(const std::string &reactorType)
Create a new reactor by type name.
Definition: ReactorFactory.cpp:41
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:557