1 2 #include <petsc/private/pcimpl.h> /*I "petscpc.h" I*/ 3 4 #undef __FUNCT__ 5 #define __FUNCT__ "PCApply_Mat" 6 static PetscErrorCode PCApply_Mat(PC pc,Vec x,Vec y) 7 { 8 PetscErrorCode ierr; 9 10 PetscFunctionBegin; 11 ierr = MatMult(pc->pmat,x,y);CHKERRQ(ierr); 12 PetscFunctionReturn(0); 13 } 14 15 #undef __FUNCT__ 16 #define __FUNCT__ "PCApplyTranspose_Mat" 17 static PetscErrorCode PCApplyTranspose_Mat(PC pc,Vec x,Vec y) 18 { 19 PetscErrorCode ierr; 20 21 PetscFunctionBegin; 22 ierr = MatMultTranspose(pc->pmat,x,y);CHKERRQ(ierr); 23 PetscFunctionReturn(0); 24 } 25 26 #undef __FUNCT__ 27 #define __FUNCT__ "PCDestroy_Mat" 28 static PetscErrorCode PCDestroy_Mat(PC pc) 29 { 30 PetscFunctionBegin; 31 PetscFunctionReturn(0); 32 } 33 34 /*MC 35 PCMAT - A preconditioner obtained by multiplying by the preconditioner matrix supplied 36 in PCSetOperators() or KSPSetOperators() 37 38 Notes: This one is a little strange. One rarely has an explict matrix that approximates the 39 inverse of the matrix they wish to solve for. 40 41 Level: intermediate 42 43 .seealso: PCCreate(), PCSetType(), PCType (for list of available types), PC, 44 PCSHELL 45 46 M*/ 47 48 #undef __FUNCT__ 49 #define __FUNCT__ "PCCreate_Mat" 50 PETSC_EXTERN PetscErrorCode PCCreate_Mat(PC pc) 51 { 52 PetscFunctionBegin; 53 pc->ops->apply = PCApply_Mat; 54 pc->ops->applytranspose = PCApplyTranspose_Mat; 55 pc->ops->setup = 0; 56 pc->ops->destroy = PCDestroy_Mat; 57 pc->ops->setfromoptions = 0; 58 pc->ops->view = 0; 59 pc->ops->applyrichardson = 0; 60 pc->ops->applysymmetricleft = 0; 61 pc->ops->applysymmetricright = 0; 62 PetscFunctionReturn(0); 63 } 64 65