16 #include <deal.II/base/config.h>
18 #include <deal.II/lac/exceptions.h>
20 #ifdef DEAL_II_WITH_PETSC
21 # include <petscconf.h>
22 # include <petscsys.h>
23 #endif // DEAL_II_WITH_PETSC
25 DEAL_II_NAMESPACE_OPEN
27 namespace LACExceptions
29 ExcPETScError::ExcPETScError(
const int error_code)
30 : error_code(error_code)
34 ExcPETScError::print_info(std::ostream &out)
const
36 out <<
"deal.II encountered an error while calling a PETSc function."
38 #ifdef DEAL_II_WITH_PETSC
41 const char * petsc_message;
42 const PetscErrorCode ierr = PetscErrorMessage(error_code,
45 if (ierr == 0 && petsc_message !=
nullptr)
47 out <<
"The description of the error provided by PETSc is \""
48 << petsc_message <<
"\"." << std::endl;
53 <<
"PETSc was not able to determine a description for this particular error code."
56 #endif // DEAL_II_WITH_PETSC
57 out <<
"The numerical value of the original error code is " << error_code
62 DEAL_II_NAMESPACE_CLOSE