Loading [MathJax]/extensions/tex2jax.js
Cantera  3.2.0a1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SystemJacobianFactory.cpp
Go to the documentation of this file.
1//! @file SystemJacobianFactory.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
10
11namespace Cantera
12{
13
14SystemJacobianFactory* SystemJacobianFactory::factory() {
15 std::unique_lock<std::mutex> lock(jac_mutex);
16 if (!s_factory) {
17 s_factory = new SystemJacobianFactory;
18 }
19 return s_factory;
20};
21
23 std::unique_lock<std::mutex> lock(jac_mutex);
24 delete s_factory;
25 s_factory = 0;
26};
27
28SystemJacobianFactory* SystemJacobianFactory::s_factory = 0;
29std::mutex SystemJacobianFactory::jac_mutex;
30
31SystemJacobianFactory::SystemJacobianFactory()
32{
33 reg("Adaptive", []() { return new AdaptivePreconditioner(); });
34 reg("banded-direct", []() { return new MultiJac(); });
35 reg("eigen-sparse-direct", []() { return new EigenSparseDirectJacobian(); });
36}
37
38shared_ptr<SystemJacobian> newSystemJacobian(const string& type)
39{
40 return shared_ptr<SystemJacobian>(SystemJacobianFactory::factory()->create(type));
41};
42
43}
Declarations for the class AdaptivePreconditioner which is a child class of SystemJacobian for precon...
AdaptivePreconditioner a preconditioner designed for use with large mechanisms that leverages sparse ...
void reg(const string &name, function< SystemJacobian *(Args...)> f)
Register a new object construction function.
Definition FactoryBase.h:80
Factory class to create Jacobian objects for use by linear solvers.
void deleteFactory() override
Virtual abstract function that deletes the factory.
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595
shared_ptr< SystemJacobian > newSystemJacobian(const string &type)
Create a SystemJacobian object of the specified type.