Skip to main content
`Ctrl`+`K`

# DMMonitorSetFromOptions

Sets a monitor function and viewer appropriate for the type indicated by the user

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMMonitorSetFromOptions(DM dm, const char name[], const char help[], const char manual[], PetscErrorCode (*monitor)(DM dm, PetscCtx ctx), PetscErrorCode (*monitorsetup)(DM dm, PetscViewerAndFormat *vf), PetscBool *flg)

Collective

## Input Parameters

- dm - `DM` object you wish to monitor

- name - the monitor type one is seeking

- help - message indicating what monitoring is done

- manual - manual page for the monitor

- monitor - the monitor function, this must use a `PetscViewerFormat` as its context

- monitorsetup - a function that is called once ONLY if the user selected this monitor that may set additional features of the `DM` or `PetscViewer` objects

## Output Parameter

- flg - Flag set if the monitor was created

## Calling sequence of `monitor`

- dm - the `DM` to be monitored

- ctx - monitor context

## Calling sequence of `monitorsetup`

- dm - the `DM` to be monitored

- vf - the `PetscViewer` and format to be used by the monitor

## See Also

DM Basics, `DM`, `PetscOptionsCreateViewer()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, `PetscOptionsFList()`, `PetscOptionsEList()`, `DMMonitor()`, `DMMonitorSet()`

## Level

developer

## Location

src/dm/interface/dm.c

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