Skip to main content
`Ctrl`+`K`

# PetscObjectAddOptionsHandler

Adds an additional function to check for options when `XXXSetFromOptions()` is called.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscObjectAddOptionsHandler(PetscObject obj, PetscErrorCode (*handle)(PetscObject obj, PetscOptionItems PetscOptionsObject, PetscCtx ctx), PetscErrorCode (*destroy)(PetscObject obj, PetscCtxRt ctx), PetscCtx ctx)

Not Collective

## Input Parameters

- obj - the PETSc object

- handle - function that checks for options

- destroy - function to destroy `ctx` if provided

- ctx - optional context for check function

## Calling sequence of `handle`

- obj - the PETSc object

- PetscOptionsObject - the `PetscOptionItems` object

- ctx - optional context for `handle`

## Calling sequence of `destroy`

- obj - the PETSc object

- ctx - optional context for `handle`

## See Also

`KSPSetFromOptions()`, `PCSetFromOptions()`, `SNESSetFromOptions()`, `PetscObjectProcessOptionsHandlers()`, `PetscObjectDestroyOptionsHandlers()`, `PetscObject`

## Level

developer

## Location

src/sys/objects/inherit.c

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