From ace4c4189324baac4bcbe4672e1a49d7325bc6cb Mon Sep 17 00:00:00 2001
From: Gauthier Becker <gauthierbecker@gmail.com>
Date: Sun, 26 Oct 2014 17:33:32 +0000
Subject: [PATCH] Give the possibility to define solver options in the python
 script. Usefull for petsc to void to pass them in command line arguments or
 to override .petscrc options (nightly tests can use different solvers
 although .petscrc cannot be modified...)

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

diff --git a/Solver/linearSystemPETSc.hpp b/Solver/linearSystemPETSc.hpp
index 136daf3d4f..3792888c5a 100644
--- a/Solver/linearSystemPETSc.hpp
+++ b/Solver/linearSystemPETSc.hpp
@@ -18,6 +18,9 @@ int linearSystemPETSc<scalar>::_getBlockSizeFromParameters() const
 template <class scalar>
 void linearSystemPETSc<scalar>::_kspCreate()
 {
+  // Set option given by the user in its (python script) without using argc,argv or .petscrc
+  if(this->_parameters.count("petsc_solver_options"))
+    _try(PetscOptionsInsertString(this->_parameters["petsc_solver_options"].c_str()));
   _try(KSPCreate(_comm, &_ksp));
   PC pc;
   _try(KSPGetPC(_ksp, &pc));
-- 
GitLab