xref: /petsc/src/ksp/pc/impls/none/none.c (revision 5b6bfdb9644f185dbf5e5a09b808ec241507e1e7)
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   PetscErrorCode ierr;
10 
11   PetscFunctionBegin;
12   ierr = VecCopy(x,y);CHKERRQ(ierr);
13   PetscFunctionReturn(0);
14 }
15 
16 /*MC
17      PCNONE - This is used when you wish to employ a nonpreconditioned
18              Krylov method.
19 
20    Level: beginner
21 
22   Concepts: preconditioners
23 
24   Notes: This is implemented by a VecCopy()
25 
26 .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC
27 M*/
28 
29 PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc)
30 {
31   PetscFunctionBegin;
32   pc->ops->apply               = PCApply_None;
33   pc->ops->applytranspose      = PCApply_None;
34   pc->ops->destroy             = 0;
35   pc->ops->setup               = 0;
36   pc->ops->view                = 0;
37   pc->ops->applysymmetricleft  = PCApply_None;
38   pc->ops->applysymmetricright = PCApply_None;
39 
40   pc->data = 0;
41   PetscFunctionReturn(0);
42 }
43