# 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
To use this from Fortran 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
 `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellGetOperation()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/shell/shell.c.html#MatShellSetContext">src/mat/impls/shell/shell.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex6f.F90.html">src/mat/tutorials/ex6f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex12.c.html">src/snes/tutorials/ex12.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex36.c.html">src/snes/tutorials/ex36.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex50.c.html">src/ts/tutorials/ex50.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/shell/shell.c.html#MatShellSetContext_Shell">MatShellSetContext_Shell in src/mat/impls/shell/shell.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
