SNESGetIterationNumber

Gets the number of nonlinear iterations completed at this time.

Synopsis

#include "petscsnes.h"  
int SNESGetIterationNumber(SNES snes,int* iter)
Not Collective

Input Parameter

snes -SNES context

Output Parameter

iter -iteration number

Notes

For example, during the computation of iteration 2 this would return 1.

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.

Keywords

SNES, nonlinear, get, iteration, number

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

Examples

src/snes/examples/tutorials/ex3.c.html
src/snes/examples/tutorials/ex18.c.html
src/snes/examples/tutorials/ex19.c.html
src/snes/examples/tutorials/ex20.c.html
src/snes/examples/tutorials/ex25.c.html
src/snes/examples/tutorials/ex29.c.html