diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h index 23c839747da1e839df3ae532fea706f01ae91924..ef62343e37084e813b551f53edd00ba8b7b8a95d 100644 --- a/Solver/linearSystemPETSc.h +++ b/Solver/linearSystemPETSc.h @@ -93,6 +93,7 @@ class linearSystemPETSc : public linearSystem<scalar> { void addToRightHandSide(int row, const scalar &val); void getFromRightHandSide(int row, scalar &val) const; double normInfRightHandSide() const; + int getNumKspIteration() const; void addToMatrix(int row, int col, const scalar &val); void addToSolution(int row, const scalar &val); void getFromSolution(int row, scalar &val) const; @@ -129,6 +130,7 @@ class linearSystemPETSc : public linearSystem<scalar> { void addToSolution(int row, const scalar &val) {} void getFromRightHandSide(int row, scalar &val) const {} void getFromSolution(int row, scalar &val) const {} + int getNumKspIteration() const {return 0;}; void zeroMatrix() {} void zeroRightHandSide() {} void zeroSolution() {} diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp index 6c24339edbc5d5da065e4524e3fe2abf64ccfd72..136daf3d4fac24485c183763780c3b08c0642ea7 100644 --- a/Solver/linearSystemPETSc.hpp +++ b/Solver/linearSystemPETSc.hpp @@ -35,6 +35,14 @@ void linearSystemPETSc<scalar>::_kspCreate() _kspAllocated = true; } +template <class scalar> +int linearSystemPETSc<scalar>::getNumKspIteration() const +{ + int n; + _try(KSPGetIterationNumber(_ksp, &n)); + return n; +} + template <class scalar> linearSystemPETSc<scalar>::linearSystemPETSc(MPI_Comm com) {