#include "petscsnes.h" #include "petscdmshell.h" #include "petscsys.h" PetscErrorCode SNESGetIterationNumber(SNES snes,PetscInt* iter)Not Collective
This is useful for using lagged Jacobians (where one does not recompute the Jacobian at each SNES iteration). For example, the code
ierr = SNESGetIterationNumber(snes,&it); if (!(it % 2)) { [compute Jacobian here] }can be used in your ComputeJacobian() function to cause the Jacobian to be recomputed every second SNES iteration.
Level:intermediate
Location:src/snes/interface/snes.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages