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