petsc-3.6.1 2015-08-06
PCSetOperators
Sets the matrix associated with the linear system and a (possibly) different one associated with the preconditioner.
Synopsis
#include "petscksp.h"
PetscErrorCode PCSetOperators(PC pc,Mat Amat,Mat Pmat)
Logically Collective on PC and Mat
Input Parameters
| pc | - the preconditioner context
|
| Amat | - the matrix that defines the linear system
|
| Pmat | - the matrix to be used in constructing the preconditioner, usually the same as Amat.
|
Notes
Passing a NULL for Amat or Pmat removes the matrix that is currently used.
If you wish to replace either Amat or Pmat but leave the other one untouched then
first call KSPGetOperators() to get the one you wish to keep, call PetscObjectReference()
on it and then pass it back in in your call to KSPSetOperators().
More Notes about Repeated Solution of Linear Systems
PETSc does NOT reset the matrix entries of either Amat or Pmat
to zero after a linear solve; the user is completely responsible for
matrix assembly. See the routine MatZeroEntries() if desiring to
zero all elements of a matrix.
Keywords
PC, set, operators, matrix, linear system
See Also
PCGetOperators(), MatZeroEntries()
Level:intermediate
Location:src/ksp/pc/interface/precon.c
Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages
Examples
src/ksp/ksp/examples/tutorials/ex21f.F.html
src/snes/examples/tutorials/ex74f.F90.html