Actual source code: factor.c
1: #define PETSCKSP_DLL
3: #include src/ksp/pc/pcimpl.h
5: /* Options Database Keys: ???
6: . -pc_ilu_damping - add damping to diagonal to prevent zero (or very small) pivots
7: . -pc_ilu_shift - apply Manteuffel shift to diagonal to force positive definite preconditioner
8: . -pc_ilu_zeropivot <tol> - set tolerance for what is considered a zero pivot
9: */
13: /*@
14: PCFactorSetZeroPivot - Sets the size at which smaller pivots are declared to be zero
16: Collective on PC
17:
18: Input Parameters:
19: + pc - the preconditioner context
20: - zero - all pivots smaller than this will be considered zero
22: Options Database Key:
23: . -pc_factor_zeropivot <zero> - Sets tolerance for what is considered a zero pivot
25: Level: intermediate
27: .keywords: PC, set, factorization, direct, fill
29: .seealso: PCFactorSetShiftNonzero(), PCFactorSetShiftPd()
30: @*/
31: PetscErrorCode PETSCKSP_DLLEXPORT PCFactorSetZeroPivot(PC pc,PetscReal zero)
32: {
33: PetscErrorCode ierr,(*f)(PC,PetscReal);
37: PetscObjectQueryFunction((PetscObject)pc,"PCFactorSetZeroPivot_C",(void (**)(void))&f);
38: if (f) {
39: (*f)(pc,zero);
40: }
41: return(0);
42: }
46: /*@
47: PCFactorSetShiftNonzero - adds this quantity to the diagonal of the matrix during
48: numerical factorization, thus the matrix has nonzero pivots
50: Collective on PC
51:
52: Input Parameters:
53: + pc - the preconditioner context
54: - shift - amount of shift
56: Options Database Key:
57: . -pc_factor_shift_nonzero <shift> - Sets shift amount or PETSC_DECIDE for the default
59: Note: If 0.0 is given, then no shift is used. If a diagonal element is classified as a zero
60: pivot, then the shift is doubled until this is alleviated.
62: Level: intermediate
64: .keywords: PC, set, factorization, direct, fill
66: .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftPd()
67: @*/
68: PetscErrorCode PETSCKSP_DLLEXPORT PCFactorSetShiftNonzero(PC pc,PetscReal shift)
69: {
70: PetscErrorCode ierr,(*f)(PC,PetscReal);
74: PetscObjectQueryFunction((PetscObject)pc,"PCFactorSetShiftNonzero_C",(void (**)(void))&f);
75: if (f) {
76: (*f)(pc,shift);
77: }
78: return(0);
79: }
83: /*@
84: PCFactorSetShiftPd - specify whether to use Manteuffel shifting.
85: If a matrix factorisation breaks down because of nonpositive pivots,
86: adding sufficient identity to the diagonal will remedy this.
87: Setting this causes a bisection method to find the minimum shift that
88: will lead to a well-defined matrix factor.
90: Collective on PC
92: Input parameters:
93: + pc - the preconditioner context
94: - shifting - PETSC_TRUE to set shift else PETSC_FALSE
96: Options Database Key:
97: . -pc_factor_shift_positive_definite [PETSC_TRUE/PETSC_FALSE] - Activate/Deactivate PCFactorSetShiftPd(); the value
98: is optional with PETSC_TRUE being the default
100: Level: intermediate
102: .keywords: PC, indefinite, factorization
104: .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftNonzero()
105: @*/
106: PetscErrorCode PETSCKSP_DLLEXPORT PCFactorSetShiftPd(PC pc,PetscTruth shift)
107: {
108: PetscErrorCode ierr,(*f)(PC,PetscTruth);
112: PetscObjectQueryFunction((PetscObject)pc,"PCFactorSetShiftPd_C",(void (**)(void))&f);
113: if (f) {
114: (*f)(pc,shift);
115: }
116: return(0);
117: }