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 32*95452b02SPatrick Sanan Notes: 33*95452b02SPatrick 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; 484b9ad928SBarry Smith pc->ops->setup = 0; 494b9ad928SBarry Smith pc->ops->destroy = PCDestroy_Mat; 504b9ad928SBarry Smith pc->ops->setfromoptions = 0; 514b9ad928SBarry Smith pc->ops->view = 0; 524b9ad928SBarry Smith pc->ops->applyrichardson = 0; 534b9ad928SBarry Smith pc->ops->applysymmetricleft = 0; 544b9ad928SBarry Smith pc->ops->applysymmetricright = 0; 554b9ad928SBarry Smith PetscFunctionReturn(0); 564b9ad928SBarry Smith } 574b9ad928SBarry Smith 58