xref: /petsc/src/ksp/pc/impls/mat/pcmat.c (revision 0a54594789a51e03afa4b1d2c7154c36053c8769)
14b9ad928SBarry Smith 
2af0996ceSBarry Smith #include <petsc/private/pcimpl.h>   /*I "petscpc.h" I*/
34b9ad928SBarry Smith 
46849ba73SBarry Smith static PetscErrorCode PCApply_Mat(PC pc,Vec x,Vec y)
54b9ad928SBarry Smith {
6dfbe8321SBarry Smith   PetscErrorCode ierr;
74b9ad928SBarry Smith 
84b9ad928SBarry Smith   PetscFunctionBegin;
94b9ad928SBarry Smith   ierr = MatMult(pc->pmat,x,y);CHKERRQ(ierr);
104b9ad928SBarry Smith   PetscFunctionReturn(0);
114b9ad928SBarry Smith }
124b9ad928SBarry Smith 
136849ba73SBarry Smith static PetscErrorCode PCApplyTranspose_Mat(PC pc,Vec x,Vec y)
144b9ad928SBarry Smith {
15dfbe8321SBarry Smith   PetscErrorCode ierr;
164b9ad928SBarry Smith 
174b9ad928SBarry Smith   PetscFunctionBegin;
184b9ad928SBarry Smith   ierr = MatMultTranspose(pc->pmat,x,y);CHKERRQ(ierr);
194b9ad928SBarry Smith   PetscFunctionReturn(0);
204b9ad928SBarry Smith }
214b9ad928SBarry Smith 
226849ba73SBarry Smith static PetscErrorCode PCDestroy_Mat(PC pc)
234b9ad928SBarry Smith {
244b9ad928SBarry Smith   PetscFunctionBegin;
254b9ad928SBarry Smith   PetscFunctionReturn(0);
264b9ad928SBarry Smith }
274b9ad928SBarry Smith 
284b9ad928SBarry Smith /*MC
294b9ad928SBarry Smith      PCMAT - A preconditioner obtained by multiplying by the preconditioner matrix supplied
304b9ad928SBarry Smith              in PCSetOperators() or KSPSetOperators()
314b9ad928SBarry Smith 
3295452b02SPatrick Sanan    Notes:
3395452b02SPatrick Sanan     This one is a little strange. One rarely has an explict matrix that approximates the
344b9ad928SBarry Smith          inverse of the matrix they wish to solve for.
354b9ad928SBarry Smith 
364b9ad928SBarry Smith    Level: intermediate
374b9ad928SBarry Smith 
384b9ad928SBarry Smith .seealso:  PCCreate(), PCSetType(), PCType (for list of available types), PC,
394b9ad928SBarry Smith            PCSHELL
404b9ad928SBarry Smith 
414b9ad928SBarry Smith M*/
424b9ad928SBarry Smith 
438cc058d9SJed Brown PETSC_EXTERN PetscErrorCode PCCreate_Mat(PC pc)
444b9ad928SBarry Smith {
454b9ad928SBarry Smith   PetscFunctionBegin;
464b9ad928SBarry Smith   pc->ops->apply               = PCApply_Mat;
474b9ad928SBarry Smith   pc->ops->applytranspose      = PCApplyTranspose_Mat;
48*0a545947SLisandro Dalcin   pc->ops->setup               = NULL;
494b9ad928SBarry Smith   pc->ops->destroy             = PCDestroy_Mat;
50*0a545947SLisandro Dalcin   pc->ops->setfromoptions      = NULL;
51*0a545947SLisandro Dalcin   pc->ops->view                = NULL;
52*0a545947SLisandro Dalcin   pc->ops->applyrichardson     = NULL;
53*0a545947SLisandro Dalcin   pc->ops->applysymmetricleft  = NULL;
54*0a545947SLisandro Dalcin   pc->ops->applysymmetricright = NULL;
554b9ad928SBarry Smith   PetscFunctionReturn(0);
564b9ad928SBarry Smith }
574b9ad928SBarry Smith 
58