diff --git a/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp b/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp index d312fc3003a094a5516e935001f78598a661f7f1..74433adb83c0add16d71b24ce5d1c1b485a8e5db 100644 --- a/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp +++ b/MathLib/LinAlg/PETSc/PETScLinearSolver.cpp @@ -41,7 +41,11 @@ bool PETScLinearSolver::solve(const PETScVector &b, PETScVector &x) PetscMemoryGetCurrentUsage(&mem1); #endif +#if (PETSC_VERSION_MAJOR == 3) && (PETSC_VERSION_MINOR > 4 || PETSC_VERSION_MAJOR > 3) + KSPSetOperators(_solver, _A.getRawMatrix(), _A.getRawMatrix()); +#else KSPSetOperators(_solver, _A.getRawMatrix(), _A.getRawMatrix(), DIFFERENT_NONZERO_PATTERN); +#endif KSPSolve(_solver, b.getData(), x.getData());