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 */ 89371c9d4SSatish Balay PetscErrorCode PCFactorSetDefaultOrdering_Factor(PC pc) { 9978beb7fSPierre Jolivet PetscBool foundmtype, flg; 1026cc229bSBarry Smith const char *prefix; 114ac6704cSBarry Smith 124ac6704cSBarry Smith PetscFunctionBegin; 134ac6704cSBarry Smith if (pc->pmat) { 1426cc229bSBarry Smith PetscCall(PCGetOptionsPrefix(pc, &prefix)); 1526cc229bSBarry Smith PetscCall(MatSetOptionsPrefixFactor(pc->pmat, prefix)); 164ac6704cSBarry Smith PC_Factor *fact = (PC_Factor *)pc->data; 179566063dSJacob Faibussowitsch PetscCall(MatSolverTypeGet(fact->solvertype, ((PetscObject)pc->pmat)->type_name, fact->factortype, NULL, &foundmtype, NULL)); 18978beb7fSPierre Jolivet if (foundmtype) { 194ac6704cSBarry Smith if (!fact->fact) { 209566063dSJacob Faibussowitsch PetscCall(MatGetFactor(pc->pmat, fact->solvertype, fact->factortype, &fact->fact)); 21978beb7fSPierre Jolivet } else if (!fact->fact->assembled) { 229566063dSJacob Faibussowitsch PetscCall(PetscStrcmp(fact->solvertype, fact->fact->solvertype, &flg)); 23978beb7fSPierre Jolivet if (!flg) { 2426cc229bSBarry Smith Mat B; 259566063dSJacob Faibussowitsch PetscCall(MatGetFactor(pc->pmat, fact->solvertype, fact->factortype, &B)); 269566063dSJacob Faibussowitsch PetscCall(MatHeaderReplace(fact->fact, &B)); 27978beb7fSPierre Jolivet } 284ac6704cSBarry Smith } 294ac6704cSBarry Smith if (!fact->ordering) { 304ac6704cSBarry Smith PetscBool canuseordering; 314ac6704cSBarry Smith MatOrderingType otype; 324ac6704cSBarry Smith 339566063dSJacob Faibussowitsch PetscCall(MatFactorGetCanUseOrdering(fact->fact, &canuseordering)); 344ac6704cSBarry Smith if (canuseordering) { 359566063dSJacob Faibussowitsch PetscCall(MatFactorGetPreferredOrdering(fact->fact, fact->factortype, &otype)); 364ac6704cSBarry Smith } else otype = MATORDERINGEXTERNAL; 379566063dSJacob Faibussowitsch PetscCall(PetscStrallocpy(otype, (char **)&fact->ordering)); 384ac6704cSBarry Smith } 394ac6704cSBarry Smith } 40978beb7fSPierre Jolivet } 414ac6704cSBarry Smith PetscFunctionReturn(0); 424ac6704cSBarry Smith } 434ac6704cSBarry Smith 449371c9d4SSatish Balay static PetscErrorCode PCFactorSetReuseOrdering_Factor(PC pc, PetscBool flag) { 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 529371c9d4SSatish Balay static PetscErrorCode PCFactorSetReuseFill_Factor(PC pc, PetscBool flag) { 533d1c1ea0SBarry Smith PC_Factor *lu = (PC_Factor *)pc->data; 543d1c1ea0SBarry Smith 553d1c1ea0SBarry Smith PetscFunctionBegin; 563d1c1ea0SBarry Smith lu->reusefill = flag; 573d1c1ea0SBarry Smith PetscFunctionReturn(0); 583d1c1ea0SBarry Smith } 593d1c1ea0SBarry Smith 609371c9d4SSatish Balay static PetscErrorCode PCFactorSetUseInPlace_Factor(PC pc, PetscBool flg) { 613d1c1ea0SBarry Smith PC_Factor *dir = (PC_Factor *)pc->data; 623d1c1ea0SBarry Smith 633d1c1ea0SBarry Smith PetscFunctionBegin; 643d1c1ea0SBarry Smith dir->inplace = flg; 653d1c1ea0SBarry Smith PetscFunctionReturn(0); 663d1c1ea0SBarry Smith } 673d1c1ea0SBarry Smith 689371c9d4SSatish Balay static PetscErrorCode PCFactorGetUseInPlace_Factor(PC pc, PetscBool *flg) { 693d1c1ea0SBarry Smith PC_Factor *dir = (PC_Factor *)pc->data; 703d1c1ea0SBarry Smith 713d1c1ea0SBarry Smith PetscFunctionBegin; 723d1c1ea0SBarry Smith *flg = dir->inplace; 733d1c1ea0SBarry Smith PetscFunctionReturn(0); 743d1c1ea0SBarry Smith } 753d1c1ea0SBarry Smith 76f8260c8fSBarry Smith /*@ 77*f1580f4eSBarry Smith PCFactorSetUpMatSolverType - Can be called after `KSPSetOperators()` or `PCSetOperators()`, causes `MatGetFactor()` to be called so then one may 78f8260c8fSBarry Smith set the options for that particular factorization object. 79f8260c8fSBarry Smith 80f8260c8fSBarry Smith Input Parameter: 81f8260c8fSBarry Smith . pc - the preconditioner context 82f8260c8fSBarry Smith 83*f1580f4eSBarry Smith Note: 84*f1580f4eSBarry Smith 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. 85f8260c8fSBarry Smith 862bd2b0e6SSatish Balay Level: intermediate 872bd2b0e6SSatish Balay 88*f1580f4eSBarry Smith .seealso: `PCCHOLESKY`, `PCLU`, `PCFactorSetMatSolverType()`, `PCFactorGetMatrix()` 89f8260c8fSBarry Smith @*/ 909371c9d4SSatish Balay PetscErrorCode PCFactorSetUpMatSolverType(PC pc) { 91f8260c8fSBarry Smith PetscFunctionBegin; 92f8260c8fSBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 93cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetUpMatSolverType_C", (PC), (pc)); 94b3a44c85SBarry Smith PetscFunctionReturn(0); 95f8260c8fSBarry Smith } 96f8260c8fSBarry Smith 97ee45ca4aSHong Zhang /*@ 98ee45ca4aSHong Zhang PCFactorSetZeroPivot - Sets the size at which smaller pivots are declared to be zero 99ee45ca4aSHong Zhang 100*f1580f4eSBarry Smith Logically Collective on pc 101ee45ca4aSHong Zhang 102ee45ca4aSHong Zhang Input Parameters: 103afaefe49SHong Zhang + pc - the preconditioner context 104afaefe49SHong Zhang - zero - all pivots smaller than this will be considered zero 105ee45ca4aSHong Zhang 106ee45ca4aSHong Zhang Options Database Key: 107ee45ca4aSHong Zhang . -pc_factor_zeropivot <zero> - Sets tolerance for what is considered a zero pivot 108ee45ca4aSHong Zhang 109ee45ca4aSHong Zhang Level: intermediate 110ee45ca4aSHong Zhang 111*f1580f4eSBarry Smith .seealso: `PCCHOLESKY`, `PCLU`, `PCFactorSetShiftType()`, `PCFactorSetShiftAmount()` 112ee45ca4aSHong Zhang @*/ 1139371c9d4SSatish Balay PetscErrorCode PCFactorSetZeroPivot(PC pc, PetscReal zero) { 114ee45ca4aSHong Zhang PetscFunctionBegin; 1150700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 116c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc, zero, 2); 117cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetZeroPivot_C", (PC, PetscReal), (pc, zero)); 118ee45ca4aSHong Zhang PetscFunctionReturn(0); 119ee45ca4aSHong Zhang } 120ee45ca4aSHong Zhang 121915743fcSHong Zhang /*@ 122915743fcSHong Zhang PCFactorSetShiftType - adds a particular type of quantity to the diagonal of the matrix during 123915743fcSHong Zhang numerical factorization, thus the matrix has nonzero pivots 124915743fcSHong Zhang 125*f1580f4eSBarry Smith Logically Collective on pc 126915743fcSHong Zhang 127915743fcSHong Zhang Input Parameters: 128915743fcSHong Zhang + pc - the preconditioner context 129*f1580f4eSBarry Smith - shifttype - type of shift; one of `MAT_SHIFT_NONE`, `MAT_SHIFT_NONZERO`, `MAT_SHIFT_POSITIVE_DEFINITE`, `MAT_SHIFT_INBLOCKS` 130915743fcSHong Zhang 131915743fcSHong Zhang Options Database Key: 13228d58a37SPierre Jolivet . -pc_factor_shift_type <shifttype> - Sets shift type; use '-help' for a list of available types 133915743fcSHong Zhang 134915743fcSHong Zhang Level: intermediate 135915743fcSHong Zhang 136*f1580f4eSBarry Smith .seealso: `PCCHOLESKY`, `PCLU`, `PCFactorSetZeroPivot()`, `PCFactorSetShiftAmount()` 137915743fcSHong Zhang @*/ 1389371c9d4SSatish Balay PetscErrorCode PCFactorSetShiftType(PC pc, MatFactorShiftType shifttype) { 139d90ac83dSHong Zhang PetscFunctionBegin; 1400700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 141c5eb9154SBarry Smith PetscValidLogicalCollectiveEnum(pc, shifttype, 2); 142cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetShiftType_C", (PC, MatFactorShiftType), (pc, shifttype)); 143d90ac83dSHong Zhang PetscFunctionReturn(0); 144d90ac83dSHong Zhang } 145d90ac83dSHong Zhang 146915743fcSHong Zhang /*@ 147915743fcSHong Zhang PCFactorSetShiftAmount - adds a quantity to the diagonal of the matrix during 148915743fcSHong Zhang numerical factorization, thus the matrix has nonzero pivots 149915743fcSHong Zhang 150*f1580f4eSBarry Smith Logically Collective on pc 151915743fcSHong Zhang 152915743fcSHong Zhang Input Parameters: 153915743fcSHong Zhang + pc - the preconditioner context 154*f1580f4eSBarry Smith - shiftamount - amount of shift or `PETSC_DECIDE` for the default 155915743fcSHong Zhang 156915743fcSHong Zhang Options Database Key: 157*f1580f4eSBarry Smith . -pc_factor_shift_amount <shiftamount> - Sets shift amount or -1 for the default 158915743fcSHong Zhang 159915743fcSHong Zhang Level: intermediate 160915743fcSHong Zhang 161*f1580f4eSBarry Smith .seealso: `PCCHOLESKY`, `PCLU`, ``PCFactorSetZeroPivot()`, `PCFactorSetShiftType()` 162915743fcSHong Zhang @*/ 1639371c9d4SSatish Balay PetscErrorCode PCFactorSetShiftAmount(PC pc, PetscReal shiftamount) { 164d90ac83dSHong Zhang PetscFunctionBegin; 1650700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 166c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc, shiftamount, 2); 167cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetShiftAmount_C", (PC, PetscReal), (pc, shiftamount)); 168d90ac83dSHong Zhang PetscFunctionReturn(0); 169d90ac83dSHong Zhang } 170d90ac83dSHong Zhang 1716d33885cSprj- /*@ 172*f1580f4eSBarry Smith PCFactorSetDropTolerance - The preconditioner will use an `PCILU` 173*f1580f4eSBarry Smith based on a drop tolerance. 17485317021SBarry Smith 175*f1580f4eSBarry Smith Logically Collective on pc 17685317021SBarry Smith 17785317021SBarry Smith Input Parameters: 17885317021SBarry Smith + pc - the preconditioner context 17985317021SBarry Smith . dt - the drop tolerance, try from 1.e-10 to .1 18085317021SBarry Smith . dtcol - tolerance for column pivot, good values [0.1 to 0.01] 18185317021SBarry Smith - maxrowcount - the max number of nonzeros allowed in a row, best value 18285317021SBarry Smith depends on the number of nonzeros in row of original matrix 18385317021SBarry Smith 18485317021SBarry Smith Options Database Key: 185b7c853c4SBarry Smith . -pc_factor_drop_tolerance <dt,dtcol,maxrowcount> - Sets drop tolerance 18685317021SBarry Smith 18785317021SBarry Smith Level: intermediate 18885317021SBarry Smith 189*f1580f4eSBarry Smith Note: 19085317021SBarry Smith There are NO default values for the 3 parameters, you must set them with reasonable values for your 19185317021SBarry Smith matrix. We don't know how to compute reasonable values. 19285317021SBarry Smith 193*f1580f4eSBarry Smith .seealso: `PCILU` 1946d33885cSprj- @*/ 1959371c9d4SSatish Balay PetscErrorCode PCFactorSetDropTolerance(PC pc, PetscReal dt, PetscReal dtcol, PetscInt maxrowcount) { 19685317021SBarry Smith PetscFunctionBegin; 1970700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 198064a246eSJacob Faibussowitsch PetscValidLogicalCollectiveReal(pc, dtcol, 3); 199064a246eSJacob Faibussowitsch PetscValidLogicalCollectiveInt(pc, maxrowcount, 4); 200cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetDropTolerance_C", (PC, PetscReal, PetscReal, PetscInt), (pc, dt, dtcol, maxrowcount)); 20185317021SBarry Smith PetscFunctionReturn(0); 20285317021SBarry Smith } 20385317021SBarry Smith 204c7f610a1SBarry Smith /*@ 205c7f610a1SBarry Smith PCFactorGetZeroPivot - Gets the tolerance used to define a zero privot 206c7f610a1SBarry Smith 207c7f610a1SBarry Smith Not Collective 208c7f610a1SBarry Smith 209c7f610a1SBarry Smith Input Parameters: 210c7f610a1SBarry Smith . pc - the preconditioner context 211c7f610a1SBarry Smith 212c7f610a1SBarry Smith Output Parameter: 213c7f610a1SBarry Smith . pivot - the tolerance 214c7f610a1SBarry Smith 215c7f610a1SBarry Smith Level: intermediate 216c7f610a1SBarry Smith 217*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCFactorSetZeroPivot()` 218c7f610a1SBarry Smith @*/ 2199371c9d4SSatish Balay PetscErrorCode PCFactorGetZeroPivot(PC pc, PetscReal *pivot) { 220c7f610a1SBarry Smith PetscFunctionBegin; 221c7f610a1SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 222cac4c232SBarry Smith PetscUseMethod(pc, "PCFactorGetZeroPivot_C", (PC, PetscReal *), (pc, pivot)); 223c7f610a1SBarry Smith PetscFunctionReturn(0); 224c7f610a1SBarry Smith } 225c7f610a1SBarry Smith 226c7f610a1SBarry Smith /*@ 227c7f610a1SBarry Smith PCFactorGetShiftAmount - Gets the tolerance used to define a zero privot 228c7f610a1SBarry Smith 229c7f610a1SBarry Smith Not Collective 230c7f610a1SBarry Smith 231c7f610a1SBarry Smith Input Parameters: 232c7f610a1SBarry Smith . pc - the preconditioner context 233c7f610a1SBarry Smith 234c7f610a1SBarry Smith Output Parameter: 235c7f610a1SBarry Smith . shift - how much to shift the diagonal entry 236c7f610a1SBarry Smith 237c7f610a1SBarry Smith Level: intermediate 238c7f610a1SBarry Smith 239*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCFactorSetShiftAmount()`, `PCFactorSetShiftType()`, `PCFactorGetShiftType()` 240c7f610a1SBarry Smith @*/ 2419371c9d4SSatish Balay PetscErrorCode PCFactorGetShiftAmount(PC pc, PetscReal *shift) { 242c7f610a1SBarry Smith PetscFunctionBegin; 243c7f610a1SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 244cac4c232SBarry Smith PetscUseMethod(pc, "PCFactorGetShiftAmount_C", (PC, PetscReal *), (pc, shift)); 245c7f610a1SBarry Smith PetscFunctionReturn(0); 246c7f610a1SBarry Smith } 247c7f610a1SBarry Smith 248c7f610a1SBarry Smith /*@ 249c7f610a1SBarry Smith PCFactorGetShiftType - Gets the type of shift, if any, done when a zero pivot is detected 250c7f610a1SBarry Smith 251c7f610a1SBarry Smith Not Collective 252c7f610a1SBarry Smith 253*f1580f4eSBarry Smith Input Parameter: 254c7f610a1SBarry Smith . pc - the preconditioner context 255c7f610a1SBarry Smith 256c7f610a1SBarry Smith Output Parameter: 257*f1580f4eSBarry Smith . type - one of `MAT_SHIFT_NONE`, `MAT_SHIFT_NONZERO`, `MAT_SHIFT_POSITIVE_DEFINITE`, or `MAT_SHIFT_INBLOCKS` 258c7f610a1SBarry Smith 259c7f610a1SBarry Smith Level: intermediate 260c7f610a1SBarry Smith 261*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCFactorSetShiftType()`, `MatFactorShiftType`, `PCFactorSetShiftAmount()`, `PCFactorGetShiftAmount()` 262c7f610a1SBarry Smith @*/ 2639371c9d4SSatish Balay PetscErrorCode PCFactorGetShiftType(PC pc, MatFactorShiftType *type) { 264c7f610a1SBarry Smith PetscFunctionBegin; 265c7f610a1SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 266cac4c232SBarry Smith PetscUseMethod(pc, "PCFactorGetShiftType_C", (PC, MatFactorShiftType *), (pc, type)); 267c7f610a1SBarry Smith PetscFunctionReturn(0); 268c7f610a1SBarry Smith } 269c7f610a1SBarry Smith 2702591b318SToby Isaac /*@ 2712591b318SToby Isaac PCFactorGetLevels - Gets the number of levels of fill to use. 2722591b318SToby Isaac 273*f1580f4eSBarry Smith Logically Collective on pc 2742591b318SToby Isaac 2752591b318SToby Isaac Input Parameters: 2762591b318SToby Isaac . pc - the preconditioner context 2772591b318SToby Isaac 2782591b318SToby Isaac Output Parameter: 2792591b318SToby Isaac . levels - number of levels of fill 2802591b318SToby Isaac 2812591b318SToby Isaac Level: intermediate 2822591b318SToby Isaac 283*f1580f4eSBarry Smith .seealso: `PCILU`, `PCICC`, `PCFactorSetLevels()` 2842591b318SToby Isaac @*/ 2859371c9d4SSatish Balay PetscErrorCode PCFactorGetLevels(PC pc, PetscInt *levels) { 2862591b318SToby Isaac PetscFunctionBegin; 2872591b318SToby Isaac PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 288cac4c232SBarry Smith PetscUseMethod(pc, "PCFactorGetLevels_C", (PC, PetscInt *), (pc, levels)); 2892591b318SToby Isaac PetscFunctionReturn(0); 2902591b318SToby Isaac } 2912591b318SToby Isaac 29285317021SBarry Smith /*@ 29385317021SBarry Smith PCFactorSetLevels - Sets the number of levels of fill to use. 29485317021SBarry Smith 295*f1580f4eSBarry Smith Logically Collective on pc 29685317021SBarry Smith 29785317021SBarry Smith Input Parameters: 29885317021SBarry Smith + pc - the preconditioner context 29985317021SBarry Smith - levels - number of levels of fill 30085317021SBarry Smith 30185317021SBarry Smith Options Database Key: 30285317021SBarry Smith . -pc_factor_levels <levels> - Sets fill level 30385317021SBarry Smith 30485317021SBarry Smith Level: intermediate 30585317021SBarry Smith 306*f1580f4eSBarry Smith .seealso: `PCILU`, `PCICC`, `PCFactorGetLevels()` 30785317021SBarry Smith @*/ 3089371c9d4SSatish Balay PetscErrorCode PCFactorSetLevels(PC pc, PetscInt levels) { 30985317021SBarry Smith PetscFunctionBegin; 3100700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 3115f80ce2aSJacob Faibussowitsch PetscCheck(levels >= 0, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_OUTOFRANGE, "negative levels"); 312c5eb9154SBarry Smith PetscValidLogicalCollectiveInt(pc, levels, 2); 313cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetLevels_C", (PC, PetscInt), (pc, levels)); 31485317021SBarry Smith PetscFunctionReturn(0); 31585317021SBarry Smith } 31685317021SBarry Smith 31785317021SBarry Smith /*@ 31885317021SBarry Smith PCFactorSetAllowDiagonalFill - Causes all diagonal matrix entries to be 31985317021SBarry Smith treated as level 0 fill even if there is no non-zero location. 32085317021SBarry Smith 321*f1580f4eSBarry Smith Logically Collective on pc 32285317021SBarry Smith 32385317021SBarry Smith Input Parameters: 32485317021SBarry Smith + pc - the preconditioner context 325*f1580f4eSBarry Smith - flg - `PETSC_TRUE` to turn on, `PETSC_FALSE` to turn off 32685317021SBarry Smith 32785317021SBarry Smith Options Database Key: 32867b8a455SSatish Balay . -pc_factor_diagonal_fill <bool> - allow the diagonal fill 32985317021SBarry Smith 330*f1580f4eSBarry Smith Note: 33185317021SBarry Smith Does not apply with 0 fill. 33285317021SBarry Smith 33385317021SBarry Smith Level: intermediate 33485317021SBarry Smith 335*f1580f4eSBarry Smith .seealso: `PCILU`, `PCICC`, `PCFactorGetAllowDiagonalFill()` 33685317021SBarry Smith @*/ 3379371c9d4SSatish Balay PetscErrorCode PCFactorSetAllowDiagonalFill(PC pc, PetscBool flg) { 33885317021SBarry Smith PetscFunctionBegin; 3390700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 340cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetAllowDiagonalFill_C", (PC, PetscBool), (pc, flg)); 34192e9c092SBarry Smith PetscFunctionReturn(0); 34292e9c092SBarry Smith } 34392e9c092SBarry Smith 34492e9c092SBarry Smith /*@ 34592e9c092SBarry Smith PCFactorGetAllowDiagonalFill - Determines if all diagonal matrix entries are 34692e9c092SBarry Smith treated as level 0 fill even if there is no non-zero location. 34792e9c092SBarry Smith 348*f1580f4eSBarry Smith Logically Collective on pc 34992e9c092SBarry Smith 35092e9c092SBarry Smith Input Parameter: 35192e9c092SBarry Smith . pc - the preconditioner context 35292e9c092SBarry Smith 35392e9c092SBarry Smith Output Parameter: 354*f1580f4eSBarry Smith . flg - `PETSC_TRUE` to turn on, `PETSC_FALSE` to turn off 35592e9c092SBarry Smith 356*f1580f4eSBarry Smith Note: 35792e9c092SBarry Smith Does not apply with 0 fill. 35892e9c092SBarry Smith 35992e9c092SBarry Smith Level: intermediate 36092e9c092SBarry Smith 361*f1580f4eSBarry Smith .seealso: `PCILU`, `PCICC`, `PCFactorSetAllowDiagonalFill()` 36292e9c092SBarry Smith @*/ 3639371c9d4SSatish Balay PetscErrorCode PCFactorGetAllowDiagonalFill(PC pc, PetscBool *flg) { 36492e9c092SBarry Smith PetscFunctionBegin; 36592e9c092SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 366cac4c232SBarry Smith PetscUseMethod(pc, "PCFactorGetAllowDiagonalFill_C", (PC, PetscBool *), (pc, flg)); 36785317021SBarry Smith PetscFunctionReturn(0); 36885317021SBarry Smith } 36985317021SBarry Smith 37085317021SBarry Smith /*@ 37185317021SBarry Smith PCFactorReorderForNonzeroDiagonal - reorders rows/columns of matrix to remove zeros from diagonal 37285317021SBarry Smith 373*f1580f4eSBarry Smith Logically Collective on pc 37485317021SBarry Smith 37585317021SBarry Smith Input Parameters: 37685317021SBarry Smith + pc - the preconditioner context 37785317021SBarry Smith - tol - diagonal entries smaller than this in absolute value are considered zero 37885317021SBarry Smith 37985317021SBarry Smith Options Database Key: 380147403d9SBarry Smith . -pc_factor_nonzeros_along_diagonal <tol> - perform the reordering with the given tolerance 38185317021SBarry Smith 38285317021SBarry Smith Level: intermediate 38385317021SBarry Smith 384*f1580f4eSBarry Smith .seealso: `PCILU`, `PCICC`, `PCFactorSetFill()`, `PCFactorSetShiftNonzero()`, `PCFactorSetZeroPivot()`, `MatReorderForNonzeroDiagonal()` 38585317021SBarry Smith @*/ 3869371c9d4SSatish Balay PetscErrorCode PCFactorReorderForNonzeroDiagonal(PC pc, PetscReal rtol) { 38785317021SBarry Smith PetscFunctionBegin; 3880700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 389c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc, rtol, 2); 390cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorReorderForNonzeroDiagonal_C", (PC, PetscReal), (pc, rtol)); 39185317021SBarry Smith PetscFunctionReturn(0); 39285317021SBarry Smith } 39385317021SBarry Smith 394bf6011e8SBarry Smith /*@C 395*f1580f4eSBarry Smith PCFactorSetMatSolverType - sets the solver package that is used to perform the factorization 39685317021SBarry Smith 397*f1580f4eSBarry Smith Logically Collective on pc 39885317021SBarry Smith 39985317021SBarry Smith Input Parameters: 40085317021SBarry Smith + pc - the preconditioner context 401*f1580f4eSBarry Smith - stype - for example, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` 40285317021SBarry Smith 40385317021SBarry Smith Options Database Key: 4043ca39a21SBarry Smith . -pc_factor_mat_solver_type <stype> - petsc, superlu, superlu_dist, mumps, cusparse 40585317021SBarry Smith 40685317021SBarry Smith Level: intermediate 40785317021SBarry Smith 40885317021SBarry Smith Note: 40985317021SBarry Smith By default this will use the PETSc factorization if it exists 41085317021SBarry Smith 411*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `MatGetFactor()`, `MatSolverType`, `PCFactorGetMatSolverType()`, `MatSolverType`, 412*f1580f4eSBarry Smith `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` 41385317021SBarry Smith @*/ 4149371c9d4SSatish Balay PetscErrorCode PCFactorSetMatSolverType(PC pc, MatSolverType stype) { 41585317021SBarry Smith PetscFunctionBegin; 4160700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 417cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetMatSolverType_C", (PC, MatSolverType), (pc, stype)); 41885317021SBarry Smith PetscFunctionReturn(0); 41985317021SBarry Smith } 42085317021SBarry Smith 421bf6011e8SBarry Smith /*@C 422*f1580f4eSBarry Smith PCFactorGetMatSolverType - gets the solver package that is used to perform the factorization 4237112b564SBarry Smith 424c5eb9154SBarry Smith Not Collective 4257112b564SBarry Smith 4267112b564SBarry Smith Input Parameter: 4277112b564SBarry Smith . pc - the preconditioner context 4287112b564SBarry Smith 4297112b564SBarry Smith Output Parameter: 430*f1580f4eSBarry Smith . stype - for example, `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` 4317112b564SBarry Smith 4327112b564SBarry Smith Level: intermediate 4337112b564SBarry Smith 434*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `MatGetFactor()`, `MatSolverType`, `PCFactorGetMatSolverType()`, `MatSolverType`, 435*f1580f4eSBarry Smith `MATSOLVERSUPERLU`, `MATSOLVERSUPERLU_DIST`, `MATSOLVERMUMPS` 4367112b564SBarry Smith @*/ 4379371c9d4SSatish Balay PetscErrorCode PCFactorGetMatSolverType(PC pc, MatSolverType *stype) { 4385f80ce2aSJacob Faibussowitsch PetscErrorCode (*f)(PC, MatSolverType *); 4397112b564SBarry Smith 4407112b564SBarry Smith PetscFunctionBegin; 4410700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 4425f80ce2aSJacob Faibussowitsch PetscValidPointer(stype, 2); 4439566063dSJacob Faibussowitsch PetscCall(PetscObjectQueryFunction((PetscObject)pc, "PCFactorGetMatSolverType_C", &f)); 4449566063dSJacob Faibussowitsch if (f) PetscCall((*f)(pc, stype)); 4455f80ce2aSJacob Faibussowitsch else *stype = NULL; 4467112b564SBarry Smith PetscFunctionReturn(0); 4477112b564SBarry Smith } 4487112b564SBarry Smith 44985317021SBarry Smith /*@ 45085317021SBarry Smith PCFactorSetFill - Indicate the amount of fill you expect in the factored matrix, 45185317021SBarry Smith fill = number nonzeros in factor/number nonzeros in original matrix. 45285317021SBarry Smith 453c5eb9154SBarry Smith Not Collective, each process can expect a different amount of fill 45485317021SBarry Smith 45585317021SBarry Smith Input Parameters: 45685317021SBarry Smith + pc - the preconditioner context 45785317021SBarry Smith - fill - amount of expected fill 45885317021SBarry Smith 45985317021SBarry Smith Options Database Key: 46085317021SBarry Smith . -pc_factor_fill <fill> - Sets fill amount 46185317021SBarry Smith 46285317021SBarry Smith Level: intermediate 46385317021SBarry Smith 464*f1580f4eSBarry Smith Notes: 46585317021SBarry Smith For sparse matrix factorizations it is difficult to predict how much 46685317021SBarry Smith fill to expect. By running with the option -info PETSc will print the 46785317021SBarry Smith actual amount of fill used; allowing you to set the value accurately for 46885317021SBarry Smith future runs. Default PETSc uses a value of 5.0 46985317021SBarry Smith 470*f1580f4eSBarry Smith This is ignored for most solver packages 47101a79839SBarry Smith 472*f1580f4eSBarry Smith This parameter has NOTHING to do with the levels-of-fill of ILU(). That is set with `PCFactorSetLevels()` or -pc_factor_levels. 473*f1580f4eSBarry Smith 474*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorSetReuseFill()` 47585317021SBarry Smith @*/ 4769371c9d4SSatish Balay PetscErrorCode PCFactorSetFill(PC pc, PetscReal fill) { 47785317021SBarry Smith PetscFunctionBegin; 4780700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 4795f80ce2aSJacob Faibussowitsch PetscCheck(fill >= 1.0, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_OUTOFRANGE, "Fill factor cannot be less then 1.0"); 480cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetFill_C", (PC, PetscReal), (pc, fill)); 48185317021SBarry Smith PetscFunctionReturn(0); 48285317021SBarry Smith } 48385317021SBarry Smith 48485317021SBarry Smith /*@ 48585317021SBarry Smith PCFactorSetUseInPlace - Tells the system to do an in-place factorization. 48685317021SBarry Smith For dense matrices, this enables the solution of much larger problems. 48785317021SBarry Smith For sparse matrices the factorization cannot be done truly in-place 48885317021SBarry Smith so this does not save memory during the factorization, but after the matrix 48985317021SBarry Smith is factored, the original unfactored matrix is freed, thus recovering that 490ec5066bdSBarry Smith space. For ICC(0) and ILU(0) with the default natural ordering the factorization is done efficiently in-place. 49185317021SBarry Smith 492*f1580f4eSBarry Smith Logically Collective on pc 49385317021SBarry Smith 49485317021SBarry Smith Input Parameters: 4958e37d05fSBarry Smith + pc - the preconditioner context 496*f1580f4eSBarry Smith - flg - `PETSC_TRUE` to enable, `PETSC_FALSE` to disable 49785317021SBarry Smith 49885317021SBarry Smith Options Database Key: 4998e37d05fSBarry Smith . -pc_factor_in_place <true,false>- Activate/deactivate in-place factorization 50085317021SBarry Smith 501*f1580f4eSBarry Smith Note: 502*f1580f4eSBarry Smith `PCFactorSetUseInplace()` can only be used with the `KSP` method `KSPPREONLY` or when 50385317021SBarry Smith a different matrix is provided for the multiply and the preconditioner in 504*f1580f4eSBarry Smith a call to `KSPSetOperators()`. 50585317021SBarry Smith This is because the Krylov space methods require an application of the 50685317021SBarry Smith matrix multiplication, which is not possible here because the matrix has 50785317021SBarry Smith been factored in-place, replacing the original matrix. 50885317021SBarry Smith 50985317021SBarry Smith Level: intermediate 51085317021SBarry Smith 511*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorGetUseInPlace()` 51285317021SBarry Smith @*/ 5139371c9d4SSatish Balay PetscErrorCode PCFactorSetUseInPlace(PC pc, PetscBool flg) { 51485317021SBarry Smith PetscFunctionBegin; 5150700a824SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 516cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetUseInPlace_C", (PC, PetscBool), (pc, flg)); 5178e37d05fSBarry Smith PetscFunctionReturn(0); 5188e37d05fSBarry Smith } 5198e37d05fSBarry Smith 5208e37d05fSBarry Smith /*@ 5218e37d05fSBarry Smith PCFactorGetUseInPlace - Determines if an in-place factorization is being used. 5228e37d05fSBarry Smith 523*f1580f4eSBarry Smith Logically Collective on pc 5248e37d05fSBarry Smith 5258e37d05fSBarry Smith Input Parameter: 5268e37d05fSBarry Smith . pc - the preconditioner context 5278e37d05fSBarry Smith 5288e37d05fSBarry Smith Output Parameter: 529*f1580f4eSBarry Smith . flg - `PETSC_TRUE` to enable, `PETSC_FALSE` to disable 5308e37d05fSBarry Smith 5318e37d05fSBarry Smith Level: intermediate 5328e37d05fSBarry Smith 533*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorSetUseInPlace()` 5348e37d05fSBarry Smith @*/ 5359371c9d4SSatish Balay PetscErrorCode PCFactorGetUseInPlace(PC pc, PetscBool *flg) { 5368e37d05fSBarry Smith PetscFunctionBegin; 5378e37d05fSBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 538cac4c232SBarry Smith PetscUseMethod(pc, "PCFactorGetUseInPlace_C", (PC, PetscBool *), (pc, flg)); 53985317021SBarry Smith PetscFunctionReturn(0); 54085317021SBarry Smith } 54185317021SBarry Smith 54285317021SBarry Smith /*@C 54385317021SBarry Smith PCFactorSetMatOrderingType - Sets the ordering routine (to reduce fill) to 544*f1580f4eSBarry Smith be used in the `PCLU`, `PCCHOLESKY`, `PCILU`, or `PCICC` preconditioners 54585317021SBarry Smith 546*f1580f4eSBarry Smith Logically Collective on pc 54785317021SBarry Smith 54885317021SBarry Smith Input Parameters: 54985317021SBarry Smith + pc - the preconditioner context 550*f1580f4eSBarry Smith - ordering - the matrix ordering name, for example, `MATORDERINGND` or `MATORDERINGRCM` 55185317021SBarry Smith 55285317021SBarry Smith Options Database Key: 5532c7c0729SBarry Smith . -pc_factor_mat_ordering_type <nd,rcm,...,external> - Sets ordering routine 55485317021SBarry Smith 55585317021SBarry Smith Level: intermediate 55685317021SBarry Smith 55795452b02SPatrick Sanan Notes: 5584ac6704cSBarry Smith Nested dissection is used by default for some of PETSc's sparse matrix formats 55985317021SBarry Smith 560*f1580f4eSBarry Smith For `PCCHOLESKY` and `PCICC` and the `MATSBAIJ` format the only reordering available is natural since only the upper half of the matrix is stored 5619bd791bbSBarry Smith and reordering this matrix is very expensive. 5629bd791bbSBarry Smith 563*f1580f4eSBarry Smith You can use a `MATSEQAIJ` matrix with Cholesky and ICC and use any ordering. 5649bd791bbSBarry Smith 565*f1580f4eSBarry Smith `MATORDERINGEXTERNAL` means PETSc will not compute an ordering and the package will use its own ordering, usable with `MATSOLVERCHOLMOD`, `MATSOLVERUMFPACK`, and others. 5662c7c0729SBarry Smith 567*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `MatOrderingType`, `MATORDERINGEXTERNAL`, `MATORDERINGND`, `MATORDERINGRCM` 56885317021SBarry Smith @*/ 5699371c9d4SSatish Balay PetscErrorCode PCFactorSetMatOrderingType(PC pc, MatOrderingType ordering) { 57085317021SBarry Smith PetscFunctionBegin; 571c5eb9154SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 572cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetMatOrderingType_C", (PC, MatOrderingType), (pc, ordering)); 57385317021SBarry Smith PetscFunctionReturn(0); 57485317021SBarry Smith } 57585317021SBarry Smith 57685317021SBarry Smith /*@ 5778ff23777SHong Zhang PCFactorSetColumnPivot - Determines when column pivoting is done during matrix factorization. 57885317021SBarry Smith For PETSc dense matrices column pivoting is always done, for PETSc sparse matrices 579*f1580f4eSBarry Smith it is never done. For the MATLAB and `MATSOLVERSUPERLU` factorization this is used. 58085317021SBarry Smith 581*f1580f4eSBarry Smith Logically Collective on pc 58285317021SBarry Smith 58385317021SBarry Smith Input Parameters: 58485317021SBarry Smith + pc - the preconditioner context 58585317021SBarry Smith - dtcol - 0.0 implies no pivoting, 1.0 complete pivoting (slower, requires more memory but more stable) 58685317021SBarry Smith 58785317021SBarry Smith Options Database Key: 588147403d9SBarry Smith . -pc_factor_pivoting <dtcol> - perform the pivoting with the given tolerance 58985317021SBarry Smith 59085317021SBarry Smith Level: intermediate 59185317021SBarry Smith 592*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCILUSetMatOrdering()`, `PCFactorSetPivotInBlocks()` 59385317021SBarry Smith @*/ 5949371c9d4SSatish Balay PetscErrorCode PCFactorSetColumnPivot(PC pc, PetscReal dtcol) { 59585317021SBarry Smith PetscFunctionBegin; 596c5eb9154SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 597c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc, dtcol, 2); 598cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetColumnPivot_C", (PC, PetscReal), (pc, dtcol)); 59985317021SBarry Smith PetscFunctionReturn(0); 60085317021SBarry Smith } 60185317021SBarry Smith 60285317021SBarry Smith /*@ 60385317021SBarry Smith PCFactorSetPivotInBlocks - Determines if pivoting is done while factoring each block 604*f1580f4eSBarry Smith with `MATBAIJ` or `MATSBAIJ` matrices 60585317021SBarry Smith 606*f1580f4eSBarry Smith Logically Collective on pc 60785317021SBarry Smith 60885317021SBarry Smith Input Parameters: 60985317021SBarry Smith + pc - the preconditioner context 610*f1580f4eSBarry Smith - pivot - `PETSC_TRUE` or `PETSC_FALSE` 61185317021SBarry Smith 61285317021SBarry Smith Options Database Key: 613*f1580f4eSBarry Smith . -pc_factor_pivot_in_blocks <true,false> - Pivot inside matrix dense blocks for `MATBAIJ` and `MATSBAIJ` 61485317021SBarry Smith 61585317021SBarry Smith Level: intermediate 61685317021SBarry Smith 617*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCILUSetMatOrdering()`, `PCFactorSetColumnPivot()` 61885317021SBarry Smith @*/ 6199371c9d4SSatish Balay PetscErrorCode PCFactorSetPivotInBlocks(PC pc, PetscBool pivot) { 62085317021SBarry Smith PetscFunctionBegin; 621c5eb9154SBarry Smith PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 622acfcf0e5SJed Brown PetscValidLogicalCollectiveBool(pc, pivot, 2); 623cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetPivotInBlocks_C", (PC, PetscBool), (pc, pivot)); 62485317021SBarry Smith PetscFunctionReturn(0); 62585317021SBarry Smith } 62685317021SBarry Smith 62785317021SBarry Smith /*@ 628288e7d53SBarry Smith PCFactorSetReuseFill - When matrices with different nonzero structure are factored, 62985317021SBarry Smith this causes later ones to use the fill ratio computed in the initial factorization. 63085317021SBarry Smith 631*f1580f4eSBarry Smith Logically Collective on pc 63285317021SBarry Smith 63385317021SBarry Smith Input Parameters: 63485317021SBarry Smith + pc - the preconditioner context 635*f1580f4eSBarry Smith - flag - `PETSC_TRUE` to reuse else `PETSC_FALSE` 63685317021SBarry Smith 63785317021SBarry Smith Options Database Key: 638*f1580f4eSBarry Smith . -pc_factor_reuse_fill - Activates `PCFactorSetReuseFill()` 63985317021SBarry Smith 64085317021SBarry Smith Level: intermediate 64185317021SBarry Smith 642*f1580f4eSBarry Smith .seealso: `PCLU`, `PCCHOLESKY`, `PCILU`, `PCICC`, `PCFactorSetReuseOrdering()`, `PCFactorSetFill()` 64385317021SBarry Smith @*/ 6449371c9d4SSatish Balay PetscErrorCode PCFactorSetReuseFill(PC pc, PetscBool flag) { 64585317021SBarry Smith PetscFunctionBegin; 646064a246eSJacob Faibussowitsch PetscValidHeaderSpecific(pc, PC_CLASSID, 1); 647acfcf0e5SJed Brown PetscValidLogicalCollectiveBool(pc, flag, 2); 648cac4c232SBarry Smith PetscTryMethod(pc, "PCFactorSetReuseFill_C", (PC, PetscBool), (pc, flag)); 64985317021SBarry Smith PetscFunctionReturn(0); 65085317021SBarry Smith } 6513d1c1ea0SBarry Smith 6529371c9d4SSatish Balay PetscErrorCode PCFactorInitialize(PC pc, MatFactorType ftype) { 6533d1c1ea0SBarry Smith PC_Factor *fact = (PC_Factor *)pc->data; 6543d1c1ea0SBarry Smith 6553d1c1ea0SBarry Smith PetscFunctionBegin; 6569566063dSJacob Faibussowitsch PetscCall(MatFactorInfoInitialize(&fact->info)); 6574ac6704cSBarry Smith fact->factortype = ftype; 6583d1c1ea0SBarry Smith fact->info.shifttype = (PetscReal)MAT_SHIFT_NONE; 6593d1c1ea0SBarry Smith fact->info.shiftamount = 100.0 * PETSC_MACHINE_EPSILON; 6603d1c1ea0SBarry Smith fact->info.zeropivot = 100.0 * PETSC_MACHINE_EPSILON; 6613d1c1ea0SBarry Smith fact->info.pivotinblocks = 1.0; 6623d1c1ea0SBarry Smith pc->ops->getfactoredmatrix = PCFactorGetMatrix_Factor; 6633d1c1ea0SBarry Smith 6649566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetZeroPivot_C", PCFactorSetZeroPivot_Factor)); 6659566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetZeroPivot_C", PCFactorGetZeroPivot_Factor)); 6669566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetShiftType_C", PCFactorSetShiftType_Factor)); 6679566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetShiftType_C", PCFactorGetShiftType_Factor)); 6689566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetShiftAmount_C", PCFactorSetShiftAmount_Factor)); 6699566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetShiftAmount_C", PCFactorGetShiftAmount_Factor)); 6709566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetMatSolverType_C", PCFactorGetMatSolverType_Factor)); 6719566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetMatSolverType_C", PCFactorSetMatSolverType_Factor)); 6729566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetUpMatSolverType_C", PCFactorSetUpMatSolverType_Factor)); 6739566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetFill_C", PCFactorSetFill_Factor)); 6749566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetMatOrderingType_C", PCFactorSetMatOrderingType_Factor)); 6759566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetLevels_C", PCFactorSetLevels_Factor)); 6769566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetLevels_C", PCFactorGetLevels_Factor)); 6779566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetAllowDiagonalFill_C", PCFactorSetAllowDiagonalFill_Factor)); 6789566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetAllowDiagonalFill_C", PCFactorGetAllowDiagonalFill_Factor)); 6799566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetPivotInBlocks_C", PCFactorSetPivotInBlocks_Factor)); 6809566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetUseInPlace_C", PCFactorSetUseInPlace_Factor)); 6819566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetUseInPlace_C", PCFactorGetUseInPlace_Factor)); 6829566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetReuseOrdering_C", PCFactorSetReuseOrdering_Factor)); 6839566063dSJacob Faibussowitsch PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetReuseFill_C", PCFactorSetReuseFill_Factor)); 6843d1c1ea0SBarry Smith PetscFunctionReturn(0); 6853d1c1ea0SBarry Smith } 6862e956fe4SStefano Zampini 6879371c9d4SSatish Balay PetscErrorCode PCFactorClearComposedFunctions(PC pc) { 6882e956fe4SStefano Zampini PetscFunctionBegin; 6892e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetZeroPivot_C", NULL)); 6902e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetZeroPivot_C", NULL)); 6912e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetShiftType_C", NULL)); 6922e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetShiftType_C", NULL)); 6932e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetShiftAmount_C", NULL)); 6942e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetShiftAmount_C", NULL)); 6952e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetMatSolverType_C", NULL)); 6962e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetMatSolverType_C", NULL)); 6972e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetUpMatSolverType_C", NULL)); 6982e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetFill_C", NULL)); 6992e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetMatOrderingType_C", NULL)); 7002e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetLevels_C", NULL)); 7012e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetLevels_C", NULL)); 7022e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetAllowDiagonalFill_C", NULL)); 7032e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetAllowDiagonalFill_C", NULL)); 7042e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetPivotInBlocks_C", NULL)); 7052e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetUseInPlace_C", NULL)); 7062e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorGetUseInPlace_C", NULL)); 7072e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetReuseOrdering_C", NULL)); 7082e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetReuseFill_C", NULL)); 7092e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorReorderForNonzeroDiagonal_C", NULL)); 7102e956fe4SStefano Zampini PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCFactorSetDropTolerance_C", NULL)); 7112e956fe4SStefano Zampini PetscFunctionReturn(0); 7122e956fe4SStefano Zampini } 713