Skip to main content
`Ctrl`+`K`

# petsc4py.PETSc.SNESLineSearch

class petsc4py.PETSc.SNESLineSearch

  Bases: `Object`

  Linesearch object used by SNES solvers.

  See also

  `SNESLineSearch`

  Enumerations

  `Type` | SNES linesearch type.

  Methods Summary

  `create`([comm]) | Create a new linesearch object.
  `destroy`() | Destroy the linesearch object.
  `getOrder`() | Return the order of the linesearch.
  `getTolerances`() | Return the tolerance parameters used in the linesearch.
  `getType`() | Return the type of the linesearch.
  `setFromOptions`() | Configure the linesearch from the options database.
  `setOrder`(order) | Set the order of the linesearch.
  `setTolerances`([minstep, maxstep, rtol, ...]) | Set the tolerance parameters used in the linesearch.
  `setType`(ls_type) | Set the type of the linesearch.
  `view`([viewer]) | View the linesearch object.

  Methods Documentation

  create(comm=None)

    Create a new linesearch object.

    Collective.

    Parameters:

      comm (`Comm`, optional) – MPI communicator, defaults to `Sys.getDefaultComm`.

    Return type:

      Self

    See also

    `destroy`, `SNESLineSearchCreate`

    Source code at petsc4py/PETSc/SNES.pyx:2751

  destroy()

    Destroy the linesearch object.

    Collective.

    See also

    `SNESLineSearchDestroy`

    Source code at petsc4py/PETSc/SNES.pyx:2925

    Return type:

      Self

  getOrder()

    Return the order of the linesearch.

    Not collective.

    See also

    `setOrder`, `SNESLineSearchGetOrder`

    Source code at petsc4py/PETSc/SNES.pyx:2898

    Return type:

      int

  getTolerances()

    Return the tolerance parameters used in the linesearch.

    Not collective.

    Returns:

      - minstep (`float`) – Minimum step length.

      - maxstep (`float`, optional) – Maximum step length.

      - rtol (`float`) – Relative tolerance.

      - atol (`float`) – Absolute tolerance.

      - ltol (`float`) – Lambda tolerance.

      - max_its (`int`) – Maximum number of iterations for the linesearch.

    Return type:

      tuple[float, float, float, float, float, int]

    See also

    `setTolerances`, `SNESLineSearchGetTolerances`

    Source code at petsc4py/PETSc/SNES.pyx:2831

  getType()

    Return the type of the linesearch.

    Not collective.

    See also

    `setType`, `SNESLineSearchGetType`

    Source code at petsc4py/PETSc/SNES.pyx:2803

    Return type:

      str

  setFromOptions()

    Configure the linesearch from the options database.

    Collective.

    See also

    `SNESLineSearchSetFromOptions`

    Source code at petsc4py/PETSc/SNES.pyx:2772

    Return type:

      None

  setOrder(order)

    Set the order of the linesearch.

    Logically collective.

    See also

    `getOrder`, `SNESLineSearchSetOrder`

    Source code at petsc4py/PETSc/SNES.pyx:2912

    Parameters:

      order (int)

    Return type:

      None

  setTolerances(minstep=None, maxstep=None, rtol=None, atol=None, ltol=None, max_its=None)

    Set the tolerance parameters used in the linesearch.

    Logically collective.

    Parameters:

      - minstep (`float`) – Minimum step length.

      - maxstep (`float`, optional) – Maximum step length.

      - rtol (`float`, optional) – Relative tolerance.

      - atol (`float`, optional) – Absolute tolerance.

      - ltol (`float`, optional) – Lambda tolerance.

      - max_its (`int`, optional) – Maximum number of iterations for the linesearch.

    Return type:

      None

    See also

    `getTolerances`, `SNESLineSearchSetTolerances`

    Source code at petsc4py/PETSc/SNES.pyx:2860

  setType(ls_type)

    Set the type of the linesearch.

    Logically collective.

    See also

    `getType`, `SNESLineSearchSetType`

    Source code at petsc4py/PETSc/SNES.pyx:2817

    Parameters:

      ls_type (Type | str)

    Return type:

      None

  view(viewer=None)

    View the linesearch object.

    Collective.

    Parameters:

      viewer (Viewer | None) – A `Viewer` instance or `None` for the default viewer.

    Return type:

      None

    See also

    `SNESLineSearchView`

    Source code at petsc4py/PETSc/SNES.pyx:2784

  __init__()
  classmethod __new__(*args, **kwargs)