xref: /petsc/src/ksp/pc/impls/none/none.c (revision 117ef88edefbfc12e7c19efe87a19a2e1b0acd4f)
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   Notes:
23     This is implemented by a VecCopy()
24 
25 .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC
26 M*/
27 
28 PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc)
29 {
30   PetscFunctionBegin;
31   pc->ops->apply               = PCApply_None;
32   pc->ops->applytranspose      = PCApply_None;
33   pc->ops->destroy             = NULL;
34   pc->ops->setup               = NULL;
35   pc->ops->view                = NULL;
36   pc->ops->applysymmetricleft  = PCApply_None;
37   pc->ops->applysymmetricright = PCApply_None;
38 
39   pc->data = NULL;
40   PetscFunctionReturn(0);
41 }
42