From 23277371e5a76b3609c0648e908c8872cb347535 Mon Sep 17 00:00:00 2001
From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be>
Date: Wed, 14 May 2014 07:45:56 +0000
Subject: [PATCH] linearSystemPETSc<fullMatrix<double> > : some petsc version
 require to set the ROW_ORIENTED option after the matrix pre-allocation

---
 Solver/linearSystemPETSc.hpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp
index dcbe582da3..6c24339edb 100644
--- a/Solver/linearSystemPETSc.hpp
+++ b/Solver/linearSystemPETSc.hpp
@@ -137,6 +137,8 @@ void linearSystemPETSc<scalar>::preAllocateEntries()
     else
       _try(MatMPIBAIJSetPreallocation(_a, blockSize, 0, &nByRowDiag[0], 0, &nByRowOffDiag[0]));
   }
+  if (blockSize > 1)
+    _try(MatSetOption(_a, MAT_ROW_ORIENTED, PETSC_FALSE));
   _entriesPreAllocated = true;
 }
 
@@ -151,12 +153,11 @@ void linearSystemPETSc<scalar>::allocate(int nbRows)
   _try(MatSetSizes(_a, blockSize * nbRows, blockSize * nbRows, PETSC_DETERMINE, PETSC_DETERMINE));
   if (blockSize > 1) {
     if (commSize > 1) {
-      MatSetType(_a, MATMPIBAIJ);
+      _try(MatSetType(_a, MATMPIBAIJ));
     }
     else {
-      MatSetType(_a, MATSEQBAIJ);
+      _try(MatSetType(_a, MATSEQBAIJ));
     }
-    MatSetOption(_a, MAT_ROW_ORIENTED, PETSC_FALSE);
   }
   // override the default options with the ones from the option
   // database (if any)
-- 
GitLab