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
12#include "cantera/zeroD/IdealGasConstPressureReactor.h"
14
15using namespace std;
16namespace Cantera
17{
18
19class 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
41ReactorBase* ReactorFactory::newReactor(const std::string& reactorType)
42{
43 return create(reactorType);
44}
45
46}
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
void reg(const std::string &name, std::function< ReactorBase *(Args...)> f)
Register a new object construction function.
Definition: FactoryBase.h:81
Base class for stirred reactors.
Definition: ReactorBase.h:49
virtual ReactorBase * newReactor(const std::string &reactorType)
Create a new reactor by type name.
Namespace for the Cantera kernel.
Definition: AnyMap.h:29