Cantera  3.1.0a1
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", []() { 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
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)
35{
36 return shared_ptr<WallBase>(WallFactory::factory()->create(model));
37}
38
39shared_ptr<WallBase> newWall3(const string& model)
40{
41 return newWall(model);
42}
43
44}
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)
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:564