Commit e0e3bce0 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#729 ThirdParty/Snes: avoid call to KSPSetUp() when a shall matrix is involved.

parent 5b622ec6
......@@ -278,8 +278,6 @@ namespace HappyHeart
} // namespace HappyHeart
# include "ThirdParty/Wrappers/Petsc/Solver/Snes.hxx"
#endif // HAPPY_HEART_x_THIRD_PARTY_x_WRAPPERS_x_PETSC_x_SOLVER_x_SNES_HPP_
......@@ -88,9 +88,14 @@ namespace HappyHeart
// Petsc documentation quote: 'The explicit call of this routine enables the separate monitoring of any
// computations performed during the set up phase, such as incomplete factorization for the ILU
// preconditioner.'
error_code = ::KSPSetUp(ksp);
if (error_code)
throw ExceptionNS::Exception(error_code, "KSPSetUp", invoking_file, invoking_line);
// However, this triggers a Petsc error if the matrix is a shell one, hence the test below that is
// false for such a matrix!
if (std::is_base_of<Wrappers::Petsc::Matrix, MatrixT>())
{
error_code = ::KSPSetUp(ksp);
if (error_code)
throw ExceptionNS::Exception(error_code, "KSPSetUp", invoking_file, invoking_line);
}
// It seems I need this step to ensure Petsc doesn't do again the preconditioning; this is weird
// because Petsc documentation doesn't mention it at all (this function is there in cases we want
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment