DPsim
SparseLUAdapter.cpp
1 /* Copyright 2017-2021 Institute for Automation of Complex Power Systems,
2  * EONERC, RWTH Aachen University
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7  *********************************************************************************/
8 
9 #include <dpsim/SparseLUAdapter.h>
10 
11 using namespace DPsim;
12 
13 namespace DPsim {
15 
17  SparseMatrix &systemMatrix,
18  std::vector<std::pair<UInt, UInt>> &listVariableSystemMatrixEntries) {
19  LUFactorizedSparse.analyzePattern(systemMatrix);
20 }
21 
22 void SparseLUAdapter::factorize(SparseMatrix &systemMatrix) {
23  LUFactorizedSparse.factorize(systemMatrix);
24 }
25 
26 void SparseLUAdapter::refactorize(SparseMatrix &systemMatrix) {
27  /* Eigen's SparseLU does not use refactorization. Use regular factorization (numerical factorization and partial pivoting) here */
28  LUFactorizedSparse.factorize(systemMatrix);
29 }
30 
32  SparseMatrix &systemMatrix,
33  std::vector<std::pair<UInt, UInt>> &listVariableSystemMatrixEntries) {
34  /* Eigen's SparseLU does not use refactorization. Use regular factorization (numerical factorization and partial pivoting) here */
35  LUFactorizedSparse.factorize(systemMatrix);
36 }
37 
38 Matrix SparseLUAdapter::solve(Matrix &mRightHandSideVector) {
39  return LUFactorizedSparse.solve(mRightHandSideVector);
40 }
41 } // namespace DPsim
void factorize(SparseMatrix &systemMatrix) override
factorization function with partial pivoting
void refactorize(SparseMatrix &systemMatrix) override
refactorization without partial pivoting
~SparseLUAdapter() override
Destructor.
void preprocessing(SparseMatrix &systemMatrix, std::vector< std::pair< UInt, UInt >> &listVariableSystemMatrixEntries) override
preprocessing function pre-ordering and scaling the matrix
void partialRefactorize(SparseMatrix &systemMatrix, std::vector< std::pair< UInt, UInt >> &listVariableSystemMatrixEntries) override
partial refactorization withouth partial pivoting
Matrix solve(Matrix &rightSideVector) override
solution function for a right hand side