Skip to main content
`Ctrl`+`K`

# TaoSetApplicationContext

Sets the optional user-defined context for a `Tao` solver that can be accessed later, for example in the `Tao` callback functions with `TaoGetApplicationContext()`

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoSetApplicationContext(Tao tao, PetscCtx ctx)

Logically Collective

## Input Parameters

- tao - the `Tao` context

- ctx - the user context

## Fortran Note

This only works when `ctx` is a Fortran derived type (it cannot be a `PetscObject`), we recommend writing a Fortran interface definition for this function that tells the Fortran compiler the derived data type that is passed in as the `ctx` argument. See `TaoGetApplicationContext()` for an example.

## See Also

TAO: Optimization Solvers, `Tao`, `TaoGetApplicationContext()`

## Level

intermediate

## Location

src/tao/interface/taosolver.c

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