xref: /petsc/src/ksp/pc/impls/none/none.c (revision 9566063d113dddea24716c546802770db7481bc0)
1dba47a55SKris Buschelman 
24b9ad928SBarry Smith /*
34b9ad928SBarry Smith     Identity preconditioner, simply copies vector x to y.
44b9ad928SBarry Smith */
5af0996ceSBarry Smith #include <petsc/private/pcimpl.h>          /*I "petscpc.h" I*/
64b9ad928SBarry Smith 
7dfbe8321SBarry Smith PetscErrorCode PCApply_None(PC pc,Vec x,Vec y)
84b9ad928SBarry Smith {
94b9ad928SBarry Smith   PetscFunctionBegin;
10*9566063dSJacob Faibussowitsch   PetscCall(VecCopy(x,y));
114b9ad928SBarry Smith   PetscFunctionReturn(0);
124b9ad928SBarry Smith }
134b9ad928SBarry Smith 
147b6e2003SPierre Jolivet PetscErrorCode PCMatApply_None(PC pc,Mat X,Mat Y)
157b6e2003SPierre Jolivet {
167b6e2003SPierre Jolivet   PetscFunctionBegin;
17*9566063dSJacob Faibussowitsch   PetscCall(MatCopy(X,Y,SAME_NONZERO_PATTERN));
187b6e2003SPierre Jolivet   PetscFunctionReturn(0);
197b6e2003SPierre Jolivet }
207b6e2003SPierre Jolivet 
214b9ad928SBarry Smith /*MC
224b9ad928SBarry Smith      PCNONE - This is used when you wish to employ a nonpreconditioned
234b9ad928SBarry Smith              Krylov method.
244b9ad928SBarry Smith 
254b9ad928SBarry Smith    Level: beginner
264b9ad928SBarry Smith 
2795452b02SPatrick Sanan   Notes:
2895452b02SPatrick Sanan     This is implemented by a VecCopy()
294b9ad928SBarry Smith 
304b9ad928SBarry Smith .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC
314b9ad928SBarry Smith M*/
324b9ad928SBarry Smith 
338cc058d9SJed Brown PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc)
344b9ad928SBarry Smith {
354b9ad928SBarry Smith   PetscFunctionBegin;
364b9ad928SBarry Smith   pc->ops->apply               = PCApply_None;
377b6e2003SPierre Jolivet   pc->ops->matapply            = PCMatApply_None;
384b9ad928SBarry Smith   pc->ops->applytranspose      = PCApply_None;
390a545947SLisandro Dalcin   pc->ops->destroy             = NULL;
400a545947SLisandro Dalcin   pc->ops->setup               = NULL;
410a545947SLisandro Dalcin   pc->ops->view                = NULL;
424b9ad928SBarry Smith   pc->ops->applysymmetricleft  = PCApply_None;
434b9ad928SBarry Smith   pc->ops->applysymmetricright = PCApply_None;
444b9ad928SBarry Smith 
450a545947SLisandro Dalcin   pc->data = NULL;
464b9ad928SBarry Smith   PetscFunctionReturn(0);
474b9ad928SBarry Smith }
48