xref: /petsc/src/ksp/pc/impls/none/none.c (revision 292f8084fb157dadf9a2ae26c5bd14368ed7ffcb)
1 /*
2     Identity preconditioner, simply copies vector x to y.
3 */
4 #include "src/ksp/pc/pcimpl.h"          /*I "petscpc.h" I*/
5 
6 #undef __FUNCT__
7 #define __FUNCT__ "PCApply_None"
8 PetscErrorCode PCApply_None(PC pc,Vec x,Vec y)
9 {
10   PetscErrorCode ierr;
11 
12   PetscFunctionBegin;
13   ierr = VecCopy(x,y);CHKERRQ(ierr);
14   PetscFunctionReturn(0);
15 }
16 
17 /*MC
18      PCNONE - This is used when you wish to employ a nonpreconditioned
19              Krylov method.
20 
21    Level: beginner
22 
23   Concepts: preconditioners
24 
25   Notes: This is implemented by a VecCopy()
26 
27 .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC
28 M*/
29 
30 EXTERN_C_BEGIN
31 #undef __FUNCT__
32 #define __FUNCT__ "PCCreate_None"
33 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 EXTERN_C_END
48