# SNESVISetComputeVariableBounds
Sets a function that is called to compute the bounds on variable for (differential) variable inequalities. 
## Synopsis
```
#include "petscsnes.h" 
PetscErrorCode SNESVISetComputeVariableBounds(SNES snes, PetscErrorCode (*compute)(SNES, Vec, Vec))
```

## Input parameter

- ***snes -*** the `SNES` context
- ***compute -*** function that computes the bounds



## Calling Sequence of function
PetscErrorCode compute(SNES snes,Vec lower,Vec higher, void *ctx)


- ***snes -*** the `SNES` context
- ***lower -*** vector to hold lower bounds
- ***higher -*** vector to hold upper bounds





## Notes
Problems with bound constraints can be solved with the reduced space, `SNESVINEWTONRSLS`, and semi-smooth `SNESVINEWTONSSLS` solvers.

For entries with no bounds you can set `PETSC_NINFINITY` or `PETSC_INFINITY`

You may use `SNESVISetVariableBounds()` to provide the bounds once if they will never change

If you have associated a `DM` with the `SNES` and provided a function to the `DM` via `DMSetVariableBounds()` that will be used automatically
to provide the bounds and you need not use this function.


## See Also
 [](sec_vi), `SNES`, `SNESVISetVariableBounds()`, `DMSetVariableBounds()`, `SNESSetFunctionDomainError()`, `SNESSetJacobianDomainError()`, `SNESVINEWTONRSLS`, `SNESVINEWTONSSLS`,
'SNESSetType()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/vi/vi.c.html#SNESVISetComputeVariableBounds">src/snes/impls/vi/vi.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex58.c.html">src/snes/tutorials/ex58.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex9.c.html">src/snes/tutorials/ex9.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/vi/vi.c.html#SNESVISetComputeVariableBounds_VI">SNESVISetComputeVariableBounds_VI in src/snes/impls/vi/vi.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/impls/vi/vi.c)


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