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