xref: /petsc/src/ksp/pc/impls/none/none.c (revision ffa8c5705e8ab2cf85ee1d14dbe507a6e2eb5283)
1 
2 /*
3     Identity preconditioner, simply copies vector x to y.
4 */
5 #include <petsc/private/pcimpl.h>          /*I "petscpc.h" I*/
6 
7 PetscErrorCode PCApply_None(PC pc,Vec x,Vec y)
8 {
9   PetscFunctionBegin;
10   PetscCall(VecCopy(x,y));
11   PetscFunctionReturn(0);
12 }
13 
14 PetscErrorCode PCMatApply_None(PC pc,Mat X,Mat Y)
15 {
16   PetscFunctionBegin;
17   PetscCall(MatCopy(X,Y,SAME_NONZERO_PATTERN));
18   PetscFunctionReturn(0);
19 }
20 
21 /*MC
22      PCNONE - This is used when you wish to employ a nonpreconditioned
23              Krylov method.
24 
25    Level: beginner
26 
27   Notes:
28     This is implemented by a VecCopy()
29 
30 .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC
31 M*/
32 
33 PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc)
34 {
35   PetscFunctionBegin;
36   pc->ops->apply               = PCApply_None;
37   pc->ops->matapply            = PCMatApply_None;
38   pc->ops->applytranspose      = PCApply_None;
39   pc->ops->destroy             = NULL;
40   pc->ops->setup               = NULL;
41   pc->ops->view                = NULL;
42   pc->ops->applysymmetricleft  = PCApply_None;
43   pc->ops->applysymmetricright = PCApply_None;
44 
45   pc->data = NULL;
46   PetscFunctionReturn(0);
47 }
48