petsc-main 2021-04-20
Report Typos and Errors


Registers a name that can be used for either a sequential or its corresponding parallel matrix type. MatSetType() and -mat_type will automatically use the sequential or parallel version based on the size of the MPI communicator associated with the matrix.


#include "petscmat.h" 
PetscErrorCode  MatRegisterRootName(const char rname[],const char sname[],const char mname[])

Input Parameters

rname - the rootname, for example, MATAIJ
sname - the name of the sequential matrix type, for example, MATSEQAIJ
mname - the name of the parallel matrix type, for example, MATMPIAIJ

Notes: The matrix rootname should not be confused with the base type of the function PetscObjectBaseTypeCompare()

Developer Notes: PETSc vectors have a similar rootname that indicates PETSc should automatically select the appropriate VecType based on the size of the communicator but it is implemented by simply having additional VecCreate_RootName() registerer routines that dispatch to the appropriate creation routine. Why have two different ways of implementing the same functionality for different types of objects? It is confusing.

See Also





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