From e022b1e0ab05d10df23513d4fea89888ec6791d3 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Fri, 4 Jul 2014 10:31:36 +0000
Subject: [PATCH] dg : micro macro particle

---
 Solver/linearSystemPETSc.h   | 2 ++
 Solver/linearSystemPETSc.hpp | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h
index 23c839747d..ef62343e37 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 6c24339edb..136daf3d4f 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)
 {
-- 
GitLab