Actual source code: pcmat.c

  1: #define PETSCKSP_DLL

 3:  #include private/pcimpl.h

  7: static PetscErrorCode PCApply_Mat(PC pc,Vec x,Vec y)
  8: {

 12:   MatMult(pc->pmat,x,y);
 13:   return(0);
 14: }

 18: static PetscErrorCode PCApplyTranspose_Mat(PC pc,Vec x,Vec y)
 19: {

 23:   MatMultTranspose(pc->pmat,x,y);
 24:   return(0);
 25: }

 29: static PetscErrorCode PCDestroy_Mat(PC pc)
 30: {
 32:   return(0);
 33: }

 35: /*MC
 36:      PCMAT - A preconditioner obtained by multiplying by the preconditioner matrix supplied
 37:              in PCSetOperators() or KSPSetOperators()

 39:    Notes:  This one is a little strange. One rarely has an explict matrix that approximates the
 40:          inverse of the matrix they wish to solve for.

 42:    Level: intermediate

 44: .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC,
 45:            PCSHELL

 47: M*/

 52: PetscErrorCode  PCCreate_Mat(PC pc)
 53: {
 55:   pc->ops->apply               = PCApply_Mat;
 56:   pc->ops->applytranspose      = PCApplyTranspose_Mat;
 57:   pc->ops->setup               = 0;
 58:   pc->ops->destroy             = PCDestroy_Mat;
 59:   pc->ops->setfromoptions      = 0;
 60:   pc->ops->view                = 0;
 61:   pc->ops->applyrichardson     = 0;
 62:   pc->ops->applysymmetricleft  = 0;
 63:   pc->ops->applysymmetricright = 0;
 64:   return(0);
 65: }