Skip to main content
`Ctrl`+`K`

# TSAdjointMonitorSetFromOptions

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

## Synopsis

    #include <petscts.h>
    PetscErrorCode TSAdjointMonitorSetFromOptions(TS ts, const char name[], const char help[], const char manual[], PetscErrorCode (*monitor)(TS ts, PetscInt step, PetscReal time, Vec u, PetscInt numcost, Vec *lambda, Vec *mu, PetscViewerAndFormat *vf), PetscErrorCode (*monitorsetup)(TS ts, PetscViewerAndFormat *vf))

Collective

## Input Parameters

- ts - `TS` 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, its context must be a `PetscViewerAndFormat`

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

## Calling sequence of `monitor`

- ts - the `TS` context

- step - iteration number (after the final time step the monitor routine is called with a step of -1, this is at the final time which may have been interpolated to)

- time - current time

- u - current iterate

- numcost - number of cost functions

- lambda - sensitivities to initial conditions

- mu - sensitivities to parameters

- vf - the `PetscViewer` and format the monitor is using

## Calling sequence of `monitorsetup`

- ts - the `TS` object being monitored

- vf - the `PetscViewer` and format the monitor is using

## See Also

TS: Scalable ODE and DAE Solvers, `PetscOptionsCreateViewer()`, `PetscOptionsGetReal()`, `PetscOptionsHasName()`, `PetscOptionsGetString()`, `PetscOptionsGetIntArray()`, `PetscOptionsGetRealArray()`, `PetscOptionsBool()`, `PetscOptionsInt()`, `PetscOptionsString()`, `PetscOptionsReal()`, `PetscOptionsName()`, `PetscOptionsBegin()`, `PetscOptionsEnd()`, `PetscOptionsHeadBegin()`, `PetscOptionsStringArray()`, `PetscOptionsRealArray()`, `PetscOptionsScalar()`, `PetscOptionsBoolGroupBegin()`, `PetscOptionsBoolGroup()`, `PetscOptionsBoolGroupEnd()`, `PetscOptionsFList()`, `PetscOptionsEList()`, `PetscViewerAndFormat`

## Level

developer

## Location

src/ts/interface/sensitivity/tssen.c

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