1d03aef70SBarry Smith /* 237f753daSBarry Smith Preconditioner module. 3d03aef70SBarry Smith */ 40a835dfdSSatish Balay #if !defined(__PETSCPC_H) 50a835dfdSSatish Balay #define __PETSCPC_H 6e1589f56SBarry Smith #include "petscdm.h" 7e9fa29b7SSatish Balay PETSC_EXTERN_CXX_BEGIN 8d03aef70SBarry Smith 97087cfbeSBarry Smith extern PetscErrorCode PCInitializePackage(const char[]); 101dbb0a54SBarry Smith 11eec0b4cfSBarry Smith /* 12eec0b4cfSBarry Smith PCList contains the list of preconditioners currently registered 13f1af5d2fSBarry Smith These are added with the PCRegisterDynamic() macro 14eec0b4cfSBarry Smith */ 15b0a32e0cSBarry Smith extern PetscFList PCList; 1682bf6240SBarry Smith 173d957683SBarry Smith /*S 183d957683SBarry Smith PC - Abstract PETSc object that manages all preconditioners 193d957683SBarry Smith 203d957683SBarry Smith Level: beginner 213d957683SBarry Smith 223d957683SBarry Smith Concepts: preconditioners 233d957683SBarry Smith 241a480d89SAdministrator .seealso: PCCreate(), PCSetType(), PCType (for list of available types) 253d957683SBarry Smith S*/ 263d957683SBarry Smith typedef struct _p_PC* PC; 273d957683SBarry Smith 2876bdecfbSBarry Smith /*J 293d957683SBarry Smith PCType - String with the name of a PETSc preconditioner method or the creation function 303d957683SBarry Smith with an optional dynamic library name, for example 313d957683SBarry Smith http://www.mcs.anl.gov/petsc/lib.a:mypccreate() 323d957683SBarry Smith 333d957683SBarry Smith Level: beginner 343d957683SBarry Smith 351a480d89SAdministrator Notes: Click on the links below to see details on a particular solver 361a480d89SAdministrator 371a480d89SAdministrator .seealso: PCSetType(), PC, PCCreate() 3876bdecfbSBarry Smith J*/ 39a313700dSBarry Smith #define PCType char* 4082bf6240SBarry Smith #define PCNONE "none" 4182bf6240SBarry Smith #define PCJACOBI "jacobi" 4282bf6240SBarry Smith #define PCSOR "sor" 4382bf6240SBarry Smith #define PCLU "lu" 4482bf6240SBarry Smith #define PCSHELL "shell" 4582bf6240SBarry Smith #define PCBJACOBI "bjacobi" 4682bf6240SBarry Smith #define PCMG "mg" 4782bf6240SBarry Smith #define PCEISENSTAT "eisenstat" 4882bf6240SBarry Smith #define PCILU "ilu" 4982bf6240SBarry Smith #define PCICC "icc" 5082bf6240SBarry Smith #define PCASM "asm" 51ab3e923fSDmitry Karpeev #define PCGASM "gasm" 5294b7f48cSBarry Smith #define PCKSP "ksp" 5382bf6240SBarry Smith #define PCCOMPOSITE "composite" 54421c37bdSBarry Smith #define PCREDUNDANT "redundant" 5527b520f0SBarry Smith #define PCSPAI "spai" 56186905e3SBarry Smith #define PCNN "nn" 574bbc92c1SBarry Smith #define PCCHOLESKY "cholesky" 583a7fca6bSBarry Smith #define PCPBJACOBI "pbjacobi" 597f5ff6fdSBarry Smith #define PCMAT "mat" 60c4888f26SBarry Smith #define PCHYPRE "hypre" 6137f80224SJose E. Roman #define PCPARMS "parms" 620971522cSBarry Smith #define PCFIELDSPLIT "fieldsplit" 63be16f70fSSatish Balay #define PCTFS "tfs" 645582bec1SHong Zhang #define PCML "ml" 6536a49750SBarry Smith #define PCPROMETHEUS "prometheus" 662a6744ebSBarry Smith #define PCGALERKIN "galerkin" 677233f9f0SBarry Smith #define PCEXOTIC "exotic" 68bad7cb1dSBarry Smith #define PCHMPI "hmpi" 69cf037197Ssdaitch #define PCSUPPORTGRAPH "supportgraph" 70f4b8409dSBarry Smith #define PCASA "asa" 7124c02a0fSBarry Smith #define PCCP "cp" 72628b8437SMatthew Knepley #define PCBFBT "bfbt" 73519d70e2SJed Brown #define PCLSC "lsc" 741d6018f0SLisandro Dalcin #define PCPYTHON "python" 75f91d8e95SBarry Smith #define PCPFMG "pfmg" 76d851a50bSGlenn Hammond #define PCSYSPFMG "syspfmg" 77df826632SBarry Smith #define PCREDISTRIBUTE "redistribute" 78ac793be5SBarry Smith #define PCSVD "svd" 79ac793be5SBarry Smith #define PCGAMG "gamg" 80ac793be5SBarry Smith #define PCSACUSP "sacusp" /* these four run on NVIDIA GPUs using CUSP */ 81bfc29b71SVictor Minden #define PCSACUSPPOLY "sacusppoly" 828154be41SBarry Smith #define PCBICGSTABCUSP "bicgstabcusp" 8304b59e88SVictor Minden #define PCAINVCUSP "ainvcusp" 840c7d97c5SJed Brown #define PCBDDC "bddc" 85123ea438SMatthew Knepley 86123ea438SMatthew Knepley /* Logging support */ 877087cfbeSBarry Smith extern PetscClassId PC_CLASSID; 88123ea438SMatthew Knepley 893d957683SBarry Smith /*E 903d957683SBarry Smith PCSide - If the preconditioner is to be applied to the left, right 913d957683SBarry Smith or symmetrically around the operator. 92d03aef70SBarry Smith 933d957683SBarry Smith Level: beginner 9421e95762SBarry Smith 953d957683SBarry Smith .seealso: 963d957683SBarry Smith E*/ 979e568555SJed Brown typedef enum { PC_SIDE_DEFAULT=-1,PC_LEFT,PC_RIGHT,PC_SYMMETRIC} PCSide; 989e568555SJed Brown #define PC_SIDE_MAX (PC_SYMMETRIC + 1) 999dcbbd2bSBarry Smith extern const char *PCSides[]; 10072b7852fSLois Curfman McInnes 1017087cfbeSBarry Smith extern PetscErrorCode PCCreate(MPI_Comm,PC*); 1027087cfbeSBarry Smith extern PetscErrorCode PCSetType(PC,const PCType); 1037087cfbeSBarry Smith extern PetscErrorCode PCSetUp(PC); 1047087cfbeSBarry Smith extern PetscErrorCode PCSetUpOnBlocks(PC); 1057087cfbeSBarry Smith extern PetscErrorCode PCApply(PC,Vec,Vec); 1067087cfbeSBarry Smith extern PetscErrorCode PCApplySymmetricLeft(PC,Vec,Vec); 1077087cfbeSBarry Smith extern PetscErrorCode PCApplySymmetricRight(PC,Vec,Vec); 1087087cfbeSBarry Smith extern PetscErrorCode PCApplyBAorAB(PC,PCSide,Vec,Vec,Vec); 1097087cfbeSBarry Smith extern PetscErrorCode PCApplyTranspose(PC,Vec,Vec); 1107087cfbeSBarry Smith extern PetscErrorCode PCApplyTransposeExists(PC,PetscBool *); 1117087cfbeSBarry Smith extern PetscErrorCode PCApplyBAorABTranspose(PC,PCSide,Vec,Vec,Vec); 1124d0a8057SBarry Smith 1134d0a8057SBarry Smith /*E 1144d0a8057SBarry Smith PCRichardsonConvergedReason - reason a PCApplyRichardson method terminates 1154d0a8057SBarry Smith 1164d0a8057SBarry Smith Level: advanced 1174d0a8057SBarry Smith 1184d0a8057SBarry Smith Notes: this must match finclude/petscpc.h and the KSPConvergedReason values in petscksp.h 1194d0a8057SBarry Smith 1204d0a8057SBarry Smith .seealso: PCApplyRichardson() 1214d0a8057SBarry Smith E*/ 1224d0a8057SBarry Smith typedef enum { 1234d0a8057SBarry Smith PCRICHARDSON_CONVERGED_RTOL = 2, 1244d0a8057SBarry Smith PCRICHARDSON_CONVERGED_ATOL = 3, 1254d0a8057SBarry Smith PCRICHARDSON_CONVERGED_ITS = 4, 1264d0a8057SBarry Smith PCRICHARDSON_DIVERGED_DTOL = -4} PCRichardsonConvergedReason; 1274d0a8057SBarry Smith 1287087cfbeSBarry Smith extern PetscErrorCode PCApplyRichardson(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*); 1297087cfbeSBarry Smith extern PetscErrorCode PCApplyRichardsonExists(PC,PetscBool *); 1307087cfbeSBarry Smith extern PetscErrorCode PCSetInitialGuessNonzero(PC,PetscBool ); 13184cb2905SBarry Smith 1327087cfbeSBarry Smith extern PetscErrorCode PCRegisterDestroy(void); 1337087cfbeSBarry Smith extern PetscErrorCode PCRegisterAll(const char[]); 134ace3abfcSBarry Smith extern PetscBool PCRegisterAllCalled; 13584cb2905SBarry Smith 1367087cfbeSBarry Smith extern PetscErrorCode PCRegister(const char[],const char[],const char[],PetscErrorCode(*)(PC)); 13730de9b25SBarry Smith 13830de9b25SBarry Smith /*MC 13930de9b25SBarry Smith PCRegisterDynamic - Adds a method to the preconditioner package. 14030de9b25SBarry Smith 14130de9b25SBarry Smith Synopsis: 1421890ba74SBarry Smith PetscErrorCode PCRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PC)) 14330de9b25SBarry Smith 14430de9b25SBarry Smith Not collective 14530de9b25SBarry Smith 14630de9b25SBarry Smith Input Parameters: 14730de9b25SBarry Smith + name_solver - name of a new user-defined solver 14830de9b25SBarry Smith . path - path (either absolute or relative) the library containing this solver 14930de9b25SBarry Smith . name_create - name of routine to create method context 15030de9b25SBarry Smith - routine_create - routine to create method context 15130de9b25SBarry Smith 15230de9b25SBarry Smith Notes: 15330de9b25SBarry Smith PCRegisterDynamic() may be called multiple times to add several user-defined preconditioners. 15430de9b25SBarry Smith 15530de9b25SBarry Smith If dynamic libraries are used, then the fourth input argument (routine_create) 15630de9b25SBarry Smith is ignored. 15730de9b25SBarry Smith 15830de9b25SBarry Smith Sample usage: 15930de9b25SBarry Smith .vb 16030de9b25SBarry Smith PCRegisterDynamic("my_solver","/home/username/my_lib/lib/libO/solaris/mylib", 16130de9b25SBarry Smith "MySolverCreate",MySolverCreate); 16230de9b25SBarry Smith .ve 16330de9b25SBarry Smith 16430de9b25SBarry Smith Then, your solver can be chosen with the procedural interface via 16530de9b25SBarry Smith $ PCSetType(pc,"my_solver") 16630de9b25SBarry Smith or at runtime via the option 16730de9b25SBarry Smith $ -pc_type my_solver 16830de9b25SBarry Smith 16930de9b25SBarry Smith Level: advanced 17030de9b25SBarry Smith 171ab901514SBarry Smith Notes: ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR}, or ${any environmental variable} 17230de9b25SBarry Smith occuring in pathname will be replaced with appropriate values. 17330de9b25SBarry Smith If your function is not being put into a shared library then use PCRegister() instead 17430de9b25SBarry Smith 17530de9b25SBarry Smith .keywords: PC, register 17630de9b25SBarry Smith 17730de9b25SBarry Smith .seealso: PCRegisterAll(), PCRegisterDestroy() 17830de9b25SBarry Smith M*/ 179aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 180f1af5d2fSBarry Smith #define PCRegisterDynamic(a,b,c,d) PCRegister(a,b,c,0) 1816df38c32SLois Curfman McInnes #else 182f1af5d2fSBarry Smith #define PCRegisterDynamic(a,b,c,d) PCRegister(a,b,c,d) 1836df38c32SLois Curfman McInnes #endif 1846df38c32SLois Curfman McInnes 185cd8bf0efSSatish Balay extern PetscErrorCode PCReset(PC); 186fcfd50ebSBarry Smith extern PetscErrorCode PCDestroy(PC*); 1877087cfbeSBarry Smith extern PetscErrorCode PCSetFromOptions(PC); 1887087cfbeSBarry Smith extern PetscErrorCode PCGetType(PC,const PCType*); 18914c91fddSBarry Smith 1907087cfbeSBarry Smith extern PetscErrorCode PCFactorGetMatrix(PC,Mat*); 1917087cfbeSBarry Smith extern PetscErrorCode PCSetModifySubMatrices(PC,PetscErrorCode(*)(PC,PetscInt,const IS[],const IS[],Mat[],void*),void*); 1927087cfbeSBarry Smith extern PetscErrorCode PCModifySubMatrices(PC,PetscInt,const IS[],const IS[],Mat[],void*); 1935b116368SBarry Smith 1947087cfbeSBarry Smith extern PetscErrorCode PCSetOperators(PC,Mat,Mat,MatStructure); 1957087cfbeSBarry Smith extern PetscErrorCode PCGetOperators(PC,Mat*,Mat*,MatStructure*); 1967087cfbeSBarry Smith extern PetscErrorCode PCGetOperatorsSet(PC,PetscBool *,PetscBool *); 1974b0e389bSBarry Smith 1987087cfbeSBarry Smith extern PetscErrorCode PCView(PC,PetscViewer); 1997bc3d0afSSatish Balay 2007087cfbeSBarry Smith extern PetscErrorCode PCSetOptionsPrefix(PC,const char[]); 2017087cfbeSBarry Smith extern PetscErrorCode PCAppendOptionsPrefix(PC,const char[]); 2027087cfbeSBarry Smith extern PetscErrorCode PCGetOptionsPrefix(PC,const char*[]); 2038ed539a5SBarry Smith 2047087cfbeSBarry Smith extern PetscErrorCode PCComputeExplicitOperator(PC,Mat*); 20571601f6fSBarry Smith 206d6913704SBarry Smith /* 207d6913704SBarry Smith These are used to provide extra scaling of preconditioned 2080f3b3ca1SHong Zhang operator for time-stepping schemes like in SUNDIALS 209d6913704SBarry Smith */ 2107087cfbeSBarry Smith extern PetscErrorCode PCGetDiagonalScale(PC,PetscBool *); 2117087cfbeSBarry Smith extern PetscErrorCode PCDiagonalScaleLeft(PC,Vec,Vec); 2127087cfbeSBarry Smith extern PetscErrorCode PCDiagonalScaleRight(PC,Vec,Vec); 2137087cfbeSBarry Smith extern PetscErrorCode PCSetDiagonalScale(PC,Vec); 214d6913704SBarry Smith 21584cb2905SBarry Smith /* ------------- options specific to particular preconditioners --------- */ 216329f5518SBarry Smith 2177087cfbeSBarry Smith extern PetscErrorCode PCJacobiSetUseRowMax(PC); 2187087cfbeSBarry Smith extern PetscErrorCode PCJacobiSetUseRowSum(PC); 2197087cfbeSBarry Smith extern PetscErrorCode PCJacobiSetUseAbs(PC); 2207087cfbeSBarry Smith extern PetscErrorCode PCSORSetSymmetric(PC,MatSORType); 2217087cfbeSBarry Smith extern PetscErrorCode PCSORSetOmega(PC,PetscReal); 2227087cfbeSBarry Smith extern PetscErrorCode PCSORSetIterations(PC,PetscInt,PetscInt); 223d03aef70SBarry Smith 2247087cfbeSBarry Smith extern PetscErrorCode PCEisenstatSetOmega(PC,PetscReal); 2257087cfbeSBarry Smith extern PetscErrorCode PCEisenstatNoDiagonalScaling(PC); 226421c37bdSBarry Smith 22715aa81f8SBarry Smith #define USE_PRECONDITIONER_MATRIX 0 22815aa81f8SBarry Smith #define USE_TRUE_MATRIX 1 2297087cfbeSBarry Smith extern PetscErrorCode PCBJacobiSetUseTrueLocal(PC); 2307087cfbeSBarry Smith extern PetscErrorCode PCBJacobiSetTotalBlocks(PC,PetscInt,const PetscInt[]); 2317087cfbeSBarry Smith extern PetscErrorCode PCBJacobiSetLocalBlocks(PC,PetscInt,const PetscInt[]); 2321eb62cbbSBarry Smith 2337087cfbeSBarry Smith extern PetscErrorCode PCKSPSetUseTrue(PC); 234981c4779SBarry Smith 2357087cfbeSBarry Smith extern PetscErrorCode PCShellSetApply(PC,PetscErrorCode (*)(PC,Vec,Vec)); 2367087cfbeSBarry Smith extern PetscErrorCode PCShellSetApplyBA(PC,PetscErrorCode (*)(PC,PCSide,Vec,Vec,Vec)); 2377087cfbeSBarry Smith extern PetscErrorCode PCShellSetApplyTranspose(PC,PetscErrorCode (*)(PC,Vec,Vec)); 2387087cfbeSBarry Smith extern PetscErrorCode PCShellSetSetUp(PC,PetscErrorCode (*)(PC)); 2397087cfbeSBarry Smith extern PetscErrorCode PCShellSetApplyRichardson(PC,PetscErrorCode (*)(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*)); 2407087cfbeSBarry Smith extern PetscErrorCode PCShellSetView(PC,PetscErrorCode (*)(PC,PetscViewer)); 2416bf464f9SBarry Smith extern PetscErrorCode PCShellSetDestroy(PC,PetscErrorCode (*)(PC)); 2427087cfbeSBarry Smith extern PetscErrorCode PCShellGetContext(PC,void**); 2437087cfbeSBarry Smith extern PetscErrorCode PCShellSetContext(PC,void*); 2447087cfbeSBarry Smith extern PetscErrorCode PCShellSetName(PC,const char[]); 245ccaf0856SBarry Smith extern PetscErrorCode PCShellGetName(PC,const char*[]); 246aabeff55SBarry Smith 2477087cfbeSBarry Smith extern PetscErrorCode PCFactorSetZeroPivot(PC,PetscReal); 248d90ac83dSHong Zhang 2497087cfbeSBarry Smith extern PetscErrorCode PCFactorSetShiftType(PC,MatFactorShiftType); 2507087cfbeSBarry Smith extern PetscErrorCode PCFactorSetShiftAmount(PC,PetscReal); 251d90ac83dSHong Zhang 2527087cfbeSBarry Smith extern PetscErrorCode PCFactorSetMatSolverPackage(PC,const MatSolverPackage); 2537087cfbeSBarry Smith extern PetscErrorCode PCFactorGetMatSolverPackage(PC,const MatSolverPackage*); 254f8260c8fSBarry Smith extern PetscErrorCode PCFactorSetUpMatSolverPackage(PC); 2552401956bSBarry Smith 2567087cfbeSBarry Smith extern PetscErrorCode PCFactorSetFill(PC,PetscReal); 2577087cfbeSBarry Smith extern PetscErrorCode PCFactorSetColumnPivot(PC,PetscReal); 2587087cfbeSBarry Smith extern PetscErrorCode PCFactorReorderForNonzeroDiagonal(PC,PetscReal); 259421c37bdSBarry Smith 2607087cfbeSBarry Smith extern PetscErrorCode PCFactorSetMatOrderingType(PC,const MatOrderingType); 2617087cfbeSBarry Smith extern PetscErrorCode PCFactorSetReuseOrdering(PC,PetscBool ); 2627087cfbeSBarry Smith extern PetscErrorCode PCFactorSetReuseFill(PC,PetscBool ); 2637087cfbeSBarry Smith extern PetscErrorCode PCFactorSetUseInPlace(PC); 2647087cfbeSBarry Smith extern PetscErrorCode PCFactorSetAllowDiagonalFill(PC); 2657087cfbeSBarry Smith extern PetscErrorCode PCFactorSetPivotInBlocks(PC,PetscBool ); 266f5a88c2aSLois Curfman McInnes 2677087cfbeSBarry Smith extern PetscErrorCode PCFactorSetLevels(PC,PetscInt); 2687087cfbeSBarry Smith extern PetscErrorCode PCFactorSetDropTolerance(PC,PetscReal,PetscReal,PetscInt); 269b35a507dSBarry Smith 2707087cfbeSBarry Smith extern PetscErrorCode PCASMSetLocalSubdomains(PC,PetscInt,IS[],IS[]); 2717087cfbeSBarry Smith extern PetscErrorCode PCASMSetTotalSubdomains(PC,PetscInt,IS[],IS[]); 2727087cfbeSBarry Smith extern PetscErrorCode PCASMSetOverlap(PC,PetscInt); 2737087cfbeSBarry Smith extern PetscErrorCode PCASMSetSortIndices(PC,PetscBool ); 274f746d493SDmitry Karpeev 2753d957683SBarry Smith /*E 2763d957683SBarry Smith PCASMType - Type of additive Schwarz method to use 2773d957683SBarry Smith 278feb221f8SDmitry Karpeev $ PC_ASM_BASIC - Symmetric version where residuals from the ghost points are used 279feb221f8SDmitry Karpeev $ and computed values in ghost regions are added together. 280feb221f8SDmitry Karpeev $ Classical standard additive Schwarz. 281feb221f8SDmitry Karpeev $ PC_ASM_RESTRICT - Residuals from ghost points are used but computed values in ghost 282feb221f8SDmitry Karpeev $ region are discarded. 283feb221f8SDmitry Karpeev $ Default. 284feb221f8SDmitry Karpeev $ PC_ASM_INTERPOLATE - Residuals from ghost points are not used, computed values in ghost 285feb221f8SDmitry Karpeev $ region are added back in. 286feb221f8SDmitry Karpeev $ PC_ASM_NONE - Residuals from ghost points are not used, computed ghost values are 287feb221f8SDmitry Karpeev $ discarded. 288feb221f8SDmitry Karpeev $ Not very good. 2893d957683SBarry Smith 2903d957683SBarry Smith Level: beginner 2913d957683SBarry Smith 2923d957683SBarry Smith .seealso: PCASMSetType() 2933d957683SBarry Smith E*/ 294d252947aSBarry Smith typedef enum {PC_ASM_BASIC = 3,PC_ASM_RESTRICT = 1,PC_ASM_INTERPOLATE = 2,PC_ASM_NONE = 0} PCASMType; 2959dcbbd2bSBarry Smith extern const char *PCASMTypes[]; 2969dcbbd2bSBarry Smith 2977087cfbeSBarry Smith extern PetscErrorCode PCASMSetType(PC,PCASMType); 2987087cfbeSBarry Smith extern PetscErrorCode PCASMCreateSubdomains(Mat,PetscInt,IS*[]); 2997087cfbeSBarry Smith extern PetscErrorCode PCASMDestroySubdomains(PetscInt,IS[],IS[]); 3007087cfbeSBarry Smith extern PetscErrorCode PCASMCreateSubdomains2D(PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,IS**,IS**); 3017087cfbeSBarry Smith extern PetscErrorCode PCASMGetLocalSubdomains(PC,PetscInt*,IS*[],IS*[]); 3027087cfbeSBarry Smith extern PetscErrorCode PCASMGetLocalSubmatrices(PC,PetscInt*,Mat*[]); 303981c4779SBarry Smith 3043d957683SBarry Smith /*E 305f746d493SDmitry Karpeev PCGASMType - Type of generalized additive Schwarz method to use (differs from ASM in allowing multiple processors per domain) 306f746d493SDmitry Karpeev 307feb221f8SDmitry Karpeev $ PC_GASM_BASIC - Symmetric version where residuals from the ghost points are used 308feb221f8SDmitry Karpeev $ and computed values in ghost regions are added together. 309feb221f8SDmitry Karpeev $ Classical standard additive Schwarz. 310feb221f8SDmitry Karpeev $ PC_GASM_RESTRICT - Residuals from ghost points are used but computed values in ghost 311feb221f8SDmitry Karpeev $ region are discarded. 312feb221f8SDmitry Karpeev $ Default. 313feb221f8SDmitry Karpeev $ PC_GASM_INTERPOLATE - Residuals from ghost points are not used, computed values in ghost 314feb221f8SDmitry Karpeev $ region are added back in. 315feb221f8SDmitry Karpeev $ PC_GASM_NONE - Residuals from ghost points are not used, computed ghost values are 316feb221f8SDmitry Karpeev $ discarded. 317feb221f8SDmitry Karpeev $ Not very good. 318f746d493SDmitry Karpeev 319f746d493SDmitry Karpeev Level: beginner 320f746d493SDmitry Karpeev 321f746d493SDmitry Karpeev .seealso: PCGASMSetType() 322f746d493SDmitry Karpeev E*/ 323f746d493SDmitry Karpeev typedef enum {PC_GASM_BASIC = 3,PC_GASM_RESTRICT = 1,PC_GASM_INTERPOLATE = 2,PC_GASM_NONE = 0} PCGASMType; 324f746d493SDmitry Karpeev extern const char *PCGASMTypes[]; 325f746d493SDmitry Karpeev 32606b43e7eSDmitry Karpeev extern PetscErrorCode PCGASMSetSubdomains(PC,PetscInt,IS[],IS[]); 32709d011a0SDmitry Karpeev extern PetscErrorCode PCGASMSetTotalBlockCount(PC,PetscInt); 3287087cfbeSBarry Smith extern PetscErrorCode PCGASMSetOverlap(PC,PetscInt); 3297087cfbeSBarry Smith extern PetscErrorCode PCGASMSetSortIndices(PC,PetscBool ); 330f746d493SDmitry Karpeev 3317087cfbeSBarry Smith extern PetscErrorCode PCGASMSetType(PC,PCGASMType); 33206b43e7eSDmitry Karpeev extern PetscErrorCode PCGASMCreateLocalSubdomains(Mat,PetscInt,IS*[],IS*[]); 3337087cfbeSBarry Smith extern PetscErrorCode PCGASMDestroySubdomains(PetscInt,IS[],IS[]); 3347087cfbeSBarry Smith extern PetscErrorCode PCGASMCreateSubdomains2D(PC,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,IS**,IS**); 33506b43e7eSDmitry Karpeev extern PetscErrorCode PCGASMGetSubdomains(PC,PetscInt*,IS*[],IS*[]); 33606b43e7eSDmitry Karpeev extern PetscErrorCode PCGASMGetSubmatrices(PC,PetscInt*,Mat*[]); 337f746d493SDmitry Karpeev 338f746d493SDmitry Karpeev /*E 3393d957683SBarry Smith PCCompositeType - Determines how two or more preconditioner are composed 3403d957683SBarry Smith 3413d957683SBarry Smith $ PC_COMPOSITE_ADDITIVE - results from application of all preconditioners are added together 3423d957683SBarry Smith $ PC_COMPOSITE_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly 3433d957683SBarry Smith $ computed after the previous preconditioner application 344ccb205f8SBarry Smith $ PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly 345ccb205f8SBarry Smith $ computed from first preconditioner to last and then back (Use only for symmetric matrices and preconditions) 3463d957683SBarry Smith $ PC_COMPOSITE_SPECIAL - This is very special for a matrix of the form alpha I + R + S 3473d957683SBarry Smith $ where first preconditioner is built from alpha I + S and second from 3483d957683SBarry Smith $ alpha I + R 3493d957683SBarry Smith 3503d957683SBarry Smith Level: beginner 3513d957683SBarry Smith 3523d957683SBarry Smith .seealso: PCCompositeSetType() 3533d957683SBarry Smith E*/ 3543b224e63SBarry Smith typedef enum {PC_COMPOSITE_ADDITIVE,PC_COMPOSITE_MULTIPLICATIVE,PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE,PC_COMPOSITE_SPECIAL,PC_COMPOSITE_SCHUR} PCCompositeType; 3559dcbbd2bSBarry Smith extern const char *PCCompositeTypes[]; 3569dcbbd2bSBarry Smith 3577087cfbeSBarry Smith extern PetscErrorCode PCCompositeSetUseTrue(PC); 3587087cfbeSBarry Smith extern PetscErrorCode PCCompositeSetType(PC,PCCompositeType); 3597087cfbeSBarry Smith extern PetscErrorCode PCCompositeAddPC(PC,PCType); 3607087cfbeSBarry Smith extern PetscErrorCode PCCompositeGetPC(PC,PetscInt,PC *); 3617087cfbeSBarry Smith extern PetscErrorCode PCCompositeSpecialSetAlpha(PC,PetscScalar); 362981c4779SBarry Smith 3637087cfbeSBarry Smith extern PetscErrorCode PCRedundantSetNumber(PC,PetscInt); 3647087cfbeSBarry Smith extern PetscErrorCode PCRedundantSetScatter(PC,VecScatter,VecScatter); 3657087cfbeSBarry Smith extern PetscErrorCode PCRedundantGetOperators(PC,Mat*,Mat*); 366da3a660dSBarry Smith 3677087cfbeSBarry Smith extern PetscErrorCode PCSPAISetEpsilon(PC,double); 3687087cfbeSBarry Smith extern PetscErrorCode PCSPAISetNBSteps(PC,PetscInt); 3697087cfbeSBarry Smith extern PetscErrorCode PCSPAISetMax(PC,PetscInt); 3707087cfbeSBarry Smith extern PetscErrorCode PCSPAISetMaxNew(PC,PetscInt); 3717087cfbeSBarry Smith extern PetscErrorCode PCSPAISetBlockSize(PC,PetscInt); 3727087cfbeSBarry Smith extern PetscErrorCode PCSPAISetCacheSize(PC,PetscInt); 3737087cfbeSBarry Smith extern PetscErrorCode PCSPAISetVerbose(PC,PetscInt); 3747087cfbeSBarry Smith extern PetscErrorCode PCSPAISetSp(PC,PetscInt); 3753304466cSBarry Smith 3767087cfbeSBarry Smith extern PetscErrorCode PCHYPRESetType(PC,const char[]); 3777087cfbeSBarry Smith extern PetscErrorCode PCHYPREGetType(PC,const char*[]); 3787087cfbeSBarry Smith extern PetscErrorCode PCBJacobiGetLocalBlocks(PC,PetscInt*,const PetscInt*[]); 3797087cfbeSBarry Smith extern PetscErrorCode PCBJacobiGetTotalBlocks(PC,PetscInt*,const PetscInt*[]); 3803304466cSBarry Smith 3815d4c12cdSJungho Lee extern PetscErrorCode PCFieldSplitSetFields(PC,const char[],PetscInt,const PetscInt*,const PetscInt*); 3827087cfbeSBarry Smith extern PetscErrorCode PCFieldSplitSetType(PC,PCCompositeType); 3837087cfbeSBarry Smith extern PetscErrorCode PCFieldSplitSetBlockSize(PC,PetscInt); 3847087cfbeSBarry Smith extern PetscErrorCode PCFieldSplitSetIS(PC,const char[],IS); 38557a9adfeSMatthew G Knepley extern PetscErrorCode PCFieldSplitGetIS(PC,const char[],IS*); 386084e4875SJed Brown 387084e4875SJed Brown /*E 388084e4875SJed Brown PCFieldSplitSchurPreType - Determines how to precondition Schur complement 389084e4875SJed Brown 390084e4875SJed Brown Level: intermediate 391084e4875SJed Brown 392084e4875SJed Brown .seealso: PCFieldSplitSchurPrecondition() 393084e4875SJed Brown E*/ 394084e4875SJed Brown typedef enum {PC_FIELDSPLIT_SCHUR_PRE_SELF,PC_FIELDSPLIT_SCHUR_PRE_DIAG,PC_FIELDSPLIT_SCHUR_PRE_USER} PCFieldSplitSchurPreType; 395f7c28744SJed Brown extern const char *const PCFieldSplitSchurPreTypes[]; 396084e4875SJed Brown 397ab1df9f5SJed Brown /*E 398c9c6ffaaSJed Brown PCFieldSplitSchurFactType - determines which off-diagonal parts of the approximate block factorization to use 399ab1df9f5SJed Brown 400ab1df9f5SJed Brown Level: intermediate 401ab1df9f5SJed Brown 402c9c6ffaaSJed Brown .seealso: PCFieldSplitSetSchurFactType() 403ab1df9f5SJed Brown E*/ 404ab1df9f5SJed Brown typedef enum { 405c9c6ffaaSJed Brown PC_FIELDSPLIT_SCHUR_FACT_DIAG, 406c9c6ffaaSJed Brown PC_FIELDSPLIT_SCHUR_FACT_LOWER, 407c9c6ffaaSJed Brown PC_FIELDSPLIT_SCHUR_FACT_UPPER, 408c9c6ffaaSJed Brown PC_FIELDSPLIT_SCHUR_FACT_FULL 409c9c6ffaaSJed Brown } PCFieldSplitSchurFactType; 410c9c6ffaaSJed Brown extern const char *const PCFieldSplitSchurFactTypes[]; 411ab1df9f5SJed Brown 4127087cfbeSBarry Smith extern PetscErrorCode PCFieldSplitSchurPrecondition(PC,PCFieldSplitSchurPreType,Mat); 413c9c6ffaaSJed Brown extern PetscErrorCode PCFieldSplitSetSchurFactType(PC,PCFieldSplitSchurFactType); 4147087cfbeSBarry Smith extern PetscErrorCode PCFieldSplitGetSchurBlocks(PC,Mat*,Mat*,Mat*,Mat*); 4153d30b1ffSBarry Smith 4167087cfbeSBarry Smith extern PetscErrorCode PCGalerkinSetRestriction(PC,Mat); 4177087cfbeSBarry Smith extern PetscErrorCode PCGalerkinSetInterpolation(PC,Mat); 4182a6744ebSBarry Smith 419302f38e8SMark F. Adams extern PetscErrorCode PCSetCoordinates(PC,PetscInt,PetscInt,PetscReal*); 4207087cfbeSBarry Smith extern PetscErrorCode PCSASetVectors(PC,PetscInt,PetscReal *); 4212102ba4dSSatish Balay 4227087cfbeSBarry Smith extern PetscErrorCode PCPythonSetType(PC,const char[]); 42367fac13cSBarry Smith 4247087cfbeSBarry Smith extern PetscErrorCode PCSetDM(PC,DM); 4257087cfbeSBarry Smith extern PetscErrorCode PCGetDM(PC,DM*); 4266c699258SBarry Smith 4271b2093e4SBarry Smith extern PetscErrorCode PCSetApplicationContext(PC,void*); 4281b2093e4SBarry Smith extern PetscErrorCode PCGetApplicationContext(PC,void*); 4291b2093e4SBarry Smith 4308154be41SBarry Smith extern PetscErrorCode PCBiCGStabCUSPSetTolerance(PC,PetscReal); 4313d740270SVictor Minden extern PetscErrorCode PCBiCGStabCUSPSetIterations(PC,PetscInt); 4323d740270SVictor Minden extern PetscErrorCode PCBiCGStabCUSPSetUseVerboseMonitor(PC,PetscBool); 4336c699258SBarry Smith 4346de8952cSVictor Minden extern PetscErrorCode PCAINVCUSPSetDropTolerance(PC,PetscReal); 4356de8952cSVictor Minden extern PetscErrorCode PCAINVCUSPUseScaling(PC,PetscBool); 4366de8952cSVictor Minden extern PetscErrorCode PCAINVCUSPSetNonzeros(PC,PetscInt); 437adbda850SVictor Minden extern PetscErrorCode PCAINVCUSPSetLinParameter(PC,PetscInt); 43837f80224SJose E. Roman /*E 43937f80224SJose E. Roman PCPARMSGlobalType - Determines the global preconditioner method in PARMS 44037f80224SJose E. Roman 44137f80224SJose E. Roman Level: intermediate 44237f80224SJose E. Roman 44337f80224SJose E. Roman .seealso: PCPARMSSetGlobal() 44437f80224SJose E. Roman E*/ 44537f80224SJose E. Roman typedef enum {PC_PARMS_GLOBAL_RAS,PC_PARMS_GLOBAL_SCHUR,PC_PARMS_GLOBAL_BJ} PCPARMSGlobalType; 44637f80224SJose E. Roman extern const char *PCPARMSGlobalTypes[]; 44737f80224SJose E. Roman /*E 44837f80224SJose E. Roman PCPARMSLocalType - Determines the local preconditioner method in PARMS 44937f80224SJose E. Roman 45037f80224SJose E. Roman Level: intermediate 45137f80224SJose E. Roman 45237f80224SJose E. Roman .seealso: PCPARMSSetLocal() 45337f80224SJose E. Roman E*/ 45437f80224SJose E. Roman typedef enum {PC_PARMS_LOCAL_ILU0,PC_PARMS_LOCAL_ILUK,PC_PARMS_LOCAL_ILUT,PC_PARMS_LOCAL_ARMS} PCPARMSLocalType; 45537f80224SJose E. Roman extern const char *PCPARMSLocalTypes[]; 45637f80224SJose E. Roman 45737f80224SJose E. Roman extern PetscErrorCode PCPARMSSetGlobal(PC pc,PCPARMSGlobalType type); 45837f80224SJose E. Roman extern PetscErrorCode PCPARMSSetLocal(PC pc,PCPARMSLocalType type); 45937f80224SJose E. Roman extern PetscErrorCode PCPARMSSetSolveTolerances(PC pc,PetscReal tol,PetscInt maxits); 46037f80224SJose E. Roman extern PetscErrorCode PCPARMSSetSolveRestart(PC pc,PetscInt restart); 46137f80224SJose E. Roman extern PetscErrorCode PCPARMSSetNonsymPerm(PC pc,PetscBool nonsym); 46237f80224SJose E. Roman extern PetscErrorCode PCPARMSSetFill(PC pc,PetscInt lfil0,PetscInt lfil1,PetscInt lfil2); 46337f80224SJose E. Roman 46456de70efSSatish Balay extern PetscErrorCode PCGAMGSetProcEqLim(PC,PetscInt); 4658263b398SMark F. Adams extern PetscErrorCode PCGAMGSetRepartitioning(PC,PetscBool); 466ffc955d6SMark F. Adams extern PetscErrorCode PCGAMGSetUseASMAggs(PC,PetscBool); 46756de70efSSatish Balay extern PetscErrorCode PCGAMGSetSolverType(PC,char[],PetscInt); 4683542efc5SMark F. Adams extern PetscErrorCode PCGAMGSetThreshold(PC,PetscReal); 469389730f3SMark F. Adams extern PetscErrorCode PCGAMGSetCoarseEqLim(PC,PetscInt); 4704ef23d27SMark F. Adams extern PetscErrorCode PCGAMGSetNlevels(PC,PetscInt); 47152284f78SMark F. Adams #define PCGAMGType char* 47252284f78SMark F. Adams extern PetscErrorCode PCGAMGSetType( PC,const PCGAMGType ); 47352284f78SMark F. Adams extern PetscErrorCode PCGAMGSetNSmooths(PC pc, PetscInt n); 474c8b0795cSMark F. Adams extern PetscErrorCode PCGAMGSetSymGraph(PC pc, PetscBool n); 4758da76f4bSJed Brown extern PetscErrorCode PCGAMGSetSquareGraph(PC,PetscBool); 47656de70efSSatish Balay 4770c7d97c5SJed Brown #if defined(PETSC_HAVE_PCBDDC) 47853cdbc3dSStefano Zampini /* Enum defining how to treat the coarse problem */ 4790c7d97c5SJed Brown typedef enum {SEQUENTIAL_BDDC,REPLICATED_BDDC,PARALLEL_BDDC,MULTILEVEL_BDDC} CoarseProblemType; 4803b03a366Sstefano_zampini extern PetscErrorCode PCBDDCSetDirichletBoundaries(PC,IS); 48153cdbc3dSStefano Zampini extern PetscErrorCode PCBDDCSetNeumannBoundaries(PC,IS); 48253cdbc3dSStefano Zampini extern PetscErrorCode PCBDDCGetNeumannBoundaries(PC,IS*); 4830c7d97c5SJed Brown extern PetscErrorCode PCBDDCSetCoarseProblemType(PC,CoarseProblemType); 4849c0446d6SStefano Zampini extern PetscErrorCode PCBDDCSetDofsSplitting(PC,PetscInt,IS[]); 4850c7d97c5SJed Brown #endif 4860c7d97c5SJed Brown 487*831a100dSStefano Zampini extern PetscErrorCode PCISSetSubdomainScalingFactor(PC,PetscScalar); 488*831a100dSStefano Zampini 489e9fa29b7SSatish Balay PETSC_EXTERN_CXX_END 490d3b1e0e7SMatthew Knepley 491123ea438SMatthew Knepley #endif /* __PETSCPC_H */ 492