Skip to main content
`Ctrl`+`K`

# TSSetPostEvaluate

Sets the general-purpose function called at the end of each step evaluation.

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetPostEvaluate(TS ts, PetscErrorCode (*func)(TS ts))

Logically Collective

## Input Parameters

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

- func - The function

## Calling sequence of `func`

- ts - the `TS` context

## Note

The function set by `TSSetPostEvaluate()` is called after the solution is evaluated, or after the step rollback. Inside the `func` callback, the solution vector can be obtained with `TSGetSolution()`, and modified, if need be. The time step can be obtained with `TSGetTimeStep()`, and the time at the start of the step - via `TSGetTime()`. The potential changes to the solution vector introduced by event handling (`postevent()`) are not relevant for `TSSetPostEvaluate()`, but are relevant for `TSSetPostStep()`, according to the function call scheme in `TSSolve()`, as shown below

      ...
      Step()
      PostEvaluate()
      EventHandling()
      step_rollback ? PostEvaluate() : PostStep()
      ...

where EventHandling() may result in one of the following three outcomes

      (1) | successful step | solution intact
      (2) | successful step | solution modified by `postevent()`
      (3) | step_rollback   | solution rolled back

## See Also

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

## Level

intermediate

## Location

src/ts/interface/ts.c

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