Skip to main content
`Ctrl`+`K`

# SNESLineSearchSetType

Sets the `SNESLinesearchType` of a `SNESLineSearch` object to indicate the line search algorithm that should be used by a given `SNES` solver

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESLineSearchSetType(SNESLineSearch linesearch, SNESLineSearchType type)

Logically Collective

## Input Parameters

- linesearch - the line search context

- type - The type of line search to be used, see `SNESLineSearchType`

## Options Database Key

- -snes_linesearch_type <type> - basic (or equivalently none), bt, l2, cp, nleqerr, shell

## Note

The `SNESLineSearch` object is generally obtained with `SNESGetLineSearch()`

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESLineSearch`, `SNESLineSearchType`, `SNESLineSearchCreate()`, `SNESLineSearchSetFromOptions()`, `SNESLineSearchGetType()`, `SNESGetLineSearch()`

## Level

intermediate

## Location

src/snes/linesearch/interface/linesearch.c

## Examples

src/ts/tutorials/ex22f.F90
src/snes/tutorials/ex1f.F90
src/ts/utils/dmplexlandau/tutorials/ex1f90.F90
src/ts/tutorials/ex22.c

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