From a795bfed1c9c3a34935a926193b27be780c13f5d Mon Sep 17 00:00:00 2001
From: Rainer Backofen <rainer.backofen@tu-dresden.de>
Date: Wed, 28 Jul 2010 12:29:36 +0000
Subject: [PATCH] set solver iteration in adaptInfo also for parallel (PetSc)

---
 AMDiS/src/parallel/GlobalMatrixSolver.cc | 8 ++++----
 AMDiS/src/parallel/GlobalMatrixSolver.h  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/AMDiS/src/parallel/GlobalMatrixSolver.cc b/AMDiS/src/parallel/GlobalMatrixSolver.cc
index b26b668a..b950675c 100644
--- a/AMDiS/src/parallel/GlobalMatrixSolver.cc
+++ b/AMDiS/src/parallel/GlobalMatrixSolver.cc
@@ -4,7 +4,6 @@
 #include "DOFVector.h"
 #include "Debug.h"
 #include "SystemVector.h"
-#include "VtkWriter.h"
 
 #include "petscksp.h"
 
@@ -47,7 +46,7 @@ namespace AMDiS {
     clock_t first = clock();
 
     fillPetscMatrix(systemMatrix, rhs);
-    solvePetscMatrix(*solution);
+    solvePetscMatrix(*solution, adaptInfo);
 
 #ifdef _OPENMP
     INFO(info, 8)("solution of discrete system needed %.5f seconds system time / %.5f seconds wallclock time\n",
@@ -474,7 +473,7 @@ namespace AMDiS {
   }
 
 
-  void GlobalMatrixSolver::solvePetscMatrix(SystemVector &vec)
+    void GlobalMatrixSolver::solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo)
   {
     FUNCNAME("GlobalMatrixSolver::solvePetscMatrix()");
 
@@ -535,7 +534,8 @@ namespace AMDiS {
     int iterations = 0;
     KSPGetIterationNumber(solver, &iterations);
     MSG("  Number of iterations: %d\n", iterations);
-    
+    adaptInfo->setSolverIterations(iterations);
+
     double norm = 0.0;
     MatMult(petscMatrix, petscSolVec, petscTmpVec);
     VecAXPY(petscTmpVec, -1.0, petscRhsVec);
diff --git a/AMDiS/src/parallel/GlobalMatrixSolver.h b/AMDiS/src/parallel/GlobalMatrixSolver.h
index d133e695..08f3656f 100644
--- a/AMDiS/src/parallel/GlobalMatrixSolver.h
+++ b/AMDiS/src/parallel/GlobalMatrixSolver.h
@@ -79,7 +79,7 @@ namespace AMDiS {
     void setDofVector(Vec& petscVec, DOFVector<double>* vec, 
 		      int disMult = 1, int dispAdd = 0);
 
-    void solvePetscMatrix(SystemVector &vec);
+    void solvePetscMatrix(SystemVector &vec, AdaptInfo *adaptInfo);
 
   protected:
     MeshDistributor *meshDistributor;
-- 
GitLab