:orphan:
# TSSetFunctionDomainError
Set a function that tests if the current state vector is valid 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSSetFunctionDomainError(TS ts, PetscErrorCode (*func)(TS, PetscReal, Vec, PetscBool *))
```

## Input Parameters

- ***ts -*** the `TS` context
- ***func -*** function called within `TSFunctionDomainError()`



## Calling sequence of `func`
```none
PetscErrorCode func(TS ts, PetscReal time, Vec state, PetscBool reject)
```

- ***ts -*** the TS context
- ***time -*** the current time (of the stage)
- ***state -*** the state to check if it is valid
- ***reject -*** (output parameter) `PETSC_FALSE` if the state is acceptable, `PETSC_TRUE` if not acceptable





## Notes
If an implicit ODE solver is being used then, in addition to providing this routine, the
user's code should call `SNESSetFunctionDomainError()` when domain errors occur during
function evaluations where the functions are provided by `TSSetIFunction()` or `TSSetRHSFunction()`.
Use `TSGetSNES()` to obtain the `SNES` object


## Developer Note
The naming of this function is inconsistent with the `SNESSetFunctionDomainError()`
since one takes a function pointer and the other does not.


## See Also
 [](ch_ts), `TSAdaptCheckStage()`, `TSFunctionDomainError()`, `SNESSetFunctionDomainError()`, `TSGetSNES()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/interface/ts.c.html#TSSetFunctionDomainError">src/ts/interface/ts.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex42.c.html">src/ts/tutorials/ex42.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ts/interface/ts.c)


[Index of all TS routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
