// // Software License for AMDiS // // Copyright (c) 2010 Dresden University of Technology // All rights reserved. // Authors: Simon Vey, Thomas Witkowski et al. // // This file is part of AMDiS // // See also license.opensource.txt in the distribution. #include "parallel/PetscSolver.h" #include "parallel/StdMpi.h" #include "parallel/MpiHelper.h" namespace AMDiS { using namespace std; void PetscSolver::printSolutionInfo(AdaptInfo *adaptInfo, bool iterationCounter, bool residual) { FUNCNAME("PetscSolver::printSolutionInfo()"); if (iterationCounter) { int iterations = 0; KSPGetIterationNumber(solver, &iterations); MSG(" Number of iterations: %d\n", iterations); adaptInfo->setSolverIterations(iterations); } if (residual) { double norm = 0.0; MatMult(petscMatrix, petscSolVec, petscTmpVec); VecAXPY(petscTmpVec, -1.0, petscRhsVec); VecNorm(petscTmpVec, NORM_2, &norm); MSG(" Residual norm: %e\n", norm); } } }