| Cantera 3.0.0

Loading...
Searching...
No Matches
WallFactory.cpp
Go to the documentation of this file.
1//! @file WallFactory.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/WallFactory.h"
7#include "cantera/zeroD/Wall.h"
8
9 namespace Cantera
10{
11
12WallFactory* WallFactory::s_factory = 0;
13std::mutex WallFactory::wall_mutex;
14
15WallFactory::WallFactory()
16{
17 reg("Wall", []() { return new Wall(); });
18}
19
20WallFactory* WallFactory::factory() {
21 std::unique_lock<std::mutex> lock(wall_mutex);
22 if (!s_factory) {
23 s_factory = new WallFactory;
24 }
25 return s_factory;
26}
27
28 void WallFactory::deleteFactory() {
29 std::unique_lock<std::mutex> lock(wall_mutex);
30 delete s_factory;
31 s_factory = 0;
32}
33
34 WallBase* WallFactory::newWall(const string& wallType)
35{
36 warn_deprecated("WallFactory::newWall",
37 "To be removed after Cantera 3.0; for new behavior, see 'newWall3'.");
38 return create(wallType);
39}
40
41 WallBase* newWall(const string& model)
42{
43 warn_deprecated("newWall",
44 "To be changed after Cantera 3.0; for new behavior, see 'newWall3'.");
45 return WallFactory::factory()->newWall(model);
46}
47
48shared_ptr<WallBase> newWall3(const string& model)
49{
50 shared_ptr<WallBase> wptr(WallFactory::factory()->create(model));
51 return wptr;
52}
53
54}
WallFactory.h
Wall.h
Header file for base class WallBase.
Cantera::Factory< WallBase >::create
WallBase * create(const string &name, Args... args)
Create an object using the object construction function corresponding to "name" and the provided cons...
Definition FactoryBase.h:75
Cantera::Factory< WallBase >::reg
void reg(const string &name, function< WallBase *(Args...)> f)
Register a new object construction function.
Definition FactoryBase.h:80
Cantera::WallBase
Base class for 'walls' (walls, pistons, etc.) connecting reactors.
Definition Wall.h:22
Cantera::WallFactory::deleteFactory
void deleteFactory() override
Virtual abstract function that deletes the factory.
Definition WallFactory.cpp:28
Cantera::WallFactory::newWall
WallBase * newWall(const string &wallType)
Create a new wall by type name.
Definition WallFactory.cpp:34
Cantera::newWall3
shared_ptr< WallBase > newWall3(const string &model)
Create a WallBase object of the specified type.
Definition WallFactory.cpp:48
Cantera::newWall
WallBase * newWall(const string &model)
Create a WallBase object of the specified type.
Definition WallFactory.cpp:41
Cantera
Namespace for the Cantera kernel.
Definition AnyMap.cpp:564
Cantera::warn_deprecated
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Definition AnyMap.cpp:1926