MatRegister#
Adds a new matrix type implementation that is usable as a Mat
in PETSc
Synopsis#
#include "petscmat.h"
PetscErrorCode MatRegister(const char sname[], PetscErrorCode (*function)(Mat))
Not Collective, No Fortran Support
Input Parameters#
sname - name of a new user-defined matrix type
function - routine to create method context
Note#
MatRegister()
may be called multiple times to add several user-defined solvers.
A simpler alternative to using MatRegister()
for an application specific matrix format is to use MatCreateShell()
, which
generates a Mat
of MatType
MATSHELL
. One can then use MatShellSetContext()
and MatShellSetOperation()
to provide
the data structures and routines customized for their matrix format.
Example Usage#
MatRegister("my_mat", MyMatCreate);
Then, your solver can be chosen with the procedural interface via MatSetType(Mat, "my_mat")
or at runtime via the option
-mat_type my_mat
See Also#
Matrices, Mat
, MatType
, MatSetType()
, MatRegisterAll()
Level#
advanced
Location#
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages