Skip to content

Commit

Permalink
Added Counter for Pivot Faults in KLUAdapter
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Fensch <[email protected]>
  • Loading branch information
philipp-fensch committed Sep 26, 2023
1 parent 279f1b5 commit 1b6d19f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dpsim/include/dpsim/KLUAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace DPsim
std::vector<Int> mVaryingRows;

/// KLU-specific structs
klu_common mCommon;
klu_common mCommon;
klu_numeric* mNumeric = nullptr;
klu_symbolic* mSymbolic = nullptr;

Expand All @@ -47,6 +47,9 @@ namespace DPsim
/// AMD_ORDERING is defined in SuiteSparse/AMD
int mPreordering = AMD_ORDERING;

/// Count Pivot faults
int mPivotFaults = 0;

PARTIAL_REFACTORIZATION_METHOD mPartialRefactorizationMethod = PARTIAL_REFACTORIZATION_METHOD::FACTORIZATION_PATH;

/// Temporary value to store the number of nonzeros
Expand Down
2 changes: 2 additions & 0 deletions dpsim/src/KLUAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ KLUAdapter::~KLUAdapter()
klu_free_symbolic(&mSymbolic, &mCommon);
if (mNumeric)
klu_free_numeric(&mNumeric, &mCommon);
mSLog->info("Number of Pivot Faults: {}", mPivotFaults);
}

KLUAdapter::KLUAdapter()
Expand Down Expand Up @@ -150,6 +151,7 @@ void KLUAdapter::partialRefactorize(SparseMatrix &systemMatrix,
if (mCommon.status == KLU_PIVOT_FAULT)
{
/* pivot became too small => fully factorize again */
mPivotFaults++;
factorize(systemMatrix);
}
}
Expand Down

0 comments on commit 1b6d19f

Please sign in to comment.