xref: /petsc/include/petscpc.h (revision a213cbb1ef4af2e4bfedadfd705b644759ea7e07)
1 /*
2       Preconditioner module.
3 */
4 #if !defined(__PETSCPC_H)
5 #define __PETSCPC_H
6 #include "petscdm.h"
7 PETSC_EXTERN_CXX_BEGIN
8 
9 extern PetscErrorCode   PCInitializePackage(const char[]);
10 
11 /*
12     PCList contains the list of preconditioners currently registered
13    These are added with the PCRegisterDynamic() macro
14 */
15 extern PetscFList PCList;
16 
17 /*S
18      PC - Abstract PETSc object that manages all preconditioners
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 or the creation function
30        with an optional dynamic library name, for example
31        http://www.mcs.anl.gov/petsc/lib.a:mypccreate()
32 
33    Level: beginner
34 
35    Notes: Click on the links below to see details on a particular solver
36 
37 .seealso: PCSetType(), PC, PCCreate()
38 J*/
39 #define PCType char*
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 PCPROMETHEUS      "prometheus"
66 #define PCGALERKIN        "galerkin"
67 #define PCEXOTIC          "exotic"
68 #define PCHMPI            "hmpi"
69 #define PCSUPPORTGRAPH    "supportgraph"
70 #define PCASA             "asa"
71 #define PCCP              "cp"
72 #define PCBFBT            "bfbt"
73 #define PCLSC             "lsc"
74 #define PCPYTHON          "python"
75 #define PCPFMG            "pfmg"
76 #define PCSYSPFMG         "syspfmg"
77 #define PCREDISTRIBUTE    "redistribute"
78 #define PCSVD             "svd"
79 #define PCGAMG            "gamg"
80 #define PCSACUSP          "sacusp"        /* these four run on NVIDIA GPUs using CUSP */
81 #define PCSACUSPPOLY      "sacusppoly"
82 #define PCBICGSTABCUSP    "bicgstabcusp"
83 #define PCAINVCUSP        "ainvcusp"
84 #define PCBDDC            "bddc"
85 
86 /* Logging support */
87 extern PetscClassId  PC_CLASSID;
88 
89 /*E
90     PCSide - If the preconditioner is to be applied to the left, right
91      or symmetrically around the operator.
92 
93    Level: beginner
94 
95 .seealso:
96 E*/
97 typedef enum { PC_SIDE_DEFAULT=-1,PC_LEFT,PC_RIGHT,PC_SYMMETRIC} PCSide;
98 #define PC_SIDE_MAX (PC_SYMMETRIC + 1)
99 extern const char *PCSides[];
100 
101 extern PetscErrorCode  PCCreate(MPI_Comm,PC*);
102 extern PetscErrorCode  PCSetType(PC,const PCType);
103 extern PetscErrorCode  PCSetUp(PC);
104 extern PetscErrorCode  PCSetUpOnBlocks(PC);
105 extern PetscErrorCode  PCApply(PC,Vec,Vec);
106 extern PetscErrorCode  PCApplySymmetricLeft(PC,Vec,Vec);
107 extern PetscErrorCode  PCApplySymmetricRight(PC,Vec,Vec);
108 extern PetscErrorCode  PCApplyBAorAB(PC,PCSide,Vec,Vec,Vec);
109 extern PetscErrorCode  PCApplyTranspose(PC,Vec,Vec);
110 extern PetscErrorCode  PCApplyTransposeExists(PC,PetscBool *);
111 extern PetscErrorCode  PCApplyBAorABTranspose(PC,PCSide,Vec,Vec,Vec);
112 
113 /*E
114     PCRichardsonConvergedReason - reason a PCApplyRichardson method terminates
115 
116    Level: advanced
117 
118    Notes: this must match finclude/petscpc.h and the KSPConvergedReason values in petscksp.h
119 
120 .seealso: PCApplyRichardson()
121 E*/
122 typedef enum {
123               PCRICHARDSON_CONVERGED_RTOL               =  2,
124               PCRICHARDSON_CONVERGED_ATOL               =  3,
125               PCRICHARDSON_CONVERGED_ITS                =  4,
126               PCRICHARDSON_DIVERGED_DTOL                = -4} PCRichardsonConvergedReason;
127 
128 extern PetscErrorCode  PCApplyRichardson(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*);
129 extern PetscErrorCode  PCApplyRichardsonExists(PC,PetscBool *);
130 extern PetscErrorCode  PCSetInitialGuessNonzero(PC,PetscBool );
131 
132 extern PetscErrorCode  PCRegisterDestroy(void);
133 extern PetscErrorCode  PCRegisterAll(const char[]);
134 extern PetscBool  PCRegisterAllCalled;
135 
136 extern PetscErrorCode  PCRegister(const char[],const char[],const char[],PetscErrorCode(*)(PC));
137 
138 /*MC
139    PCRegisterDynamic - Adds a method to the preconditioner package.
140 
141    Synopsis:
142    PetscErrorCode PCRegisterDynamic(const char *name_solver,const char *path,const char *name_create,PetscErrorCode (*routine_create)(PC))
143 
144    Not collective
145 
146    Input Parameters:
147 +  name_solver - name of a new user-defined solver
148 .  path - path (either absolute or relative) the library containing this solver
149 .  name_create - name of routine to create method context
150 -  routine_create - routine to create method context
151 
152    Notes:
153    PCRegisterDynamic() may be called multiple times to add several user-defined preconditioners.
154 
155    If dynamic libraries are used, then the fourth input argument (routine_create)
156    is ignored.
157 
158    Sample usage:
159 .vb
160    PCRegisterDynamic("my_solver","/home/username/my_lib/lib/libO/solaris/mylib",
161               "MySolverCreate",MySolverCreate);
162 .ve
163 
164    Then, your solver can be chosen with the procedural interface via
165 $     PCSetType(pc,"my_solver")
166    or at runtime via the option
167 $     -pc_type my_solver
168 
169    Level: advanced
170 
171    Notes: ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},  or ${any environmental variable}
172            occuring in pathname will be replaced with appropriate values.
173          If your function is not being put into a shared library then use PCRegister() instead
174 
175 .keywords: PC, register
176 
177 .seealso: PCRegisterAll(), PCRegisterDestroy()
178 M*/
179 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
180 #define PCRegisterDynamic(a,b,c,d) PCRegister(a,b,c,0)
181 #else
182 #define PCRegisterDynamic(a,b,c,d) PCRegister(a,b,c,d)
183 #endif
184 
185 extern PetscErrorCode  PCReset(PC);
186 extern PetscErrorCode  PCDestroy(PC*);
187 extern PetscErrorCode  PCSetFromOptions(PC);
188 extern PetscErrorCode  PCGetType(PC,const PCType*);
189 
190 extern PetscErrorCode  PCFactorGetMatrix(PC,Mat*);
191 extern PetscErrorCode  PCSetModifySubMatrices(PC,PetscErrorCode(*)(PC,PetscInt,const IS[],const IS[],Mat[],void*),void*);
192 extern PetscErrorCode  PCModifySubMatrices(PC,PetscInt,const IS[],const IS[],Mat[],void*);
193 
194 extern PetscErrorCode  PCSetOperators(PC,Mat,Mat,MatStructure);
195 extern PetscErrorCode  PCGetOperators(PC,Mat*,Mat*,MatStructure*);
196 extern PetscErrorCode  PCGetOperatorsSet(PC,PetscBool *,PetscBool *);
197 
198 extern PetscErrorCode  PCView(PC,PetscViewer);
199 
200 extern PetscErrorCode  PCSetOptionsPrefix(PC,const char[]);
201 extern PetscErrorCode  PCAppendOptionsPrefix(PC,const char[]);
202 extern PetscErrorCode  PCGetOptionsPrefix(PC,const char*[]);
203 
204 extern PetscErrorCode  PCComputeExplicitOperator(PC,Mat*);
205 
206 /*
207       These are used to provide extra scaling of preconditioned
208    operator for time-stepping schemes like in SUNDIALS
209 */
210 extern PetscErrorCode  PCGetDiagonalScale(PC,PetscBool *);
211 extern PetscErrorCode  PCDiagonalScaleLeft(PC,Vec,Vec);
212 extern PetscErrorCode  PCDiagonalScaleRight(PC,Vec,Vec);
213 extern PetscErrorCode  PCSetDiagonalScale(PC,Vec);
214 
215 /* ------------- options specific to particular preconditioners --------- */
216 
217 extern PetscErrorCode  PCJacobiSetUseRowMax(PC);
218 extern PetscErrorCode  PCJacobiSetUseRowSum(PC);
219 extern PetscErrorCode  PCJacobiSetUseAbs(PC);
220 extern PetscErrorCode  PCSORSetSymmetric(PC,MatSORType);
221 extern PetscErrorCode  PCSORSetOmega(PC,PetscReal);
222 extern PetscErrorCode  PCSORSetIterations(PC,PetscInt,PetscInt);
223 
224 extern PetscErrorCode  PCEisenstatSetOmega(PC,PetscReal);
225 extern PetscErrorCode  PCEisenstatNoDiagonalScaling(PC);
226 
227 #define USE_PRECONDITIONER_MATRIX 0
228 #define USE_TRUE_MATRIX           1
229 extern PetscErrorCode  PCBJacobiSetUseTrueLocal(PC);
230 extern PetscErrorCode  PCBJacobiSetTotalBlocks(PC,PetscInt,const PetscInt[]);
231 extern PetscErrorCode  PCBJacobiSetLocalBlocks(PC,PetscInt,const PetscInt[]);
232 
233 extern PetscErrorCode  PCKSPSetUseTrue(PC);
234 
235 extern PetscErrorCode  PCShellSetApply(PC,PetscErrorCode (*)(PC,Vec,Vec));
236 extern PetscErrorCode  PCShellSetApplyBA(PC,PetscErrorCode (*)(PC,PCSide,Vec,Vec,Vec));
237 extern PetscErrorCode  PCShellSetApplyTranspose(PC,PetscErrorCode (*)(PC,Vec,Vec));
238 extern PetscErrorCode  PCShellSetSetUp(PC,PetscErrorCode (*)(PC));
239 extern PetscErrorCode  PCShellSetApplyRichardson(PC,PetscErrorCode (*)(PC,Vec,Vec,Vec,PetscReal,PetscReal,PetscReal,PetscInt,PetscBool ,PetscInt*,PCRichardsonConvergedReason*));
240 extern PetscErrorCode  PCShellSetView(PC,PetscErrorCode (*)(PC,PetscViewer));
241 extern PetscErrorCode  PCShellSetDestroy(PC,PetscErrorCode (*)(PC));
242 extern PetscErrorCode  PCShellGetContext(PC,void**);
243 extern PetscErrorCode  PCShellSetContext(PC,void*);
244 extern PetscErrorCode  PCShellSetName(PC,const char[]);
245 extern PetscErrorCode  PCShellGetName(PC,const char*[]);
246 
247 extern PetscErrorCode  PCFactorSetZeroPivot(PC,PetscReal);
248 
249 extern PetscErrorCode  PCFactorSetShiftType(PC,MatFactorShiftType);
250 extern PetscErrorCode  PCFactorSetShiftAmount(PC,PetscReal);
251 
252 extern PetscErrorCode  PCFactorSetMatSolverPackage(PC,const MatSolverPackage);
253 extern PetscErrorCode  PCFactorGetMatSolverPackage(PC,const MatSolverPackage*);
254 extern PetscErrorCode  PCFactorSetUpMatSolverPackage(PC);
255 
256 extern PetscErrorCode  PCFactorSetFill(PC,PetscReal);
257 extern PetscErrorCode  PCFactorSetColumnPivot(PC,PetscReal);
258 extern PetscErrorCode  PCFactorReorderForNonzeroDiagonal(PC,PetscReal);
259 
260 extern PetscErrorCode  PCFactorSetMatOrderingType(PC,const MatOrderingType);
261 extern PetscErrorCode  PCFactorSetReuseOrdering(PC,PetscBool );
262 extern PetscErrorCode  PCFactorSetReuseFill(PC,PetscBool );
263 extern PetscErrorCode  PCFactorSetUseInPlace(PC);
264 extern PetscErrorCode  PCFactorSetAllowDiagonalFill(PC);
265 extern PetscErrorCode  PCFactorSetPivotInBlocks(PC,PetscBool );
266 
267 extern PetscErrorCode  PCFactorSetLevels(PC,PetscInt);
268 extern PetscErrorCode  PCFactorSetDropTolerance(PC,PetscReal,PetscReal,PetscInt);
269 
270 extern PetscErrorCode  PCASMSetLocalSubdomains(PC,PetscInt,IS[],IS[]);
271 extern PetscErrorCode  PCASMSetTotalSubdomains(PC,PetscInt,IS[],IS[]);
272 extern PetscErrorCode  PCASMSetOverlap(PC,PetscInt);
273 extern PetscErrorCode  PCASMSetSortIndices(PC,PetscBool );
274 
275 /*E
276     PCASMType - Type of additive Schwarz method to use
277 
278 $  PC_ASM_BASIC        - Symmetric version where residuals from the ghost points are used
279 $                        and computed values in ghost regions are added together.
280 $                        Classical standard additive Schwarz.
281 $  PC_ASM_RESTRICT     - Residuals from ghost points are used but computed values in ghost
282 $                        region are discarded.
283 $                        Default.
284 $  PC_ASM_INTERPOLATE  - Residuals from ghost points are not used, computed values in ghost
285 $                        region are added back in.
286 $  PC_ASM_NONE         - Residuals from ghost points are not used, computed ghost values are
287 $                        discarded.
288 $                        Not very good.
289 
290    Level: beginner
291 
292 .seealso: PCASMSetType()
293 E*/
294 typedef enum {PC_ASM_BASIC = 3,PC_ASM_RESTRICT = 1,PC_ASM_INTERPOLATE = 2,PC_ASM_NONE = 0} PCASMType;
295 extern const char *PCASMTypes[];
296 
297 extern PetscErrorCode  PCASMSetType(PC,PCASMType);
298 extern PetscErrorCode  PCASMCreateSubdomains(Mat,PetscInt,IS*[]);
299 extern PetscErrorCode  PCASMDestroySubdomains(PetscInt,IS[],IS[]);
300 extern PetscErrorCode  PCASMCreateSubdomains2D(PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,IS**,IS**);
301 extern PetscErrorCode  PCASMGetLocalSubdomains(PC,PetscInt*,IS*[],IS*[]);
302 extern PetscErrorCode  PCASMGetLocalSubmatrices(PC,PetscInt*,Mat*[]);
303 
304 /*E
305     PCGASMType - Type of generalized additive Schwarz method to use (differs from ASM in allowing multiple processors per subdomain).
306 
307    Each subdomain has nested inner and outer parts.  The inner subdomains are assumed to form a non-overlapping covering of the computational
308    domain, while the outer subdomains contain the inner subdomains and overlap with each other.  This preconditioner will compute
309    a subdomain correction over each *outer* subdomain from a residual computed there, but its different variants will differ in
310    (a) how the outer subdomain residual is computed, and (b) how the outer subdomain correction is computed.
311 
312 $  PC_GASM_BASIC       - Symmetric version where the full from the outer subdomain is used, and the resulting correction is applied
313 $                        over the outer subdomains.  As a result, points in the overlap will receive the sum of the corrections
314 $                        from neighboring subdomains.
315 $                        Classical standard additive Schwarz.
316 $  PC_GASM_RESTRICT    - Residual from the outer subdomain is used but the correction is restricted to the inner subdomain only
317 $                        (i.e., zeroed out over the overlap portion of the outer subdomain before being applied).  As a result,
318 $                        each point will receive a correction only from the unique inner subdomain containing it (nonoverlapping covering
319 $                        assumption).
320 $                        Default.
321 $  PC_GASM_INTERPOLATE - Residual is zeroed out over the overlap portion of the outer subdomain, but the resulting correction is
322 $                        applied over the outer subdomain. As a result, points in the overlap will receive the sum of the corrections
323 $                        from neighboring subdomains.
324 $
325 $  PC_GASM_NONE        - Residuals and corrections are zeroed out outside the local subdomains.
326 $                        Not very good.
327 
328    Level: beginner
329 
330 .seealso: PCGASMSetType()
331 E*/
332 typedef enum {PC_GASM_BASIC = 3,PC_GASM_RESTRICT = 1,PC_GASM_INTERPOLATE = 2,PC_GASM_NONE = 0} PCGASMType;
333 extern const char *PCGASMTypes[];
334 
335 extern PetscErrorCode  PCGASMSetSubdomains(PC,PetscInt,IS[],IS[]);
336 extern PetscErrorCode  PCGASMSetTotalSubdomains(PC,PetscInt,PetscBool);
337 extern PetscErrorCode  PCGASMSetOverlap(PC,PetscInt);
338 extern PetscErrorCode  PCGASMSetSortIndices(PC,PetscBool );
339 
340 extern PetscErrorCode  PCGASMSetType(PC,PCGASMType);
341 extern PetscErrorCode  PCGASMCreateLocalSubdomains(Mat,PetscInt,PetscInt,IS*[],IS*[]);
342 extern PetscErrorCode  PCGASMDestroySubdomains(PetscInt,IS[],IS[]);
343 extern PetscErrorCode  PCGASMCreateSubdomains2D(PC,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt,PetscInt*,IS**,IS**);
344 extern PetscErrorCode  PCGASMGetSubdomains(PC,PetscInt*,IS*[],IS*[]);
345 extern PetscErrorCode  PCGASMGetSubmatrices(PC,PetscInt*,Mat*[]);
346 
347 /*E
348     PCCompositeType - Determines how two or more preconditioner are composed
349 
350 $  PC_COMPOSITE_ADDITIVE - results from application of all preconditioners are added together
351 $  PC_COMPOSITE_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly
352 $                                computed after the previous preconditioner application
353 $  PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE - preconditioners are applied sequentially to the residual freshly
354 $                                computed from first preconditioner to last and then back (Use only for symmetric matrices and preconditions)
355 $  PC_COMPOSITE_SPECIAL - This is very special for a matrix of the form alpha I + R + S
356 $                         where first preconditioner is built from alpha I + S and second from
357 $                         alpha I + R
358 
359    Level: beginner
360 
361 .seealso: PCCompositeSetType()
362 E*/
363 typedef enum {PC_COMPOSITE_ADDITIVE,PC_COMPOSITE_MULTIPLICATIVE,PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE,PC_COMPOSITE_SPECIAL,PC_COMPOSITE_SCHUR} PCCompositeType;
364 extern const char *PCCompositeTypes[];
365 
366 extern PetscErrorCode  PCCompositeSetUseTrue(PC);
367 extern PetscErrorCode  PCCompositeSetType(PC,PCCompositeType);
368 extern PetscErrorCode  PCCompositeAddPC(PC,PCType);
369 extern PetscErrorCode  PCCompositeGetPC(PC,PetscInt,PC *);
370 extern PetscErrorCode  PCCompositeSpecialSetAlpha(PC,PetscScalar);
371 
372 extern PetscErrorCode  PCRedundantSetNumber(PC,PetscInt);
373 extern PetscErrorCode  PCRedundantSetScatter(PC,VecScatter,VecScatter);
374 extern PetscErrorCode  PCRedundantGetOperators(PC,Mat*,Mat*);
375 
376 extern PetscErrorCode  PCSPAISetEpsilon(PC,double);
377 extern PetscErrorCode  PCSPAISetNBSteps(PC,PetscInt);
378 extern PetscErrorCode  PCSPAISetMax(PC,PetscInt);
379 extern PetscErrorCode  PCSPAISetMaxNew(PC,PetscInt);
380 extern PetscErrorCode  PCSPAISetBlockSize(PC,PetscInt);
381 extern PetscErrorCode  PCSPAISetCacheSize(PC,PetscInt);
382 extern PetscErrorCode  PCSPAISetVerbose(PC,PetscInt);
383 extern PetscErrorCode  PCSPAISetSp(PC,PetscInt);
384 
385 extern PetscErrorCode  PCHYPRESetType(PC,const char[]);
386 extern PetscErrorCode  PCHYPREGetType(PC,const char*[]);
387 extern PetscErrorCode  PCBJacobiGetLocalBlocks(PC,PetscInt*,const PetscInt*[]);
388 extern PetscErrorCode  PCBJacobiGetTotalBlocks(PC,PetscInt*,const PetscInt*[]);
389 
390 extern PetscErrorCode  PCFieldSplitSetFields(PC,const char[],PetscInt,const PetscInt*,const PetscInt*);
391 extern PetscErrorCode  PCFieldSplitGetType(PC,PCCompositeType*);
392 extern PetscErrorCode  PCFieldSplitSetType(PC,PCCompositeType);
393 extern PetscErrorCode  PCFieldSplitSetBlockSize(PC,PetscInt);
394 extern PetscErrorCode  PCFieldSplitSetIS(PC,const char[],IS);
395 extern PetscErrorCode  PCFieldSplitGetIS(PC,const char[],IS*);
396 
397 /*E
398     PCFieldSplitSchurPreType - Determines how to precondition Schur complement
399 
400     Level: intermediate
401 
402 .seealso: PCFieldSplitSchurPrecondition()
403 E*/
404 typedef enum {PC_FIELDSPLIT_SCHUR_PRE_SELF,PC_FIELDSPLIT_SCHUR_PRE_DIAG,PC_FIELDSPLIT_SCHUR_PRE_USER} PCFieldSplitSchurPreType;
405 extern const char *const PCFieldSplitSchurPreTypes[];
406 
407 /*E
408     PCFieldSplitSchurFactType - determines which off-diagonal parts of the approximate block factorization to use
409 
410     Level: intermediate
411 
412 .seealso: PCFieldSplitSetSchurFactType()
413 E*/
414 typedef enum {
415   PC_FIELDSPLIT_SCHUR_FACT_DIAG,
416   PC_FIELDSPLIT_SCHUR_FACT_LOWER,
417   PC_FIELDSPLIT_SCHUR_FACT_UPPER,
418   PC_FIELDSPLIT_SCHUR_FACT_FULL
419 } PCFieldSplitSchurFactType;
420 extern const char *const PCFieldSplitSchurFactTypes[];
421 
422 extern PetscErrorCode  PCFieldSplitSchurPrecondition(PC,PCFieldSplitSchurPreType,Mat);
423 extern PetscErrorCode  PCFieldSplitSetSchurFactType(PC,PCFieldSplitSchurFactType);
424 extern PetscErrorCode  PCFieldSplitGetSchurBlocks(PC,Mat*,Mat*,Mat*,Mat*);
425 
426 extern PetscErrorCode  PCGalerkinSetRestriction(PC,Mat);
427 extern PetscErrorCode  PCGalerkinSetInterpolation(PC,Mat);
428 
429 extern PetscErrorCode  PCSetCoordinates(PC,PetscInt,PetscInt,PetscReal*);
430 extern PetscErrorCode  PCSASetVectors(PC,PetscInt,PetscReal *);
431 
432 extern PetscErrorCode  PCPythonSetType(PC,const char[]);
433 
434 extern PetscErrorCode  PCSetDM(PC,DM);
435 extern PetscErrorCode  PCGetDM(PC,DM*);
436 
437 extern PetscErrorCode  PCSetApplicationContext(PC,void*);
438 extern PetscErrorCode  PCGetApplicationContext(PC,void*);
439 
440 extern PetscErrorCode  PCBiCGStabCUSPSetTolerance(PC,PetscReal);
441 extern PetscErrorCode  PCBiCGStabCUSPSetIterations(PC,PetscInt);
442 extern PetscErrorCode  PCBiCGStabCUSPSetUseVerboseMonitor(PC,PetscBool);
443 
444 extern PetscErrorCode  PCAINVCUSPSetDropTolerance(PC,PetscReal);
445 extern PetscErrorCode  PCAINVCUSPUseScaling(PC,PetscBool);
446 extern PetscErrorCode  PCAINVCUSPSetNonzeros(PC,PetscInt);
447 extern PetscErrorCode  PCAINVCUSPSetLinParameter(PC,PetscInt);
448 /*E
449     PCPARMSGlobalType - Determines the global preconditioner method in PARMS
450 
451     Level: intermediate
452 
453 .seealso: PCPARMSSetGlobal()
454 E*/
455 typedef enum {PC_PARMS_GLOBAL_RAS,PC_PARMS_GLOBAL_SCHUR,PC_PARMS_GLOBAL_BJ} PCPARMSGlobalType;
456 extern const char *PCPARMSGlobalTypes[];
457 /*E
458     PCPARMSLocalType - Determines the local preconditioner method in PARMS
459 
460     Level: intermediate
461 
462 .seealso: PCPARMSSetLocal()
463 E*/
464 typedef enum {PC_PARMS_LOCAL_ILU0,PC_PARMS_LOCAL_ILUK,PC_PARMS_LOCAL_ILUT,PC_PARMS_LOCAL_ARMS} PCPARMSLocalType;
465 extern const char *PCPARMSLocalTypes[];
466 
467 extern PetscErrorCode PCPARMSSetGlobal(PC pc,PCPARMSGlobalType type);
468 extern PetscErrorCode PCPARMSSetLocal(PC pc,PCPARMSLocalType type);
469 extern PetscErrorCode PCPARMSSetSolveTolerances(PC pc,PetscReal tol,PetscInt maxits);
470 extern PetscErrorCode PCPARMSSetSolveRestart(PC pc,PetscInt restart);
471 extern PetscErrorCode PCPARMSSetNonsymPerm(PC pc,PetscBool nonsym);
472 extern PetscErrorCode PCPARMSSetFill(PC pc,PetscInt lfil0,PetscInt lfil1,PetscInt lfil2);
473 
474 extern PetscErrorCode PCGAMGSetProcEqLim(PC,PetscInt);
475 extern PetscErrorCode PCGAMGSetRepartitioning(PC,PetscBool);
476 extern PetscErrorCode PCGAMGSetUseASMAggs(PC,PetscBool);
477 extern PetscErrorCode PCGAMGSetSolverType(PC,char[],PetscInt);
478 extern PetscErrorCode PCGAMGSetThreshold(PC,PetscReal);
479 extern PetscErrorCode PCGAMGSetCoarseEqLim(PC,PetscInt);
480 extern PetscErrorCode PCGAMGSetNlevels(PC,PetscInt);
481 #define PCGAMGType char*
482 extern PetscErrorCode PCGAMGSetType( PC,const PCGAMGType );
483 extern PetscErrorCode PCGAMGSetNSmooths(PC pc, PetscInt n);
484 extern PetscErrorCode PCGAMGSetSymGraph(PC pc, PetscBool n);
485 extern PetscErrorCode PCGAMGSetSquareGraph(PC,PetscBool);
486 
487 #if defined(PETSC_HAVE_PCBDDC)
488 /* Enum defining how to treat the coarse problem */
489 typedef enum {SEQUENTIAL_BDDC,REPLICATED_BDDC,PARALLEL_BDDC,MULTILEVEL_BDDC} CoarseProblemType;
490 extern PetscErrorCode PCBDDCSetDirichletBoundaries(PC,IS);
491 extern PetscErrorCode PCBDDCGetDirichletBoundaries(PC,IS*);
492 extern PetscErrorCode PCBDDCSetNeumannBoundaries(PC,IS);
493 extern PetscErrorCode PCBDDCGetNeumannBoundaries(PC,IS*);
494 extern PetscErrorCode PCBDDCSetCoarseProblemType(PC,CoarseProblemType);
495 extern PetscErrorCode PCBDDCSetDofsSplitting(PC,PetscInt,IS[]);
496 #endif
497 
498 extern PetscErrorCode PCISSetSubdomainScalingFactor(PC,PetscScalar);
499 
500 PETSC_EXTERN_CXX_END
501 
502 #endif /* __PETSCPC_H */
503