xref: /petsc/src/ksp/pc/impls/none/none.c (revision 9371c9d470a9602b6d10a8bf50c9b2280a79e45a)
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 
7*9371c9d4SSatish Balay PetscErrorCode PCApply_None(PC pc, Vec x, Vec y) {
84b9ad928SBarry Smith   PetscFunctionBegin;
99566063dSJacob Faibussowitsch   PetscCall(VecCopy(x, y));
104b9ad928SBarry Smith   PetscFunctionReturn(0);
114b9ad928SBarry Smith }
124b9ad928SBarry Smith 
13*9371c9d4SSatish Balay PetscErrorCode PCMatApply_None(PC pc, Mat X, Mat Y) {
147b6e2003SPierre Jolivet   PetscFunctionBegin;
159566063dSJacob Faibussowitsch   PetscCall(MatCopy(X, Y, SAME_NONZERO_PATTERN));
167b6e2003SPierre Jolivet   PetscFunctionReturn(0);
177b6e2003SPierre Jolivet }
187b6e2003SPierre Jolivet 
194b9ad928SBarry Smith /*MC
204b9ad928SBarry Smith      PCNONE - This is used when you wish to employ a nonpreconditioned
214b9ad928SBarry Smith              Krylov method.
224b9ad928SBarry Smith 
234b9ad928SBarry Smith    Level: beginner
244b9ad928SBarry Smith 
2595452b02SPatrick Sanan   Notes:
2695452b02SPatrick Sanan     This is implemented by a VecCopy()
274b9ad928SBarry Smith 
28db781477SPatrick Sanan .seealso: `PCCreate()`, `PCSetType()`, `PCType`, `PC`
294b9ad928SBarry Smith M*/
304b9ad928SBarry Smith 
31*9371c9d4SSatish Balay PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc) {
324b9ad928SBarry Smith   PetscFunctionBegin;
334b9ad928SBarry Smith   pc->ops->apply               = PCApply_None;
347b6e2003SPierre Jolivet   pc->ops->matapply            = PCMatApply_None;
354b9ad928SBarry Smith   pc->ops->applytranspose      = PCApply_None;
360a545947SLisandro Dalcin   pc->ops->destroy             = NULL;
370a545947SLisandro Dalcin   pc->ops->setup               = NULL;
380a545947SLisandro Dalcin   pc->ops->view                = NULL;
394b9ad928SBarry Smith   pc->ops->applysymmetricleft  = PCApply_None;
404b9ad928SBarry Smith   pc->ops->applysymmetricright = PCApply_None;
414b9ad928SBarry Smith 
420a545947SLisandro Dalcin   pc->data = NULL;
434b9ad928SBarry Smith   PetscFunctionReturn(0);
444b9ad928SBarry Smith }
45