DPsim
SparseLUAdapter.h
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 #pragma once
10 
11 #include <bitset>
12 #include <iostream>
13 #include <list>
14 #include <memory>
15 #include <unordered_map>
16 #include <vector>
17 
18 #include <dpsim/Config.h>
19 #include <dpsim/Definitions.h>
20 #include <dpsim/DirectLinearSolver.h>
21 
22 namespace DPsim {
24  Eigen::SparseLU<CPS::SparseMatrixRow, Eigen::COLAMDOrdering<int>>
25  LUFactorizedSparse;
26 
27 public:
30 
32  ~SparseLUAdapter() override;
33 
35  void preprocessing(SparseMatrix &systemMatrix,
36  std::vector<std::pair<UInt, UInt>>
37  &listVariableSystemMatrixEntries) override;
38 
40  void factorize(SparseMatrix &systemMatrix) override;
41 
43  void refactorize(SparseMatrix &systemMatrix) override;
44 
46  void partialRefactorize(SparseMatrix &systemMatrix,
47  std::vector<std::pair<UInt, UInt>>
48  &listVariableSystemMatrixEntries) override;
49 
51  Matrix solve(Matrix &rightSideVector) override;
52 };
53 } // namespace DPsim
DirectLinearSolver()=default
Constructor.
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