Skip to main content
`Ctrl`+`K`

# DMSNESSetObjective

Sets the objective function minimized by some of the `SNES` linesearch methods into a `DMSNES` object, used instead of the 2-norm of the residual

## Synopsis

    #include "petscsnes.h"
    #include "petscdm.h"
    PetscErrorCode DMSNESSetObjective(DM dm, SNESObjectiveFn *obj, PetscCtx ctx)

Not Collective

## Input Parameters

- dm - `DM` to be used with `SNES`

- obj - objective evaluation routine; see `SNESObjectiveFn` for the calling sequence

- ctx - [optional] user-defined context for private data for the objective evaluation routine (may be `NULL`)

## See Also

SNES: Nonlinear Solvers, `DMSNES`, `DMSNESSetContext()`, `SNESGetObjective()`, `DMSNESSetFunction()`, `SNESObjectiveFn`

## Level

developer

## Location

src/snes/utils/dmsnes.c

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