Cantera
Install
User Guide
Examples
Reference
Develop
Community
4.0.0a2
Toggle main menu visibility
Loading...
Searching...
No Matches
EigenSparseDirectJacobian.cpp
Go to the documentation of this file.
1
//! @file EigenSparseDirectJacobian.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/numerics/EigenSparseDirectJacobian.h
"
7
#include "cantera/numerics/eigen_dense.h"
8
9
namespace
Cantera
10
{
11
12
void
EigenSparseDirectJacobian::factorize
()
13
{
14
m_matrix
.makeCompressed();
15
// analyze and factorize
16
m_solver.compute(
m_matrix
);
17
// check for errors
18
if
(m_solver.info() != Eigen::Success) {
19
throw
CanteraError
(
"EigenSparseDirectJacobian::factorize"
,
20
"error code: {}"
,
static_cast<
int
>
(m_solver.info()));
21
}
22
}
23
24
void
EigenSparseDirectJacobian::solve
(span<const double> b, span<double> x)
25
{
26
MappedVector(x.data(),
m_dim
) = m_solver.solve(ConstMappedVector(b.data(),
m_dim
));
27
// check for errors
28
if
(m_solver.info() != Eigen::Success) {
29
throw
CanteraError
(
"EigenSparseDirectJacobian::solve"
,
30
"error code: {}"
,
static_cast<
int
>
(m_solver.info()));
31
}
32
}
33
34
}
EigenSparseDirectJacobian.h
Cantera::CanteraError
Base class for exceptions thrown by Cantera classes.
Definition
ctexceptions.h:66
Cantera::EigenSparseDirectJacobian::factorize
void factorize() override
Factorize the system matrix.
Definition
EigenSparseDirectJacobian.cpp:12
Cantera::EigenSparseDirectJacobian::solve
void solve(span< const double > rhs_vector, span< double > output) override
Solve a linear system using the system matrix M.
Definition
EigenSparseDirectJacobian.cpp:24
Cantera::EigenSparseJacobian::m_matrix
Eigen::SparseMatrix< double > m_matrix
Container that is the sparse preconditioner.
Definition
EigenSparseJacobian.h:54
Cantera::SystemJacobian::m_dim
size_t m_dim
Dimension of the system.
Definition
SystemJacobian.h:200
Cantera
Namespace for the Cantera kernel.
Definition
AnyMap.cpp:595
src
numerics
EigenSparseDirectJacobian.cpp
Generated by
1.17.0