xref: /petsc/src/ksp/pc/impls/factor/factor.c (revision 147403d98689287189d69e47992b7c8152b2c9da)
15e8efad8SHong Zhang 
2c6db04a5SJed Brown #include <../src/ksp/pc/impls/factor/factor.h>  /*I "petscpc.h" I*/
3978beb7fSPierre Jolivet #include <petsc/private/matimpl.h>
45e8efad8SHong Zhang 
54ac6704cSBarry Smith /*
64ac6704cSBarry Smith     If an ordering is not yet set and the matrix is available determine a default ordering
74ac6704cSBarry Smith */
84ac6704cSBarry Smith PetscErrorCode PCFactorSetDefaultOrdering_Factor(PC pc)
94ac6704cSBarry Smith {
10978beb7fSPierre Jolivet   Mat            B;
11978beb7fSPierre Jolivet   PetscBool      foundmtype,flg;
124ac6704cSBarry Smith   PetscErrorCode ierr;
134ac6704cSBarry Smith 
144ac6704cSBarry Smith   PetscFunctionBegin;
154ac6704cSBarry Smith   if (pc->pmat) {
164ac6704cSBarry Smith     PC_Factor *fact = (PC_Factor*)pc->data;
17978beb7fSPierre Jolivet     ierr = MatSolverTypeGet(fact->solvertype,((PetscObject)pc->pmat)->type_name,fact->factortype,NULL,&foundmtype,NULL);CHKERRQ(ierr);
18978beb7fSPierre Jolivet     if (foundmtype) {
194ac6704cSBarry Smith       if (!fact->fact) {
204ac6704cSBarry Smith         ierr = MatGetFactor(pc->pmat,fact->solvertype,fact->factortype,&fact->fact);CHKERRQ(ierr);
21978beb7fSPierre Jolivet       } else if (!fact->fact->assembled) {
22978beb7fSPierre Jolivet         ierr = PetscStrcmp(fact->solvertype,fact->fact->solvertype,&flg);CHKERRQ(ierr);
23978beb7fSPierre Jolivet         if (!flg) {
24978beb7fSPierre Jolivet           ierr = MatGetFactor(pc->pmat,fact->solvertype,fact->factortype,&B);CHKERRQ(ierr);
25978beb7fSPierre Jolivet           ierr = MatHeaderReplace(fact->fact,&B);CHKERRQ(ierr);
26978beb7fSPierre Jolivet         }
274ac6704cSBarry Smith       }
284ac6704cSBarry Smith       if (!fact->ordering) {
294ac6704cSBarry Smith         PetscBool       canuseordering;
304ac6704cSBarry Smith         MatOrderingType otype;
314ac6704cSBarry Smith 
324ac6704cSBarry Smith         ierr = MatFactorGetCanUseOrdering(fact->fact,&canuseordering);CHKERRQ(ierr);
334ac6704cSBarry Smith         if (canuseordering) {
344ac6704cSBarry Smith           ierr = MatFactorGetPreferredOrdering(fact->fact,fact->factortype,&otype);CHKERRQ(ierr);
354ac6704cSBarry Smith         } else otype = MATORDERINGEXTERNAL;
364ac6704cSBarry Smith         ierr = PetscStrallocpy(otype,(char **)&fact->ordering);CHKERRQ(ierr);
374ac6704cSBarry Smith       }
384ac6704cSBarry Smith     }
39978beb7fSPierre Jolivet   }
404ac6704cSBarry Smith   PetscFunctionReturn(0);
414ac6704cSBarry Smith }
424ac6704cSBarry Smith 
433d1c1ea0SBarry Smith static PetscErrorCode PCFactorSetReuseOrdering_Factor(PC pc,PetscBool flag)
443d1c1ea0SBarry Smith {
453d1c1ea0SBarry Smith   PC_Factor *lu = (PC_Factor*)pc->data;
463d1c1ea0SBarry Smith 
473d1c1ea0SBarry Smith   PetscFunctionBegin;
483d1c1ea0SBarry Smith   lu->reuseordering = flag;
493d1c1ea0SBarry Smith   PetscFunctionReturn(0);
503d1c1ea0SBarry Smith }
513d1c1ea0SBarry Smith 
523d1c1ea0SBarry Smith static PetscErrorCode PCFactorSetReuseFill_Factor(PC pc,PetscBool flag)
533d1c1ea0SBarry Smith {
543d1c1ea0SBarry Smith   PC_Factor *lu = (PC_Factor*)pc->data;
553d1c1ea0SBarry Smith 
563d1c1ea0SBarry Smith   PetscFunctionBegin;
573d1c1ea0SBarry Smith   lu->reusefill = flag;
583d1c1ea0SBarry Smith   PetscFunctionReturn(0);
593d1c1ea0SBarry Smith }
603d1c1ea0SBarry Smith 
613d1c1ea0SBarry Smith static PetscErrorCode  PCFactorSetUseInPlace_Factor(PC pc,PetscBool flg)
623d1c1ea0SBarry Smith {
633d1c1ea0SBarry Smith   PC_Factor *dir = (PC_Factor*)pc->data;
643d1c1ea0SBarry Smith 
653d1c1ea0SBarry Smith   PetscFunctionBegin;
663d1c1ea0SBarry Smith   dir->inplace = flg;
673d1c1ea0SBarry Smith   PetscFunctionReturn(0);
683d1c1ea0SBarry Smith }
693d1c1ea0SBarry Smith 
703d1c1ea0SBarry Smith static PetscErrorCode  PCFactorGetUseInPlace_Factor(PC pc,PetscBool *flg)
713d1c1ea0SBarry Smith {
723d1c1ea0SBarry Smith   PC_Factor *dir = (PC_Factor*)pc->data;
733d1c1ea0SBarry Smith 
743d1c1ea0SBarry Smith   PetscFunctionBegin;
753d1c1ea0SBarry Smith   *flg = dir->inplace;
763d1c1ea0SBarry Smith   PetscFunctionReturn(0);
773d1c1ea0SBarry Smith }
783d1c1ea0SBarry Smith 
79f8260c8fSBarry Smith /*@
803ca39a21SBarry Smith     PCFactorSetUpMatSolverType - Can be called after KSPSetOperators() or PCSetOperators(), causes MatGetFactor() to be called so then one may
81f8260c8fSBarry Smith        set the options for that particular factorization object.
82f8260c8fSBarry Smith 
83f8260c8fSBarry Smith   Input Parameter:
84f8260c8fSBarry Smith .  pc  - the preconditioner context
85f8260c8fSBarry Smith 
8695452b02SPatrick Sanan   Notes:
8795452b02SPatrick Sanan     After you have called this function (which has to be after the KSPSetOperators() or PCSetOperators()) you can call PCFactorGetMatrix() and then set factor options on that matrix.
88f8260c8fSBarry Smith 
892bd2b0e6SSatish Balay   Level: intermediate
902bd2b0e6SSatish Balay 
916d33885cSprj- .seealso: PCFactorSetMatSolverType(), PCFactorGetMatrix()
92f8260c8fSBarry Smith @*/
933ca39a21SBarry Smith PetscErrorCode PCFactorSetUpMatSolverType(PC pc)
94f8260c8fSBarry Smith {
95f8260c8fSBarry Smith   PetscErrorCode ierr;
96f8260c8fSBarry Smith 
97f8260c8fSBarry Smith   PetscFunctionBegin;
98f8260c8fSBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
993ca39a21SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetUpMatSolverType_C",(PC),(pc));CHKERRQ(ierr);
100b3a44c85SBarry Smith   PetscFunctionReturn(0);
101f8260c8fSBarry Smith }
102f8260c8fSBarry Smith 
103ee45ca4aSHong Zhang /*@
104ee45ca4aSHong Zhang    PCFactorSetZeroPivot - Sets the size at which smaller pivots are declared to be zero
105ee45ca4aSHong Zhang 
106ad4df100SBarry Smith    Logically Collective on PC
107ee45ca4aSHong Zhang 
108ee45ca4aSHong Zhang    Input Parameters:
109afaefe49SHong Zhang +  pc - the preconditioner context
110afaefe49SHong Zhang -  zero - all pivots smaller than this will be considered zero
111ee45ca4aSHong Zhang 
112ee45ca4aSHong Zhang    Options Database Key:
113ee45ca4aSHong Zhang .  -pc_factor_zeropivot <zero> - Sets tolerance for what is considered a zero pivot
114ee45ca4aSHong Zhang 
115ee45ca4aSHong Zhang    Level: intermediate
116ee45ca4aSHong Zhang 
117daa17b54SHong Zhang .seealso: PCFactorSetShiftType(), PCFactorSetShiftAmount()
118ee45ca4aSHong Zhang @*/
1197087cfbeSBarry Smith PetscErrorCode  PCFactorSetZeroPivot(PC pc,PetscReal zero)
120ee45ca4aSHong Zhang {
1214ac538c5SBarry Smith   PetscErrorCode ierr;
122afaefe49SHong Zhang 
123ee45ca4aSHong Zhang   PetscFunctionBegin;
1240700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
125c5eb9154SBarry Smith   PetscValidLogicalCollectiveReal(pc,zero,2);
1264ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetZeroPivot_C",(PC,PetscReal),(pc,zero));CHKERRQ(ierr);
127ee45ca4aSHong Zhang   PetscFunctionReturn(0);
128ee45ca4aSHong Zhang }
129ee45ca4aSHong Zhang 
130915743fcSHong Zhang /*@
131915743fcSHong Zhang    PCFactorSetShiftType - adds a particular type of quantity to the diagonal of the matrix during
132915743fcSHong Zhang      numerical factorization, thus the matrix has nonzero pivots
133915743fcSHong Zhang 
134ad4df100SBarry Smith    Logically Collective on PC
135915743fcSHong Zhang 
136915743fcSHong Zhang    Input Parameters:
137915743fcSHong Zhang +  pc - the preconditioner context
138915743fcSHong Zhang -  shifttype - type of shift; one of MAT_SHIFT_NONE, MAT_SHIFT_NONZERO,  MAT_SHIFT_POSITIVE_DEFINITE, MAT_SHIFT_INBLOCKS
139915743fcSHong Zhang 
140915743fcSHong Zhang    Options Database Key:
14128d58a37SPierre Jolivet .  -pc_factor_shift_type <shifttype> - Sets shift type; use '-help' for a list of available types
142915743fcSHong Zhang 
143915743fcSHong Zhang    Level: intermediate
144915743fcSHong Zhang 
145915743fcSHong Zhang .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftAmount()
146915743fcSHong Zhang @*/
1477087cfbeSBarry Smith PetscErrorCode  PCFactorSetShiftType(PC pc,MatFactorShiftType shifttype)
148d90ac83dSHong Zhang {
1494ac538c5SBarry Smith   PetscErrorCode ierr;
150d90ac83dSHong Zhang 
151d90ac83dSHong Zhang   PetscFunctionBegin;
1520700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
153c5eb9154SBarry Smith   PetscValidLogicalCollectiveEnum(pc,shifttype,2);
1544ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetShiftType_C",(PC,MatFactorShiftType),(pc,shifttype));CHKERRQ(ierr);
155d90ac83dSHong Zhang   PetscFunctionReturn(0);
156d90ac83dSHong Zhang }
157d90ac83dSHong Zhang 
158915743fcSHong Zhang /*@
159915743fcSHong Zhang    PCFactorSetShiftAmount - adds a quantity to the diagonal of the matrix during
160915743fcSHong Zhang      numerical factorization, thus the matrix has nonzero pivots
161915743fcSHong Zhang 
162ad4df100SBarry Smith    Logically Collective on PC
163915743fcSHong Zhang 
164915743fcSHong Zhang    Input Parameters:
165915743fcSHong Zhang +  pc - the preconditioner context
166915743fcSHong Zhang -  shiftamount - amount of shift
167915743fcSHong Zhang 
168915743fcSHong Zhang    Options Database Key:
169915743fcSHong Zhang .  -pc_factor_shift_amount <shiftamount> - Sets shift amount or PETSC_DECIDE for the default
170915743fcSHong Zhang 
171915743fcSHong Zhang    Level: intermediate
172915743fcSHong Zhang 
173915743fcSHong Zhang .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftType()
174915743fcSHong Zhang @*/
1757087cfbeSBarry Smith PetscErrorCode  PCFactorSetShiftAmount(PC pc,PetscReal shiftamount)
176d90ac83dSHong Zhang {
1774ac538c5SBarry Smith   PetscErrorCode ierr;
178d90ac83dSHong Zhang 
179d90ac83dSHong Zhang   PetscFunctionBegin;
1800700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
181c5eb9154SBarry Smith   PetscValidLogicalCollectiveReal(pc,shiftamount,2);
1824ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetShiftAmount_C",(PC,PetscReal),(pc,shiftamount));CHKERRQ(ierr);
183d90ac83dSHong Zhang   PetscFunctionReturn(0);
184d90ac83dSHong Zhang }
185d90ac83dSHong Zhang 
1866d33885cSprj- /*@
187b7c853c4SBarry Smith    PCFactorSetDropTolerance - The preconditioner will use an ILU
18878fc6b22SHong Zhang    based on a drop tolerance. (Under development)
18985317021SBarry Smith 
190ad4df100SBarry Smith    Logically Collective on PC
19185317021SBarry Smith 
19285317021SBarry Smith    Input Parameters:
19385317021SBarry Smith +  pc - the preconditioner context
19485317021SBarry Smith .  dt - the drop tolerance, try from 1.e-10 to .1
19585317021SBarry Smith .  dtcol - tolerance for column pivot, good values [0.1 to 0.01]
19685317021SBarry Smith -  maxrowcount - the max number of nonzeros allowed in a row, best value
19785317021SBarry Smith                  depends on the number of nonzeros in row of original matrix
19885317021SBarry Smith 
19985317021SBarry Smith    Options Database Key:
200b7c853c4SBarry Smith .  -pc_factor_drop_tolerance <dt,dtcol,maxrowcount> - Sets drop tolerance
20185317021SBarry Smith 
20285317021SBarry Smith    Level: intermediate
20385317021SBarry Smith 
20485317021SBarry Smith       There are NO default values for the 3 parameters, you must set them with reasonable values for your
20585317021SBarry Smith       matrix. We don't know how to compute reasonable values.
20685317021SBarry Smith 
2076d33885cSprj- @*/
2087087cfbeSBarry Smith PetscErrorCode  PCFactorSetDropTolerance(PC pc,PetscReal dt,PetscReal dtcol,PetscInt maxrowcount)
20985317021SBarry Smith {
2104ac538c5SBarry Smith   PetscErrorCode ierr;
21185317021SBarry Smith 
21285317021SBarry Smith   PetscFunctionBegin;
2130700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
214064a246eSJacob Faibussowitsch   PetscValidLogicalCollectiveReal(pc,dtcol,3);
215064a246eSJacob Faibussowitsch   PetscValidLogicalCollectiveInt(pc,maxrowcount,4);
2164ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetDropTolerance_C",(PC,PetscReal,PetscReal,PetscInt),(pc,dt,dtcol,maxrowcount));CHKERRQ(ierr);
21785317021SBarry Smith   PetscFunctionReturn(0);
21885317021SBarry Smith }
21985317021SBarry Smith 
220c7f610a1SBarry Smith /*@
221c7f610a1SBarry Smith    PCFactorGetZeroPivot - Gets the tolerance used to define a zero privot
222c7f610a1SBarry Smith 
223c7f610a1SBarry Smith    Not Collective
224c7f610a1SBarry Smith 
225c7f610a1SBarry Smith    Input Parameters:
226c7f610a1SBarry Smith .  pc - the preconditioner context
227c7f610a1SBarry Smith 
228c7f610a1SBarry Smith    Output Parameter:
229c7f610a1SBarry Smith .  pivot - the tolerance
230c7f610a1SBarry Smith 
231c7f610a1SBarry Smith    Level: intermediate
232c7f610a1SBarry Smith 
233c7f610a1SBarry Smith .seealso: PCFactorSetZeroPivot()
234c7f610a1SBarry Smith @*/
235c7f610a1SBarry Smith PetscErrorCode  PCFactorGetZeroPivot(PC pc,PetscReal *pivot)
236c7f610a1SBarry Smith {
237c7f610a1SBarry Smith   PetscErrorCode ierr;
238c7f610a1SBarry Smith 
239c7f610a1SBarry Smith   PetscFunctionBegin;
240c7f610a1SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
241c7f610a1SBarry Smith   ierr = PetscUseMethod(pc,"PCFactorGetZeroPivot_C",(PC,PetscReal*),(pc,pivot));CHKERRQ(ierr);
242c7f610a1SBarry Smith   PetscFunctionReturn(0);
243c7f610a1SBarry Smith }
244c7f610a1SBarry Smith 
245c7f610a1SBarry Smith /*@
246c7f610a1SBarry Smith    PCFactorGetShiftAmount - Gets the tolerance used to define a zero privot
247c7f610a1SBarry Smith 
248c7f610a1SBarry Smith    Not Collective
249c7f610a1SBarry Smith 
250c7f610a1SBarry Smith    Input Parameters:
251c7f610a1SBarry Smith .  pc - the preconditioner context
252c7f610a1SBarry Smith 
253c7f610a1SBarry Smith    Output Parameter:
254c7f610a1SBarry Smith .  shift - how much to shift the diagonal entry
255c7f610a1SBarry Smith 
256c7f610a1SBarry Smith    Level: intermediate
257c7f610a1SBarry Smith 
258c7f610a1SBarry Smith .seealso: PCFactorSetShiftAmount(), PCFactorSetShiftType(), PCFactorGetShiftType()
259c7f610a1SBarry Smith @*/
260c7f610a1SBarry Smith PetscErrorCode  PCFactorGetShiftAmount(PC pc,PetscReal *shift)
261c7f610a1SBarry Smith {
262c7f610a1SBarry Smith   PetscErrorCode ierr;
263c7f610a1SBarry Smith 
264c7f610a1SBarry Smith   PetscFunctionBegin;
265c7f610a1SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
266c7f610a1SBarry Smith   ierr = PetscUseMethod(pc,"PCFactorGetShiftAmount_C",(PC,PetscReal*),(pc,shift));CHKERRQ(ierr);
267c7f610a1SBarry Smith   PetscFunctionReturn(0);
268c7f610a1SBarry Smith }
269c7f610a1SBarry Smith 
270c7f610a1SBarry Smith /*@
271c7f610a1SBarry Smith    PCFactorGetShiftType - Gets the type of shift, if any, done when a zero pivot is detected
272c7f610a1SBarry Smith 
273c7f610a1SBarry Smith    Not Collective
274c7f610a1SBarry Smith 
275c7f610a1SBarry Smith    Input Parameters:
276c7f610a1SBarry Smith .  pc - the preconditioner context
277c7f610a1SBarry Smith 
278c7f610a1SBarry Smith    Output Parameter:
279c7f610a1SBarry Smith .  type - one of MAT_SHIFT_NONE, MAT_SHIFT_NONZERO,  MAT_SHIFT_POSITIVE_DEFINITE, or MAT_SHIFT_INBLOCKS
280c7f610a1SBarry Smith 
281c7f610a1SBarry Smith    Level: intermediate
282c7f610a1SBarry Smith 
283c7f610a1SBarry Smith .seealso: PCFactorSetShiftType(), MatFactorShiftType, PCFactorSetShiftAmount(), PCFactorGetShiftAmount()
284c7f610a1SBarry Smith @*/
285c7f610a1SBarry Smith PetscErrorCode  PCFactorGetShiftType(PC pc,MatFactorShiftType *type)
286c7f610a1SBarry Smith {
287c7f610a1SBarry Smith   PetscErrorCode ierr;
288c7f610a1SBarry Smith 
289c7f610a1SBarry Smith   PetscFunctionBegin;
290c7f610a1SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
291c7f610a1SBarry Smith   ierr = PetscUseMethod(pc,"PCFactorGetShiftType_C",(PC,MatFactorShiftType*),(pc,type));CHKERRQ(ierr);
292c7f610a1SBarry Smith   PetscFunctionReturn(0);
293c7f610a1SBarry Smith }
294c7f610a1SBarry Smith 
2952591b318SToby Isaac /*@
2962591b318SToby Isaac    PCFactorGetLevels - Gets the number of levels of fill to use.
2972591b318SToby Isaac 
2982591b318SToby Isaac    Logically Collective on PC
2992591b318SToby Isaac 
3002591b318SToby Isaac    Input Parameters:
3012591b318SToby Isaac .  pc - the preconditioner context
3022591b318SToby Isaac 
3032591b318SToby Isaac    Output Parameter:
3042591b318SToby Isaac .  levels - number of levels of fill
3052591b318SToby Isaac 
3062591b318SToby Isaac    Level: intermediate
3072591b318SToby Isaac 
3082591b318SToby Isaac @*/
3092591b318SToby Isaac PetscErrorCode  PCFactorGetLevels(PC pc,PetscInt *levels)
3102591b318SToby Isaac {
3112591b318SToby Isaac   PetscErrorCode ierr;
3122591b318SToby Isaac 
3132591b318SToby Isaac   PetscFunctionBegin;
3142591b318SToby Isaac   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
315c60c7ad4SBarry Smith   ierr = PetscUseMethod(pc,"PCFactorGetLevels_C",(PC,PetscInt*),(pc,levels));CHKERRQ(ierr);
3162591b318SToby Isaac   PetscFunctionReturn(0);
3172591b318SToby Isaac }
3182591b318SToby Isaac 
31985317021SBarry Smith /*@
32085317021SBarry Smith    PCFactorSetLevels - Sets the number of levels of fill to use.
32185317021SBarry Smith 
322ad4df100SBarry Smith    Logically Collective on PC
32385317021SBarry Smith 
32485317021SBarry Smith    Input Parameters:
32585317021SBarry Smith +  pc - the preconditioner context
32685317021SBarry Smith -  levels - number of levels of fill
32785317021SBarry Smith 
32885317021SBarry Smith    Options Database Key:
32985317021SBarry Smith .  -pc_factor_levels <levels> - Sets fill level
33085317021SBarry Smith 
33185317021SBarry Smith    Level: intermediate
33285317021SBarry Smith 
33385317021SBarry Smith @*/
3347087cfbeSBarry Smith PetscErrorCode  PCFactorSetLevels(PC pc,PetscInt levels)
33585317021SBarry Smith {
3364ac538c5SBarry Smith   PetscErrorCode ierr;
33785317021SBarry Smith 
33885317021SBarry Smith   PetscFunctionBegin;
3390700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
3402c71b3e2SJacob Faibussowitsch   PetscCheckFalse(levels < 0,PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"negative levels");
341c5eb9154SBarry Smith   PetscValidLogicalCollectiveInt(pc,levels,2);
3424ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetLevels_C",(PC,PetscInt),(pc,levels));CHKERRQ(ierr);
34385317021SBarry Smith   PetscFunctionReturn(0);
34485317021SBarry Smith }
34585317021SBarry Smith 
34685317021SBarry Smith /*@
34785317021SBarry Smith    PCFactorSetAllowDiagonalFill - Causes all diagonal matrix entries to be
34885317021SBarry Smith    treated as level 0 fill even if there is no non-zero location.
34985317021SBarry Smith 
350ad4df100SBarry Smith    Logically Collective on PC
35185317021SBarry Smith 
35285317021SBarry Smith    Input Parameters:
35385317021SBarry Smith +  pc - the preconditioner context
35492e9c092SBarry Smith -  flg - PETSC_TRUE to turn on, PETSC_FALSE to turn off
35585317021SBarry Smith 
35685317021SBarry Smith    Options Database Key:
357*147403d9SBarry Smith .  -pc_factor_diagonal_fill <bool> allow the diagonal fill
35885317021SBarry Smith 
35985317021SBarry Smith    Notes:
36085317021SBarry Smith    Does not apply with 0 fill.
36185317021SBarry Smith 
36285317021SBarry Smith    Level: intermediate
36385317021SBarry Smith 
36492e9c092SBarry Smith .seealso: PCFactorGetAllowDiagonalFill()
36585317021SBarry Smith @*/
36692e9c092SBarry Smith PetscErrorCode  PCFactorSetAllowDiagonalFill(PC pc,PetscBool flg)
36785317021SBarry Smith {
3684ac538c5SBarry Smith   PetscErrorCode ierr;
36985317021SBarry Smith 
37085317021SBarry Smith   PetscFunctionBegin;
3710700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
37292e9c092SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetAllowDiagonalFill_C",(PC,PetscBool),(pc,flg));CHKERRQ(ierr);
37392e9c092SBarry Smith   PetscFunctionReturn(0);
37492e9c092SBarry Smith }
37592e9c092SBarry Smith 
37692e9c092SBarry Smith /*@
37792e9c092SBarry Smith    PCFactorGetAllowDiagonalFill - Determines if all diagonal matrix entries are
37892e9c092SBarry Smith        treated as level 0 fill even if there is no non-zero location.
37992e9c092SBarry Smith 
38092e9c092SBarry Smith    Logically Collective on PC
38192e9c092SBarry Smith 
38292e9c092SBarry Smith    Input Parameter:
38392e9c092SBarry Smith .  pc - the preconditioner context
38492e9c092SBarry Smith 
38592e9c092SBarry Smith    Output Parameter:
38692e9c092SBarry Smith .   flg - PETSC_TRUE to turn on, PETSC_FALSE to turn off
38792e9c092SBarry Smith 
38892e9c092SBarry Smith    Notes:
38992e9c092SBarry Smith    Does not apply with 0 fill.
39092e9c092SBarry Smith 
39192e9c092SBarry Smith    Level: intermediate
39292e9c092SBarry Smith 
39392e9c092SBarry Smith .seealso: PCFactorSetAllowDiagonalFill()
39492e9c092SBarry Smith @*/
39592e9c092SBarry Smith PetscErrorCode  PCFactorGetAllowDiagonalFill(PC pc,PetscBool *flg)
39692e9c092SBarry Smith {
39792e9c092SBarry Smith   PetscErrorCode ierr;
39892e9c092SBarry Smith 
39992e9c092SBarry Smith   PetscFunctionBegin;
40092e9c092SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
401c60c7ad4SBarry Smith   ierr = PetscUseMethod(pc,"PCFactorGetAllowDiagonalFill_C",(PC,PetscBool*),(pc,flg));CHKERRQ(ierr);
40285317021SBarry Smith   PetscFunctionReturn(0);
40385317021SBarry Smith }
40485317021SBarry Smith 
40585317021SBarry Smith /*@
40685317021SBarry Smith    PCFactorReorderForNonzeroDiagonal - reorders rows/columns of matrix to remove zeros from diagonal
40785317021SBarry Smith 
408ad4df100SBarry Smith    Logically Collective on PC
40985317021SBarry Smith 
41085317021SBarry Smith    Input Parameters:
41185317021SBarry Smith +  pc - the preconditioner context
41285317021SBarry Smith -  tol - diagonal entries smaller than this in absolute value are considered zero
41385317021SBarry Smith 
41485317021SBarry Smith    Options Database Key:
415*147403d9SBarry Smith .  -pc_factor_nonzeros_along_diagonal <tol> - perform the reordering with the given tolerance
41685317021SBarry Smith 
41785317021SBarry Smith    Level: intermediate
41885317021SBarry Smith 
41985317021SBarry Smith .seealso: PCFactorSetFill(), PCFactorSetShiftNonzero(), PCFactorSetZeroPivot(), MatReorderForNonzeroDiagonal()
42085317021SBarry Smith @*/
4217087cfbeSBarry Smith PetscErrorCode  PCFactorReorderForNonzeroDiagonal(PC pc,PetscReal rtol)
42285317021SBarry Smith {
4234ac538c5SBarry Smith   PetscErrorCode ierr;
42485317021SBarry Smith 
42585317021SBarry Smith   PetscFunctionBegin;
4260700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
427c5eb9154SBarry Smith   PetscValidLogicalCollectiveReal(pc,rtol,2);
4284ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorReorderForNonzeroDiagonal_C",(PC,PetscReal),(pc,rtol));CHKERRQ(ierr);
42985317021SBarry Smith   PetscFunctionReturn(0);
43085317021SBarry Smith }
43185317021SBarry Smith 
432bf6011e8SBarry Smith /*@C
4333ca39a21SBarry Smith    PCFactorSetMatSolverType - sets the software that is used to perform the factorization
43485317021SBarry Smith 
435ad4df100SBarry Smith    Logically Collective on PC
43685317021SBarry Smith 
43785317021SBarry Smith    Input Parameters:
43885317021SBarry Smith +  pc - the preconditioner context
439f60c3dc2SHong Zhang -  stype - for example, superlu, superlu_dist
44085317021SBarry Smith 
44185317021SBarry Smith    Options Database Key:
4423ca39a21SBarry Smith .  -pc_factor_mat_solver_type <stype> - petsc, superlu, superlu_dist, mumps, cusparse
44385317021SBarry Smith 
44485317021SBarry Smith    Level: intermediate
44585317021SBarry Smith 
44685317021SBarry Smith    Note:
44785317021SBarry Smith      By default this will use the PETSc factorization if it exists
44885317021SBarry Smith 
4493ca39a21SBarry Smith .seealso: MatGetFactor(), MatSolverType, PCFactorGetMatSolverType()
45085317021SBarry Smith @*/
451ea799195SBarry Smith PetscErrorCode  PCFactorSetMatSolverType(PC pc,MatSolverType stype)
45285317021SBarry Smith {
4534ac538c5SBarry Smith   PetscErrorCode ierr;
45485317021SBarry Smith 
45585317021SBarry Smith   PetscFunctionBegin;
4560700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
457ea799195SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetMatSolverType_C",(PC,MatSolverType),(pc,stype));CHKERRQ(ierr);
45885317021SBarry Smith   PetscFunctionReturn(0);
45985317021SBarry Smith }
46085317021SBarry Smith 
461bf6011e8SBarry Smith /*@C
4623ca39a21SBarry Smith    PCFactorGetMatSolverType - gets the software that is used to perform the factorization
4637112b564SBarry Smith 
464c5eb9154SBarry Smith    Not Collective
4657112b564SBarry Smith 
4667112b564SBarry Smith    Input Parameter:
4677112b564SBarry Smith .  pc - the preconditioner context
4687112b564SBarry Smith 
4697112b564SBarry Smith    Output Parameter:
4700298fd71SBarry Smith .   stype - for example, superlu, superlu_dist (NULL if the PC does not have a solver package)
4717112b564SBarry Smith 
4727112b564SBarry Smith    Level: intermediate
4737112b564SBarry Smith 
4743ca39a21SBarry Smith .seealso: MatGetFactor(), MatSolverType, PCFactorGetMatSolverType()
4757112b564SBarry Smith @*/
476ea799195SBarry Smith PetscErrorCode  PCFactorGetMatSolverType(PC pc,MatSolverType *stype)
4777112b564SBarry Smith {
478ea799195SBarry Smith   PetscErrorCode ierr,(*f)(PC,MatSolverType*);
4797112b564SBarry Smith 
4807112b564SBarry Smith   PetscFunctionBegin;
4810700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
4823ca39a21SBarry Smith   ierr = PetscObjectQueryFunction((PetscObject)pc,"PCFactorGetMatSolverType_C",&f);CHKERRQ(ierr);
4838b5c83b4SJed Brown   if (f) {
4848b5c83b4SJed Brown     ierr = (*f)(pc,stype);CHKERRQ(ierr);
4858b5c83b4SJed Brown   } else {
4860298fd71SBarry Smith     *stype = NULL;
4878b5c83b4SJed Brown   }
4887112b564SBarry Smith   PetscFunctionReturn(0);
4897112b564SBarry Smith }
4907112b564SBarry Smith 
49185317021SBarry Smith /*@
49285317021SBarry Smith    PCFactorSetFill - Indicate the amount of fill you expect in the factored matrix,
49385317021SBarry Smith    fill = number nonzeros in factor/number nonzeros in original matrix.
49485317021SBarry Smith 
495c5eb9154SBarry Smith    Not Collective, each process can expect a different amount of fill
49685317021SBarry Smith 
49785317021SBarry Smith    Input Parameters:
49885317021SBarry Smith +  pc - the preconditioner context
49985317021SBarry Smith -  fill - amount of expected fill
50085317021SBarry Smith 
50185317021SBarry Smith    Options Database Key:
50285317021SBarry Smith .  -pc_factor_fill <fill> - Sets fill amount
50385317021SBarry Smith 
50485317021SBarry Smith    Level: intermediate
50585317021SBarry Smith 
50685317021SBarry Smith    Note:
50785317021SBarry Smith    For sparse matrix factorizations it is difficult to predict how much
50885317021SBarry Smith    fill to expect. By running with the option -info PETSc will print the
50985317021SBarry Smith    actual amount of fill used; allowing you to set the value accurately for
51085317021SBarry Smith    future runs. Default PETSc uses a value of 5.0
51185317021SBarry Smith 
51201a79839SBarry Smith    This parameter has NOTHING to do with the levels-of-fill of ILU(). That is set with PCFactorSetLevels() or -pc_factor_levels.
51301a79839SBarry Smith 
51485317021SBarry Smith @*/
5157087cfbeSBarry Smith PetscErrorCode  PCFactorSetFill(PC pc,PetscReal fill)
51685317021SBarry Smith {
5174ac538c5SBarry Smith   PetscErrorCode ierr;
51885317021SBarry Smith 
51985317021SBarry Smith   PetscFunctionBegin;
5200700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
5212c71b3e2SJacob Faibussowitsch   PetscCheckFalse(fill < 1.0,PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"Fill factor cannot be less then 1.0");
5224ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetFill_C",(PC,PetscReal),(pc,fill));CHKERRQ(ierr);
52385317021SBarry Smith   PetscFunctionReturn(0);
52485317021SBarry Smith }
52585317021SBarry Smith 
52685317021SBarry Smith /*@
52785317021SBarry Smith    PCFactorSetUseInPlace - Tells the system to do an in-place factorization.
52885317021SBarry Smith    For dense matrices, this enables the solution of much larger problems.
52985317021SBarry Smith    For sparse matrices the factorization cannot be done truly in-place
53085317021SBarry Smith    so this does not save memory during the factorization, but after the matrix
53185317021SBarry Smith    is factored, the original unfactored matrix is freed, thus recovering that
532ec5066bdSBarry Smith    space. For ICC(0) and ILU(0) with the default natural ordering the factorization is done efficiently in-place.
53385317021SBarry Smith 
534ad4df100SBarry Smith    Logically Collective on PC
53585317021SBarry Smith 
53685317021SBarry Smith    Input Parameters:
5378e37d05fSBarry Smith +  pc - the preconditioner context
5388e37d05fSBarry Smith -  flg - PETSC_TRUE to enable, PETSC_FALSE to disable
53985317021SBarry Smith 
54085317021SBarry Smith    Options Database Key:
5418e37d05fSBarry Smith .  -pc_factor_in_place <true,false>- Activate/deactivate in-place factorization
54285317021SBarry Smith 
54385317021SBarry Smith    Notes:
54485317021SBarry Smith    PCFactorSetUseInplace() can only be used with the KSP method KSPPREONLY or when
54585317021SBarry Smith    a different matrix is provided for the multiply and the preconditioner in
54685317021SBarry Smith    a call to KSPSetOperators().
54785317021SBarry Smith    This is because the Krylov space methods require an application of the
54885317021SBarry Smith    matrix multiplication, which is not possible here because the matrix has
54985317021SBarry Smith    been factored in-place, replacing the original matrix.
55085317021SBarry Smith 
55185317021SBarry Smith    Level: intermediate
55285317021SBarry Smith 
5538e37d05fSBarry Smith .seealso: PCFactorGetUseInPlace()
55485317021SBarry Smith @*/
5558e37d05fSBarry Smith PetscErrorCode  PCFactorSetUseInPlace(PC pc,PetscBool flg)
55685317021SBarry Smith {
5574ac538c5SBarry Smith   PetscErrorCode ierr;
55885317021SBarry Smith 
55985317021SBarry Smith   PetscFunctionBegin;
5600700a824SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
5618e37d05fSBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetUseInPlace_C",(PC,PetscBool),(pc,flg));CHKERRQ(ierr);
5628e37d05fSBarry Smith   PetscFunctionReturn(0);
5638e37d05fSBarry Smith }
5648e37d05fSBarry Smith 
5658e37d05fSBarry Smith /*@
5668e37d05fSBarry Smith    PCFactorGetUseInPlace - Determines if an in-place factorization is being used.
5678e37d05fSBarry Smith 
5688e37d05fSBarry Smith    Logically Collective on PC
5698e37d05fSBarry Smith 
5708e37d05fSBarry Smith    Input Parameter:
5718e37d05fSBarry Smith .  pc - the preconditioner context
5728e37d05fSBarry Smith 
5738e37d05fSBarry Smith    Output Parameter:
5748e37d05fSBarry Smith .  flg - PETSC_TRUE to enable, PETSC_FALSE to disable
5758e37d05fSBarry Smith 
5768e37d05fSBarry Smith    Level: intermediate
5778e37d05fSBarry Smith 
5788e37d05fSBarry Smith .seealso: PCFactorSetUseInPlace()
5798e37d05fSBarry Smith @*/
5808e37d05fSBarry Smith PetscErrorCode  PCFactorGetUseInPlace(PC pc,PetscBool *flg)
5818e37d05fSBarry Smith {
5828e37d05fSBarry Smith   PetscErrorCode ierr;
5838e37d05fSBarry Smith 
5848e37d05fSBarry Smith   PetscFunctionBegin;
5858e37d05fSBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
586c60c7ad4SBarry Smith   ierr = PetscUseMethod(pc,"PCFactorGetUseInPlace_C",(PC,PetscBool*),(pc,flg));CHKERRQ(ierr);
58785317021SBarry Smith   PetscFunctionReturn(0);
58885317021SBarry Smith }
58985317021SBarry Smith 
59085317021SBarry Smith /*@C
59185317021SBarry Smith     PCFactorSetMatOrderingType - Sets the ordering routine (to reduce fill) to
5922c7c0729SBarry Smith     be used in the LU, ILU, Cholesky, and ICC factorizations.
59385317021SBarry Smith 
594ad4df100SBarry Smith     Logically Collective on PC
59585317021SBarry Smith 
59685317021SBarry Smith     Input Parameters:
59785317021SBarry Smith +   pc - the preconditioner context
5982692d6eeSBarry Smith -   ordering - the matrix ordering name, for example, MATORDERINGND or MATORDERINGRCM
59985317021SBarry Smith 
60085317021SBarry Smith     Options Database Key:
6012c7c0729SBarry Smith .   -pc_factor_mat_ordering_type <nd,rcm,...,external> - Sets ordering routine
60285317021SBarry Smith 
60385317021SBarry Smith     Level: intermediate
60485317021SBarry Smith 
60595452b02SPatrick Sanan     Notes:
6064ac6704cSBarry Smith       Nested dissection is used by default for some of PETSc's sparse matrix formats
60785317021SBarry Smith 
6089bd791bbSBarry Smith      For Cholesky and ICC and the SBAIJ format the only reordering available is natural since only the upper half of the matrix is stored
6099bd791bbSBarry Smith      and reordering this matrix is very expensive.
6109bd791bbSBarry Smith 
6114ac6704cSBarry Smith       You can use a SeqAIJ matrix with Cholesky and ICC and use any ordering.
6129bd791bbSBarry Smith 
6134ac6704cSBarry Smith       MATORDERINGEXTERNAL means PETSc will not compute an ordering and the package will use its own ordering, usable with MATSOLVERCHOLMOD, MATSOLVERUMFPACK, and others.
6142c7c0729SBarry Smith 
6159bd791bbSBarry Smith .seealso: MatOrderingType
61685317021SBarry Smith 
61785317021SBarry Smith @*/
61819fd82e9SBarry Smith PetscErrorCode  PCFactorSetMatOrderingType(PC pc,MatOrderingType ordering)
61985317021SBarry Smith {
6204ac538c5SBarry Smith   PetscErrorCode ierr;
62185317021SBarry Smith 
62285317021SBarry Smith   PetscFunctionBegin;
623c5eb9154SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
62419fd82e9SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetMatOrderingType_C",(PC,MatOrderingType),(pc,ordering));CHKERRQ(ierr);
62585317021SBarry Smith   PetscFunctionReturn(0);
62685317021SBarry Smith }
62785317021SBarry Smith 
62885317021SBarry Smith /*@
6298ff23777SHong Zhang     PCFactorSetColumnPivot - Determines when column pivoting is done during matrix factorization.
63085317021SBarry Smith       For PETSc dense matrices column pivoting is always done, for PETSc sparse matrices
631e3c5b3baSBarry Smith       it is never done. For the MATLAB and SuperLU factorization this is used.
63285317021SBarry Smith 
633ad4df100SBarry Smith     Logically Collective on PC
63485317021SBarry Smith 
63585317021SBarry Smith     Input Parameters:
63685317021SBarry Smith +   pc - the preconditioner context
63785317021SBarry Smith -   dtcol - 0.0 implies no pivoting, 1.0 complete pivoting (slower, requires more memory but more stable)
63885317021SBarry Smith 
63985317021SBarry Smith     Options Database Key:
640*147403d9SBarry Smith .   -pc_factor_pivoting <dtcol> - perform the pivoting with the given tolerance
64185317021SBarry Smith 
64285317021SBarry Smith     Level: intermediate
64385317021SBarry Smith 
64485317021SBarry Smith .seealso: PCILUSetMatOrdering(), PCFactorSetPivotInBlocks()
64585317021SBarry Smith @*/
6467087cfbeSBarry Smith PetscErrorCode  PCFactorSetColumnPivot(PC pc,PetscReal dtcol)
64785317021SBarry Smith {
6484ac538c5SBarry Smith   PetscErrorCode ierr;
64985317021SBarry Smith 
65085317021SBarry Smith   PetscFunctionBegin;
651c5eb9154SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
652c5eb9154SBarry Smith   PetscValidLogicalCollectiveReal(pc,dtcol,2);
6534ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetColumnPivot_C",(PC,PetscReal),(pc,dtcol));CHKERRQ(ierr);
65485317021SBarry Smith   PetscFunctionReturn(0);
65585317021SBarry Smith }
65685317021SBarry Smith 
65785317021SBarry Smith /*@
65885317021SBarry Smith     PCFactorSetPivotInBlocks - Determines if pivoting is done while factoring each block
65985317021SBarry Smith       with BAIJ or SBAIJ matrices
66085317021SBarry Smith 
661ad4df100SBarry Smith     Logically Collective on PC
66285317021SBarry Smith 
66385317021SBarry Smith     Input Parameters:
66485317021SBarry Smith +   pc - the preconditioner context
66585317021SBarry Smith -   pivot - PETSC_TRUE or PETSC_FALSE
66685317021SBarry Smith 
66785317021SBarry Smith     Options Database Key:
66885317021SBarry Smith .   -pc_factor_pivot_in_blocks <true,false>
66985317021SBarry Smith 
67085317021SBarry Smith     Level: intermediate
67185317021SBarry Smith 
6728ff23777SHong Zhang .seealso: PCILUSetMatOrdering(), PCFactorSetColumnPivot()
67385317021SBarry Smith @*/
6747087cfbeSBarry Smith PetscErrorCode  PCFactorSetPivotInBlocks(PC pc,PetscBool pivot)
67585317021SBarry Smith {
6764ac538c5SBarry Smith   PetscErrorCode ierr;
67785317021SBarry Smith 
67885317021SBarry Smith   PetscFunctionBegin;
679c5eb9154SBarry Smith   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
680acfcf0e5SJed Brown   PetscValidLogicalCollectiveBool(pc,pivot,2);
6814ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetPivotInBlocks_C",(PC,PetscBool),(pc,pivot));CHKERRQ(ierr);
68285317021SBarry Smith   PetscFunctionReturn(0);
68385317021SBarry Smith }
68485317021SBarry Smith 
68585317021SBarry Smith /*@
686288e7d53SBarry Smith    PCFactorSetReuseFill - When matrices with different nonzero structure are factored,
68785317021SBarry Smith    this causes later ones to use the fill ratio computed in the initial factorization.
68885317021SBarry Smith 
689ad4df100SBarry Smith    Logically Collective on PC
69085317021SBarry Smith 
69185317021SBarry Smith    Input Parameters:
69285317021SBarry Smith +  pc - the preconditioner context
69385317021SBarry Smith -  flag - PETSC_TRUE to reuse else PETSC_FALSE
69485317021SBarry Smith 
69585317021SBarry Smith    Options Database Key:
69685317021SBarry Smith .  -pc_factor_reuse_fill - Activates PCFactorSetReuseFill()
69785317021SBarry Smith 
69885317021SBarry Smith    Level: intermediate
69985317021SBarry Smith 
70085317021SBarry Smith .seealso: PCFactorSetReuseOrdering()
70185317021SBarry Smith @*/
7027087cfbeSBarry Smith PetscErrorCode  PCFactorSetReuseFill(PC pc,PetscBool flag)
70385317021SBarry Smith {
7044ac538c5SBarry Smith   PetscErrorCode ierr;
70585317021SBarry Smith 
70685317021SBarry Smith   PetscFunctionBegin;
707064a246eSJacob Faibussowitsch   PetscValidHeaderSpecific(pc,PC_CLASSID,1);
708acfcf0e5SJed Brown   PetscValidLogicalCollectiveBool(pc,flag,2);
7094ac538c5SBarry Smith   ierr = PetscTryMethod(pc,"PCFactorSetReuseFill_C",(PC,PetscBool),(pc,flag));CHKERRQ(ierr);
71085317021SBarry Smith   PetscFunctionReturn(0);
71185317021SBarry Smith }
7123d1c1ea0SBarry Smith 
7134ac6704cSBarry Smith PetscErrorCode PCFactorInitialize(PC pc,MatFactorType ftype)
7143d1c1ea0SBarry Smith {
7153d1c1ea0SBarry Smith   PetscErrorCode ierr;
7163d1c1ea0SBarry Smith   PC_Factor      *fact = (PC_Factor*)pc->data;
7173d1c1ea0SBarry Smith 
7183d1c1ea0SBarry Smith   PetscFunctionBegin;
7193d1c1ea0SBarry Smith   ierr                       = MatFactorInfoInitialize(&fact->info);CHKERRQ(ierr);
7204ac6704cSBarry Smith   fact->factortype           = ftype;
7213d1c1ea0SBarry Smith   fact->info.shifttype       = (PetscReal)MAT_SHIFT_NONE;
7223d1c1ea0SBarry Smith   fact->info.shiftamount     = 100.0*PETSC_MACHINE_EPSILON;
7233d1c1ea0SBarry Smith   fact->info.zeropivot       = 100.0*PETSC_MACHINE_EPSILON;
7243d1c1ea0SBarry Smith   fact->info.pivotinblocks   = 1.0;
7253d1c1ea0SBarry Smith   pc->ops->getfactoredmatrix = PCFactorGetMatrix_Factor;
7263d1c1ea0SBarry Smith 
7273d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetZeroPivot_C",PCFactorSetZeroPivot_Factor);CHKERRQ(ierr);
7283d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetZeroPivot_C",PCFactorGetZeroPivot_Factor);CHKERRQ(ierr);
7293d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetShiftType_C",PCFactorSetShiftType_Factor);CHKERRQ(ierr);
7303d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetShiftType_C",PCFactorGetShiftType_Factor);CHKERRQ(ierr);
7313d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetShiftAmount_C",PCFactorSetShiftAmount_Factor);CHKERRQ(ierr);
7323d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetShiftAmount_C",PCFactorGetShiftAmount_Factor);CHKERRQ(ierr);
7333ca39a21SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetMatSolverType_C",PCFactorGetMatSolverType_Factor);CHKERRQ(ierr);
7343ca39a21SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetMatSolverType_C",PCFactorSetMatSolverType_Factor);CHKERRQ(ierr);
7353ca39a21SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetUpMatSolverType_C",PCFactorSetUpMatSolverType_Factor);CHKERRQ(ierr);
7363d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetFill_C",PCFactorSetFill_Factor);CHKERRQ(ierr);
7373d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetMatOrderingType_C",PCFactorSetMatOrderingType_Factor);CHKERRQ(ierr);
7383d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetLevels_C",PCFactorSetLevels_Factor);CHKERRQ(ierr);
7393d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetLevels_C",PCFactorGetLevels_Factor);CHKERRQ(ierr);
7403d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetAllowDiagonalFill_C",PCFactorSetAllowDiagonalFill_Factor);CHKERRQ(ierr);
7413d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetAllowDiagonalFill_C",PCFactorGetAllowDiagonalFill_Factor);CHKERRQ(ierr);
7423d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetPivotInBlocks_C",PCFactorSetPivotInBlocks_Factor);CHKERRQ(ierr);
7433d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetUseInPlace_C",PCFactorSetUseInPlace_Factor);CHKERRQ(ierr);
7443d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetUseInPlace_C",PCFactorGetUseInPlace_Factor);CHKERRQ(ierr);
7453d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetReuseOrdering_C",PCFactorSetReuseOrdering_Factor);CHKERRQ(ierr);
7463d1c1ea0SBarry Smith   ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetReuseFill_C",PCFactorSetReuseFill_Factor);CHKERRQ(ierr);
7473d1c1ea0SBarry Smith   PetscFunctionReturn(0);
7483d1c1ea0SBarry Smith }
749