1*f97fa5f8SBarry Smith /* $Id: pc.h,v 1.97 2000/01/11 21:04:04 bsmith Exp $ */ 2*f97fa5f8SBarry Smith 3*f97fa5f8SBarry Smith /* 4*f97fa5f8SBarry Smith Preconditioner module. 5*f97fa5f8SBarry Smith */ 6*f97fa5f8SBarry Smith #if !defined(__PC_H) 7*f97fa5f8SBarry Smith #define __PC_H 8*f97fa5f8SBarry Smith #include "mat.h" 9*f97fa5f8SBarry Smith 10*f97fa5f8SBarry Smith /* 11*f97fa5f8SBarry Smith PCList contains the list of preconditioners currently registered 12*f97fa5f8SBarry Smith These are added with the PCRegisterDynamic() macro 13*f97fa5f8SBarry Smith */ 14*f97fa5f8SBarry Smith extern FList PCList; 15*f97fa5f8SBarry Smith typedef char *PCType; 16*f97fa5f8SBarry Smith 17*f97fa5f8SBarry Smith /* 18*f97fa5f8SBarry Smith Standard PETSc preconditioners 19*f97fa5f8SBarry Smith */ 20*f97fa5f8SBarry Smith #define PCNONE "none" 21*f97fa5f8SBarry Smith #define PCJACOBI "jacobi" 22*f97fa5f8SBarry Smith #define PCSOR "sor" 23*f97fa5f8SBarry Smith #define PCLU "lu" 24*f97fa5f8SBarry Smith #define PCSHELL "shell" 25*f97fa5f8SBarry Smith #define PCBJACOBI "bjacobi" 26*f97fa5f8SBarry Smith #define PCMG "mg" 27*f97fa5f8SBarry Smith #define PCEISENSTAT "eisenstat" 28*f97fa5f8SBarry Smith #define PCILU "ilu" 29*f97fa5f8SBarry Smith #define PCICC "icc" 30*f97fa5f8SBarry Smith #define PCASM "asm" 31*f97fa5f8SBarry Smith #define PCSLES "sles" 32*f97fa5f8SBarry Smith #define PCCOMPOSITE "composite" 33*f97fa5f8SBarry Smith #define PCREDUNDANT "redundant" 34*f97fa5f8SBarry Smith 35*f97fa5f8SBarry Smith typedef struct _p_PC* PC; 36*f97fa5f8SBarry Smith #define PC_COOKIE PETSC_COOKIE+9 37*f97fa5f8SBarry Smith 38*f97fa5f8SBarry Smith /* 39*f97fa5f8SBarry Smith Null space code is not yet developed 40*f97fa5f8SBarry Smith */ 41*f97fa5f8SBarry Smith typedef struct _p_PCNullSpace* PCNullSpace; 42*f97fa5f8SBarry Smith #define PCNULLSPACE_COOKIE PETSC_COOKIE+17 43*f97fa5f8SBarry Smith 44*f97fa5f8SBarry Smith typedef enum { PC_LEFT,PC_RIGHT,PC_SYMMETRIC } PCSide; 45*f97fa5f8SBarry Smith 46*f97fa5f8SBarry Smith extern int PCCreate(MPI_Comm,PC*); 47*f97fa5f8SBarry Smith extern int PCSetType(PC,PCType); 48*f97fa5f8SBarry Smith extern int PCSetUp(PC); 49*f97fa5f8SBarry Smith extern int PCSetUpOnBlocks(PC); 50*f97fa5f8SBarry Smith extern int PCApply(PC,Vec,Vec); 51*f97fa5f8SBarry Smith extern int PCApplySymmetricLeft(PC,Vec,Vec); 52*f97fa5f8SBarry Smith extern int PCApplySymmetricRight(PC,Vec,Vec); 53*f97fa5f8SBarry Smith extern int PCApplyBAorAB(PC,PCSide,Vec,Vec,Vec); 54*f97fa5f8SBarry Smith extern int PCApplyTranspose(PC,Vec,Vec); 55*f97fa5f8SBarry Smith extern int PCApplyBAorABTranspose(PC,PCSide,Vec,Vec,Vec); 56*f97fa5f8SBarry Smith extern int PCApplyRichardson(PC,Vec,Vec,Vec,int); 57*f97fa5f8SBarry Smith extern int PCApplyRichardsonExists(PC,PetscTruth*); 58*f97fa5f8SBarry Smith 59*f97fa5f8SBarry Smith extern int PCRegisterDestroy(void); 60*f97fa5f8SBarry Smith extern int PCRegisterAll(char*); 61*f97fa5f8SBarry Smith extern int PCRegisterAllCalled; 62*f97fa5f8SBarry Smith 63*f97fa5f8SBarry Smith extern int PCRegister(char*,char*,char*,int(*)(PC)); 64*f97fa5f8SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 65*f97fa5f8SBarry Smith #define PCRegisterDynamic(a,b,c,d) PCRegister(a,b,c,0) 66*f97fa5f8SBarry Smith #else 67*f97fa5f8SBarry Smith #define PCRegisterDynamic(a,b,c,d) PCRegister(a,b,c,d) 68*f97fa5f8SBarry Smith #endif 69*f97fa5f8SBarry Smith 70*f97fa5f8SBarry Smith extern int PCDestroy(PC); 71*f97fa5f8SBarry Smith extern int PCSetFromOptions(PC); 72*f97fa5f8SBarry Smith extern int PCSetTypeFromOptions(PC); 73*f97fa5f8SBarry Smith extern int PCGetType(PC,PCType*); 74*f97fa5f8SBarry Smith 75*f97fa5f8SBarry Smith extern int PCGetFactoredMatrix(PC,Mat*); 76*f97fa5f8SBarry Smith extern int PCSetModifySubMatrices(PC,int(*)(PC,int,IS*,IS*,Mat*,void*),void*); 77*f97fa5f8SBarry Smith extern int PCModifySubMatrices(PC,int,IS*,IS*,Mat*,void*); 78*f97fa5f8SBarry Smith 79*f97fa5f8SBarry Smith extern int PCSetOperators(PC,Mat,Mat,MatStructure); 80*f97fa5f8SBarry Smith extern int PCGetOperators(PC,Mat*,Mat*,MatStructure*); 81*f97fa5f8SBarry Smith 82*f97fa5f8SBarry Smith extern int PCSetVector(PC,Vec); 83*f97fa5f8SBarry Smith extern int PCGetVector(PC,Vec*); 84*f97fa5f8SBarry Smith extern int PCPrintHelp(PC); 85*f97fa5f8SBarry Smith extern int PCView(PC,Viewer); 86*f97fa5f8SBarry Smith 87*f97fa5f8SBarry Smith extern int PCSetOptionsPrefix(PC,char*); 88*f97fa5f8SBarry Smith extern int PCAppendOptionsPrefix(PC,char*); 89*f97fa5f8SBarry Smith extern int PCGetOptionsPrefix(PC,char**); 90*f97fa5f8SBarry Smith 91*f97fa5f8SBarry Smith extern int PCNullSpaceCreate(MPI_Comm,int,int,Vec *,PCNullSpace*); 92*f97fa5f8SBarry Smith extern int PCNullSpaceDestroy(PCNullSpace); 93*f97fa5f8SBarry Smith extern int PCNullSpaceRemove(PCNullSpace,Vec); 94*f97fa5f8SBarry Smith extern int PCNullSpaceAttach(PC,PCNullSpace); 95*f97fa5f8SBarry Smith 96*f97fa5f8SBarry Smith /* ------------- options specific to particular preconditioners --------- */ 97*f97fa5f8SBarry Smith 98*f97fa5f8SBarry Smith extern int PCSORSetSymmetric(PC,MatSORType); 99*f97fa5f8SBarry Smith extern int PCSORSetOmega(PC,double); 100*f97fa5f8SBarry Smith extern int PCSORSetIterations(PC,int); 101*f97fa5f8SBarry Smith 102*f97fa5f8SBarry Smith extern int PCEisenstatSetOmega(PC,double); 103*f97fa5f8SBarry Smith extern int PCEisenstatNoDiagonalScaling(PC); 104*f97fa5f8SBarry Smith 105*f97fa5f8SBarry Smith #define USE_PRECONDITIONER_MATRIX 0 106*f97fa5f8SBarry Smith #define USE_TRUE_MATRIX 1 107*f97fa5f8SBarry Smith extern int PCBJacobiSetUseTrueLocal(PC); 108*f97fa5f8SBarry Smith extern int PCBJacobiSetTotalBlocks(PC,int,int*); 109*f97fa5f8SBarry Smith extern int PCBJacobiSetLocalBlocks(PC,int,int*); 110*f97fa5f8SBarry Smith 111*f97fa5f8SBarry Smith extern int PCSLESSetUseTrue(PC); 112*f97fa5f8SBarry Smith extern int PCCompositeSetUseTrue(PC); 113*f97fa5f8SBarry Smith 114*f97fa5f8SBarry Smith extern int PCShellSetApply(PC,int (*)(void*,Vec,Vec),void*); 115*f97fa5f8SBarry Smith extern int PCShellSetSetUp(PC,int (*)(void*)); 116*f97fa5f8SBarry Smith extern int PCShellSetApplyRichardson(PC,int (*)(void*,Vec,Vec,Vec,int),void*); 117*f97fa5f8SBarry Smith extern int PCShellSetName(PC,char*); 118*f97fa5f8SBarry Smith extern int PCShellGetName(PC,char**); 119*f97fa5f8SBarry Smith 120*f97fa5f8SBarry Smith extern int PCLUSetMatOrdering(PC,MatOrderingType); 121*f97fa5f8SBarry Smith extern int PCLUSetReuseOrdering(PC,PetscTruth); 122*f97fa5f8SBarry Smith extern int PCLUSetReuseFill(PC,PetscTruth); 123*f97fa5f8SBarry Smith extern int PCLUSetUseInPlace(PC); 124*f97fa5f8SBarry Smith extern int PCLUSetFill(PC,double); 125*f97fa5f8SBarry Smith 126*f97fa5f8SBarry Smith extern int PCILUSetMatOrdering(PC,MatOrderingType); 127*f97fa5f8SBarry Smith extern int PCILUSetUseInPlace(PC); 128*f97fa5f8SBarry Smith extern int PCILUSetFill(PC,double); 129*f97fa5f8SBarry Smith extern int PCILUSetLevels(PC,int); 130*f97fa5f8SBarry Smith extern int PCILUSetReuseOrdering(PC,PetscTruth); 131*f97fa5f8SBarry Smith extern int PCILUSetUseDropTolerance(PC,double,double,int); 132*f97fa5f8SBarry Smith extern int PCILUSetReuseFill(PC,PetscTruth); 133*f97fa5f8SBarry Smith extern int PCILUSetAllowDiagonalFill(PC); 134*f97fa5f8SBarry Smith 135*f97fa5f8SBarry Smith extern int PCASMSetLocalSubdomains(PC,int,IS *); 136*f97fa5f8SBarry Smith extern int PCASMSetTotalSubdomains(PC,int,IS *); 137*f97fa5f8SBarry Smith extern int PCASMSetOverlap(PC,int); 138*f97fa5f8SBarry Smith typedef enum {PC_ASM_BASIC = 3,PC_ASM_RESTRICT = 1,PC_ASM_INTERPOLATE = 2,PC_ASM_NONE = 0} PCASMType; 139*f97fa5f8SBarry Smith extern int PCASMSetType(PC,PCASMType); 140*f97fa5f8SBarry Smith extern int PCASMCreateSubdomains2D(int,int,int,int,int,int,int *,IS **); 141*f97fa5f8SBarry Smith extern int PCASMSetUseInPlace(PC); 142*f97fa5f8SBarry Smith 143*f97fa5f8SBarry Smith typedef enum {PC_COMPOSITE_ADDITIVE,PC_COMPOSITE_MULTIPLICATIVE} PCCompositeType; 144*f97fa5f8SBarry Smith extern int PCCompositeSetType(PC,PCCompositeType); 145*f97fa5f8SBarry Smith extern int PCCompositeAddPC(PC,PCType); 146*f97fa5f8SBarry Smith extern int PCCompositeGetPC(PC pc,int n,PC *); 147*f97fa5f8SBarry Smith 148*f97fa5f8SBarry Smith extern int PCRedundantSetScatter(PC,VecScatter,VecScatter); 149*f97fa5f8SBarry Smith 150*f97fa5f8SBarry Smith 151*f97fa5f8SBarry Smith #endif 152*f97fa5f8SBarry Smith 153*f97fa5f8SBarry Smith 154*f97fa5f8SBarry Smith 155*f97fa5f8SBarry Smith 156