20 #ifndef dealii__petsc_compatibility_h
21 #define dealii__petsc_compatibility_h
23 #include <deal.II/base/config.h>
24 #include <deal.II/lac/exceptions.h>
26 #ifdef DEAL_II_WITH_PETSC
28 #include <petscconf.h>
35 DEAL_II_NAMESPACE_OPEN
37 namespace PETScWrappers
39 #if DEAL_II_PETSC_VERSION_LT(3,2,0)
40 typedef PetscTruth PetscBooleanType;
42 typedef PetscBool PetscBooleanType;
51 const std::string &value)
53 #if DEAL_II_PETSC_VERSION_LT(3, 7, 0)
54 const PetscErrorCode ierr = PetscOptionsSetValue (name.c_str (), value.c_str ());
56 const PetscErrorCode ierr = PetscOptionsSetValue (NULL, name.c_str (), value.c_str ());
76 #if DEAL_II_PETSC_VERSION_LT(3, 2, 0)
77 return MatDestroy (matrix);
79 return MatDestroy (&matrix);
98 #if DEAL_II_PETSC_VERSION_LT(3, 2, 0)
99 return KSPDestroy (krylov_solver);
101 return KSPDestroy (&krylov_solver);
115 const MatOption option_name,
116 const PetscBooleanType option_value = PETSC_FALSE)
118 #if DEAL_II_PETSC_VERSION_LT(3,0,0)
119 const PetscErrorCode ierr = MatSetOption (matrix, option_name);
121 const PetscErrorCode ierr = MatSetOption (matrix, option_name, option_value);
135 #if DEAL_II_PETSC_VERSION_LT(3, 0, 0)
159 #if DEAL_II_PETSC_VERSION_LT(3, 1, 0)
167 DEAL_II_NAMESPACE_CLOSE
169 #endif // DEAL_II_WITH_PETSC
170 #endif // dealii__petsc_compatibility_h
PetscErrorCode destroy_matrix(Mat &matrix)
#define AssertThrow(cond, exc)
void set_option_value(const std::string &name, const std::string &value)
void set_keep_zero_rows(Mat &matrix)
PetscErrorCode destroy_krylov_solver(KSP &krylov_solver)
void set_matrix_option(Mat &matrix, const MatOption option_name, const PetscBooleanType option_value=PETSC_FALSE)
void close_matrix(Mat &matrix)