From 9da42db4781063092dfff814ef8b612bcbd38675 Mon Sep 17 00:00:00 2001
From: Paul-Emile Bernard <paul-emile.bernard@uclouvain.be>
Date: Thu, 25 Jul 2013 12:45:12 +0000
Subject: [PATCH] bug using PETSC corrected...

---
 Solver/linearSystemPETSc.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp
index 9fe2ae310f..75656d52f3 100644
--- a/Solver/linearSystemPETSc.hpp
+++ b/Solver/linearSystemPETSc.hpp
@@ -93,7 +93,7 @@ void linearSystemPETSc<scalar>::preAllocateEntries()
   int blockSize = _getBlockSizeFromParameters();
   std::vector<int> nByRowDiag (_localSize), nByRowOffDiag (_localSize);
   if (_sparsity.getNbRows() == 0) {
-    PetscInt prealloc = 300;
+    PetscInt prealloc = std::min(300,_localSize);
     PetscBool set;
     PetscOptionsGetInt(PETSC_NULL, "-petsc_prealloc", &prealloc, &set);
     nByRowDiag.resize(0);
-- 
GitLab