#include "petscdm.h" PetscErrorCode DMCreateMatrix(DM dm,Mat *mat)Collective on DM
Notes: This properly preallocates the number of nonzeros in the sparse matrix so you do not need to do it yourself.
By default it also sets the nonzero structure and puts in the zero entries. To prevent setting the nonzero pattern call DMDASetMatPreallocateOnly()
For structured grid problems, when you call MatView() on this matrix it is displayed using the global natural ordering, NOT in the ordering used internally by PETSc.
For structured grid problems, in general it is easiest to use MatSetValuesStencil() or MatSetValuesLocal() to put values into the matrix because MatSetValues() requires the indices for the global numbering for DMDAs which is complicated.
Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages