DPsim
Loading...
Searching...
No Matches
DirectLinearSolverConfiguration.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/DirectLinearSolverConfiguration.h>
10
11using namespace DPsim;
12
13namespace DPsim {
14DirectLinearSolverConfiguration::DirectLinearSolverConfiguration() {
15 mScalingMethod = SCALING_METHOD::MAX_SCALING;
16 mPartialRefactorizationMethod =
17 PARTIAL_REFACTORIZATION_METHOD::NO_PARTIAL_REFACTORIZATION;
18 mUseBTF = USE_BTF::DO_BTF;
19 mFillInReductionMethod = FILL_IN_REDUCTION_METHOD::AMD;
20}
21
22void DirectLinearSolverConfiguration::setFillInReductionMethod(
23 FILL_IN_REDUCTION_METHOD fillInReductionMethod) {
24 mFillInReductionMethod = fillInReductionMethod;
25}
26
27void DirectLinearSolverConfiguration::setScalingMethod(
28 SCALING_METHOD scalingMethod) {
29 mScalingMethod = scalingMethod;
30}
31
32void DirectLinearSolverConfiguration::setPartialRefactorizationMethod(
33 PARTIAL_REFACTORIZATION_METHOD partialRefactorizationMethod) {
34 mPartialRefactorizationMethod = partialRefactorizationMethod;
35}
36
37void DirectLinearSolverConfiguration::setBTF(USE_BTF useBTF) {
38 mUseBTF = useBTF;
39}
40
41SCALING_METHOD DirectLinearSolverConfiguration::getScalingMethod() const {
42 return mScalingMethod;
43}
44
45FILL_IN_REDUCTION_METHOD
46DirectLinearSolverConfiguration::getFillInReductionMethod() const {
47 return mFillInReductionMethod;
48}
49
50PARTIAL_REFACTORIZATION_METHOD
51DirectLinearSolverConfiguration::getPartialRefactorizationMethod() const {
52 return mPartialRefactorizationMethod;
53}
54
55USE_BTF
56DirectLinearSolverConfiguration::DirectLinearSolverConfiguration::getBTF()
57 const {
58 return mUseBTF;
59}
60
61String DirectLinearSolverConfiguration::getScalingMethodString() const {
62 switch (mScalingMethod) {
63 case SCALING_METHOD::MAX_SCALING:
64 return "max scaling";
65 case SCALING_METHOD::SUM_SCALING:
66 return "sum scaling";
67 case SCALING_METHOD::NO_SCALING:
68 return "without scaling";
69 default:
70 return "using the solver's default scaling method";
71 }
72}
73
74String DirectLinearSolverConfiguration::getFillInReductionMethodString() const {
75 switch (mFillInReductionMethod) {
76 case FILL_IN_REDUCTION_METHOD::AMD_NV:
77 return "AMD using a preference for non-varying entries";
78 case FILL_IN_REDUCTION_METHOD::AMD_RA:
79 return "AMD using a right-arranging of varying entries";
80 case FILL_IN_REDUCTION_METHOD::COLAMD:
81 return "COLAMD";
82 case FILL_IN_REDUCTION_METHOD::AMD:
83 return "AMD";
84 default:
85 return "using the solver's default fill-in reduction";
86 }
87}
88
89String
90DirectLinearSolverConfiguration::getPartialRefactorizationMethodString() const {
91 switch (mPartialRefactorizationMethod) {
92 case PARTIAL_REFACTORIZATION_METHOD::REFACTORIZATION_RESTART:
93 return "with refactorization restart";
94 case PARTIAL_REFACTORIZATION_METHOD::NO_PARTIAL_REFACTORIZATION:
95 return "without partial refactorization";
96 case PARTIAL_REFACTORIZATION_METHOD::FACTORIZATION_PATH:
97 return "with factorization path";
98 default:
99 return "with unknown method";
100 }
101}
102
103String DirectLinearSolverConfiguration::getBTFString() const {
104 switch (mUseBTF) {
105 case USE_BTF::DO_BTF:
106 return "with BTF";
107 case USE_BTF::NO_BTF:
108 default:
109 return "without BTF";
110 }
111}
112} // namespace DPsim