:orphan: # KSPGetConvergenceTest Gets the function to be used to determine convergence. ## Synopsis ``` #include "petscksp.h" #include "petscmat.h" PetscErrorCode KSPGetConvergenceTest(KSP ksp, PetscErrorCode (**converge)(KSP, PetscInt, PetscReal, KSPConvergedReason *, void *), void **cctx, PetscErrorCode (**destroy)(void *)) ``` Logically Collective ## Input Parameter - ***ksp -*** iterative context obtained from `KSPCreate()` ## Output Parameters - ***converge -*** pointer to convergence test function - ***cctx -*** context for private data for the convergence routine (may be null) - ***destroy -*** a routine for destroying the context (may be null) ## Calling sequence of `converge` ```none PetscErrorCode converge(KSP ksp, PetscInt it, PetscReal rnorm, KSPConvergedReason *reason, void *mctx) ``` - ***ksp -*** iterative context obtained from `KSPCreate()` - ***it -*** iteration number - ***rnorm -*** (estimated) 2-norm of (preconditioned) residual - ***reason -*** the reason why it has converged or diverged - ***cctx -*** optional convergence context, as set by `KSPSetConvergenceTest()` ## Calling Sequence of `destroy` ```none PetscErrorCode destroy(void *cctx) ``` ## See Also [](ch_ksp), `KSP`, `KSPConvergedDefault()`, `KSPGetConvergenceContext()`, `KSPSetTolerances()`, `KSP`, `KSPSetConvergenceTest()`, `KSPGetAndClearConvergenceTest()` ## Level advanced ## Location src/ksp/ksp/interface/itfunc.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/interface/itfunc.c) [Index of all KSP routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)