1 /* 2 Preconditioner module. 3 */ 4 #if !defined(__PETSCPC_H) 5 #define __PETSCPC_H 6 #include <petscmat.h> 7 #include <petscdmtypes.h> 8 9 PETSC_EXTERN PetscErrorCode PCInitializePackage(void); 10 11 /* 12 PCList contains the list of preconditioners currently registered 13 These are added with PCRegister() 14 */ 15 PETSC_EXTERN PetscFunctionList PCList; 16 17 /*S 18 PC - Abstract PETSc object that manages all preconditioners including direct solvers such as PCLU 19 20 Level: beginner 21 22 Concepts: preconditioners 23 24 .seealso: PCCreate(), PCSetType(), PCType (for list of available types) 25 S*/ 26 typedef struct _p_PC* PC; 27 28 /*J 29 PCType - String with the name of a PETSc preconditioner method. 30 31 Level: beginner 32 33 Notes: Click on the links below to see details on a particular solver 34 35 PCRegister() is used to register preconditioners that are then accessible via PCSetType() 36 37 .seealso: PCSetType(), PC, PCCreate(), PCRegister(), PCSetFromOptions() 38 J*/ 39 typedef const char* PCType; 40 #define PCNONE "none" 41 #define PCJACOBI "jacobi" 42 #define PCSOR "sor" 43 #define PCLU "lu" 44 #define PCSHELL "shell" 45 #define PCBJACOBI "bjacobi" 46 #define PCMG "mg" 47 #define PCEISENSTAT "eisenstat" 48 #define PCILU "ilu" 49 #define PCICC "icc" 50 #define PCASM "asm" 51 #define PCGASM "gasm" 52 #define PCKSP "ksp" 53 #define PCCOMPOSITE "composite" 54 #define PCREDUNDANT "redundant" 55 #define PCSPAI "spai" 56 #define PCNN "nn" 57 #define PCCHOLESKY "cholesky" 58 #define PCPBJACOBI "pbjacobi" 59 #define PCMAT "mat" 60 #define PCHYPRE "hypre" 61 #define PCPARMS "parms" 62 #define PCFIELDSPLIT "fieldsplit" 63 #define PCTFS "tfs" 64 #define PCML "ml" 65 #define PCGALERKIN "galerkin" 66 #define PCEXOTIC "exotic" 67 #define PCCP "cp" 68 #define PCBFBT "bfbt" 69 #define PCLSC "lsc" 70 #define PCPYTHON "python" 71 #define PCPFMG "pfmg" 72 #define PCSYSPFMG "syspfmg" 73 #define PCREDISTRIBUTE "redistribute" 74 #define PCSVD "svd" 75 #define PCGAMG "gamg" 76 #define PCSACUSP "sacusp" /* these four run on NVIDIA GPUs using CUSP */ 77 #define PCSACUSPPOLY "sacusppoly" 78 #define PCBICGSTABCUSP "bicgstabcusp" 79 #define PCAINVCUSP "ainvcusp" 80 #define PCBDDC "bddc" 81 #define PCKACZMARZ "kaczmarz" 82 83 /* Logging support */ 84 PETSC_EXTERN PetscClassId PC_CLASSID; 85 86 /*E 87 PCSide - If the preconditioner is to be applied to the left, right 88 or symmetrically around the operator. 89 90 Level: beginner 91 92 .seealso: 93 E*/ 94 typedef enum { PC_SIDE_DEFAULT=-1,PC_LEFT,PC_RIGHT,PC_SYMMETRIC} PCSide; 95 #define PC_SIDE_MAX (PC_SYMMETRIC + 1) 96 PETSC_EXTERN const char *const *const PCSides; 97 98 PETSC_EXTERN PetscErrorCode PCCreate(MPI_Comm,PC*); 99 PETSC_EXTERN PetscErrorCode PCSetType(PC,PCType); 100 PETSC_EXTERN PetscErrorCode PCGetType(PC,PCType*); 101 PETSC_EXTERN PetscErrorCode PCSetUp(PC); 102 PETSC_EXTERN PetscErrorCode PCSetUpOnBlocks(PC); 103 PETSC_EXTERN PetscErrorCode PCApply(PC,Vec,Vec); 104 PETSC_EXTERN PetscErrorCode PCApplySymmetricLeft(PC,Vec,Vec); 105 PETSC_EXTERN PetscErrorCode PCApplySymmetricRight(PC,Vec,Vec); 106 PETSC_EXTERN PetscErrorCode PCApplyBAorAB(PC,PCSide,Vec,Vec,Vec); 107 PETSC_EXTERN PetscErrorCode PCApplyTranspose(PC,Vec,Vec); 108 PETSC_EXTERN PetscErrorCode PCApplyTransposeExists(PC,PetscBool *); 109 PETSC_EXTERN PetscErrorCode PCApplyBAorABTranspose(PC,PCSide,Vec,Vec,Vec); 110 PETSC_EXTERN PetscErrorCode PCSetReusePreconditioner(PC,PetscBool); 111 PETSC_EXTERN PetscErrorCode PCGetReusePreconditioner(PC,PetscBool*); 112 113 #define PC_FILE_CLASSID 1211222 114 115 /*E 116 PCRichardsonConvergedReason - reason a PCApplyRichardson method terminates 117 118 Level: advanced 119 120 Notes: this must match petsc/finclude/petscpc.h and the KSPConvergedReason values in petscksp.h 121 122 .seealso: PCApplyRichardson() 123 E*/ 124 typedef enum { 125 PCRICHARDSON_CONVERGED_RTOL = 2, 126 PCRICHARDSON_CONVERGED_ATOL = 3, 127 PCRICHARDSON_CONVERGED_ITS = 4, 128 PCRICHARDSON_DIVERGED_DTOL = -4} PCRichardsonConvergedReason; 129 130 PETSC_EXTERN PetscErrorCode PCApplyRichardson(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*); 131 PETSC_EXTERN PetscErrorCode PCApplyRichardsonExists(PC,PetscBool *); 132 PETSC_EXTERN PetscErrorCode PCSetInitialGuessNonzero(PC,PetscBool); 133 PETSC_EXTERN PetscErrorCode PCGetInitialGuessNonzero(PC,PetscBool*); 134 PETSC_EXTERN PetscErrorCode PCSetUseAmat(PC,PetscBool); 135 PETSC_EXTERN PetscErrorCode PCGetUseAmat(PC,PetscBool*); 136 137 138 PETSC_EXTERN PetscErrorCode PCRegister(const char[],PetscErrorCode(*)(PC)); 139 140 PETSC_EXTERN PetscErrorCode PCReset(PC); 141 PETSC_EXTERN PetscErrorCode PCDestroy(PC*); 142 PETSC_EXTERN PetscErrorCode PCSetFromOptions(PC); 143 144 PETSC_EXTERN PetscErrorCode PCFactorGetMatrix(PC,Mat*); 145 PETSC_EXTERN PetscErrorCode PCSetModifySubMatrices(PC,PetscErrorCode(*)(PC,PetscInt,const IS[],const IS[],Mat[],void*),void*); 146 PETSC_EXTERN PetscErrorCode PCModifySubMatrices(PC,PetscInt,const IS[],const IS[],Mat[],void*); 147 148 PETSC_EXTERN PetscErrorCode PCSetOperators(PC,Mat,Mat); 149 PETSC_EXTERN PetscErrorCode PCGetOperators(PC,Mat*,Mat*); 150 PETSC_EXTERN PetscErrorCode PCGetOperatorsSet(PC,PetscBool *,PetscBool *); 151 152 PETSC_EXTERN PetscErrorCode PCView(PC,PetscViewer); 153 PETSC_EXTERN PetscErrorCode PCLoad(PC,PetscViewer); 154 PETSC_STATIC_INLINE PetscErrorCode PCViewFromOptions(PC A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);} 155 156 PETSC_EXTERN PetscErrorCode PCSetOptionsPrefix(PC,const char[]); 157 PETSC_EXTERN PetscErrorCode PCAppendOptionsPrefix(PC,const char[]); 158 PETSC_EXTERN PetscErrorCode PCGetOptionsPrefix(PC,const char*[]); 159 160 PETSC_EXTERN PetscErrorCode PCComputeExplicitOperator(PC,Mat*); 161 162 /* 163 These are used to provide extra scaling of preconditioned 164 operator for time-stepping schemes like in SUNDIALS 165 */ 166 PETSC_EXTERN PetscErrorCode PCGetDiagonalScale(PC,PetscBool *); 167 PETSC_EXTERN PetscErrorCode PCDiagonalScaleLeft(PC,Vec,Vec); 168 PETSC_EXTERN PetscErrorCode PCDiagonalScaleRight(PC,Vec,Vec); 169 PETSC_EXTERN PetscErrorCode PCSetDiagonalScale(PC,Vec); 170 171 /* ------------- options specific to particular preconditioners --------- */ 172 173 /*E 174 PCJacobiType - What elements are used to form the Jacobi preconditioner 175 176 Level: intermediate 177 178 .seealso: 179 E*/ 180 typedef enum { PC_JACOBI_DIAGONAL,PC_JACOBI_ROWMAX,PC_JACOBI_ROWSUM} PCJacobiType; 181 PETSC_EXTERN const char *const PCJacobiTypes[]; 182 183 PETSC_EXTERN PetscErrorCode PCJacobiSetType(PC,PCJacobiType); 184 PETSC_EXTERN PetscErrorCode PCJacobiGetType(PC,PCJacobiType*); 185 PETSC_EXTERN PetscErrorCode PCJacobiSetUseAbs(PC,PetscBool); 186 PETSC_EXTERN PetscErrorCode PCJacobiGetUseAbs(PC,PetscBool*); 187 PETSC_EXTERN PetscErrorCode PCSORSetSymmetric(PC,MatSORType); 188 PETSC_EXTERN PetscErrorCode PCSORGetSymmetric(PC,MatSORType*); 189 PETSC_EXTERN PetscErrorCode PCSORSetOmega(PC,PetscReal); 190 PETSC_EXTERN PetscErrorCode PCSORGetOmega(PC,PetscReal*); 191 PETSC_EXTERN PetscErrorCode PCSORSetIterations(PC,PetscInt,PetscInt); 192 PETSC_EXTERN PetscErrorCode PCSORGetIterations(PC,PetscInt*,PetscInt*); 193 194 PETSC_EXTERN PetscErrorCode PCEisenstatSetOmega(PC,PetscReal); 195 PETSC_EXTERN PetscErrorCode PCEisenstatGetOmega(PC,PetscReal*); 196 PETSC_EXTERN PetscErrorCode PCEisenstatSetNoDiagonalScaling(PC,PetscBool); 197 PETSC_EXTERN PetscErrorCode PCEisenstatGetNoDiagonalScaling(PC,PetscBool*); 198 199 PETSC_EXTERN PetscErrorCode PCBJacobiSetTotalBlocks(PC,PetscInt,const PetscInt[]); 200 PETSC_EXTERN PetscErrorCode PCBJacobiGetTotalBlocks(PC,PetscInt*,const PetscInt*[]); 201 PETSC_EXTERN PetscErrorCode PCBJacobiSetLocalBlocks(PC,PetscInt,const PetscInt[]); 202 PETSC_EXTERN PetscErrorCode PCBJacobiGetLocalBlocks(PC,PetscInt*,const PetscInt*[]); 203 204 PETSC_EXTERN PetscErrorCode PCShellSetApply(PC,PetscErrorCode (*)(PC,Vec,Vec)); 205 PETSC_EXTERN PetscErrorCode PCShellSetApplyBA(PC,PetscErrorCode (*)(PC,PCSide,Vec,Vec,Vec)); 206 PETSC_EXTERN PetscErrorCode PCShellSetApplyTranspose(PC,PetscErrorCode (*)(PC,Vec,Vec)); 207 PETSC_EXTERN PetscErrorCode PCShellSetSetUp(PC,PetscErrorCode (*)(PC)); 208 PETSC_EXTERN PetscErrorCode PCShellSetApplyRichardson(PC,PetscErrorCode (*)(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*)); 209 PETSC_EXTERN PetscErrorCode PCShellSetView(PC,PetscErrorCode (*)(PC,PetscViewer)); 210 PETSC_EXTERN PetscErrorCode PCShellSetDestroy(PC,PetscErrorCode (*)(PC)); 211 PETSC_EXTERN PetscErrorCode PCShellSetContext(PC,void*); 212 PETSC_EXTERN PetscErrorCode PCShellGetContext(PC,void**); 213 PETSC_EXTERN PetscErrorCode PCShellSetName(PC,const char[]); 214 PETSC_EXTERN PetscErrorCode PCShellGetName(PC,const char*[]); 215 216 PETSC_EXTERN PetscErrorCode PCFactorSetZeroPivot(PC,PetscReal); 217 218 PETSC_EXTERN PetscErrorCode PCFactorSetShiftType(PC,MatFactorShiftType); 219 PETSC_EXTERN PetscErrorCode PCFactorSetShiftAmount(PC,PetscReal); 220 221 PETSC_EXTERN PetscErrorCode PCFactorSetMatSolverPackage(PC,const MatSolverPackage); 222 PETSC_EXTERN PetscErrorCode PCFactorGetMatSolverPackage(PC,const MatSolverPackage*); 223 PETSC_EXTERN PetscErrorCode PCFactorSetUpMatSolverPackage(PC); 224 225 PETSC_EXTERN PetscErrorCode PCFactorSetFill(PC,PetscReal); 226 PETSC_EXTERN PetscErrorCode PCFactorSetColumnPivot(PC,PetscReal); 227 PETSC_EXTERN PetscErrorCode PCFactorReorderForNonzeroDiagonal(PC,PetscReal); 228 229 PETSC_EXTERN PetscErrorCode PCFactorSetMatOrderingType(PC,MatOrderingType); 230 PETSC_EXTERN PetscErrorCode PCFactorSetReuseOrdering(PC,PetscBool ); 231 PETSC_EXTERN PetscErrorCode PCFactorSetReuseFill(PC,PetscBool ); 232 PETSC_EXTERN PetscErrorCode PCFactorSetUseInPlace(PC,PetscBool); 233 PETSC_EXTERN PetscErrorCode PCFactorGetUseInPlace(PC,PetscBool*); 234 PETSC_EXTERN PetscErrorCode PCFactorSetAllowDiagonalFill(PC,PetscBool); 235 PETSC_EXTERN PetscErrorCode PCFactorGetAllowDiagonalFill(PC,PetscBool*); 236 PETSC_EXTERN PetscErrorCode PCFactorSetPivotInBlocks(PC,PetscBool); 237 238 PETSC_EXTERN PetscErrorCode PCFactorSetLevels(PC,PetscInt); 239 PETSC_EXTERN PetscErrorCode PCFactorGetLevels(PC,PetscInt*); 240 PETSC_EXTERN PetscErrorCode PCFactorSetDropTolerance(PC,PetscReal,PetscReal,PetscInt); 241 242 PETSC_EXTERN PetscErrorCode PCASMSetLocalSubdomains(PC,PetscInt,IS[],IS[]); 243 PETSC_EXTERN PetscErrorCode PCASMSetTotalSubdomains(PC,PetscInt,IS[],IS[]); 244 PETSC_EXTERN PetscErrorCode PCASMSetOverlap(PC,PetscInt); 245 PETSC_EXTERN PetscErrorCode PCASMSetDMSubdomains(PC,PetscBool); 246 PETSC_EXTERN PetscErrorCode PCASMGetDMSubdomains(PC,PetscBool*); 247 PETSC_EXTERN PetscErrorCode PCASMSetSortIndices(PC,PetscBool); 248 249 /*E 250 PCASMType - Type of additive Schwarz method to use 251 252 $ PC_ASM_BASIC - Symmetric version where residuals from the ghost points are used 253 $ and computed values in ghost regions are added together. 254 $ Classical standard additive Schwarz. 255 $ PC_ASM_RESTRICT - Residuals from ghost points are used but computed values in ghost 256 $ region are discarded. 257 $ Default. 258 $ PC_ASM_INTERPOLATE - Residuals from ghost points are not used, computed values in ghost 259 $ region are added back in. 260 $ PC_ASM_NONE - Residuals from ghost points are not used, computed ghost values are 261 $ discarded. 262 $ Not very good. 263 264 Level: beginner 265 266 .seealso: PCASMSetType() 267 E*/ 268 typedef enum {PC_ASM_BASIC = 3,PC_ASM_RESTRICT = 1,PC_ASM_INTERPOLATE = 2,PC_ASM_NONE = 0} PCASMType; 269 PETSC_EXTERN const char *const PCASMTypes[]; 270 271 PETSC_EXTERN PetscErrorCode PCASMSetType(PC,PCASMType); 272 PETSC_EXTERN PetscErrorCode PCASMGetType(PC,PCASMType*); 273 PETSC_EXTERN PetscErrorCode PCASMCreateSubdomains(Mat,PetscInt,IS*[]); 274 PETSC_EXTERN PetscErrorCode PCASMDestroySubdomains(PetscInt,IS[],IS[]); 275 PETSC_EXTERN PetscErrorCode PCASMCreateSubdomains2D(PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,IS**,IS**); 276 PETSC_EXTERN PetscErrorCode PCASMGetLocalSubdomains(PC,PetscInt*,IS*[],IS*[]); 277 PETSC_EXTERN PetscErrorCode PCASMGetLocalSubmatrices(PC,PetscInt*,Mat*[]); 278 279 /*E 280 PCGASMType - Type of generalized additive Schwarz method to use (differs from ASM in allowing multiple processors per subdomain). 281 282 Each subdomain has nested inner and outer parts. The inner subdomains are assumed to form a non-overlapping covering of the computational 283 domain, while the outer subdomains contain the inner subdomains and overlap with each other. This preconditioner will compute 284 a subdomain correction over each *outer* subdomain from a residual computed there, but its different variants will differ in 285 (a) how the outer subdomain residual is computed, and (b) how the outer subdomain correction is computed. 286 287 $ PC_GASM_BASIC - Symmetric version where the full from the outer subdomain is used, and the resulting correction is applied 288 $ over the outer subdomains. As a result, points in the overlap will receive the sum of the corrections 289 $ from neighboring subdomains. 290 $ Classical standard additive Schwarz. 291 $ PC_GASM_RESTRICT - Residual from the outer subdomain is used but the correction is restricted to the inner subdomain only 292 $ (i.e., zeroed out over the overlap portion of the outer subdomain before being applied). As a result, 293 $ each point will receive a correction only from the unique inner subdomain containing it (nonoverlapping covering 294 $ assumption). 295 $ Default. 296 $ PC_GASM_INTERPOLATE - Residual is zeroed out over the overlap portion of the outer subdomain, but the resulting correction is 297 $ applied over the outer subdomain. As a result, points in the overlap will receive the sum of the corrections 298 $ from neighboring subdomains. 299 $ 300 $ PC_GASM_NONE - Residuals and corrections are zeroed out outside the local subdomains. 301 $ Not very good. 302 303 Level: beginner 304 305 .seealso: PCGASMSetType() 306 E*/ 307 typedef enum {PC_GASM_BASIC = 3,PC_GASM_RESTRICT = 1,PC_GASM_INTERPOLATE = 2,PC_GASM_NONE = 0} PCGASMType; 308 PETSC_EXTERN const char *const PCGASMTypes[]; 309 310 PETSC_EXTERN PetscErrorCode PCGASMSetSubdomains(PC,PetscInt,IS[],IS[]); 311 PETSC_EXTERN PetscErrorCode PCGASMSetTotalSubdomains(PC,PetscInt,PetscBool); 312 PETSC_EXTERN PetscErrorCode PCGASMSetOverlap(PC,PetscInt); 313 PETSC_EXTERN PetscErrorCode PCGASMSetDMSubdomains(PC,PetscBool); 314 PETSC_EXTERN PetscErrorCode PCGASMGetDMSubdomains(PC,PetscBool*); 315 PETSC_EXTERN PetscErrorCode PCGASMSetSortIndices(PC,PetscBool ); 316 317 PETSC_EXTERN PetscErrorCode PCGASMSetType(PC,PCGASMType); 318 PETSC_EXTERN PetscErrorCode PCGASMCreateLocalSubdomains(Mat,PetscInt,PetscInt,IS*[],IS*[]); 319 PETSC_EXTERN PetscErrorCode PCGASMDestroySubdomains(PetscInt,IS[],IS[]); 320 PETSC_EXTERN PetscErrorCode PCGASMCreateSubdomains2D(PC,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,IS**,IS**); 321 PETSC_EXTERN PetscErrorCode PCGASMGetSubdomains(PC,PetscInt*,IS*[],IS*[]); 322 PETSC_EXTERN PetscErrorCode PCGASMGetSubmatrices(PC,PetscInt*,Mat*[]); 323 324 /*E 325 PCCompositeType - Determines how two or more preconditioner are composed 326 327 $ PC_COMPOSITE_ADDITIVE - results from application of all preconditioners are added together 328 $ PC_COMPOSITE_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly 329 $ computed after the previous preconditioner application 330 $ PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly 331 $ computed from first preconditioner to last and then back (Use only for symmetric matrices and preconditions) 332 $ PC_COMPOSITE_SPECIAL - This is very special for a matrix of the form alpha I + R + S 333 $ where first preconditioner is built from alpha I + S and second from 334 $ alpha I + R 335 336 Level: beginner 337 338 .seealso: PCCompositeSetType() 339 E*/ 340 typedef enum {PC_COMPOSITE_ADDITIVE,PC_COMPOSITE_MULTIPLICATIVE,PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE,PC_COMPOSITE_SPECIAL,PC_COMPOSITE_SCHUR} PCCompositeType; 341 PETSC_EXTERN const char *const PCCompositeTypes[]; 342 343 PETSC_EXTERN PetscErrorCode PCCompositeSetType(PC,PCCompositeType); 344 PETSC_EXTERN PetscErrorCode PCCompositeGetType(PC,PCCompositeType*); 345 PETSC_EXTERN PetscErrorCode PCCompositeAddPC(PC,PCType); 346 PETSC_EXTERN PetscErrorCode PCCompositeGetPC(PC,PetscInt,PC *); 347 PETSC_EXTERN PetscErrorCode PCCompositeSpecialSetAlpha(PC,PetscScalar); 348 349 PETSC_EXTERN PetscErrorCode PCRedundantSetNumber(PC,PetscInt); 350 PETSC_EXTERN PetscErrorCode PCRedundantSetScatter(PC,VecScatter,VecScatter); 351 PETSC_EXTERN PetscErrorCode PCRedundantGetOperators(PC,Mat*,Mat*); 352 353 PETSC_EXTERN PetscErrorCode PCSPAISetEpsilon(PC,double); 354 PETSC_EXTERN PetscErrorCode PCSPAISetNBSteps(PC,PetscInt); 355 PETSC_EXTERN PetscErrorCode PCSPAISetMax(PC,PetscInt); 356 PETSC_EXTERN PetscErrorCode PCSPAISetMaxNew(PC,PetscInt); 357 PETSC_EXTERN PetscErrorCode PCSPAISetBlockSize(PC,PetscInt); 358 PETSC_EXTERN PetscErrorCode PCSPAISetCacheSize(PC,PetscInt); 359 PETSC_EXTERN PetscErrorCode PCSPAISetVerbose(PC,PetscInt); 360 PETSC_EXTERN PetscErrorCode PCSPAISetSp(PC,PetscInt); 361 362 PETSC_EXTERN PetscErrorCode PCHYPRESetType(PC,const char[]); 363 PETSC_EXTERN PetscErrorCode PCHYPREGetType(PC,const char*[]); 364 PETSC_EXTERN PetscErrorCode PCHYPRESetDiscreteGradient(PC,Mat); 365 PETSC_EXTERN PetscErrorCode PCHYPRESetDiscreteCurl(PC,Mat); 366 PETSC_EXTERN PetscErrorCode PCHYPRESetEdgeConstantVectors(PC,Vec,Vec,Vec); 367 PETSC_EXTERN PetscErrorCode PCHYPRESetAlphaPoissonMatrix(PC,Mat); 368 PETSC_EXTERN PetscErrorCode PCHYPRESetBetaPoissonMatrix(PC,Mat); 369 PETSC_EXTERN PetscErrorCode PCBJacobiGetLocalBlocks(PC,PetscInt*,const PetscInt*[]); 370 PETSC_EXTERN PetscErrorCode PCBJacobiGetTotalBlocks(PC,PetscInt*,const PetscInt*[]); 371 372 PETSC_EXTERN PetscErrorCode PCFieldSplitSetFields(PC,const char[],PetscInt,const PetscInt*,const PetscInt*); 373 PETSC_EXTERN PetscErrorCode PCFieldSplitSetType(PC,PCCompositeType); 374 PETSC_EXTERN PetscErrorCode PCFieldSplitGetType(PC,PCCompositeType*); 375 PETSC_EXTERN PetscErrorCode PCFieldSplitSetBlockSize(PC,PetscInt); 376 PETSC_EXTERN PetscErrorCode PCFieldSplitSetIS(PC,const char[],IS); 377 PETSC_EXTERN PetscErrorCode PCFieldSplitGetIS(PC,const char[],IS*); 378 PETSC_EXTERN PetscErrorCode PCFieldSplitSetDMSplits(PC,PetscBool); 379 PETSC_EXTERN PetscErrorCode PCFieldSplitGetDMSplits(PC,PetscBool*); 380 PETSC_EXTERN PetscErrorCode PCFieldSplitSetDiagUseAmat(PC,PetscBool); 381 PETSC_EXTERN PetscErrorCode PCFieldSplitGetDiagUseAmat(PC,PetscBool*); 382 PETSC_EXTERN PetscErrorCode PCFieldSplitSetOffDiagUseAmat(PC,PetscBool); 383 PETSC_EXTERN PetscErrorCode PCFieldSplitGetOffDiagUseAmat(PC,PetscBool*); 384 385 386 /*E 387 PCFieldSplitSchurPreType - Determines how to precondition Schur complement 388 389 Level: intermediate 390 391 .seealso: PCFieldSplitSetSchurPre() 392 E*/ 393 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; 394 PETSC_EXTERN const char *const PCFieldSplitSchurPreTypes[]; 395 396 /*E 397 PCFieldSplitSchurFactType - determines which off-diagonal parts of the approximate block factorization to use 398 399 Level: intermediate 400 401 .seealso: PCFieldSplitSetSchurFactType() 402 E*/ 403 typedef enum { 404 PC_FIELDSPLIT_SCHUR_FACT_DIAG, 405 PC_FIELDSPLIT_SCHUR_FACT_LOWER, 406 PC_FIELDSPLIT_SCHUR_FACT_UPPER, 407 PC_FIELDSPLIT_SCHUR_FACT_FULL 408 } PCFieldSplitSchurFactType; 409 PETSC_EXTERN const char *const PCFieldSplitSchurFactTypes[]; 410 411 PETSC_EXTERN PETSC_DEPRECATED("Use PCFieldSplitSetSchurPre") PetscErrorCode PCFieldSplitSchurPrecondition(PC,PCFieldSplitSchurPreType,Mat); 412 PETSC_EXTERN PetscErrorCode PCFieldSplitSetSchurPre(PC,PCFieldSplitSchurPreType,Mat); 413 PETSC_EXTERN PetscErrorCode PCFieldSplitGetSchurPre(PC,PCFieldSplitSchurPreType*,Mat*); 414 PETSC_EXTERN PetscErrorCode PCFieldSplitSetSchurFactType(PC,PCFieldSplitSchurFactType); 415 PETSC_EXTERN PetscErrorCode PCFieldSplitGetSchurBlocks(PC,Mat*,Mat*,Mat*,Mat*); 416 PETSC_EXTERN PetscErrorCode PCFieldSplitSchurGetS(PC,Mat *S); 417 PETSC_EXTERN PetscErrorCode PCFieldSplitSchurRestoreS(PC,Mat *S); 418 419 PETSC_EXTERN PetscErrorCode PCGalerkinSetRestriction(PC,Mat); 420 PETSC_EXTERN PetscErrorCode PCGalerkinSetInterpolation(PC,Mat); 421 422 PETSC_EXTERN PetscErrorCode PCSetCoordinates(PC,PetscInt,PetscInt,PetscReal*); 423 424 PETSC_EXTERN PetscErrorCode PCPythonSetType(PC,const char[]); 425 426 PETSC_EXTERN PetscErrorCode PCSetDM(PC,DM); 427 PETSC_EXTERN PetscErrorCode PCGetDM(PC,DM*); 428 429 PETSC_EXTERN PetscErrorCode PCSetApplicationContext(PC,void*); 430 PETSC_EXTERN PetscErrorCode PCGetApplicationContext(PC,void*); 431 432 PETSC_EXTERN PetscErrorCode PCBiCGStabCUSPSetTolerance(PC,PetscReal); 433 PETSC_EXTERN PetscErrorCode PCBiCGStabCUSPSetIterations(PC,PetscInt); 434 PETSC_EXTERN PetscErrorCode PCBiCGStabCUSPSetUseVerboseMonitor(PC,PetscBool); 435 436 PETSC_EXTERN PetscErrorCode PCAINVCUSPSetDropTolerance(PC,PetscReal); 437 PETSC_EXTERN PetscErrorCode PCAINVCUSPUseScaling(PC,PetscBool); 438 PETSC_EXTERN PetscErrorCode PCAINVCUSPSetNonzeros(PC,PetscInt); 439 PETSC_EXTERN PetscErrorCode PCAINVCUSPSetLinParameter(PC,PetscInt); 440 /*E 441 PCPARMSGlobalType - Determines the global preconditioner method in PARMS 442 443 Level: intermediate 444 445 .seealso: PCPARMSSetGlobal() 446 E*/ 447 typedef enum {PC_PARMS_GLOBAL_RAS,PC_PARMS_GLOBAL_SCHUR,PC_PARMS_GLOBAL_BJ} PCPARMSGlobalType; 448 PETSC_EXTERN const char *const PCPARMSGlobalTypes[]; 449 /*E 450 PCPARMSLocalType - Determines the local preconditioner method in PARMS 451 452 Level: intermediate 453 454 .seealso: PCPARMSSetLocal() 455 E*/ 456 typedef enum {PC_PARMS_LOCAL_ILU0,PC_PARMS_LOCAL_ILUK,PC_PARMS_LOCAL_ILUT,PC_PARMS_LOCAL_ARMS} PCPARMSLocalType; 457 PETSC_EXTERN const char *const PCPARMSLocalTypes[]; 458 459 PETSC_EXTERN PetscErrorCode PCPARMSSetGlobal(PC,PCPARMSGlobalType); 460 PETSC_EXTERN PetscErrorCode PCPARMSSetLocal(PC,PCPARMSLocalType); 461 PETSC_EXTERN PetscErrorCode PCPARMSSetSolveTolerances(PC,PetscReal,PetscInt); 462 PETSC_EXTERN PetscErrorCode PCPARMSSetSolveRestart(PC,PetscInt); 463 PETSC_EXTERN PetscErrorCode PCPARMSSetNonsymPerm(PC,PetscBool); 464 PETSC_EXTERN PetscErrorCode PCPARMSSetFill(PC,PetscInt,PetscInt,PetscInt); 465 466 /*E 467 PCGAMGType - type of generalized algebraic multigrid (PCGAMG) method 468 469 Level: intermediate 470 471 .seealso: PCMG, PCSetType(), PCGAMGSetThreshold(), PCGAMGSetThreshold(), PCGAMGSetReuseInterpolation() 472 E*/ 473 typedef const char *PCGAMGType; 474 #define PCGAMGAGG "agg" 475 #define PCGAMGGEO "geo" 476 #define PCGAMGCLASSICAL "classical" 477 478 PETSC_EXTERN PetscErrorCode PCGAMGSetType( PC,PCGAMGType); 479 PETSC_EXTERN PetscErrorCode PCGAMGGetType( PC,PCGAMGType*); 480 PETSC_EXTERN PetscErrorCode PCGAMGSetProcEqLim(PC,PetscInt); 481 PETSC_EXTERN PetscErrorCode PCGAMGSetRepartitioning(PC,PetscBool); 482 PETSC_EXTERN PetscErrorCode PCGAMGSetUseASMAggs(PC,PetscBool); 483 PETSC_EXTERN PetscErrorCode PCGAMGSetSolverType(PC,char[],PetscInt); 484 PETSC_EXTERN PetscErrorCode PCGAMGSetThreshold(PC,PetscReal); 485 PETSC_EXTERN PetscErrorCode PCGAMGSetCoarseEqLim(PC,PetscInt); 486 PETSC_EXTERN PetscErrorCode PCGAMGSetNlevels(PC,PetscInt); 487 PETSC_EXTERN PetscErrorCode PCGAMGSetNSmooths(PC,PetscInt); 488 PETSC_EXTERN PetscErrorCode PCGAMGSetSymGraph(PC,PetscBool); 489 PETSC_EXTERN PetscErrorCode PCGAMGSetSquareGraph(PC,PetscInt); 490 PETSC_EXTERN PetscErrorCode PCGAMGSetReuseInterpolation(PC,PetscBool); 491 PETSC_EXTERN PetscErrorCode PCGAMGFinalizePackage(void); 492 PETSC_EXTERN PetscErrorCode PCGAMGInitializePackage(void); 493 PETSC_EXTERN PetscErrorCode PCGAMGRegister(PCGAMGType,PetscErrorCode (*)(PC)); 494 495 typedef const char *PCGAMGClassicalType; 496 #define PCGAMGCLASSICALDIRECT "direct" 497 #define PCGAMGCLASSICALSTANDARD "standard" 498 PETSC_EXTERN PetscErrorCode PCGAMGClassicalSetType(PC,PCGAMGClassicalType); 499 PETSC_EXTERN PetscErrorCode PCGAMGClassicalGetType(PC,PCGAMGClassicalType*); 500 501 PETSC_EXTERN PetscErrorCode PCBDDCSetChangeOfBasisMat(PC,Mat); 502 PETSC_EXTERN PetscErrorCode PCBDDCSetPrimalVerticesLocalIS(PC,IS); 503 PETSC_EXTERN PetscErrorCode PCBDDCSetCoarseningRatio(PC,PetscInt); 504 PETSC_EXTERN PetscErrorCode PCBDDCSetLevels(PC,PetscInt); 505 PETSC_EXTERN PetscErrorCode PCBDDCSetNullSpace(PC,MatNullSpace); 506 PETSC_EXTERN PetscErrorCode PCBDDCSetDirichletBoundaries(PC,IS); 507 PETSC_EXTERN PetscErrorCode PCBDDCSetDirichletBoundariesLocal(PC,IS); 508 PETSC_EXTERN PetscErrorCode PCBDDCGetDirichletBoundaries(PC,IS*); 509 PETSC_EXTERN PetscErrorCode PCBDDCGetDirichletBoundariesLocal(PC,IS*); 510 PETSC_EXTERN PetscErrorCode PCBDDCSetNeumannBoundaries(PC,IS); 511 PETSC_EXTERN PetscErrorCode PCBDDCSetNeumannBoundariesLocal(PC,IS); 512 PETSC_EXTERN PetscErrorCode PCBDDCGetNeumannBoundaries(PC,IS*); 513 PETSC_EXTERN PetscErrorCode PCBDDCGetNeumannBoundariesLocal(PC,IS*); 514 PETSC_EXTERN PetscErrorCode PCBDDCSetDofsSplitting(PC,PetscInt,IS[]); 515 PETSC_EXTERN PetscErrorCode PCBDDCSetDofsSplittingLocal(PC,PetscInt,IS[]); 516 PETSC_EXTERN PetscErrorCode PCBDDCSetLocalAdjacencyGraph(PC,PetscInt,const PetscInt[],const PetscInt[],PetscCopyMode); 517 PETSC_EXTERN PetscErrorCode PCBDDCCreateFETIDPOperators(PC,Mat*,PC*); 518 PETSC_EXTERN PetscErrorCode PCBDDCMatFETIDPGetRHS(Mat,Vec,Vec); 519 PETSC_EXTERN PetscErrorCode PCBDDCMatFETIDPGetSolution(Mat,Vec,Vec); 520 521 PETSC_EXTERN PetscErrorCode PCISSetUseStiffnessScaling(PC,PetscBool); 522 PETSC_EXTERN PetscErrorCode PCISSetSubdomainScalingFactor(PC,PetscScalar); 523 PETSC_EXTERN PetscErrorCode PCISSetSubdomainDiagonalScaling(PC,Vec); 524 525 /*E 526 PCMGType - Determines the type of multigrid method that is run. 527 528 Level: beginner 529 530 Values: 531 + PC_MG_MULTIPLICATIVE (default) - traditional V or W cycle as determined by PCMGSetCycles() 532 . PC_MG_ADDITIVE - the additive multigrid preconditioner where all levels are 533 smoothed before updating the residual. This only uses the 534 down smoother, in the preconditioner the upper smoother is ignored 535 . PC_MG_FULL - same as multiplicative except one also performs grid sequencing, 536 that is starts on the coarsest grid, performs a cycle, interpolates 537 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 538 algorithm supports smoothing on before the restriction on each level in the initial restriction to the coarsest stage. In addition that algorithm 539 calls the V-cycle only on the coarser level and has a post-smoother instead. 540 - PC_MG_KASKADE - like full multigrid except one never goes back to a coarser level 541 from a finer 542 543 .seealso: PCMGSetType() 544 545 E*/ 546 typedef enum { PC_MG_MULTIPLICATIVE,PC_MG_ADDITIVE,PC_MG_FULL,PC_MG_KASKADE } PCMGType; 547 PETSC_EXTERN const char *const PCMGTypes[]; 548 #define PC_MG_CASCADE PC_MG_KASKADE; 549 550 /*E 551 PCMGCycleType - Use V-cycle or W-cycle 552 553 Level: beginner 554 555 Values: 556 + PC_MG_V_CYCLE 557 - PC_MG_W_CYCLE 558 559 .seealso: PCMGSetCycleType() 560 561 E*/ 562 typedef enum { PC_MG_CYCLE_V = 1,PC_MG_CYCLE_W = 2 } PCMGCycleType; 563 PETSC_EXTERN const char *const PCMGCycleTypes[]; 564 565 PETSC_EXTERN PetscErrorCode PCMGSetType(PC,PCMGType); 566 PETSC_EXTERN PetscErrorCode PCMGGetType(PC,PCMGType*); 567 PETSC_EXTERN PetscErrorCode PCMGSetLevels(PC,PetscInt,MPI_Comm*); 568 PETSC_EXTERN PetscErrorCode PCMGGetLevels(PC,PetscInt*); 569 570 PETSC_EXTERN PetscErrorCode PCMGSetNumberSmoothUp(PC,PetscInt); 571 PETSC_EXTERN PetscErrorCode PCMGSetNumberSmoothDown(PC,PetscInt); 572 PETSC_EXTERN PetscErrorCode PCMGSetCycleType(PC,PCMGCycleType); 573 PETSC_EXTERN PetscErrorCode PCMGSetCycleTypeOnLevel(PC,PetscInt,PCMGCycleType); 574 PETSC_EXTERN PetscErrorCode PCMGSetCyclesOnLevel(PC,PetscInt,PetscInt); 575 PETSC_EXTERN PetscErrorCode PCMGMultiplicativeSetCycles(PC,PetscInt); 576 PETSC_EXTERN PetscErrorCode PCMGSetGalerkin(PC,PetscBool); 577 PETSC_EXTERN PetscErrorCode PCMGGetGalerkin(PC,PetscBool*); 578 579 PETSC_EXTERN PetscErrorCode PCMGSetRhs(PC,PetscInt,Vec); 580 PETSC_EXTERN PetscErrorCode PCMGSetX(PC,PetscInt,Vec); 581 PETSC_EXTERN PetscErrorCode PCMGSetR(PC,PetscInt,Vec); 582 583 PETSC_EXTERN PetscErrorCode PCMGSetRestriction(PC,PetscInt,Mat); 584 PETSC_EXTERN PetscErrorCode PCMGGetRestriction(PC,PetscInt,Mat*); 585 PETSC_EXTERN PetscErrorCode PCMGSetInterpolation(PC,PetscInt,Mat); 586 PETSC_EXTERN PetscErrorCode PCMGGetInterpolation(PC,PetscInt,Mat*); 587 PETSC_EXTERN PetscErrorCode PCMGSetRScale(PC,PetscInt,Vec); 588 PETSC_EXTERN PetscErrorCode PCMGGetRScale(PC,PetscInt,Vec*); 589 PETSC_EXTERN PetscErrorCode PCMGSetResidual(PC,PetscInt,PetscErrorCode (*)(Mat,Vec,Vec,Vec),Mat); 590 PETSC_EXTERN PetscErrorCode PCMGResidualDefault(Mat,Vec,Vec,Vec); 591 592 /*E 593 PCExoticType - Face based or wirebasket based coarse grid space 594 595 Level: beginner 596 597 .seealso: PCExoticSetType(), PCEXOTIC 598 E*/ 599 typedef enum { PC_EXOTIC_FACE,PC_EXOTIC_WIREBASKET } PCExoticType; 600 PETSC_EXTERN const char *const PCExoticTypes[]; 601 PETSC_EXTERN PetscErrorCode PCExoticSetType(PC,PCExoticType); 602 603 #endif /* __PETSCPC_H */ 604