From 9378bea8ea8ba85b401cdec8defea3c8918b15a4 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Fri, 4 Feb 2011 12:23:53 +0000
Subject: [PATCH] linear system petsc block uses sparsity data if available

---
 Solver/linearSystemPETSc.cpp | 6 +++++-
 Solver/linearSystemPETSc.h   | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Solver/linearSystemPETSc.cpp b/Solver/linearSystemPETSc.cpp
index 9e3ba80d27..6c3184f962 100644
--- a/Solver/linearSystemPETSc.cpp
+++ b/Solver/linearSystemPETSc.cpp
@@ -159,6 +159,11 @@ int linearSystemPETScBlockDouble::systemSolve()
   KSPSolve(_ksp, _b, _x);
   return 1;
 }
+void linearSystemPETScBlockDouble::insertInSparsityPattern (int i, int j) {
+  i -= _localRowStart;
+  if (i<0 || i>= _localSize) return;
+  _sparsity.insertEntry (i,j);
+}
 
 void linearSystemPETScBlockDouble::preAllocateEntries() 
 {
@@ -220,7 +225,6 @@ linearSystemPETScBlockDouble::linearSystemPETScBlockDouble()
   _entriesPreAllocated = false;
   _isAllocated = false;
   _kspAllocated = false;
-  printf("init\n");
 }
 
 double linearSystemPETScBlockDouble::normInfRightHandSide() const
diff --git a/Solver/linearSystemPETSc.h b/Solver/linearSystemPETSc.h
index c07ace49b0..faba13f749 100644
--- a/Solver/linearSystemPETSc.h
+++ b/Solver/linearSystemPETSc.h
@@ -288,6 +288,7 @@ class linearSystemPETScBlockDouble : public linearSystem<fullMatrix<double> > {
   void zeroMatrix();
   void zeroRightHandSide();
   double normInfRightHandSide() const;
+  void insertInSparsityPattern (int i, int j);
   linearSystemPETScBlockDouble();
 };
 
-- 
GitLab