# TSSetResize#

Sets the resize callbacks.

## Synopsis#

```
#include "petscts.h"
PetscErrorCode TSSetResize(TS ts, PetscBool rollback, PetscErrorCode (*setup)(TS ts, PetscInt step, PetscReal time, Vec state, PetscBool *resize, void *ctx), PetscErrorCode (*transfer)(TS ts, PetscInt nv, Vec vecsin[], Vec vecsout[], void *ctx), void *ctx)
```

Logically Collective

## Input Parameters#

## Calling sequence of `setup`

#

the**ts -**`TS`

contextthe current step**step -**the current time**time -**the current vector of state**state -**(output parameter)**resize -**`PETSC_TRUE`

if need resizing,`PETSC_FALSE`

otherwiseuser defined context**ctx -**

## Calling sequence of `transfer`

#

the**ts -**`TS`

contextthe number of vectors to be transferred**nv -**array of vectors to be transferred**vecsin -**array of transferred vectors**vecsout -**user defined context**ctx -**

## Notes#

The `setup`

function is called inside `TSSolve()`

after `TSEventHandler()`

or after `TSPostStep()`

depending on the `rollback`

value: if `rollback`

is true, then these callbacks behave as error indicators
and will flag the need to remesh and restart the current step. Otherwise, they will simply flag the solver
that the size of the discrete problem has changed.
In both cases, the solver will collect the needed vectors that will be
transferred from the old to the new sizes using the `transfer`

callback. These vectors will include the
current solution vector, and other vectors needed by the specific solver used.
For example, `TSBDF`

uses previous solutions vectors to solve for the next time step.
Other application specific objects associated with the solver, i.e. Jacobian matrices and `DM`

,
will be automatically reset if the sizes are changed and they must be specified again by the user
inside the `transfer`

function.
The input and output arrays passed to `transfer`

are allocated by PETSc.
Vectors in `vecsout`

must be created by the user.
Ownership of vectors in `vecsout`

is transferred to PETSc.

## See Also#

TS: Scalable ODE and DAE Solvers, `TS`

, `TSSetDM()`

, `TSSetIJacobian()`

, `TSSetRHSJacobian()`

## Level#

advanced

## Location#

## Examples#

src/ts/tutorials/ex45.c

src/ts/tutorials/ex11.c

src/ts/tutorials/ex30.c

Index of all TS routines

Table of Contents for all manual pages

Index of all manual pages