20#ifdef DEAL_II_WITH_PETSC
22# include <petsc/private/pcimpl.h>
23# include <petsc/private/petscimpl.h>
24# include <petsc/private/snesimpl.h>
25# include <petsc/private/tsimpl.h>
29# define AssertPETSc(code) \
32 PetscErrorCode ierr = (code); \
33 AssertThrow(ierr == 0, ExcPETScError(ierr)); \
42#ifdef DEAL_II_WITH_PETSC
50 AssertPETSc(PetscObjectStateIncrease(
reinterpret_cast<PetscObject
>(v)));
56 AssertPETSc(PetscObjectStateIncrease(
reinterpret_cast<PetscObject
>(A)));
62# if DEAL_II_PETSC_VERSION_GTE(3, 14, 0)
63 return PCSetFailedReason(pc, reason);
65 pc->failedreason = reason;
73# if DEAL_II_PETSC_VERSION_GTE(3, 11, 0)
74 snes->jacobiandomainerror = PETSC_FALSE;
76# if DEAL_II_PETSC_VERSION_GTE(3, 25, 0)
77 snes->functiondomainerror = PETSC_FALSE;
78 snes->objectivedomainerror = PETSC_FALSE;
80 snes->domainerror = PETSC_FALSE;
87# if DEAL_II_PETSC_VERSION_GTE(3, 11, 0)
88 snes->jacobiandomainerror = PETSC_TRUE;
92 snes->reason = SNES_DIVERGED_FUNCTION_DOMAIN;
99# if DEAL_II_PETSC_VERSION_LT(3, 13, 1)
100 snes->mf = mf ? PETSC_TRUE : PETSC_FALSE;
101 snes->mf_operator = mf_operator ? PETSC_TRUE : PETSC_FALSE;
104 mf_operator ? PETSC_TRUE : PETSC_FALSE,
105 mf ? PETSC_TRUE : PETSC_FALSE));
120# if DEAL_II_PETSC_VERSION_LT(3, 8, 0)
122 ts->max_steps = maxsteps;
131# if DEAL_II_PETSC_VERSION_LT(3, 8, 0)
132 if (maxtime != PETSC_DEFAULT)
133 ts->max_time = maxtime;
149# if DEAL_II_PETSC_VERSION_LT(3, 8, 0)
154 return static_cast<unsigned int>(step);
160 return ts->snes ? true :
false;
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
void set_use_matrix_free(SNES snes, const bool mf_operator, const bool mf)
PetscErrorCode pc_set_failed_reason(PC pc, PCFailedReason reason)
void ts_set_max_time(TS ts, const PetscReal maxtime)
void snes_reset_domain_flags(SNES snes)
void snes_set_jacobian_domain_error(SNES snes)
void ts_set_max_steps(TS ts, const PetscInt maxsteps)
void petsc_increment_state_counter(Vec v)
unsigned int ts_get_step_number(TS ts)
#define AssertPETSc(code)