Cantera  3.1.0a4
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
8
9namespace Cantera
10{
11
12WallFactory* WallFactory::s_factory = 0;
13std::mutex WallFactory::wall_mutex;
14
15WallFactory::WallFactory()
16{
17 reg("Wall", [](const string& name) { return new Wall(name); });
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
29 std::unique_lock<std::mutex> lock(wall_mutex);
30 delete s_factory;
31 s_factory = 0;
32}
33
34shared_ptr<WallBase> newWall(const string& model, const string& name)
35{
36 return shared_ptr<WallBase>(WallFactory::factory()->create(model, name));
37}
38
39shared_ptr<WallBase> newWall3(const string& model)
40{
41 warn_deprecated("newWall3",
42 "Use newWall instead; to be removed after Cantera 3.1.");
43 return newWall(model);
44}
45
46}
Header file for base class WallBase.
void reg(const string &name, function< WallBase *(Args...)> f)
Register a new object construction function.
Definition FactoryBase.h:80
void deleteFactory() override
Virtual abstract function that deletes the factory.
shared_ptr< WallBase > newWall(const string &model, const string &name)
Create a WallBase object of the specified type.
shared_ptr< WallBase > newWall3(const string &model)
Create a WallBase object of the specified type.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
void warn_deprecated(const string &source, const AnyBase &node, const string &message)
A deprecation warning for syntax in an input file.
Definition AnyMap.cpp:1997