#include "petscksp.h" PetscErrorCode PCGetOperators(PC pc,Mat *Amat,Mat *Pmat)Not collective, though parallel Mats are returned if the PC is parallel Many br
Amat | - the matrix defining the linear system Many br | |
Pmat | - the matrix from which the preconditioner is constructed, usually the same as Amat. Many br |
Many br
Notes: Does not increase the reference count of the matrices, so you should not destroy them Many br
Alternative usage: If the operators have NOT been set with KSP/PCSetOperators() then the operators Many brare created in PC and returned to the user. In this case, if both operators Many brmat and pmat are requested, two DIFFERENT operators will be returned. If Many bronly one is requested both operators in the PC will be the same (i.e. as Many brif one had called KSP/PCSetOperators() with the same argument for both Mats). Many brThe user must set the sizes of the returned matrices and their type etc just Many bras if the user created them with MatCreate(). For example, Many br
KSP/PCGetOperators(ksp/pc,&Amat,NULL); is equivalent to
set size, type, etc of Amat
MatCreate(comm,&mat);
KSP/PCSetOperators(ksp/pc,Amat,Amat);
PetscObjectDereference((PetscObject)mat);
set size, type, etc of Amat
and Many br
KSP/PCGetOperators(ksp/pc,&Amat,&Pmat); is equivalent to
set size, type, etc of Amat and Pmat
MatCreate(comm,&Amat);
MatCreate(comm,&Pmat);
KSP/PCSetOperators(ksp/pc,Amat,Pmat);
PetscObjectDereference((PetscObject)Amat);
PetscObjectDereference((PetscObject)Pmat);
set size, type, etc of Amat and Pmat
The rational for this support is so that when creating a TS, SNES, or KSP the hierarchy Many brof underlying objects (i.e. SNES, KSP, PC, Mat) and their livespans can be completely Many brmanaged by the top most level object (i.e. the TS, SNES, or KSP). Another way to look Many brat this is when you create a SNES you do not NEED to create a KSP and attach it to Many brthe SNES object (the SNES object manages it for you). Similarly when you create a KSP Many bryou do not need to attach a PC to it (the KSP object manages the PC object for you). Many brThus, why should YOU have to create the Mat and attach it to the SNES/KSP/PC, when Many brit can be created for you? Many br
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