:orphan:
# MatShellGetOperation
Gets a matrix function for a `MATSHELL` shell matrix. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatShellGetOperation(Mat mat, MatOperation op, void (**g)(void))
```
Not Collective


## Input Parameters

- ***mat -*** the `MATSHELL` shell matrix
- ***op -*** the name of the operation



## Output Parameter

- ***g -*** the function that provides the operation.





## Notes
See the file include/petscmat.h for a complete list of matrix
operations, which all have the form MATOP_<OPERATION>, where
<OPERATION> is the name (in all capital letters) of the
user interface routine (e.g., `MatMult()` -> `MATOP_MULT`).

All user-provided functions have the same calling
sequence as the usual matrix interface routines, since they
are intended to be accessed via the usual matrix interface
routines, e.g.,
```none
MatMult(Mat, Vec, Vec) -> usermult(Mat, Vec, Vec)
```

Within each user-defined routine, the user should call
`MatShellGetContext()` to obtain the user-defined context that was
set by `MatCreateShell()`.


## See Also
 [](ch_matrices), `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellGetContext()`, `MatShellSetOperation()`, `MatShellSetContext()`

## Level
advanced

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

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/shell/shell.c.html#MatShellGetOperation_Shell(Mat mat, MatOperation op, void (**f)">MatShellGetOperation_Shell(Mat mat, MatOperation op, void (**f) 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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
