Skip to main content
`Ctrl`+`K`

# KSPMonitorRegister

Registers a Krylov subspace solver monitor routine that may be accessed with `KSPMonitorSetFromOptions()`

## Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPMonitorRegister(const char name[], PetscViewerType vtype, PetscViewerFormat format, KSPMonitorRegisterFn *monitor, KSPMonitorRegisterCreateFn *create, KSPMonitorRegisterDestroyFn *destroy)

Not Collective

## Input Parameters

- name - name of a new monitor type

- vtype - A `PetscViewerType` for the output

- format - A `PetscViewerFormat` for the output

- monitor - Monitor routine, see `KSPMonitorRegisterFn`

- create - Creation routine, or `NULL`

- destroy - Destruction routine, or `NULL`

## Notes

`KSPMonitorRegister()` may be called multiple times to add several user-defined monitors.

The calling sequence for the given function matches the calling sequence used by `KSPMonitorFn` functions passed to `KSPMonitorSet()` with the additional requirement that its final argument be a `PetscViewerAndFormat`.

## Example Usage

      KSPMonitorRegister("my_monitor", PETSCVIEWERASCII, PETSC_VIEWER_ASCII_INFO_DETAIL, MyMonitor, NULL, NULL);

Then, your monitor can be chosen with the procedural interface via

      KSPMonitorSetFromOptions(ksp, "-ksp_monitor_my_monitor", "my_monitor", NULL)

or at runtime via the option `-ksp_monitor_my_monitor`

## See Also

KSP: Linear System Solvers, `KSP`, `KSPMonitorSet()`, `KSPMonitorRegisterAll()`, `KSPMonitorSetFromOptions()`

## Level

advanced

## Location

src/ksp/ksp/interface/itcreate.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages