15e8efad8SHong Zhang 2c6db04a5SJed Brown #include <../src/ksp/pc/impls/factor/factor.h> /*I "petscpc.h" I*/ 35e8efad8SHong Zhang 43d1c1ea0SBarry Smith static PetscErrorCode PCFactorSetReuseOrdering_Factor(PC pc,PetscBool flag) 53d1c1ea0SBarry Smith { 63d1c1ea0SBarry Smith PC_Factor *lu = (PC_Factor*)pc->data; 73d1c1ea0SBarry Smith 83d1c1ea0SBarry Smith PetscFunctionBegin; 93d1c1ea0SBarry Smith lu->reuseordering = flag; 103d1c1ea0SBarry Smith PetscFunctionReturn(0); 113d1c1ea0SBarry Smith } 123d1c1ea0SBarry Smith 133d1c1ea0SBarry Smith static PetscErrorCode PCFactorSetReuseFill_Factor(PC pc,PetscBool flag) 143d1c1ea0SBarry Smith { 153d1c1ea0SBarry Smith PC_Factor *lu = (PC_Factor*)pc->data; 163d1c1ea0SBarry Smith 173d1c1ea0SBarry Smith PetscFunctionBegin; 183d1c1ea0SBarry Smith lu->reusefill = flag; 193d1c1ea0SBarry Smith PetscFunctionReturn(0); 203d1c1ea0SBarry Smith } 213d1c1ea0SBarry Smith 223d1c1ea0SBarry Smith static PetscErrorCode PCFactorSetUseInPlace_Factor(PC pc,PetscBool flg) 233d1c1ea0SBarry Smith { 243d1c1ea0SBarry Smith PC_Factor *dir = (PC_Factor*)pc->data; 253d1c1ea0SBarry Smith 263d1c1ea0SBarry Smith PetscFunctionBegin; 273d1c1ea0SBarry Smith dir->inplace = flg; 283d1c1ea0SBarry Smith PetscFunctionReturn(0); 293d1c1ea0SBarry Smith } 303d1c1ea0SBarry Smith 313d1c1ea0SBarry Smith static PetscErrorCode PCFactorGetUseInPlace_Factor(PC pc,PetscBool *flg) 323d1c1ea0SBarry Smith { 333d1c1ea0SBarry Smith PC_Factor *dir = (PC_Factor*)pc->data; 343d1c1ea0SBarry Smith 353d1c1ea0SBarry Smith PetscFunctionBegin; 363d1c1ea0SBarry Smith *flg = dir->inplace; 373d1c1ea0SBarry Smith PetscFunctionReturn(0); 383d1c1ea0SBarry Smith } 393d1c1ea0SBarry Smith 40f8260c8fSBarry Smith /*@ 413ca39a21SBarry Smith PCFactorSetUpMatSolverType - Can be called after KSPSetOperators() or PCSetOperators(), causes MatGetFactor() to be called so then one may 42f8260c8fSBarry Smith set the options for that particular factorization object. 43f8260c8fSBarry Smith 44f8260c8fSBarry Smith Input Parameter: 45f8260c8fSBarry Smith . pc - the preconditioner context 46f8260c8fSBarry Smith 4795452b02SPatrick Sanan Notes: 4895452b02SPatrick 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. 49f8260c8fSBarry Smith 503ca39a21SBarry Smith .seealso: PCFactorSetMatSolverType(), PCFactorGetMatrix() 51f8260c8fSBarry Smith 522bd2b0e6SSatish Balay Level: intermediate 532bd2b0e6SSatish Balay 54f8260c8fSBarry Smith @*/ 553ca39a21SBarry Smith PetscErrorCode PCFactorSetUpMatSolverType(PC pc) 56f8260c8fSBarry Smith { 57f8260c8fSBarry Smith PetscErrorCode ierr; 58f8260c8fSBarry Smith 59f8260c8fSBarry Smith PetscFunctionBegin; 60f8260c8fSBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 613ca39a21SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetUpMatSolverType_C",(PC),(pc));CHKERRQ(ierr); 62b3a44c85SBarry Smith PetscFunctionReturn(0); 63f8260c8fSBarry Smith } 64f8260c8fSBarry Smith 65ee45ca4aSHong Zhang /*@ 66ee45ca4aSHong Zhang PCFactorSetZeroPivot - Sets the size at which smaller pivots are declared to be zero 67ee45ca4aSHong Zhang 68ad4df100SBarry Smith Logically Collective on PC 69ee45ca4aSHong Zhang 70ee45ca4aSHong Zhang Input Parameters: 71afaefe49SHong Zhang + pc - the preconditioner context 72afaefe49SHong Zhang - zero - all pivots smaller than this will be considered zero 73ee45ca4aSHong Zhang 74ee45ca4aSHong Zhang Options Database Key: 75ee45ca4aSHong Zhang . -pc_factor_zeropivot <zero> - Sets tolerance for what is considered a zero pivot 76ee45ca4aSHong Zhang 77ee45ca4aSHong Zhang Level: intermediate 78ee45ca4aSHong Zhang 79daa17b54SHong Zhang .seealso: PCFactorSetShiftType(), PCFactorSetShiftAmount() 80ee45ca4aSHong Zhang @*/ 817087cfbeSBarry Smith PetscErrorCode PCFactorSetZeroPivot(PC pc,PetscReal zero) 82ee45ca4aSHong Zhang { 834ac538c5SBarry Smith PetscErrorCode ierr; 84afaefe49SHong Zhang 85ee45ca4aSHong Zhang PetscFunctionBegin; 860700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 87c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc,zero,2); 884ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetZeroPivot_C",(PC,PetscReal),(pc,zero));CHKERRQ(ierr); 89ee45ca4aSHong Zhang PetscFunctionReturn(0); 90ee45ca4aSHong Zhang } 91ee45ca4aSHong Zhang 92915743fcSHong Zhang /*@ 93915743fcSHong Zhang PCFactorSetShiftType - adds a particular type of quantity to the diagonal of the matrix during 94915743fcSHong Zhang numerical factorization, thus the matrix has nonzero pivots 95915743fcSHong Zhang 96ad4df100SBarry Smith Logically Collective on PC 97915743fcSHong Zhang 98915743fcSHong Zhang Input Parameters: 99915743fcSHong Zhang + pc - the preconditioner context 100915743fcSHong Zhang - shifttype - type of shift; one of MAT_SHIFT_NONE, MAT_SHIFT_NONZERO, MAT_SHIFT_POSITIVE_DEFINITE, MAT_SHIFT_INBLOCKS 101915743fcSHong Zhang 102915743fcSHong Zhang Options Database Key: 10328d58a37SPierre Jolivet . -pc_factor_shift_type <shifttype> - Sets shift type; use '-help' for a list of available types 104915743fcSHong Zhang 105915743fcSHong Zhang Level: intermediate 106915743fcSHong Zhang 107915743fcSHong Zhang .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftAmount() 108915743fcSHong Zhang @*/ 1097087cfbeSBarry Smith PetscErrorCode PCFactorSetShiftType(PC pc,MatFactorShiftType shifttype) 110d90ac83dSHong Zhang { 1114ac538c5SBarry Smith PetscErrorCode ierr; 112d90ac83dSHong Zhang 113d90ac83dSHong Zhang PetscFunctionBegin; 1140700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 115c5eb9154SBarry Smith PetscValidLogicalCollectiveEnum(pc,shifttype,2); 1164ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetShiftType_C",(PC,MatFactorShiftType),(pc,shifttype));CHKERRQ(ierr); 117d90ac83dSHong Zhang PetscFunctionReturn(0); 118d90ac83dSHong Zhang } 119d90ac83dSHong Zhang 120915743fcSHong Zhang /*@ 121915743fcSHong Zhang PCFactorSetShiftAmount - adds a quantity to the diagonal of the matrix during 122915743fcSHong Zhang numerical factorization, thus the matrix has nonzero pivots 123915743fcSHong Zhang 124ad4df100SBarry Smith Logically Collective on PC 125915743fcSHong Zhang 126915743fcSHong Zhang Input Parameters: 127915743fcSHong Zhang + pc - the preconditioner context 128915743fcSHong Zhang - shiftamount - amount of shift 129915743fcSHong Zhang 130915743fcSHong Zhang Options Database Key: 131915743fcSHong Zhang . -pc_factor_shift_amount <shiftamount> - Sets shift amount or PETSC_DECIDE for the default 132915743fcSHong Zhang 133915743fcSHong Zhang Level: intermediate 134915743fcSHong Zhang 135915743fcSHong Zhang .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftType() 136915743fcSHong Zhang @*/ 1377087cfbeSBarry Smith PetscErrorCode PCFactorSetShiftAmount(PC pc,PetscReal shiftamount) 138d90ac83dSHong Zhang { 1394ac538c5SBarry Smith PetscErrorCode ierr; 140d90ac83dSHong Zhang 141d90ac83dSHong Zhang PetscFunctionBegin; 1420700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 143c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc,shiftamount,2); 1444ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetShiftAmount_C",(PC,PetscReal),(pc,shiftamount));CHKERRQ(ierr); 145d90ac83dSHong Zhang PetscFunctionReturn(0); 146d90ac83dSHong Zhang } 147d90ac83dSHong Zhang 14878fc6b22SHong Zhang /* 149b7c853c4SBarry Smith PCFactorSetDropTolerance - The preconditioner will use an ILU 15078fc6b22SHong Zhang based on a drop tolerance. (Under development) 15185317021SBarry Smith 152ad4df100SBarry Smith Logically Collective on PC 15385317021SBarry Smith 15485317021SBarry Smith Input Parameters: 15585317021SBarry Smith + pc - the preconditioner context 15685317021SBarry Smith . dt - the drop tolerance, try from 1.e-10 to .1 15785317021SBarry Smith . dtcol - tolerance for column pivot, good values [0.1 to 0.01] 15885317021SBarry Smith - maxrowcount - the max number of nonzeros allowed in a row, best value 15985317021SBarry Smith depends on the number of nonzeros in row of original matrix 16085317021SBarry Smith 16185317021SBarry Smith Options Database Key: 162b7c853c4SBarry Smith . -pc_factor_drop_tolerance <dt,dtcol,maxrowcount> - Sets drop tolerance 16385317021SBarry Smith 16485317021SBarry Smith Level: intermediate 16585317021SBarry Smith 16685317021SBarry Smith There are NO default values for the 3 parameters, you must set them with reasonable values for your 16785317021SBarry Smith matrix. We don't know how to compute reasonable values. 16885317021SBarry Smith 16978fc6b22SHong Zhang */ 1707087cfbeSBarry Smith PetscErrorCode PCFactorSetDropTolerance(PC pc,PetscReal dt,PetscReal dtcol,PetscInt maxrowcount) 17185317021SBarry Smith { 1724ac538c5SBarry Smith PetscErrorCode ierr; 17385317021SBarry Smith 17485317021SBarry Smith PetscFunctionBegin; 1750700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 176c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc,dtcol,2); 177c5eb9154SBarry Smith PetscValidLogicalCollectiveInt(pc,maxrowcount,3); 1784ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetDropTolerance_C",(PC,PetscReal,PetscReal,PetscInt),(pc,dt,dtcol,maxrowcount));CHKERRQ(ierr); 17985317021SBarry Smith PetscFunctionReturn(0); 18085317021SBarry Smith } 18185317021SBarry Smith 182c7f610a1SBarry Smith /*@ 183c7f610a1SBarry Smith PCFactorGetZeroPivot - Gets the tolerance used to define a zero privot 184c7f610a1SBarry Smith 185c7f610a1SBarry Smith Not Collective 186c7f610a1SBarry Smith 187c7f610a1SBarry Smith Input Parameters: 188c7f610a1SBarry Smith . pc - the preconditioner context 189c7f610a1SBarry Smith 190c7f610a1SBarry Smith Output Parameter: 191c7f610a1SBarry Smith . pivot - the tolerance 192c7f610a1SBarry Smith 193c7f610a1SBarry Smith Level: intermediate 194c7f610a1SBarry Smith 195c7f610a1SBarry Smith 196c7f610a1SBarry Smith .seealso: PCFactorSetZeroPivot() 197c7f610a1SBarry Smith @*/ 198c7f610a1SBarry Smith PetscErrorCode PCFactorGetZeroPivot(PC pc,PetscReal *pivot) 199c7f610a1SBarry Smith { 200c7f610a1SBarry Smith PetscErrorCode ierr; 201c7f610a1SBarry Smith 202c7f610a1SBarry Smith PetscFunctionBegin; 203c7f610a1SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 204c7f610a1SBarry Smith ierr = PetscUseMethod(pc,"PCFactorGetZeroPivot_C",(PC,PetscReal*),(pc,pivot));CHKERRQ(ierr); 205c7f610a1SBarry Smith PetscFunctionReturn(0); 206c7f610a1SBarry Smith } 207c7f610a1SBarry Smith 208c7f610a1SBarry Smith /*@ 209c7f610a1SBarry Smith PCFactorGetShiftAmount - Gets the tolerance used to define a zero privot 210c7f610a1SBarry Smith 211c7f610a1SBarry Smith Not Collective 212c7f610a1SBarry Smith 213c7f610a1SBarry Smith Input Parameters: 214c7f610a1SBarry Smith . pc - the preconditioner context 215c7f610a1SBarry Smith 216c7f610a1SBarry Smith Output Parameter: 217c7f610a1SBarry Smith . shift - how much to shift the diagonal entry 218c7f610a1SBarry Smith 219c7f610a1SBarry Smith Level: intermediate 220c7f610a1SBarry Smith 221c7f610a1SBarry Smith 222c7f610a1SBarry Smith .seealso: PCFactorSetShiftAmount(), PCFactorSetShiftType(), PCFactorGetShiftType() 223c7f610a1SBarry Smith @*/ 224c7f610a1SBarry Smith PetscErrorCode PCFactorGetShiftAmount(PC pc,PetscReal *shift) 225c7f610a1SBarry Smith { 226c7f610a1SBarry Smith PetscErrorCode ierr; 227c7f610a1SBarry Smith 228c7f610a1SBarry Smith PetscFunctionBegin; 229c7f610a1SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 230c7f610a1SBarry Smith ierr = PetscUseMethod(pc,"PCFactorGetShiftAmount_C",(PC,PetscReal*),(pc,shift));CHKERRQ(ierr); 231c7f610a1SBarry Smith PetscFunctionReturn(0); 232c7f610a1SBarry Smith } 233c7f610a1SBarry Smith 234c7f610a1SBarry Smith /*@ 235c7f610a1SBarry Smith PCFactorGetShiftType - Gets the type of shift, if any, done when a zero pivot is detected 236c7f610a1SBarry Smith 237c7f610a1SBarry Smith Not Collective 238c7f610a1SBarry Smith 239c7f610a1SBarry Smith Input Parameters: 240c7f610a1SBarry Smith . pc - the preconditioner context 241c7f610a1SBarry Smith 242c7f610a1SBarry Smith Output Parameter: 243c7f610a1SBarry Smith . type - one of MAT_SHIFT_NONE, MAT_SHIFT_NONZERO, MAT_SHIFT_POSITIVE_DEFINITE, or MAT_SHIFT_INBLOCKS 244c7f610a1SBarry Smith 245c7f610a1SBarry Smith Level: intermediate 246c7f610a1SBarry Smith 247c7f610a1SBarry Smith 248c7f610a1SBarry Smith .seealso: PCFactorSetShiftType(), MatFactorShiftType, PCFactorSetShiftAmount(), PCFactorGetShiftAmount() 249c7f610a1SBarry Smith @*/ 250c7f610a1SBarry Smith PetscErrorCode PCFactorGetShiftType(PC pc,MatFactorShiftType *type) 251c7f610a1SBarry Smith { 252c7f610a1SBarry Smith PetscErrorCode ierr; 253c7f610a1SBarry Smith 254c7f610a1SBarry Smith PetscFunctionBegin; 255c7f610a1SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 256c7f610a1SBarry Smith ierr = PetscUseMethod(pc,"PCFactorGetShiftType_C",(PC,MatFactorShiftType*),(pc,type));CHKERRQ(ierr); 257c7f610a1SBarry Smith PetscFunctionReturn(0); 258c7f610a1SBarry Smith } 259c7f610a1SBarry Smith 2602591b318SToby Isaac /*@ 2612591b318SToby Isaac PCFactorGetLevels - Gets the number of levels of fill to use. 2622591b318SToby Isaac 2632591b318SToby Isaac Logically Collective on PC 2642591b318SToby Isaac 2652591b318SToby Isaac Input Parameters: 2662591b318SToby Isaac . pc - the preconditioner context 2672591b318SToby Isaac 2682591b318SToby Isaac Output Parameter: 2692591b318SToby Isaac . levels - number of levels of fill 2702591b318SToby Isaac 2712591b318SToby Isaac Level: intermediate 2722591b318SToby Isaac 2732591b318SToby Isaac @*/ 2742591b318SToby Isaac PetscErrorCode PCFactorGetLevels(PC pc,PetscInt *levels) 2752591b318SToby Isaac { 2762591b318SToby Isaac PetscErrorCode ierr; 2772591b318SToby Isaac 2782591b318SToby Isaac PetscFunctionBegin; 2792591b318SToby Isaac PetscValidHeaderSpecific(pc,PC_CLASSID,1); 280c60c7ad4SBarry Smith ierr = PetscUseMethod(pc,"PCFactorGetLevels_C",(PC,PetscInt*),(pc,levels));CHKERRQ(ierr); 2812591b318SToby Isaac PetscFunctionReturn(0); 2822591b318SToby Isaac } 2832591b318SToby Isaac 28485317021SBarry Smith /*@ 28585317021SBarry Smith PCFactorSetLevels - Sets the number of levels of fill to use. 28685317021SBarry Smith 287ad4df100SBarry Smith Logically Collective on PC 28885317021SBarry Smith 28985317021SBarry Smith Input Parameters: 29085317021SBarry Smith + pc - the preconditioner context 29185317021SBarry Smith - levels - number of levels of fill 29285317021SBarry Smith 29385317021SBarry Smith Options Database Key: 29485317021SBarry Smith . -pc_factor_levels <levels> - Sets fill level 29585317021SBarry Smith 29685317021SBarry Smith Level: intermediate 29785317021SBarry Smith 29885317021SBarry Smith @*/ 2997087cfbeSBarry Smith PetscErrorCode PCFactorSetLevels(PC pc,PetscInt levels) 30085317021SBarry Smith { 3014ac538c5SBarry Smith PetscErrorCode ierr; 30285317021SBarry Smith 30385317021SBarry Smith PetscFunctionBegin; 3040700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 305ce94432eSBarry Smith if (levels < 0) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"negative levels"); 306c5eb9154SBarry Smith PetscValidLogicalCollectiveInt(pc,levels,2); 3074ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetLevels_C",(PC,PetscInt),(pc,levels));CHKERRQ(ierr); 30885317021SBarry Smith PetscFunctionReturn(0); 30985317021SBarry Smith } 31085317021SBarry Smith 31185317021SBarry Smith /*@ 31285317021SBarry Smith PCFactorSetAllowDiagonalFill - Causes all diagonal matrix entries to be 31385317021SBarry Smith treated as level 0 fill even if there is no non-zero location. 31485317021SBarry Smith 315ad4df100SBarry Smith Logically Collective on PC 31685317021SBarry Smith 31785317021SBarry Smith Input Parameters: 31885317021SBarry Smith + pc - the preconditioner context 31992e9c092SBarry Smith - flg - PETSC_TRUE to turn on, PETSC_FALSE to turn off 32085317021SBarry Smith 32185317021SBarry Smith Options Database Key: 32285317021SBarry Smith . -pc_factor_diagonal_fill 32385317021SBarry Smith 32485317021SBarry Smith Notes: 32585317021SBarry Smith Does not apply with 0 fill. 32685317021SBarry Smith 32785317021SBarry Smith Level: intermediate 32885317021SBarry Smith 32992e9c092SBarry Smith .seealso: PCFactorGetAllowDiagonalFill() 33092e9c092SBarry Smith 33185317021SBarry Smith @*/ 33292e9c092SBarry Smith PetscErrorCode PCFactorSetAllowDiagonalFill(PC pc,PetscBool flg) 33385317021SBarry Smith { 3344ac538c5SBarry Smith PetscErrorCode ierr; 33585317021SBarry Smith 33685317021SBarry Smith PetscFunctionBegin; 3370700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 33892e9c092SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetAllowDiagonalFill_C",(PC,PetscBool),(pc,flg));CHKERRQ(ierr); 33992e9c092SBarry Smith PetscFunctionReturn(0); 34092e9c092SBarry Smith } 34192e9c092SBarry Smith 34292e9c092SBarry Smith /*@ 34392e9c092SBarry Smith PCFactorGetAllowDiagonalFill - Determines if all diagonal matrix entries are 34492e9c092SBarry Smith treated as level 0 fill even if there is no non-zero location. 34592e9c092SBarry Smith 34692e9c092SBarry Smith Logically Collective on PC 34792e9c092SBarry Smith 34892e9c092SBarry Smith Input Parameter: 34992e9c092SBarry Smith . pc - the preconditioner context 35092e9c092SBarry Smith 35192e9c092SBarry Smith Output Parameter: 35292e9c092SBarry Smith . flg - PETSC_TRUE to turn on, PETSC_FALSE to turn off 35392e9c092SBarry Smith 35492e9c092SBarry Smith Options Database Key: 35592e9c092SBarry Smith . -pc_factor_diagonal_fill 35692e9c092SBarry Smith 35792e9c092SBarry Smith Notes: 35892e9c092SBarry Smith Does not apply with 0 fill. 35992e9c092SBarry Smith 36092e9c092SBarry Smith Level: intermediate 36192e9c092SBarry Smith 36292e9c092SBarry Smith .seealso: PCFactorSetAllowDiagonalFill() 36392e9c092SBarry Smith 36492e9c092SBarry Smith @*/ 36592e9c092SBarry Smith PetscErrorCode PCFactorGetAllowDiagonalFill(PC pc,PetscBool *flg) 36692e9c092SBarry Smith { 36792e9c092SBarry Smith PetscErrorCode ierr; 36892e9c092SBarry Smith 36992e9c092SBarry Smith PetscFunctionBegin; 37092e9c092SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 371c60c7ad4SBarry Smith ierr = PetscUseMethod(pc,"PCFactorGetAllowDiagonalFill_C",(PC,PetscBool*),(pc,flg));CHKERRQ(ierr); 37285317021SBarry Smith PetscFunctionReturn(0); 37385317021SBarry Smith } 37485317021SBarry Smith 37585317021SBarry Smith /*@ 37685317021SBarry Smith PCFactorReorderForNonzeroDiagonal - reorders rows/columns of matrix to remove zeros from diagonal 37785317021SBarry Smith 378ad4df100SBarry Smith Logically Collective on PC 37985317021SBarry Smith 38085317021SBarry Smith Input Parameters: 38185317021SBarry Smith + pc - the preconditioner context 38285317021SBarry Smith - tol - diagonal entries smaller than this in absolute value are considered zero 38385317021SBarry Smith 38485317021SBarry Smith Options Database Key: 38592e9c092SBarry Smith . -pc_factor_nonzeros_along_diagonal <tol> 38685317021SBarry Smith 38785317021SBarry Smith Level: intermediate 38885317021SBarry Smith 38985317021SBarry Smith .seealso: PCFactorSetFill(), PCFactorSetShiftNonzero(), PCFactorSetZeroPivot(), MatReorderForNonzeroDiagonal() 39085317021SBarry Smith @*/ 3917087cfbeSBarry Smith PetscErrorCode PCFactorReorderForNonzeroDiagonal(PC pc,PetscReal rtol) 39285317021SBarry Smith { 3934ac538c5SBarry Smith PetscErrorCode ierr; 39485317021SBarry Smith 39585317021SBarry Smith PetscFunctionBegin; 3960700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 397c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc,rtol,2); 3984ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorReorderForNonzeroDiagonal_C",(PC,PetscReal),(pc,rtol));CHKERRQ(ierr); 39985317021SBarry Smith PetscFunctionReturn(0); 40085317021SBarry Smith } 40185317021SBarry Smith 402bf6011e8SBarry Smith /*@C 4033ca39a21SBarry Smith PCFactorSetMatSolverType - sets the software that is used to perform the factorization 40485317021SBarry Smith 405ad4df100SBarry Smith Logically Collective on PC 40685317021SBarry Smith 40785317021SBarry Smith Input Parameters: 40885317021SBarry Smith + pc - the preconditioner context 409f60c3dc2SHong Zhang - stype - for example, superlu, superlu_dist 41085317021SBarry Smith 41185317021SBarry Smith Options Database Key: 4123ca39a21SBarry Smith . -pc_factor_mat_solver_type <stype> - petsc, superlu, superlu_dist, mumps, cusparse 41385317021SBarry Smith 41485317021SBarry Smith Level: intermediate 41585317021SBarry Smith 41685317021SBarry Smith Note: 41785317021SBarry Smith By default this will use the PETSc factorization if it exists 41885317021SBarry Smith 41985317021SBarry Smith 4203ca39a21SBarry Smith .seealso: MatGetFactor(), MatSolverType, PCFactorGetMatSolverType() 42185317021SBarry Smith 42285317021SBarry Smith @*/ 423ea799195SBarry Smith PetscErrorCode PCFactorSetMatSolverType(PC pc,MatSolverType stype) 42485317021SBarry Smith { 4254ac538c5SBarry Smith PetscErrorCode ierr; 42685317021SBarry Smith 42785317021SBarry Smith PetscFunctionBegin; 4280700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 429ea799195SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetMatSolverType_C",(PC,MatSolverType),(pc,stype));CHKERRQ(ierr); 43085317021SBarry Smith PetscFunctionReturn(0); 43185317021SBarry Smith } 43285317021SBarry Smith 433bf6011e8SBarry Smith /*@C 4343ca39a21SBarry Smith PCFactorGetMatSolverType - gets the software that is used to perform the factorization 4357112b564SBarry Smith 436c5eb9154SBarry Smith Not Collective 4377112b564SBarry Smith 4387112b564SBarry Smith Input Parameter: 4397112b564SBarry Smith . pc - the preconditioner context 4407112b564SBarry Smith 4417112b564SBarry Smith Output Parameter: 4420298fd71SBarry Smith . stype - for example, superlu, superlu_dist (NULL if the PC does not have a solver package) 4437112b564SBarry Smith 4447112b564SBarry Smith Level: intermediate 4457112b564SBarry Smith 4467112b564SBarry Smith 4473ca39a21SBarry Smith .seealso: MatGetFactor(), MatSolverType, PCFactorGetMatSolverType() 4487112b564SBarry Smith 4497112b564SBarry Smith @*/ 450ea799195SBarry Smith PetscErrorCode PCFactorGetMatSolverType(PC pc,MatSolverType *stype) 4517112b564SBarry Smith { 452ea799195SBarry Smith PetscErrorCode ierr,(*f)(PC,MatSolverType*); 4537112b564SBarry Smith 4547112b564SBarry Smith PetscFunctionBegin; 4550700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 4563ca39a21SBarry Smith ierr = PetscObjectQueryFunction((PetscObject)pc,"PCFactorGetMatSolverType_C",&f);CHKERRQ(ierr); 4578b5c83b4SJed Brown if (f) { 4588b5c83b4SJed Brown ierr = (*f)(pc,stype);CHKERRQ(ierr); 4598b5c83b4SJed Brown } else { 4600298fd71SBarry Smith *stype = NULL; 4618b5c83b4SJed Brown } 4627112b564SBarry Smith PetscFunctionReturn(0); 4637112b564SBarry Smith } 4647112b564SBarry Smith 46585317021SBarry Smith /*@ 46685317021SBarry Smith PCFactorSetFill - Indicate the amount of fill you expect in the factored matrix, 46785317021SBarry Smith fill = number nonzeros in factor/number nonzeros in original matrix. 46885317021SBarry Smith 469c5eb9154SBarry Smith Not Collective, each process can expect a different amount of fill 47085317021SBarry Smith 47185317021SBarry Smith Input Parameters: 47285317021SBarry Smith + pc - the preconditioner context 47385317021SBarry Smith - fill - amount of expected fill 47485317021SBarry Smith 47585317021SBarry Smith Options Database Key: 47685317021SBarry Smith . -pc_factor_fill <fill> - Sets fill amount 47785317021SBarry Smith 47885317021SBarry Smith Level: intermediate 47985317021SBarry Smith 48085317021SBarry Smith Note: 48185317021SBarry Smith For sparse matrix factorizations it is difficult to predict how much 48285317021SBarry Smith fill to expect. By running with the option -info PETSc will print the 48385317021SBarry Smith actual amount of fill used; allowing you to set the value accurately for 48485317021SBarry Smith future runs. Default PETSc uses a value of 5.0 48585317021SBarry Smith 48601a79839SBarry Smith This parameter has NOTHING to do with the levels-of-fill of ILU(). That is set with PCFactorSetLevels() or -pc_factor_levels. 48701a79839SBarry Smith 48801a79839SBarry Smith 48985317021SBarry Smith @*/ 4907087cfbeSBarry Smith PetscErrorCode PCFactorSetFill(PC pc,PetscReal fill) 49185317021SBarry Smith { 4924ac538c5SBarry Smith PetscErrorCode ierr; 49385317021SBarry Smith 49485317021SBarry Smith PetscFunctionBegin; 4950700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 496ce94432eSBarry Smith if (fill < 1.0) SETERRQ(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_OUTOFRANGE,"Fill factor cannot be less then 1.0"); 4974ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetFill_C",(PC,PetscReal),(pc,fill));CHKERRQ(ierr); 49885317021SBarry Smith PetscFunctionReturn(0); 49985317021SBarry Smith } 50085317021SBarry Smith 50185317021SBarry Smith /*@ 50285317021SBarry Smith PCFactorSetUseInPlace - Tells the system to do an in-place factorization. 50385317021SBarry Smith For dense matrices, this enables the solution of much larger problems. 50485317021SBarry Smith For sparse matrices the factorization cannot be done truly in-place 50585317021SBarry Smith so this does not save memory during the factorization, but after the matrix 50685317021SBarry Smith is factored, the original unfactored matrix is freed, thus recovering that 507*ec5066bdSBarry Smith space. For ICC(0) and ILU(0) with the default natural ordering the factorization is done efficiently in-place. 50885317021SBarry Smith 509ad4df100SBarry Smith Logically Collective on PC 51085317021SBarry Smith 51185317021SBarry Smith Input Parameters: 5128e37d05fSBarry Smith + pc - the preconditioner context 5138e37d05fSBarry Smith - flg - PETSC_TRUE to enable, PETSC_FALSE to disable 51485317021SBarry Smith 51585317021SBarry Smith Options Database Key: 5168e37d05fSBarry Smith . -pc_factor_in_place <true,false>- Activate/deactivate in-place factorization 51785317021SBarry Smith 51885317021SBarry Smith Notes: 51985317021SBarry Smith PCFactorSetUseInplace() can only be used with the KSP method KSPPREONLY or when 52085317021SBarry Smith a different matrix is provided for the multiply and the preconditioner in 52185317021SBarry Smith a call to KSPSetOperators(). 52285317021SBarry Smith This is because the Krylov space methods require an application of the 52385317021SBarry Smith matrix multiplication, which is not possible here because the matrix has 52485317021SBarry Smith been factored in-place, replacing the original matrix. 52585317021SBarry Smith 52685317021SBarry Smith Level: intermediate 52785317021SBarry Smith 5288e37d05fSBarry Smith .seealso: PCFactorGetUseInPlace() 52985317021SBarry Smith @*/ 5308e37d05fSBarry Smith PetscErrorCode PCFactorSetUseInPlace(PC pc,PetscBool flg) 53185317021SBarry Smith { 5324ac538c5SBarry Smith PetscErrorCode ierr; 53385317021SBarry Smith 53485317021SBarry Smith PetscFunctionBegin; 5350700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 5368e37d05fSBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetUseInPlace_C",(PC,PetscBool),(pc,flg));CHKERRQ(ierr); 5378e37d05fSBarry Smith PetscFunctionReturn(0); 5388e37d05fSBarry Smith } 5398e37d05fSBarry Smith 5408e37d05fSBarry Smith /*@ 5418e37d05fSBarry Smith PCFactorGetUseInPlace - Determines if an in-place factorization is being used. 5428e37d05fSBarry Smith 5438e37d05fSBarry Smith Logically Collective on PC 5448e37d05fSBarry Smith 5458e37d05fSBarry Smith Input Parameter: 5468e37d05fSBarry Smith . pc - the preconditioner context 5478e37d05fSBarry Smith 5488e37d05fSBarry Smith Output Parameter: 5498e37d05fSBarry Smith . flg - PETSC_TRUE to enable, PETSC_FALSE to disable 5508e37d05fSBarry Smith 5518e37d05fSBarry Smith Level: intermediate 5528e37d05fSBarry Smith 5538e37d05fSBarry Smith .seealso: PCFactorSetUseInPlace() 5548e37d05fSBarry Smith @*/ 5558e37d05fSBarry Smith PetscErrorCode PCFactorGetUseInPlace(PC pc,PetscBool *flg) 5568e37d05fSBarry Smith { 5578e37d05fSBarry Smith PetscErrorCode ierr; 5588e37d05fSBarry Smith 5598e37d05fSBarry Smith PetscFunctionBegin; 5608e37d05fSBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 561c60c7ad4SBarry Smith ierr = PetscUseMethod(pc,"PCFactorGetUseInPlace_C",(PC,PetscBool*),(pc,flg));CHKERRQ(ierr); 56285317021SBarry Smith PetscFunctionReturn(0); 56385317021SBarry Smith } 56485317021SBarry Smith 56585317021SBarry Smith /*@C 56685317021SBarry Smith PCFactorSetMatOrderingType - Sets the ordering routine (to reduce fill) to 56785317021SBarry Smith be used in the LU factorization. 56885317021SBarry Smith 569ad4df100SBarry Smith Logically Collective on PC 57085317021SBarry Smith 57185317021SBarry Smith Input Parameters: 57285317021SBarry Smith + pc - the preconditioner context 5732692d6eeSBarry Smith - ordering - the matrix ordering name, for example, MATORDERINGND or MATORDERINGRCM 57485317021SBarry Smith 57585317021SBarry Smith Options Database Key: 57685317021SBarry Smith . -pc_factor_mat_ordering_type <nd,rcm,...> - Sets ordering routine 57785317021SBarry Smith 57885317021SBarry Smith Level: intermediate 57985317021SBarry Smith 58095452b02SPatrick Sanan Notes: 58195452b02SPatrick Sanan nested dissection is used by default 58285317021SBarry Smith 58385317021SBarry Smith For Cholesky and ICC and the SBAIJ format reorderings are not available, 58485317021SBarry Smith since only the upper triangular part of the matrix is stored. You can use the 58585317021SBarry Smith SeqAIJ format in this case to get reorderings. 58685317021SBarry Smith 58785317021SBarry Smith @*/ 58819fd82e9SBarry Smith PetscErrorCode PCFactorSetMatOrderingType(PC pc,MatOrderingType ordering) 58985317021SBarry Smith { 5904ac538c5SBarry Smith PetscErrorCode ierr; 59185317021SBarry Smith 59285317021SBarry Smith PetscFunctionBegin; 593c5eb9154SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 59419fd82e9SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetMatOrderingType_C",(PC,MatOrderingType),(pc,ordering));CHKERRQ(ierr); 59585317021SBarry Smith PetscFunctionReturn(0); 59685317021SBarry Smith } 59785317021SBarry Smith 59885317021SBarry Smith /*@ 5998ff23777SHong Zhang PCFactorSetColumnPivot - Determines when column pivoting is done during matrix factorization. 60085317021SBarry Smith For PETSc dense matrices column pivoting is always done, for PETSc sparse matrices 601e3c5b3baSBarry Smith it is never done. For the MATLAB and SuperLU factorization this is used. 60285317021SBarry Smith 603ad4df100SBarry Smith Logically Collective on PC 60485317021SBarry Smith 60585317021SBarry Smith Input Parameters: 60685317021SBarry Smith + pc - the preconditioner context 60785317021SBarry Smith - dtcol - 0.0 implies no pivoting, 1.0 complete pivoting (slower, requires more memory but more stable) 60885317021SBarry Smith 60985317021SBarry Smith Options Database Key: 61085317021SBarry Smith . -pc_factor_pivoting <dtcol> 61185317021SBarry Smith 61285317021SBarry Smith Level: intermediate 61385317021SBarry Smith 61485317021SBarry Smith .seealso: PCILUSetMatOrdering(), PCFactorSetPivotInBlocks() 61585317021SBarry Smith @*/ 6167087cfbeSBarry Smith PetscErrorCode PCFactorSetColumnPivot(PC pc,PetscReal dtcol) 61785317021SBarry Smith { 6184ac538c5SBarry Smith PetscErrorCode ierr; 61985317021SBarry Smith 62085317021SBarry Smith PetscFunctionBegin; 621c5eb9154SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 622c5eb9154SBarry Smith PetscValidLogicalCollectiveReal(pc,dtcol,2); 6234ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetColumnPivot_C",(PC,PetscReal),(pc,dtcol));CHKERRQ(ierr); 62485317021SBarry Smith PetscFunctionReturn(0); 62585317021SBarry Smith } 62685317021SBarry Smith 62785317021SBarry Smith /*@ 62885317021SBarry Smith PCFactorSetPivotInBlocks - Determines if pivoting is done while factoring each block 62985317021SBarry Smith with BAIJ or SBAIJ matrices 63085317021SBarry Smith 631ad4df100SBarry Smith Logically Collective on PC 63285317021SBarry Smith 63385317021SBarry Smith Input Parameters: 63485317021SBarry Smith + pc - the preconditioner context 63585317021SBarry Smith - pivot - PETSC_TRUE or PETSC_FALSE 63685317021SBarry Smith 63785317021SBarry Smith Options Database Key: 63885317021SBarry Smith . -pc_factor_pivot_in_blocks <true,false> 63985317021SBarry Smith 64085317021SBarry Smith Level: intermediate 64185317021SBarry Smith 6428ff23777SHong Zhang .seealso: PCILUSetMatOrdering(), PCFactorSetColumnPivot() 64385317021SBarry Smith @*/ 6447087cfbeSBarry Smith PetscErrorCode PCFactorSetPivotInBlocks(PC pc,PetscBool pivot) 64585317021SBarry Smith { 6464ac538c5SBarry Smith PetscErrorCode ierr; 64785317021SBarry Smith 64885317021SBarry Smith PetscFunctionBegin; 649c5eb9154SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,1); 650acfcf0e5SJed Brown PetscValidLogicalCollectiveBool(pc,pivot,2); 6514ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetPivotInBlocks_C",(PC,PetscBool),(pc,pivot));CHKERRQ(ierr); 65285317021SBarry Smith PetscFunctionReturn(0); 65385317021SBarry Smith } 65485317021SBarry Smith 65585317021SBarry Smith /*@ 656288e7d53SBarry Smith PCFactorSetReuseFill - When matrices with different nonzero structure are factored, 65785317021SBarry Smith this causes later ones to use the fill ratio computed in the initial factorization. 65885317021SBarry Smith 659ad4df100SBarry Smith Logically Collective on PC 66085317021SBarry Smith 66185317021SBarry Smith Input Parameters: 66285317021SBarry Smith + pc - the preconditioner context 66385317021SBarry Smith - flag - PETSC_TRUE to reuse else PETSC_FALSE 66485317021SBarry Smith 66585317021SBarry Smith Options Database Key: 66685317021SBarry Smith . -pc_factor_reuse_fill - Activates PCFactorSetReuseFill() 66785317021SBarry Smith 66885317021SBarry Smith Level: intermediate 66985317021SBarry Smith 67085317021SBarry Smith .seealso: PCFactorSetReuseOrdering() 67185317021SBarry Smith @*/ 6727087cfbeSBarry Smith PetscErrorCode PCFactorSetReuseFill(PC pc,PetscBool flag) 67385317021SBarry Smith { 6744ac538c5SBarry Smith PetscErrorCode ierr; 67585317021SBarry Smith 67685317021SBarry Smith PetscFunctionBegin; 6770700a824SBarry Smith PetscValidHeaderSpecific(pc,PC_CLASSID,2); 678acfcf0e5SJed Brown PetscValidLogicalCollectiveBool(pc,flag,2); 6794ac538c5SBarry Smith ierr = PetscTryMethod(pc,"PCFactorSetReuseFill_C",(PC,PetscBool),(pc,flag));CHKERRQ(ierr); 68085317021SBarry Smith PetscFunctionReturn(0); 68185317021SBarry Smith } 6823d1c1ea0SBarry Smith 6833d1c1ea0SBarry Smith PetscErrorCode PCFactorInitialize(PC pc) 6843d1c1ea0SBarry Smith { 6853d1c1ea0SBarry Smith PetscErrorCode ierr; 6863d1c1ea0SBarry Smith PC_Factor *fact = (PC_Factor*)pc->data; 6873d1c1ea0SBarry Smith 6883d1c1ea0SBarry Smith PetscFunctionBegin; 6893d1c1ea0SBarry Smith ierr = MatFactorInfoInitialize(&fact->info);CHKERRQ(ierr); 6903d1c1ea0SBarry Smith fact->info.shifttype = (PetscReal)MAT_SHIFT_NONE; 6913d1c1ea0SBarry Smith fact->info.shiftamount = 100.0*PETSC_MACHINE_EPSILON; 6923d1c1ea0SBarry Smith fact->info.zeropivot = 100.0*PETSC_MACHINE_EPSILON; 6933d1c1ea0SBarry Smith fact->info.pivotinblocks = 1.0; 6943d1c1ea0SBarry Smith pc->ops->getfactoredmatrix = PCFactorGetMatrix_Factor; 6953d1c1ea0SBarry Smith 6963d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetZeroPivot_C",PCFactorSetZeroPivot_Factor);CHKERRQ(ierr); 6973d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetZeroPivot_C",PCFactorGetZeroPivot_Factor);CHKERRQ(ierr); 6983d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetShiftType_C",PCFactorSetShiftType_Factor);CHKERRQ(ierr); 6993d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetShiftType_C",PCFactorGetShiftType_Factor);CHKERRQ(ierr); 7003d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetShiftAmount_C",PCFactorSetShiftAmount_Factor);CHKERRQ(ierr); 7013d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetShiftAmount_C",PCFactorGetShiftAmount_Factor);CHKERRQ(ierr); 7023ca39a21SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetMatSolverType_C",PCFactorGetMatSolverType_Factor);CHKERRQ(ierr); 7033ca39a21SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetMatSolverType_C",PCFactorSetMatSolverType_Factor);CHKERRQ(ierr); 7043ca39a21SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetUpMatSolverType_C",PCFactorSetUpMatSolverType_Factor);CHKERRQ(ierr); 7053d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetFill_C",PCFactorSetFill_Factor);CHKERRQ(ierr); 7063d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetMatOrderingType_C",PCFactorSetMatOrderingType_Factor);CHKERRQ(ierr); 7073d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetLevels_C",PCFactorSetLevels_Factor);CHKERRQ(ierr); 7083d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetLevels_C",PCFactorGetLevels_Factor);CHKERRQ(ierr); 7093d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetAllowDiagonalFill_C",PCFactorSetAllowDiagonalFill_Factor);CHKERRQ(ierr); 7103d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetAllowDiagonalFill_C",PCFactorGetAllowDiagonalFill_Factor);CHKERRQ(ierr); 7113d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetPivotInBlocks_C",PCFactorSetPivotInBlocks_Factor);CHKERRQ(ierr); 7123d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetUseInPlace_C",PCFactorSetUseInPlace_Factor);CHKERRQ(ierr); 7133d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorGetUseInPlace_C",PCFactorGetUseInPlace_Factor);CHKERRQ(ierr); 7143d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetReuseOrdering_C",PCFactorSetReuseOrdering_Factor);CHKERRQ(ierr); 7153d1c1ea0SBarry Smith ierr = PetscObjectComposeFunction((PetscObject)pc,"PCFactorSetReuseFill_C",PCFactorSetReuseFill_Factor);CHKERRQ(ierr); 7163d1c1ea0SBarry Smith PetscFunctionReturn(0); 7173d1c1ea0SBarry Smith } 718