:orphan:
# MatShellSetContext
sets the context for a `MATSHELL` shell matrix
## Synopsis
```
#include "petscmat.h"
PetscErrorCode MatShellSetContext(Mat mat, void *ctx)
```
Logically Collective
## Input Parameters
- ***mat -*** the `MATSHELL` shell matrix
- ***ctx -*** the context
## Fortran Note
You must write a Fortran interface definition for this
function that tells Fortran the Fortran derived data type that you are passing in as the `ctx` argument.
## See Also
[](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`
## Level
advanced
## Location
src/mat/impls/shell/shell.c
## Examples
src/mat/tutorials/ex6f.F90
src/snes/tutorials/ex12.c
src/snes/tutorials/ex36.c
src/ts/tutorials/ex50.c
## Implementations
MatShellSetContext_Shell in src/mat/impls/shell/shell.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/shell/shell.c)
[Index of all Mat routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)