:orphan: # SNESRegister Adds a method to the nonlinear solver package. ## Synopsis ``` #include "petscsnes.h" PetscErrorCode SNESRegister(const char sname[], PetscErrorCode (*function)(SNES)) ``` Not Collective ## Input Parameters - ***sname -*** name of a new user-defined solver - ***function -*** routine to create method context ## Note `SNESRegister()` may be called multiple times to add several user-defined solvers. ## Sample usage ```none SNESRegister("my_solver", MySolverCreate); ``` Then, your solver can be chosen with the procedural interface via ```none SNESSetType(snes, "my_solver") ``` or at runtime via the option ```none -snes_type my_solver ``` ## See Also [](ch_snes), `SNESRegisterAll()`, `SNESRegisterDestroy()` ## Level advanced ## Location src/snes/interface/snes.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c) [Index of all SNES routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)