MatShellSetContextDestroy — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# MatShellSetContextDestroy

sets the destroy function for a `MATSHELL` shell matrix context

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatShellSetContextDestroy(Mat mat, PetscErrorCode (*f)(void *))

Logically Collective

## Input Parameters

- mat - the shell matrix

- f - the context destroy function

## Note

If the `MatShell` is never duplicated, the behavior of this function is equivalent to `MatShellSetOperation`(`Mat`,`MATOP_DESTROY`,f). However, `MatShellSetContextDestroy()` ensures proper reference counting for the user provided context data in the case that the `MATSHELL` is duplicated.

## See Also

Matrices, `Mat`, `MATSHELL`, `MatCreateShell()`, `MatShellSetContext()`

## Level

advanced

## Location

src/mat/impls/shell/shell.c

## Implementations

MatShellSetContextDestroy_Shell(Mat mat, PetscErrorCode (*f)() in src/mat/impls/shell/shell.c
MatShellSetContextDestroy_Immutable(Mat mat, PetscErrorCode (*f)() in src/mat/impls/shell/shell.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages