Skip to main content
`Ctrl`+`K`

# TSSetApplicationContext

Sets an optional user-defined context for the timesteppers that may be accessed, for example inside the user provided `TS` callbacks with `TSGetApplicationContext()`

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetApplicationContext(TS ts, PeCtx ctx)

Logically Collective

## Input Parameters

- ts - the `TS` context obtained from `TSCreate()`

- ctx - 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 `TSGetApplicationContext()` for an example.

## See Also

TS: Scalable ODE and DAE Solvers, `TS`, `TSGetApplicationContext()`

## Level

intermediate

## Location

src/ts/interface/ts.c

## Examples

src/ts/tutorials/ex30.c
src/ts/utils/dmplexlandau/tutorials/ex2.c
src/ts/tutorials/ex77.c
src/ts/tutorials/ex42.c
src/ts/utils/dmplexlandau/tutorials/ex1.c
src/ts/tutorials/ex48.c

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