1 #if !defined(_PETSCPCTYPES_H) 2 #define _PETSCPCTYPES_H 3 4 #include <petscdmtypes.h> 5 6 /*S 7 PC - Abstract PETSc object that manages all preconditioners including direct solvers such as PCLU 8 9 Level: beginner 10 11 Concepts: preconditioners 12 13 .seealso: PCCreate(), PCSetType(), PCType (for list of available types) 14 S*/ 15 typedef struct _p_PC* PC; 16 17 /*J 18 PCType - String with the name of a PETSc preconditioner method. 19 20 Level: beginner 21 22 Notes: 23 Click on the links above to see details on a particular solver 24 25 PCRegister() is used to register preconditioners that are then accessible via PCSetType() 26 27 .seealso: PCSetType(), PC, PCCreate(), PCRegister(), PCSetFromOptions() 28 J*/ 29 typedef const char* PCType; 30 #define PCNONE "none" 31 #define PCJACOBI "jacobi" 32 #define PCSOR "sor" 33 #define PCLU "lu" 34 #define PCSHELL "shell" 35 #define PCBJACOBI "bjacobi" 36 #define PCMG "mg" 37 #define PCEISENSTAT "eisenstat" 38 #define PCILU "ilu" 39 #define PCICC "icc" 40 #define PCASM "asm" 41 #define PCGASM "gasm" 42 #define PCKSP "ksp" 43 #define PCCOMPOSITE "composite" 44 #define PCREDUNDANT "redundant" 45 #define PCSPAI "spai" 46 #define PCNN "nn" 47 #define PCCHOLESKY "cholesky" 48 #define PCPBJACOBI "pbjacobi" 49 #define PCMAT "mat" 50 #define PCHYPRE "hypre" 51 #define PCPARMS "parms" 52 #define PCFIELDSPLIT "fieldsplit" 53 #define PCTFS "tfs" 54 #define PCML "ml" 55 #define PCGALERKIN "galerkin" 56 #define PCEXOTIC "exotic" 57 #define PCCP "cp" 58 #define PCBFBT "bfbt" 59 #define PCLSC "lsc" 60 #define PCPYTHON "python" 61 #define PCPFMG "pfmg" 62 #define PCSYSPFMG "syspfmg" 63 #define PCREDISTRIBUTE "redistribute" 64 #define PCSVD "svd" 65 #define PCGAMG "gamg" 66 #define PCCHOWILUVIENNACL "chowiluviennacl" 67 #define PCROWSCALINGVIENNACL "rowscalingviennacl" 68 #define PCSAVIENNACL "saviennacl" 69 #define PCBDDC "bddc" 70 #define PCKACZMARZ "kaczmarz" 71 #define PCTELESCOPE "telescope" 72 #define PCLMVM "lmvm" 73 74 /*E 75 PCSide - If the preconditioner is to be applied to the left, right 76 or symmetrically around the operator. 77 78 Level: beginner 79 80 .seealso: 81 E*/ 82 typedef enum { PC_SIDE_DEFAULT=-1,PC_LEFT,PC_RIGHT,PC_SYMMETRIC} PCSide; 83 #define PC_SIDE_MAX (PC_SYMMETRIC + 1) 84 PETSC_EXTERN const char *const *const PCSides; 85 86 /*E 87 PCRichardsonConvergedReason - reason a PCApplyRichardson method terminates 88 89 Level: advanced 90 91 Notes: 92 this must match petsc/finclude/petscpc.h and the KSPConvergedReason values in petscksp.h 93 94 .seealso: PCApplyRichardson() 95 E*/ 96 typedef enum { 97 PCRICHARDSON_CONVERGED_RTOL = 2, 98 PCRICHARDSON_CONVERGED_ATOL = 3, 99 PCRICHARDSON_CONVERGED_ITS = 4, 100 PCRICHARDSON_DIVERGED_DTOL = -4} PCRichardsonConvergedReason; 101 102 /*E 103 PCJacobiType - What elements are used to form the Jacobi preconditioner 104 105 Level: intermediate 106 107 .seealso: 108 E*/ 109 typedef enum { PC_JACOBI_DIAGONAL,PC_JACOBI_ROWMAX,PC_JACOBI_ROWSUM} PCJacobiType; 110 PETSC_EXTERN const char *const PCJacobiTypes[]; 111 112 /*E 113 PCASMType - Type of additive Schwarz method to use 114 115 $ PC_ASM_BASIC - Symmetric version where residuals from the ghost points are used 116 $ and computed values in ghost regions are added together. 117 $ Classical standard additive Schwarz. 118 $ PC_ASM_RESTRICT - Residuals from ghost points are used but computed values in ghost 119 $ region are discarded. 120 $ Default. 121 $ PC_ASM_INTERPOLATE - Residuals from ghost points are not used, computed values in ghost 122 $ region are added back in. 123 $ PC_ASM_NONE - Residuals from ghost points are not used, computed ghost values are 124 $ discarded. 125 $ Not very good. 126 127 Level: beginner 128 129 .seealso: PCASMSetType() 130 E*/ 131 typedef enum {PC_ASM_BASIC = 3,PC_ASM_RESTRICT = 1,PC_ASM_INTERPOLATE = 2,PC_ASM_NONE = 0} PCASMType; 132 PETSC_EXTERN const char *const PCASMTypes[]; 133 134 /*E 135 PCGASMType - Type of generalized additive Schwarz method to use (differs from ASM in allowing multiple processors per subdomain). 136 137 Each subdomain has nested inner and outer parts. The inner subdomains are assumed to form a non-overlapping covering of the computational 138 domain, while the outer subdomains contain the inner subdomains and overlap with each other. This preconditioner will compute 139 a subdomain correction over each *outer* subdomain from a residual computed there, but its different variants will differ in 140 (a) how the outer subdomain residual is computed, and (b) how the outer subdomain correction is computed. 141 142 $ PC_GASM_BASIC - Symmetric version where the full from the outer subdomain is used, and the resulting correction is applied 143 $ over the outer subdomains. As a result, points in the overlap will receive the sum of the corrections 144 $ from neighboring subdomains. 145 $ Classical standard additive Schwarz. 146 $ PC_GASM_RESTRICT - Residual from the outer subdomain is used but the correction is restricted to the inner subdomain only 147 $ (i.e., zeroed out over the overlap portion of the outer subdomain before being applied). As a result, 148 $ each point will receive a correction only from the unique inner subdomain containing it (nonoverlapping covering 149 $ assumption). 150 $ Default. 151 $ PC_GASM_INTERPOLATE - Residual is zeroed out over the overlap portion of the outer subdomain, but the resulting correction is 152 $ applied over the outer subdomain. As a result, points in the overlap will receive the sum of the corrections 153 $ from neighboring subdomains. 154 $ 155 $ PC_GASM_NONE - Residuals and corrections are zeroed out outside the local subdomains. 156 $ Not very good. 157 158 Level: beginner 159 160 .seealso: PCGASMSetType() 161 E*/ 162 typedef enum {PC_GASM_BASIC = 3,PC_GASM_RESTRICT = 1,PC_GASM_INTERPOLATE = 2,PC_GASM_NONE = 0} PCGASMType; 163 PETSC_EXTERN const char *const PCGASMTypes[]; 164 165 /*E 166 PCCompositeType - Determines how two or more preconditioner are composed 167 168 $ PC_COMPOSITE_ADDITIVE - results from application of all preconditioners are added together 169 $ PC_COMPOSITE_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly 170 $ computed after the previous preconditioner application 171 $ PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly 172 $ computed from first preconditioner to last and then back (Use only for symmetric matrices and preconditioners) 173 $ PC_COMPOSITE_SPECIAL - This is very special for a matrix of the form alpha I + R + S 174 $ where first preconditioner is built from alpha I + S and second from 175 $ alpha I + R 176 177 Level: beginner 178 179 .seealso: PCCompositeSetType() 180 E*/ 181 typedef enum {PC_COMPOSITE_ADDITIVE,PC_COMPOSITE_MULTIPLICATIVE,PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE,PC_COMPOSITE_SPECIAL,PC_COMPOSITE_SCHUR} PCCompositeType; 182 PETSC_EXTERN const char *const PCCompositeTypes[]; 183 184 /*E 185 PCFieldSplitSchurPreType - Determines how to precondition Schur complement 186 187 Level: intermediate 188 189 .seealso: PCFieldSplitSetSchurPre() 190 E*/ 191 typedef enum {PC_FIELDSPLIT_SCHUR_PRE_SELF,PC_FIELDSPLIT_SCHUR_PRE_SELFP,PC_FIELDSPLIT_SCHUR_PRE_A11,PC_FIELDSPLIT_SCHUR_PRE_USER,PC_FIELDSPLIT_SCHUR_PRE_FULL} PCFieldSplitSchurPreType; 192 PETSC_EXTERN const char *const PCFieldSplitSchurPreTypes[]; 193 194 /*E 195 PCFieldSplitSchurFactType - determines which off-diagonal parts of the approximate block factorization to use 196 197 Level: intermediate 198 199 .seealso: PCFieldSplitSetSchurFactType() 200 E*/ 201 typedef enum { 202 PC_FIELDSPLIT_SCHUR_FACT_DIAG, 203 PC_FIELDSPLIT_SCHUR_FACT_LOWER, 204 PC_FIELDSPLIT_SCHUR_FACT_UPPER, 205 PC_FIELDSPLIT_SCHUR_FACT_FULL 206 } PCFieldSplitSchurFactType; 207 PETSC_EXTERN const char *const PCFieldSplitSchurFactTypes[]; 208 209 /*E 210 PCPARMSGlobalType - Determines the global preconditioner method in PARMS 211 212 Level: intermediate 213 214 .seealso: PCPARMSSetGlobal() 215 E*/ 216 typedef enum {PC_PARMS_GLOBAL_RAS,PC_PARMS_GLOBAL_SCHUR,PC_PARMS_GLOBAL_BJ} PCPARMSGlobalType; 217 PETSC_EXTERN const char *const PCPARMSGlobalTypes[]; 218 /*E 219 PCPARMSLocalType - Determines the local preconditioner method in PARMS 220 221 Level: intermediate 222 223 .seealso: PCPARMSSetLocal() 224 E*/ 225 typedef enum {PC_PARMS_LOCAL_ILU0,PC_PARMS_LOCAL_ILUK,PC_PARMS_LOCAL_ILUT,PC_PARMS_LOCAL_ARMS} PCPARMSLocalType; 226 PETSC_EXTERN const char *const PCPARMSLocalTypes[]; 227 228 /*E 229 PCGAMGType - type of generalized algebraic multigrid (PCGAMG) method 230 231 Level: intermediate 232 233 .seealso: PCMG, PCSetType(), PCGAMGSetThreshold(), PCGAMGSetThreshold(), PCGAMGSetReuseInterpolation() 234 E*/ 235 typedef const char *PCGAMGType; 236 #define PCGAMGAGG "agg" 237 #define PCGAMGGEO "geo" 238 #define PCGAMGCLASSICAL "classical" 239 240 typedef const char *PCGAMGClassicalType; 241 #define PCGAMGCLASSICALDIRECT "direct" 242 #define PCGAMGCLASSICALSTANDARD "standard" 243 244 /*E 245 PCMGType - Determines the type of multigrid method that is run. 246 247 Level: beginner 248 249 Values: 250 + PC_MG_MULTIPLICATIVE (default) - traditional V or W cycle as determined by PCMGSetCycleType() 251 . PC_MG_ADDITIVE - the additive multigrid preconditioner where all levels are 252 smoothed before updating the residual. This only uses the 253 down smoother, in the preconditioner the upper smoother is ignored 254 . PC_MG_FULL - same as multiplicative except one also performs grid sequencing, 255 that is starts on the coarsest grid, performs a cycle, interpolates 256 to the next, performs a cycle etc. This is much like the F-cycle presented in "Multigrid" by Trottenberg, Oosterlee, Schuller page 49, but that 257 algorithm supports smoothing on before the restriction on each level in the initial restriction to the coarsest stage. In addition that algorithm 258 calls the V-cycle only on the coarser level and has a post-smoother instead. 259 - PC_MG_KASKADE - like full multigrid except one never goes back to a coarser level 260 from a finer 261 262 .seealso: PCMGSetType(), PCMGSetCycleType(), PCMGSetCycleTypeOnLevel() 263 264 E*/ 265 typedef enum { PC_MG_MULTIPLICATIVE,PC_MG_ADDITIVE,PC_MG_FULL,PC_MG_KASKADE } PCMGType; 266 PETSC_EXTERN const char *const PCMGTypes[]; 267 #define PC_MG_CASCADE PC_MG_KASKADE; 268 269 /*E 270 PCMGCycleType - Use V-cycle or W-cycle 271 272 Level: beginner 273 274 Values: 275 + PC_MG_V_CYCLE 276 - PC_MG_W_CYCLE 277 278 .seealso: PCMGSetCycleType() 279 280 E*/ 281 typedef enum { PC_MG_CYCLE_V = 1,PC_MG_CYCLE_W = 2 } PCMGCycleType; 282 PETSC_EXTERN const char *const PCMGCycleTypes[]; 283 284 /*E 285 PCMGalerkinType - Determines if the coarse grid operators are computed via the Galerkin process 286 287 Level: beginner 288 289 Values: 290 + PC_MG_GALERKIN_PMAT - computes the pmat (matrix from which the preconditioner is built) via the Galerkin process from the finest grid 291 . PC_MG_GALERKIN_MAT - computes the mat (matrix used to apply the operator) via the Galerkin process from the finest grid 292 . PC_MG_GALERKIN_BOTH - computes both the mat and pmat via the Galerkin process (if pmat == mat the construction is only done once 293 - PC_MG_GALERKIN_NONE - neither operator is computed via the Galerkin process, the user must provide the operator 294 295 Users should never set PC_MG_GALERKIN_EXTERNAL, it is used by GAMG and ML 296 297 .seealso: PCMGSetCycleType() 298 299 E*/ 300 typedef enum { PC_MG_GALERKIN_BOTH,PC_MG_GALERKIN_PMAT,PC_MG_GALERKIN_MAT, PC_MG_GALERKIN_NONE, PC_MG_GALERKIN_EXTERNAL} PCMGGalerkinType; 301 PETSC_EXTERN const char *const PCMGGalerkinTypes[]; 302 303 /*E 304 PCExoticType - Face based or wirebasket based coarse grid space 305 306 Level: beginner 307 308 .seealso: PCExoticSetType(), PCEXOTIC 309 E*/ 310 typedef enum { PC_EXOTIC_FACE,PC_EXOTIC_WIREBASKET } PCExoticType; 311 PETSC_EXTERN const char *const PCExoticTypes[]; 312 PETSC_EXTERN PetscErrorCode PCExoticSetType(PC,PCExoticType); 313 314 /*E 315 PCFailedReason - indicates type of PC failure 316 317 Level: beginner 318 319 Any additions/changes here MUST also be made in include/petsc/finclude/petscpc.h 320 E*/ 321 typedef enum {PC_NOERROR,PC_FACTOR_STRUCT_ZEROPIVOT,PC_FACTOR_NUMERIC_ZEROPIVOT,PC_FACTOR_OUTMEMORY,PC_FACTOR_OTHER,PC_SUBPC_ERROR} PCFailedReason; 322 PETSC_EXTERN const char *const PCFailedReasons[]; 323 #endif 324