Skip to main content
`Ctrl`+`K`

# TSGetApplicationContext

Gets the user-defined context for the timestepper that was set with `TSSetApplicationContext()`

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSGetApplicationContext(TS ts, void *ctx)

Not Collective

## Input Parameter

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

## Output Parameter

- ctx - a pointer to the user context

## Fortran Notes

This only works when the context is a Fortran derived type (it cannot be a `PetscObject`) and you must write a Fortran interface definition for this function that tells the Fortran compiler the derived data type that is returned as the `ctx` argument. For example,

      Interface TSGetApplicationContext
        Subroutine TSGetApplicationContext(ts,ctx,ierr)
      #include <petsc/finclude/petscts.h>
          use petscts
          TS ts
          type(tUsertype), pointer :: ctx
          PetscErrorCode ierr
        End Subroutine
      End Interface TSGetApplicationContext

The prototype for `ctx` must be

      type(tUsertype), pointer :: ctx

## See Also

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

## Level

intermediate

## Location

src/ts/interface/ts.c

## Examples

src/ts/tutorials/ex30.c
src/ts/tutorials/ex77.c
src/ts/tutorials/ex48.c
src/ts/tutorials/ex42.c

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