xref: /petsc/src/ksp/pc/impls/none/none.c (revision bef158480efac06de457f7a665168877ab3c2fd7)
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 PetscErrorCode PCMatApply_None(PC pc,Mat X,Mat Y)
17 {
18   PetscErrorCode ierr;
19 
20   PetscFunctionBegin;
21   ierr = MatCopy(X,Y,SAME_NONZERO_PATTERN);CHKERRQ(ierr);
22   PetscFunctionReturn(0);
23 }
24 
25 /*MC
26      PCNONE - This is used when you wish to employ a nonpreconditioned
27              Krylov method.
28 
29    Level: beginner
30 
31   Notes:
32     This is implemented by a VecCopy()
33 
34 .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC
35 M*/
36 
37 PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc)
38 {
39   PetscFunctionBegin;
40   pc->ops->apply               = PCApply_None;
41   pc->ops->matapply            = PCMatApply_None;
42   pc->ops->applytranspose      = PCApply_None;
43   pc->ops->destroy             = NULL;
44   pc->ops->setup               = NULL;
45   pc->ops->view                = NULL;
46   pc->ops->applysymmetricleft  = PCApply_None;
47   pc->ops->applysymmetricright = PCApply_None;
48 
49   pc->data = NULL;
50   PetscFunctionReturn(0);
51 }
52