xref: /petsc/src/ksp/pc/impls/mat/pcmat.c (revision 7087cfbefd1a42b179f217f9994fb6cb0d0c1824)
1dba47a55SKris Buschelman #define PETSCKSP_DLL
24b9ad928SBarry Smith 
36356e834SBarry Smith #include "private/pcimpl.h"   /*I "petscpc.h" I*/
44b9ad928SBarry Smith 
54b9ad928SBarry Smith #undef __FUNCT__
64b9ad928SBarry Smith #define __FUNCT__ "PCApply_Mat"
76849ba73SBarry Smith static PetscErrorCode PCApply_Mat(PC pc,Vec x,Vec y)
84b9ad928SBarry Smith {
9dfbe8321SBarry Smith   PetscErrorCode ierr;
104b9ad928SBarry Smith 
114b9ad928SBarry Smith   PetscFunctionBegin;
124b9ad928SBarry Smith   ierr = MatMult(pc->pmat,x,y);CHKERRQ(ierr);
134b9ad928SBarry Smith   PetscFunctionReturn(0);
144b9ad928SBarry Smith }
154b9ad928SBarry Smith 
164b9ad928SBarry Smith #undef __FUNCT__
174b9ad928SBarry Smith #define __FUNCT__ "PCApplyTranspose_Mat"
186849ba73SBarry Smith static PetscErrorCode PCApplyTranspose_Mat(PC pc,Vec x,Vec y)
194b9ad928SBarry Smith {
20dfbe8321SBarry Smith   PetscErrorCode ierr;
214b9ad928SBarry Smith 
224b9ad928SBarry Smith   PetscFunctionBegin;
234b9ad928SBarry Smith   ierr = MatMultTranspose(pc->pmat,x,y);CHKERRQ(ierr);
244b9ad928SBarry Smith   PetscFunctionReturn(0);
254b9ad928SBarry Smith }
264b9ad928SBarry Smith 
274b9ad928SBarry Smith #undef __FUNCT__
284b9ad928SBarry Smith #define __FUNCT__ "PCDestroy_Mat"
296849ba73SBarry Smith static PetscErrorCode PCDestroy_Mat(PC pc)
304b9ad928SBarry Smith {
314b9ad928SBarry Smith   PetscFunctionBegin;
324b9ad928SBarry Smith   PetscFunctionReturn(0);
334b9ad928SBarry Smith }
344b9ad928SBarry Smith 
354b9ad928SBarry Smith /*MC
364b9ad928SBarry Smith      PCMAT - A preconditioner obtained by multiplying by the preconditioner matrix supplied
374b9ad928SBarry Smith              in PCSetOperators() or KSPSetOperators()
384b9ad928SBarry Smith 
394b9ad928SBarry Smith    Notes:  This one is a little strange. One rarely has an explict matrix that approximates the
404b9ad928SBarry Smith          inverse of the matrix they wish to solve for.
414b9ad928SBarry Smith 
424b9ad928SBarry Smith    Level: intermediate
434b9ad928SBarry Smith 
444b9ad928SBarry Smith .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC,
454b9ad928SBarry Smith            PCSHELL
464b9ad928SBarry Smith 
474b9ad928SBarry Smith M*/
484b9ad928SBarry Smith 
494b9ad928SBarry Smith EXTERN_C_BEGIN
504b9ad928SBarry Smith #undef __FUNCT__
514b9ad928SBarry Smith #define __FUNCT__ "PCCreate_Mat"
52*7087cfbeSBarry Smith PetscErrorCode  PCCreate_Mat(PC pc)
534b9ad928SBarry Smith {
544b9ad928SBarry Smith   PetscFunctionBegin;
554b9ad928SBarry Smith   pc->ops->apply               = PCApply_Mat;
564b9ad928SBarry Smith   pc->ops->applytranspose      = PCApplyTranspose_Mat;
574b9ad928SBarry Smith   pc->ops->setup               = 0;
584b9ad928SBarry Smith   pc->ops->destroy             = PCDestroy_Mat;
594b9ad928SBarry Smith   pc->ops->setfromoptions      = 0;
604b9ad928SBarry Smith   pc->ops->view                = 0;
614b9ad928SBarry Smith   pc->ops->applyrichardson     = 0;
624b9ad928SBarry Smith   pc->ops->applysymmetricleft  = 0;
634b9ad928SBarry Smith   pc->ops->applysymmetricright = 0;
644b9ad928SBarry Smith   PetscFunctionReturn(0);
654b9ad928SBarry Smith }
664b9ad928SBarry Smith EXTERN_C_END
674b9ad928SBarry Smith 
68