From 33292ef262fcc9d546a6d15de716fa5585103c64 Mon Sep 17 00:00:00 2001 From: Sebastien Blaise <sebastien.blaise@uclouvain.be> Date: Tue, 12 Jun 2012 09:15:39 +0000 Subject: [PATCH] Print system petsc --- Solver/linearSystemPETSc.cpp | 18 ++++++++++++++++++ Solver/linearSystemPETSc.h | 1 + 2 files changed, 19 insertions(+) diff --git a/Solver/linearSystemPETSc.cpp b/Solver/linearSystemPETSc.cpp index 56fc1a453b..0bba26d013 100644 --- a/Solver/linearSystemPETSc.cpp +++ b/Solver/linearSystemPETSc.cpp @@ -177,6 +177,24 @@ void linearSystemPETScBlockDouble::clear() _isAllocated = false; } +void linearSystemPETScBlockDouble::print() +{ + _try(MatAssemblyBegin(_a, MAT_FINAL_ASSEMBLY)); + _try(MatAssemblyEnd(_a, MAT_FINAL_ASSEMBLY)); + _try(VecAssemblyBegin(_b)); + _try(VecAssemblyEnd(_b)); + if(Msg::GetCommRank()==0) + printf("a :\n"); + MatView(_a, PETSC_VIEWER_STDOUT_WORLD); + if(Msg::GetCommRank()==0) + printf("b :\n"); + VecView(_b, PETSC_VIEWER_STDOUT_WORLD); + if(Msg::GetCommRank()==0) + printf("x :\n"); + VecView(_x, PETSC_VIEWER_STDOUT_WORLD); +} + + int linearSystemPETScBlockDouble::systemSolve() { if (!_kspAllocated) diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h index 176d8c5390..1cd061baff 100644 --- a/Solver/linearSystemPETSc.h +++ b/Solver/linearSystemPETSc.h @@ -91,6 +91,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > { bool _sequential; public: void _kspCreate(); + void print(); virtual void addToMatrix(int row, int col, const fullMatrix<double> &val); virtual void addToRightHandSide(int row, const fullMatrix<double> &val); virtual void addToSolution(int row, const fullMatrix<double> &val); -- GitLab