Cantera  3.1.0b1
Loading...
Searching...
No Matches
PreconditionerFactory.cpp
Go to the documentation of this file.
1//! @file PreconditionerFactory.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
12PreconditionerFactory* PreconditionerFactory::factory() {
13 std::unique_lock<std::mutex> lock(precon_mutex);
14 if (!s_factory) {
15 s_factory = new PreconditionerFactory;
16 }
17 return s_factory;
18};
19
20//! Delete preconditioner factory
22 std::unique_lock<std::mutex> lock(precon_mutex);
23 delete s_factory;
24 s_factory = 0;
25};
26
27PreconditionerFactory* PreconditionerFactory::s_factory = 0;
28std::mutex PreconditionerFactory::precon_mutex;
29
30PreconditionerFactory::PreconditionerFactory()
31{
32 reg("Adaptive", []() { return new AdaptivePreconditioner(); });
33}
34
35shared_ptr<PreconditionerBase> newPreconditioner(const string& precon)
36{
37 return shared_ptr<PreconditionerBase>(PreconditionerFactory::factory()->create(precon));
38};
39
40}
Declarations for the class AdaptivePreconditioner which is a child class of PreconditionerBase for pr...
AdaptivePreconditioner a preconditioner designed for use with large mechanisms that leverages sparse ...
void reg(const string &name, function< PreconditionerBase *(Args...)> f)
Register a new object construction function.
Definition FactoryBase.h:80
Factory class to create preconditioner objects.
void deleteFactory() override
Delete preconditioner factory.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
shared_ptr< PreconditionerBase > newPreconditioner(const string &precon)
Create a Preconditioner object of the specified type.