DAGetMatrix

Creates a matrix with the correct parallel layout and nonzero structure required for computing the Jacobian on a function defined using the stencil set in the DA.

Synopsis

#include "petscda.h"     
#include "petscmat.h"    
PetscErrorCode PETSCDM_DLLEXPORT DAGetMatrix(DA da, MatType mtype,Mat *J)
Collective on DA

Input Parameter

da - the distributed array
mtype - Supported types are MATSEQAIJ, MATMPIAIJ, MATSEQBAIJ, MATMPIBAIJ, MATSEQSBAIJ, MATMPISBAIJ, or any type which inherits from one of these (such as MATAIJ, MATLUSOL, etc.).

Output Parameters

J -matrix with the correct nonzero structure (obviously without the correct Jacobian values)

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 DASetMatPreallocateOnly()

See Also

ISColoringView(), ISColoringGetIS(), MatFDColoringCreate(), DASetBlockFills(), DASetMatPreallocateOnly()

Level:advanced
Location:
src/dm/da/utils/fdda.c
Index of all DA routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/snes/examples/tutorials/ex5.c.html
src/snes/examples/tutorials/ex14.c.html
src/snes/examples/tutorials/ex24.c.html
src/snes/examples/tutorials/ex26.c.html
src/snes/examples/tutorials/ex5f.F.html
src/snes/examples/tutorials/ex5f90.F.html
src/ts/examples/tutorials/ex7.c.html