7#ifndef SVZERODSOLVER_ALGREBRA_SPARSESYSTEM_HPP_
8#define SVZERODSOLVER_ALGREBRA_SPARSESYSTEM_HPP_
10#include <Eigen/Sparse>
11#include <Eigen/SparseLU>
51 Eigen::SparseMatrix<double>
F;
52 Eigen::SparseMatrix<double>
E;
53 Eigen::SparseMatrix<double>
dC_dy;
55 Eigen::Matrix<double, Eigen::Dynamic, 1>
C;
58 Eigen::Matrix<double, Eigen::Dynamic, 1>
60 Eigen::Matrix<double, Eigen::Dynamic, 1>
63 std::shared_ptr<Eigen::SparseLU<Eigen::SparseMatrix<double>>>
solver =
64 std::shared_ptr<Eigen::SparseLU<Eigen::SparseMatrix<double>>>(
65 new Eigen::SparseLU<Eigen::SparseMatrix<double>>());
82 Eigen::Matrix<double, Eigen::Dynamic, 1> &ydot);
Model of 0D elements.
Definition Model.h:48
Eigen::SparseMatrix< double > dC_dy
System matrix dC/dy.
Definition SparseSystem.h:53
void reserve(Model *model)
Reserve memory in system matrices based on number of triplets.
Definition SparseSystem.cpp:30
void clean()
Delete dynamically allocated memory (class member Eigen::SparseLU<Eigen::SparseMatrix> *solver)
Definition SparseSystem.cpp:24
Eigen::SparseMatrix< double > E
System matrix E.
Definition SparseSystem.h:52
Eigen::SparseMatrix< double > dC_dydot
System matrix dC/dydot.
Definition SparseSystem.h:54
Eigen::Matrix< double, Eigen::Dynamic, 1 > C
System vector C.
Definition SparseSystem.h:55
Eigen::Matrix< double, Eigen::Dynamic, 1 > residual
Residual of the system.
Definition SparseSystem.h:59
SparseSystem()
Construct a new Sparse System object.
Definition SparseSystem.cpp:8
void solve()
Solve the system.
Definition SparseSystem.cpp:74
Eigen::SparseMatrix< double > F
System matrix F.
Definition SparseSystem.h:51
void update_residual(Eigen::Matrix< double, Eigen::Dynamic, 1 > &y, Eigen::Matrix< double, Eigen::Dynamic, 1 > &ydot)
Update the residual of the system.
Definition SparseSystem.cpp:58
void update_jacobian(double time_coeff_ydot, double time_coeff_y)
Update the jacobian of the system.
Definition SparseSystem.cpp:67
Eigen::Matrix< double, Eigen::Dynamic, 1 > dydot
Solution increment of the system.
Definition SparseSystem.h:61
~SparseSystem()
Destroy the Sparse System object.
Definition SparseSystem.cpp:22
Eigen::SparseMatrix< double > jacobian
Jacobian of the system.
Definition SparseSystem.h:57
std::shared_ptr< Eigen::SparseLU< Eigen::SparseMatrix< double > > > solver
Definition SparseSystem.h:63