Actual source code: pcmat.c
petsc-3.3-p7 2013-05-11
2: #include <petsc-private/pcimpl.h> /*I "petscpc.h" I*/
6: static PetscErrorCode PCApply_Mat(PC pc,Vec x,Vec y)
7: {
11: MatMult(pc->pmat,x,y);
12: return(0);
13: }
17: static PetscErrorCode PCApplyTranspose_Mat(PC pc,Vec x,Vec y)
18: {
22: MatMultTranspose(pc->pmat,x,y);
23: return(0);
24: }
28: static PetscErrorCode PCDestroy_Mat(PC pc)
29: {
31: return(0);
32: }
34: /*MC
35: PCMAT - A preconditioner obtained by multiplying by the preconditioner matrix supplied
36: in PCSetOperators() or KSPSetOperators()
38: Notes: This one is a little strange. One rarely has an explict matrix that approximates the
39: inverse of the matrix they wish to solve for.
41: Level: intermediate
43: .seealso: PCCreate(), PCSetType(), PCType (for list of available types), PC,
44: PCSHELL
46: M*/
48: EXTERN_C_BEGIN
51: PetscErrorCode PCCreate_Mat(PC pc)
52: {
54: pc->ops->apply = PCApply_Mat;
55: pc->ops->applytranspose = PCApplyTranspose_Mat;
56: pc->ops->setup = 0;
57: pc->ops->destroy = PCDestroy_Mat;
58: pc->ops->setfromoptions = 0;
59: pc->ops->view = 0;
60: pc->ops->applyrichardson = 0;
61: pc->ops->applysymmetricleft = 0;
62: pc->ops->applysymmetricright = 0;
63: return(0);
64: }
65: EXTERN_C_END