DMAdaptorMonitorSet — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# DMAdaptorMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the error etc.

## Synopsis

    #include "petscdmadaptor.h"
    PetscErrorCode DMAdaptorMonitorSet(DMAdaptor adaptor, PetscErrorCode (*monitor)(DMAdaptor adaptor, PetscInt it, DM odm, DM adm, PetscInt Nf, PetscReal enorms[], Vec error, void *ctx), void *ctx, PetscCtxDestroyFn *monitordestroy)

Logically Collective

## Input Parameters

- adaptor - the `DMAdaptor`

- monitor - pointer to function (if this is `NULL`, it turns off monitoring

- ctx - [optional] context for private data for the monitor routine (use `NULL` if no context is needed)

- monitordestroy - [optional] routine that frees monitor context (may be `NULL`), see `PetscCtxDestroyFn` for its calling sequence

## Calling sequence of `monitor`

- adaptor - the `DMAdaptor`

- it - iteration number

- odm - the original `DM`

- adm - the adapted `DM`

- Nf - number of fields

- enorms - (estimated) 2-norm of the error for each field

- error - `Vec` of cellwise errors

- ctx - optional monitoring context, as set by `DMAdaptorMonitorSet()`

## Options Database Keys

- -adaptor_monitor_size - sets `DMAdaptorMonitorSize()`

- -adaptor_monitor_error - sets `DMAdaptorMonitorError()`

- -adaptor_monitor_error draw - sets `DMAdaptorMonitorErrorDraw()` and plots error

- -adaptor_monitor_error draw::draw_lg - sets `DMAdaptorMonitorErrorDrawLG()` and plots error

- -dm_adaptor_monitor_cancel - Cancels all monitors that have been hardwired into a code by calls to `DMAdaptorMonitorSet()`, but does not cancel those set via the options database.

## See Also

SNES: Nonlinear Solvers, `DMAdaptorMonitorError()`, `DMAdaptor`, `PetscCtxDestroyFn`

## Level

beginner

## Location

src/snes/utils/dm/dmadapt.c

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