# PCRegister
Adds a method to the preconditioner package. 
## Synopsis
```
#include "petscksp.h" 
PetscErrorCode PCRegister(const char sname[], PetscErrorCode (*function)(PC))
```
Not collective


## Input Parameters

- ***name_solver -*** name of a new user-defined solver
- ***routine_create -*** routine to create method context



## Note
`PCRegister()` may be called multiple times to add several user-defined preconditioners.


## Sample usage
```none
   PCRegister("my_solver", MySolverCreate);
```


Then, your solver can be chosen with the procedural interface via
```none
PCSetType(pc,"my_solver")
```
or at runtime via the option
```none
-pc_type my_solver
```




## See Also
 `PC`, `PCType`, `PCRegisterAll()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/pc/interface/precon.c.html#PCRegister">src/ksp/pc/interface/precon.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex12.c.html">src/ksp/ksp/tutorials/ex12.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/pc/interface/precon.c)


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