Actual source code: none.c


  2: /*
  3:     Identity preconditioner, simply copies vector x to y.
  4: */
  5: #include <petsc/private/pcimpl.h>

  7: PetscErrorCode PCApply_None(PC pc, Vec x, Vec y)
  8: {
  9:   VecCopy(x, y);
 10:   return 0;
 11: }

 13: PetscErrorCode PCMatApply_None(PC pc, Mat X, Mat Y)
 14: {
 15:   MatCopy(X, Y, SAME_NONZERO_PATTERN);
 16:   return 0;
 17: }

 19: /*MC
 20:      PCNONE - This is used when you wish to employ a nonpreconditioned
 21:              Krylov method.

 23:    Level: beginner

 25:   Developer Note:
 26:   This is implemented by a `VecCopy()`. It would be nice if the `KSP` implementations could be organized to avoid this copy without making them
 27:   more complex.

 29: .seealso: `PCCreate()`, `PCSetType()`, `PCType`, `PC`
 30: M*/

 32: PETSC_EXTERN PetscErrorCode PCCreate_None(PC pc)
 33: {
 34:   pc->ops->apply               = PCApply_None;
 35:   pc->ops->matapply            = PCMatApply_None;
 36:   pc->ops->applytranspose      = PCApply_None;
 37:   pc->ops->destroy             = NULL;
 38:   pc->ops->setup               = NULL;
 39:   pc->ops->view                = NULL;
 40:   pc->ops->applysymmetricleft  = PCApply_None;
 41:   pc->ops->applysymmetricright = PCApply_None;

 43:   pc->data = NULL;
 44:   return 0;
 45: }