Lines Matching full:pc
2 The PC (preconditioner) interface routines, callable by users.
14 PETSC_INTERN PetscErrorCode PCGetDefaultType_Private(PC pc, const char *type[]) in PCGetDefaultType_Private() argument
20 PetscCallMPI(MPI_Comm_size(PetscObjectComm((PetscObject)pc), &size)); in PCGetDefaultType_Private()
21 if (pc->pmat) { in PCGetDefaultType_Private()
22 PetscCall(MatHasOperation(pc->pmat, MATOP_GET_DIAGONAL_BLOCK, &hasopblock)); in PCGetDefaultType_Private()
23 PetscCall(MatHasOperation(pc->pmat, MATOP_SOLVE, &hasopsolve)); in PCGetDefaultType_Private()
25 PetscCall(MatGetFactorAvailable(pc->pmat, "petsc", MAT_FACTOR_ICC, &flg1)); in PCGetDefaultType_Private()
26 PetscCall(MatGetFactorAvailable(pc->pmat, "petsc", MAT_FACTOR_ILU, &flg2)); in PCGetDefaultType_Private()
27 PetscCall(MatIsSymmetricKnown(pc->pmat, &set, &flg3)); in PCGetDefaultType_Private()
28 …PetscCall(PetscObjectTypeCompareAny((PetscObject)pc->pmat, &isnormal, MATNORMAL, MATNORMALHERMITIA… in PCGetDefaultType_Private()
83 …PCReset - Resets a `PC` context to the state it was in before `PCSetUp()` was called, and removes …
88 . pc - the `PC` preconditioner context
95 …This allows a `PC` to be reused for a different sized linear system but using the same options tha…
97 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetUp()`
99 PetscErrorCode PCReset(PC pc) in PCReset() argument
102 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCReset()
103 PetscTryTypeMethod(pc, reset); in PCReset()
104 PetscCall(VecDestroy(&pc->diagonalscaleright)); in PCReset()
105 PetscCall(VecDestroy(&pc->diagonalscaleleft)); in PCReset()
106 PetscCall(MatDestroy(&pc->pmat)); in PCReset()
107 PetscCall(MatDestroy(&pc->mat)); in PCReset()
109 pc->setupcalled = PETSC_FALSE; in PCReset()
114 PCDestroy - Destroys `PC` context that was created with `PCCreate()`.
119 . pc - the `PC` preconditioner context
123 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetUp()`
125 PetscErrorCode PCDestroy(PC *pc) in PCDestroy() argument
128 if (!*pc) PetscFunctionReturn(PETSC_SUCCESS); in PCDestroy()
129 PetscValidHeaderSpecific(*pc, PC_CLASSID, 1); in PCDestroy()
130 if (--((PetscObject)*pc)->refct > 0) { in PCDestroy()
131 *pc = NULL; in PCDestroy()
135 PetscCall(PCReset(*pc)); in PCDestroy()
138 PetscCall(PetscObjectSAWsViewOff((PetscObject)*pc)); in PCDestroy()
139 PetscTryTypeMethod(*pc, destroy); in PCDestroy()
140 PetscCall(DMDestroy(&(*pc)->dm)); in PCDestroy()
141 PetscCall(PetscHeaderDestroy(pc)); in PCDestroy()
152 . pc - the `PC` preconditioner context
169 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetUp()`, `PCDiagonalScaleLeft()`, `PCDiagonalScaleRig…
171 PetscErrorCode PCGetDiagonalScale(PC pc, PetscBool *flag) in PCGetDiagonalScale() argument
174 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetDiagonalScale()
176 *flag = pc->diagonalscale; in PCGetDiagonalScale()
187 + pc - the `PC` preconditioner context
205 PetscErrorCode PCSetDiagonalScale(PC pc, Vec s) in PCSetDiagonalScale() argument
208 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetDiagonalScale()
210 pc->diagonalscale = PETSC_TRUE; in PCSetDiagonalScale()
213 PetscCall(VecDestroy(&pc->diagonalscaleleft)); in PCSetDiagonalScale()
215 pc->diagonalscaleleft = s; in PCSetDiagonalScale()
217 PetscCall(VecDuplicate(s, &pc->diagonalscaleright)); in PCSetDiagonalScale()
218 PetscCall(VecCopy(s, pc->diagonalscaleright)); in PCSetDiagonalScale()
219 PetscCall(VecReciprocal(pc->diagonalscaleright)); in PCSetDiagonalScale()
229 + pc - the `PC` preconditioner context
251 PetscErrorCode PCDiagonalScaleLeft(PC pc, Vec in, Vec out) in PCDiagonalScaleLeft() argument
254 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCDiagonalScaleLeft()
257 if (pc->diagonalscale) { in PCDiagonalScaleLeft()
258 PetscCall(VecPointwiseMult(out, pc->diagonalscaleleft, in)); in PCDiagonalScaleLeft()
271 + pc - the `PC` preconditioner context
293 PetscErrorCode PCDiagonalScaleRight(PC pc, Vec in, Vec out) in PCDiagonalScaleRight() argument
296 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCDiagonalScaleRight()
299 if (pc->diagonalscale) { in PCDiagonalScaleRight()
300 PetscCall(VecPointwiseMult(out, pc->diagonalscaleright, in)); in PCDiagonalScaleRight()
315 + pc - the `PC` preconditioner context
327 .seealso: [](ch_ksp), `PC`, `PCGetUseAmat()`, `PCBJACOBI`, `PCMG`, `PCFIELDSPLIT`, `PCCOMPOSITE`,
330 PetscErrorCode PCSetUseAmat(PC pc, PetscBool flg) in PCSetUseAmat() argument
333 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetUseAmat()
334 pc->useAmat = flg; in PCSetUseAmat()
339 …PCSetErrorIfFailure - Causes `PC` to generate an error if a floating point exception, for example …
344 + pc - iterative context obtained from `PCCreate()`
354 …This is propagated into `KSP`s used by this `PC`, which then propagate it into `PC`s used by those…
356 .seealso: [](ch_ksp), `PC`, `KSPSetErrorIfNotConverged()`, `PCGetInitialGuessNonzero()`, `PCSetInit…
358 PetscErrorCode PCSetErrorIfFailure(PC pc, PetscBool flg) in PCSetErrorIfFailure() argument
361 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetErrorIfFailure()
362 PetscValidLogicalCollectiveBool(pc, flg, 2); in PCSetErrorIfFailure()
363 pc->erroriffailure = flg; in PCSetErrorIfFailure()
375 . pc - the `PC` preconditioner context
386 .seealso: [](ch_ksp), `PC`, `PCSetUseAmat()`, `PCBJACOBI`, `PCMG`, `PCFIELDSPLIT`, `PCCOMPOSITE`
388 PetscErrorCode PCGetUseAmat(PC pc, PetscBool *flg) in PCGetUseAmat() argument
391 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetUseAmat()
392 *flg = pc->useAmat; in PCGetUseAmat()
397 PCSetKSPNestLevel - sets the amount of nesting the `KSP` that contains this `PC` has
402 + pc - the `PC`
409 PetscErrorCode PCSetKSPNestLevel(PC pc, PetscInt level) in PCSetKSPNestLevel() argument
412 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetKSPNestLevel()
413 PetscValidLogicalCollectiveInt(pc, level, 2); in PCSetKSPNestLevel()
414 pc->kspnestlevel = level; in PCSetKSPNestLevel()
419 PCGetKSPNestLevel - gets the amount of nesting the `KSP` that contains this `PC` has
424 . pc - the `PC`
433 PetscErrorCode PCGetKSPNestLevel(PC pc, PetscInt *level) in PCGetKSPNestLevel() argument
436 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetKSPNestLevel()
438 *level = pc->kspnestlevel; in PCGetKSPNestLevel()
443 PCCreate - Creates a preconditioner context, `PC`
451 . newpc - location to put the `PC` preconditioner context
456 …alled directly by users since `KSP` manages the `PC` objects it uses. Use `KSPGetPC()` to access t…
458 …Type()` or `PCSetFromOptions()` with the option `-pc_type pctype` to set the `PCType` for this `PC`
463 .seealso: [](ch_ksp), `PC`, `PCType`, `PCSetType`, `PCSetUp()`, `PCApply()`, `PCDestroy()`, `KSP`, …
465 PetscErrorCode PCCreate(MPI_Comm comm, PC *newpc) in PCCreate()
467 PC pc; in PCCreate() local
473 …PetscCall(PetscHeaderCreate(pc, PC_CLASSID, "PC", "Preconditioner", "PC", comm, PCDestroy, PCView)… in PCCreate()
474 pc->mat = NULL; in PCCreate()
475 pc->pmat = NULL; in PCCreate()
476 pc->setupcalled = PETSC_FALSE; in PCCreate()
477 pc->setfromoptionscalled = 0; in PCCreate()
478 pc->data = NULL; in PCCreate()
479 pc->diagonalscale = PETSC_FALSE; in PCCreate()
480 pc->diagonalscaleleft = NULL; in PCCreate()
481 pc->diagonalscaleright = NULL; in PCCreate()
483 pc->modifysubmatrices = NULL; in PCCreate()
484 pc->modifysubmatricesP = NULL; in PCCreate()
486 *newpc = pc; in PCCreate()
496 + pc - the `PC` preconditioner context
504 .seealso: [](ch_ksp), `PC`, `PCApplyTranspose()`, `PCApplyBAorAB()`
506 PetscErrorCode PCApply(PC pc, Vec x, Vec y) in PCApply() argument
511 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApply()
514 …PetscCheck(x != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "x and y must be different… in PCApply()
515 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(x, 2, PETSC_TRUE)); in PCApply()
517 PetscCall(MatGetLocalSize(pc->pmat, &m, &n)); in PCApply()
525 PetscCall(PCSetUp(pc)); in PCApply()
527 PetscCall(PetscLogEventBegin(PC_Apply, pc, x, y, 0)); in PCApply()
528 PetscUseTypeMethod(pc, apply, x, y); in PCApply()
529 PetscCall(PetscLogEventEnd(PC_Apply, pc, x, y, 0)); in PCApply()
530 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 3, PETSC_FALSE)); in PCApply()
535 static PetscErrorCode PCMatApplyTranspose_Private(PC pc, Mat X, Mat Y, PetscBool transpose) in PCMatApplyTranspose_Private() argument
543 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCMatApplyTranspose_Private()
546 PetscCheckSameComm(pc, 1, X, 2); in PCMatApplyTranspose_Private()
547 PetscCheckSameComm(pc, 1, Y, 3); in PCMatApplyTranspose_Private()
548 …PetscCheck(Y != X, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "Y and X must be different… in PCMatApplyTranspose_Private()
549 PetscCall(PCGetOperators(pc, NULL, &A)); in PCMatApplyTranspose_Private()
563 PetscCall(PCSetUp(pc)); in PCMatApplyTranspose_Private()
564 if (!transpose && pc->ops->matapply) { in PCMatApplyTranspose_Private()
565 PetscCall(PetscLogEventBegin(PC_MatApply, pc, X, Y, 0)); in PCMatApplyTranspose_Private()
566 PetscUseTypeMethod(pc, matapply, X, Y); in PCMatApplyTranspose_Private()
567 PetscCall(PetscLogEventEnd(PC_MatApply, pc, X, Y, 0)); in PCMatApplyTranspose_Private()
568 } else if (transpose && pc->ops->matapplytranspose) { in PCMatApplyTranspose_Private()
569 PetscCall(PetscLogEventBegin(PC_MatApply, pc, X, Y, 0)); in PCMatApplyTranspose_Private()
570 PetscUseTypeMethod(pc, matapplytranspose, X, Y); in PCMatApplyTranspose_Private()
571 PetscCall(PetscLogEventEnd(PC_MatApply, pc, X, Y, 0)); in PCMatApplyTranspose_Private()
573 … PetscCall(PetscInfo(pc, "PC type %s applying column by column\n", ((PetscObject)pc)->type_name)); in PCMatApplyTranspose_Private()
577 if (!transpose) PetscCall(PCApply(pc, cx, cy)); in PCMatApplyTranspose_Private()
578 else PetscCall(PCApplyTranspose(pc, cx, cy)); in PCMatApplyTranspose_Private()
592 + pc - the `PC` preconditioner context
600 .seealso: [](ch_ksp), `PC`, `PCApply()`, `KSPMatSolve()`
602 PetscErrorCode PCMatApply(PC pc, Mat X, Mat Y) in PCMatApply() argument
605 PetscCall(PCMatApplyTranspose_Private(pc, X, Y, PETSC_FALSE)); in PCMatApply()
615 + pc - the `PC` preconditioner context
623 .seealso: [](ch_ksp), `PC`, `PCApplyTranspose()`, `KSPMatSolveTranspose()`
625 PetscErrorCode PCMatApplyTranspose(PC pc, Mat X, Mat Y) in PCMatApplyTranspose() argument
628 PetscCall(PCMatApplyTranspose_Private(pc, X, Y, PETSC_TRUE)); in PCMatApplyTranspose()
638 + pc - the `PC` preconditioner context
649 .seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplySymmetricRight()`
651 PetscErrorCode PCApplySymmetricLeft(PC pc, Vec x, Vec y) in PCApplySymmetricLeft() argument
654 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplySymmetricLeft()
657 …PetscCheck(x != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "x and y must be different… in PCApplySymmetricLeft()
658 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(x, 2, PETSC_TRUE)); in PCApplySymmetricLeft()
659 PetscCall(PCSetUp(pc)); in PCApplySymmetricLeft()
661 PetscCall(PetscLogEventBegin(PC_ApplySymmetricLeft, pc, x, y, 0)); in PCApplySymmetricLeft()
662 PetscUseTypeMethod(pc, applysymmetricleft, x, y); in PCApplySymmetricLeft()
663 PetscCall(PetscLogEventEnd(PC_ApplySymmetricLeft, pc, x, y, 0)); in PCApplySymmetricLeft()
665 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 3, PETSC_FALSE)); in PCApplySymmetricLeft()
675 + pc - the `PC` preconditioner context
686 .seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplySymmetricLeft()`
688 PetscErrorCode PCApplySymmetricRight(PC pc, Vec x, Vec y) in PCApplySymmetricRight() argument
691 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplySymmetricRight()
694 …PetscCheck(x != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "x and y must be different… in PCApplySymmetricRight()
695 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(x, 2, PETSC_TRUE)); in PCApplySymmetricRight()
696 PetscCall(PCSetUp(pc)); in PCApplySymmetricRight()
698 PetscCall(PetscLogEventBegin(PC_ApplySymmetricRight, pc, x, y, 0)); in PCApplySymmetricRight()
699 PetscUseTypeMethod(pc, applysymmetricright, x, y); in PCApplySymmetricRight()
700 PetscCall(PetscLogEventEnd(PC_ApplySymmetricRight, pc, x, y, 0)); in PCApplySymmetricRight()
702 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 3, PETSC_FALSE)); in PCApplySymmetricRight()
712 + pc - the `PC` preconditioner context
726 .seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplyBAorAB()`, `PCApplyBAorABTranspose()`, `PCApplyTra…
728 PetscErrorCode PCApplyTranspose(PC pc, Vec x, Vec y) in PCApplyTranspose() argument
731 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplyTranspose()
734 …PetscCheck(x != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "x and y must be different… in PCApplyTranspose()
735 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(x, 2, PETSC_TRUE)); in PCApplyTranspose()
736 PetscCall(PCSetUp(pc)); in PCApplyTranspose()
738 PetscCall(PetscLogEventBegin(PC_Apply, pc, x, y, 0)); in PCApplyTranspose()
739 PetscUseTypeMethod(pc, applytranspose, x, y); in PCApplyTranspose()
740 PetscCall(PetscLogEventEnd(PC_Apply, pc, x, y, 0)); in PCApplyTranspose()
742 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 3, PETSC_FALSE)); in PCApplyTranspose()
752 . pc - the `PC` preconditioner context
759 .seealso: [](ch_ksp), `PC`, `PCApplyTranspose()`
761 PetscErrorCode PCApplyTransposeExists(PC pc, PetscBool *flg) in PCApplyTransposeExists() argument
764 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplyTransposeExists()
766 if (pc->ops->applytranspose) *flg = PETSC_TRUE; in PCApplyTransposeExists()
777 + pc - the `PC` preconditioner context
788 …If the `PC` has had `PCSetDiagonalScale()` set then $ D M A D^{-1} $ for left preconditioning or $…
791 .seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplyTranspose()`, `PCApplyBAorABTranspose()`
793 PetscErrorCode PCApplyBAorAB(PC pc, PCSide side, Vec x, Vec y, Vec work) in PCApplyBAorAB() argument
796 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplyBAorAB()
797 PetscValidLogicalCollectiveEnum(pc, side, 2); in PCApplyBAorAB()
801 PetscCheckSameComm(pc, 1, x, 3); in PCApplyBAorAB()
802 PetscCheckSameComm(pc, 1, y, 4); in PCApplyBAorAB()
803 PetscCheckSameComm(pc, 1, work, 5); in PCApplyBAorAB()
804 …PetscCheck(x != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "x and y must be different… in PCApplyBAorAB()
805 … || side == PC_SYMMETRIC || side == PC_RIGHT, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_OUTO… in PCApplyBAorAB()
806 …PetscCheck(!pc->diagonalscale || side != PC_SYMMETRIC, PetscObjectComm((PetscObject)pc), PETSC_ERR… in PCApplyBAorAB()
807 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(x, 3, PETSC_TRUE)); in PCApplyBAorAB()
809 PetscCall(PCSetUp(pc)); in PCApplyBAorAB()
810 if (pc->diagonalscale) { in PCApplyBAorAB()
811 if (pc->ops->applyBA) { in PCApplyBAorAB()
814 PetscCall(PCDiagonalScaleRight(pc, x, work2)); in PCApplyBAorAB()
815 PetscUseTypeMethod(pc, applyBA, side, work2, y, work); in PCApplyBAorAB()
816 PetscCall(PCDiagonalScaleLeft(pc, y, y)); in PCApplyBAorAB()
819 PetscCall(PCDiagonalScaleRight(pc, x, y)); in PCApplyBAorAB()
820 PetscCall(PCApply(pc, y, work)); in PCApplyBAorAB()
821 PetscCall(MatMult(pc->mat, work, y)); in PCApplyBAorAB()
822 PetscCall(PCDiagonalScaleLeft(pc, y, y)); in PCApplyBAorAB()
824 PetscCall(PCDiagonalScaleRight(pc, x, y)); in PCApplyBAorAB()
825 PetscCall(MatMult(pc->mat, y, work)); in PCApplyBAorAB()
826 PetscCall(PCApply(pc, work, y)); in PCApplyBAorAB()
827 PetscCall(PCDiagonalScaleLeft(pc, y, y)); in PCApplyBAorAB()
828 …} else PetscCheck(side != PC_SYMMETRIC, PetscObjectComm((PetscObject)pc), PETSC_ERR_SUP, "Cannot p… in PCApplyBAorAB()
830 if (pc->ops->applyBA) { in PCApplyBAorAB()
831 PetscUseTypeMethod(pc, applyBA, side, x, y, work); in PCApplyBAorAB()
833 PetscCall(PCApply(pc, x, work)); in PCApplyBAorAB()
834 PetscCall(MatMult(pc->mat, work, y)); in PCApplyBAorAB()
836 PetscCall(MatMult(pc->mat, x, work)); in PCApplyBAorAB()
837 PetscCall(PCApply(pc, work, y)); in PCApplyBAorAB()
840 PetscCall(PCApplySymmetricRight(pc, x, work)); in PCApplyBAorAB()
841 PetscCall(MatMult(pc->mat, work, y)); in PCApplyBAorAB()
843 PetscCall(PCApplySymmetricLeft(pc, work, y)); in PCApplyBAorAB()
846 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 4, PETSC_FALSE)); in PCApplyBAorAB()
858 + pc - the `PC` preconditioner context
872 .seealso: [](ch_ksp), `PC`, `PCApply()`, `PCApplyTranspose()`, `PCApplyBAorAB()`
874 PetscErrorCode PCApplyBAorABTranspose(PC pc, PCSide side, Vec x, Vec y, Vec work) in PCApplyBAorABTranspose() argument
877 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplyBAorABTranspose()
881 …PetscCheck(x != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "x and y must be different… in PCApplyBAorABTranspose()
882 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(x, 3, PETSC_TRUE)); in PCApplyBAorABTranspose()
883 if (pc->ops->applyBAtranspose) { in PCApplyBAorABTranspose()
884 PetscUseTypeMethod(pc, applyBAtranspose, side, x, y, work); in PCApplyBAorABTranspose()
885 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 4, PETSC_FALSE)); in PCApplyBAorABTranspose()
888 …PetscCheck(side == PC_LEFT || side == PC_RIGHT, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_OU… in PCApplyBAorABTranspose()
890 PetscCall(PCSetUp(pc)); in PCApplyBAorABTranspose()
892 PetscCall(PCApplyTranspose(pc, x, work)); in PCApplyBAorABTranspose()
893 PetscCall(MatMultTranspose(pc->mat, work, y)); in PCApplyBAorABTranspose()
895 PetscCall(MatMultTranspose(pc->mat, x, work)); in PCApplyBAorABTranspose()
896 PetscCall(PCApplyTranspose(pc, work, y)); in PCApplyBAorABTranspose()
899 if (pc->erroriffailure) PetscCall(VecValidValues_Internal(y, 4, PETSC_FALSE)); in PCApplyBAorABTranspose()
910 . pc - the preconditioner
917 .seealso: [](ch_ksp), `PC`, `KSPRICHARDSON`, `PCApplyRichardson()`
919 PetscErrorCode PCApplyRichardsonExists(PC pc, PetscBool *exists) in PCApplyRichardsonExists() argument
922 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplyRichardsonExists()
924 if (pc->ops->applyrichardson) *exists = PETSC_TRUE; in PCApplyRichardsonExists()
937 + pc - the `PC` preconditioner context
960 .seealso: [](ch_ksp), `PC`, `PCApplyRichardsonExists()`
962 PetscErrorCode PCApplyRichardson(PC pc, Vec b, Vec y, Vec w, PetscReal rtol, PetscReal abstol, Pets… in PCApplyRichardson() argument
965 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCApplyRichardson()
969 …PetscCheck(b != y, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_IDN, "b and y must be different… in PCApplyRichardson()
970 PetscCall(PCSetUp(pc)); in PCApplyRichardson()
971 …PetscUseTypeMethod(pc, applyrichardson, b, y, w, rtol, abstol, dtol, its, guesszero, outits, reaso… in PCApplyRichardson()
981 + pc - the `PC` preconditioner context
986 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `PCFailedReason`
988 PetscErrorCode PCSetFailedReason(PC pc, PCFailedReason reason) in PCSetFailedReason() argument
991 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetFailedReason()
992 pc->failedreason = reason; in PCSetFailedReason()
1002 . pc - the `PC` preconditioner context
1011 …this is the maximum reason over all MPI processes in the `PC` communicator and hence logically col…
1014 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `PCSetFailedReason()`, `PCFai…
1016 PetscErrorCode PCGetFailedReason(PC pc, PCFailedReason *reason) in PCGetFailedReason() argument
1019 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetFailedReason()
1020 *reason = pc->failedreason; in PCGetFailedReason()
1025 PCReduceFailedReason - Reduce the failed reason among the MPI processes that share the `PC`
1030 . pc - the `PC` preconditioner context
1038 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `PCGetFailedReason()`, `PCSet…
1040 PetscErrorCode PCReduceFailedReason(PC pc) in PCReduceFailedReason() argument
1045 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCReduceFailedReason()
1046 buf = (PetscInt)pc->failedreason; in PCReduceFailedReason()
1047 …allMPI(MPIU_Allreduce(MPI_IN_PLACE, &buf, 1, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject)pc))); in PCReduceFailedReason()
1048 pc->failedreason = (PCFailedReason)buf; in PCReduceFailedReason()
1064 . pc - the `PC` preconditioner context
1076 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCApply()`, `PCDestroy()`, `KSPSetUp()`, `PCSetUpOnBlock…
1078 PetscErrorCode PCSetUp(PC pc) in PCSetUp() argument
1084 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetUp()
1085 …PetscCheck(pc->mat, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONGSTATE, "Matrix must be se… in PCSetUp()
1087 if (pc->setupcalled && pc->reusepreconditioner) { in PCSetUp()
1088 …PetscCall(PetscInfo(pc, "Leaving PC with identical preconditioner since reuse preconditioner is se… in PCSetUp()
1092 PetscCall(PetscObjectStateGet((PetscObject)pc->pmat, &matstate)); in PCSetUp()
1093 PetscCall(MatGetNonzeroState(pc->pmat, &matnonzerostate)); in PCSetUp()
1094 if (!pc->setupcalled) { in PCSetUp()
1095 //PetscCall(PetscInfo(pc, "Setting up PC for first time\n")); in PCSetUp()
1096 pc->flag = DIFFERENT_NONZERO_PATTERN; in PCSetUp()
1097 } else if (matstate == pc->matstate) PetscFunctionReturn(PETSC_SUCCESS); in PCSetUp()
1099 if (matnonzerostate != pc->matnonzerostate) { in PCSetUp()
1100 PetscCall(PetscInfo(pc, "Setting up PC with different nonzero pattern\n")); in PCSetUp()
1101 pc->flag = DIFFERENT_NONZERO_PATTERN; in PCSetUp()
1103 //PetscCall(PetscInfo(pc, "Setting up PC with same nonzero pattern\n")); in PCSetUp()
1104 pc->flag = SAME_NONZERO_PATTERN; in PCSetUp()
1107 pc->matstate = matstate; in PCSetUp()
1108 pc->matnonzerostate = matnonzerostate; in PCSetUp()
1110 if (!((PetscObject)pc)->type_name) { in PCSetUp()
1111 PetscCall(PCGetDefaultType_Private(pc, &def)); in PCSetUp()
1112 PetscCall(PCSetType(pc, def)); in PCSetUp()
1115 PetscCall(MatSetErrorIfFailure(pc->pmat, pc->erroriffailure)); in PCSetUp()
1116 PetscCall(MatSetErrorIfFailure(pc->mat, pc->erroriffailure)); in PCSetUp()
1117 PetscCall(PetscLogEventBegin(PC_SetUp, pc, 0, 0, 0)); in PCSetUp()
1118 if (pc->ops->setup) { in PCSetUp()
1120 PetscUseTypeMethod(pc, setup); in PCSetUp()
1123 PetscCall(PetscLogEventEnd(PC_SetUp, pc, 0, 0, 0)); in PCSetUp()
1124 if (pc->postsetup) PetscCall((*pc->postsetup)(pc)); in PCSetUp()
1125 if (!pc->setupcalled) pc->setupcalled = PETSC_TRUE; in PCSetUp()
1136 . pc - the `PC` preconditioner context
1142 called on the outer `PC`, this routine ensures it is called.
1146 .seealso: [](ch_ksp), `PC`, `PCSetUp()`, `PCCreate()`, `PCApply()`, `PCDestroy()`
1148 PetscErrorCode PCSetUpOnBlocks(PC pc) in PCSetUpOnBlocks() argument
1151 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetUpOnBlocks()
1152 if (!pc->setupcalled) PetscCall(PCSetUp(pc)); /* "if" to prevent -info extra prints */ in PCSetUpOnBlocks()
1153 if (!pc->ops->setuponblocks) PetscFunctionReturn(PETSC_SUCCESS); in PCSetUpOnBlocks()
1154 PetscCall(MatSetErrorIfFailure(pc->pmat, pc->erroriffailure)); in PCSetUpOnBlocks()
1155 PetscCall(PetscLogEventBegin(PC_SetUpOnBlocks, pc, 0, 0, 0)); in PCSetUpOnBlocks()
1157 PetscUseTypeMethod(pc, setuponblocks); in PCSetUpOnBlocks()
1159 PetscCall(PetscLogEventEnd(PC_SetUpOnBlocks, pc, 0, 0, 0)); in PCSetUpOnBlocks()
1170 + pc - the `PC` preconditioner context
1188 .seealso: [](ch_ksp), `PC`, `PCModifySubMatricesFn`, `PCBJACOBI`, `PCASM`, `PCModifySubMatrices()`
1190 PetscErrorCode PCSetModifySubMatrices(PC pc, PCModifySubMatricesFn *func, PetscCtx ctx) in PCSetModifySubMatrices() argument
1193 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetModifySubMatrices()
1194 pc->modifysubmatrices = func; in PCSetModifySubMatrices()
1195 pc->modifysubmatricesP = ctx; in PCSetModifySubMatrices()
1206 + pc - the `PC` preconditioner context
1226 .seealso: [](ch_ksp), `PC`, `PCModifySubMatricesFn`, `PCSetModifySubMatrices()`
1228 PetscErrorCode PCModifySubMatrices(PC pc, PetscInt nsub, const IS row[], const IS col[], Mat submat… in PCModifySubMatrices() argument
1231 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCModifySubMatrices()
1232 if (!pc->modifysubmatrices) PetscFunctionReturn(PETSC_SUCCESS); in PCModifySubMatrices()
1233 PetscCall(PetscLogEventBegin(PC_ModifySubMatrices, pc, 0, 0, 0)); in PCModifySubMatrices()
1234 PetscCall((*pc->modifysubmatrices)(pc, nsub, row, col, submat, ctx)); in PCModifySubMatrices()
1235 PetscCall(PetscLogEventEnd(PC_ModifySubMatrices, pc, 0, 0, 0)); in PCModifySubMatrices()
1246 + pc - the `PC` preconditioner context
1267 .seealso: [](ch_ksp), `PC`, `PCGetOperators()`, `MatZeroEntries()`
1269 PetscErrorCode PCSetOperators(PC pc, Mat Amat, Mat Pmat) in PCSetOperators() argument
1274 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetOperators()
1277 if (Amat) PetscCheckSameComm(pc, 1, Amat, 2); in PCSetOperators()
1278 if (Pmat) PetscCheckSameComm(pc, 1, Pmat, 3); in PCSetOperators()
1279 if (pc->setupcalled && pc->mat && pc->pmat && Amat && Pmat) { in PCSetOperators()
1281 PetscCall(MatGetLocalSize(pc->mat, &m2, &n2)); in PCSetOperators()
1284 PetscCall(MatGetLocalSize(pc->pmat, &m2, &n2)); in PCSetOperators()
1288 if (Pmat != pc->pmat) { in PCSetOperators()
1290 pc->matnonzerostate = -1; in PCSetOperators()
1291 pc->matstate = -1; in PCSetOperators()
1296 PetscCall(MatDestroy(&pc->mat)); in PCSetOperators()
1298 PetscCall(MatDestroy(&pc->pmat)); in PCSetOperators()
1299 pc->mat = Amat; in PCSetOperators()
1300 pc->pmat = Pmat; in PCSetOperators()
1305 …ner - reuse the current preconditioner even if the operator in the preconditioner `PC` has changed.
1310 + pc - the `PC` preconditioner context
1316 …Normally if a matrix inside a `PC` changes the `PC` automatically updates itself using information…
1319 .seealso: [](ch_ksp), `PC`, `PCGetOperators()`, `MatZeroEntries()`, `PCGetReusePreconditioner()`, `…
1321 PetscErrorCode PCSetReusePreconditioner(PC pc, PetscBool flag) in PCSetReusePreconditioner() argument
1324 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetReusePreconditioner()
1325 PetscValidLogicalCollectiveBool(pc, flag, 2); in PCSetReusePreconditioner()
1326 pc->reusepreconditioner = flag; in PCSetReusePreconditioner()
1327 PetscTryMethod(pc, "PCSetReusePreconditioner_C", (PC, PetscBool), (pc, flag)); in PCSetReusePreconditioner()
1332 …PCGetReusePreconditioner - Determines if the `PC` reuses the current preconditioner even if the op…
1337 . pc - the `PC` preconditioner context
1344 .seealso: [](ch_ksp), `PC`, `PCGetOperators()`, `MatZeroEntries()`, `PCSetReusePreconditioner()`
1346 PetscErrorCode PCGetReusePreconditioner(PC pc, PetscBool *flag) in PCGetReusePreconditioner() argument
1349 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetReusePreconditioner()
1351 *flag = pc->reusepreconditioner; in PCGetReusePreconditioner()
1359 Not Collective, though parallel `Mat`s are returned if `pc` is parallel
1362 . pc - the `PC` preconditioner context
1374 are created in `PC` and returned to the user. In this case, if both operators
1376 only one is requested both operators in the PC will be the same (i.e. as
1382 KSP/PCGetOperators(ksp/pc,&Amat,NULL); is equivalent to
1386 KSP/PCSetOperators(ksp/pc,Amat,Amat);
1394 KSP/PCGetOperators(ksp/pc,&Amat,&Pmat); is equivalent to
1399 KSP/PCSetOperators(ksp/pc,Amat,Pmat);
1406 of underlying objects (i.e. `SNES`, `KSP`, `PC`, `Mat`) and their lifespans can be completely
1410 you do not need to attach a `PC` to it (the `KSP` object manages the `PC` object for you).
1411 Thus, why should YOU have to create the `Mat` and attach it to the `SNES`/`KSP`/`PC`, when
1414 .seealso: [](ch_ksp), `PC`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetOperators()`, `PCGetOpe…
1416 PetscErrorCode PCGetOperators(PC pc, Mat *Amat, Mat *Pmat) in PCGetOperators() argument
1419 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetOperators()
1421 if (!pc->mat) { in PCGetOperators()
1422 if (pc->pmat && !Pmat) { /* Pmat has been set, but user did not request it, so use for Amat */ in PCGetOperators()
1423 pc->mat = pc->pmat; in PCGetOperators()
1424 PetscCall(PetscObjectReference((PetscObject)pc->mat)); in PCGetOperators()
1426 PetscCall(MatCreate(PetscObjectComm((PetscObject)pc), &pc->mat)); in PCGetOperators()
1428 pc->pmat = pc->mat; in PCGetOperators()
1429 PetscCall(PetscObjectReference((PetscObject)pc->pmat)); in PCGetOperators()
1433 *Amat = pc->mat; in PCGetOperators()
1436 if (!pc->pmat) { in PCGetOperators()
1437 if (pc->mat && !Amat) { /* Amat has been set but was not requested, so use for pmat */ in PCGetOperators()
1438 pc->pmat = pc->mat; in PCGetOperators()
1439 PetscCall(PetscObjectReference((PetscObject)pc->pmat)); in PCGetOperators()
1441 PetscCall(MatCreate(PetscObjectComm((PetscObject)pc), &pc->pmat)); in PCGetOperators()
1443 pc->mat = pc->pmat; in PCGetOperators()
1444 PetscCall(PetscObjectReference((PetscObject)pc->mat)); in PCGetOperators()
1448 *Pmat = pc->pmat; in PCGetOperators()
1455 possibly a different one associated with the preconditioner have been set in the `PC`.
1460 . pc - the `PC` preconditioner context
1468 .seealso: [](ch_ksp), `PC`, `PCSetOperators()`, `KSPGetOperators()`, `KSPSetOperators()`, `PCGetOpe…
1470 PetscErrorCode PCGetOperatorsSet(PC pc, PetscBool *mat, PetscBool *pmat) in PCGetOperatorsSet() argument
1473 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetOperatorsSet()
1474 if (mat) *mat = (pc->mat) ? PETSC_TRUE : PETSC_FALSE; in PCGetOperatorsSet()
1475 if (pmat) *pmat = (pc->pmat) ? PETSC_TRUE : PETSC_FALSE; in PCGetOperatorsSet()
1484 Not Collective though `mat` is parallel if `pc` is parallel
1487 . pc - the `PC` preconditioner context
1497 .seealso: [](ch_ksp), `PC`, `PCLU`, `PCILU`, `PCCHOLESKY`, `PCICC`
1499 PetscErrorCode PCFactorGetMatrix(PC pc, Mat *mat) in PCFactorGetMatrix() argument
1502 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCFactorGetMatrix()
1504 PetscCall(PCFactorSetUpMatSolverType(pc)); in PCFactorGetMatrix()
1505 PetscUseTypeMethod(pc, getfactoredmatrix, mat); in PCFactorGetMatrix()
1511 `PC` options in the database.
1516 + pc - the `PC` preconditioner context
1517 - prefix - the prefix string to prepend to all `PC` option requests
1526 .seealso: [](ch_ksp), `PC`, `PCSetFromOptions`, `PCAppendOptionsPrefix()`, `PCGetOptionsPrefix()`
1528 PetscErrorCode PCSetOptionsPrefix(PC pc, const char prefix[]) in PCSetOptionsPrefix() argument
1531 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetOptionsPrefix()
1532 PetscCall(PetscObjectSetOptionsPrefix((PetscObject)pc, prefix)); in PCSetOptionsPrefix()
1538 `PC` options in the database.
1543 + pc - the `PC` preconditioner context
1544 - prefix - the prefix string to prepend to all `PC` option requests
1553 .seealso: [](ch_ksp), `PC`, `PCSetFromOptions`, `PCSetOptionsPrefix()`, `PCGetOptionsPrefix()`
1555 PetscErrorCode PCAppendOptionsPrefix(PC pc, const char prefix[]) in PCAppendOptionsPrefix() argument
1558 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCAppendOptionsPrefix()
1559 PetscCall(PetscObjectAppendOptionsPrefix((PetscObject)pc, prefix)); in PCAppendOptionsPrefix()
1565 PC options in the database.
1570 . pc - the `PC` preconditioner context
1577 .seealso: [](ch_ksp), `PC`, `PCSetFromOptions`, `PCSetOptionsPrefix()`, `PCAppendOptionsPrefix()`
1579 PetscErrorCode PCGetOptionsPrefix(PC pc, const char *prefix[]) in PCGetOptionsPrefix() argument
1582 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetOptionsPrefix()
1584 PetscCall(PetscObjectGetOptionsPrefix((PetscObject)pc, prefix)); in PCGetOptionsPrefix()
1593 PETSC_INTERN PetscErrorCode PCPreSolveChangeRHS(PC pc, PetscBool *change) in PCPreSolveChangeRHS() argument
1596 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCPreSolveChangeRHS()
1599 PetscTryMethod(pc, "PCPreSolveChangeRHS_C", (PC, PetscBool *), (pc, change)); in PCPreSolveChangeRHS()
1610 + pc - the `PC` preconditioner context
1624 .seealso: [](ch_ksp), `PC`, `PCPostSolve()`, `KSP`, `PCSetPostSetUp()`, `KSPSetPreSolve()`, `KSPSet…
1626 PetscErrorCode PCPreSolve(PC pc, KSP ksp) in PCPreSolve() argument
1631 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCPreSolve()
1633 pc->presolvedone++; in PCPreSolve()
1634 …PetscCheck(pc->presolvedone <= 2, PetscObjectComm((PetscObject)pc), PETSC_ERR_SUP, "Cannot embed P… in PCPreSolve()
1637 PetscTryTypeMethod(pc, presolve, ksp, rhs, x); in PCPreSolve()
1647 + pc - the preconditioner object
1651 . pc - the `PC` context
1655 .seealso: [](ch_ksp), `PC`, `PCSetUp()`
1657 PetscErrorCode PCSetPostSetUp(PC pc, PetscErrorCode (*postsetup)(PC pc)) in PCSetPostSetUp() argument
1660 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetPostSetUp()
1661 pc->postsetup = postsetup; in PCSetPostSetUp()
1673 + pc - the `PC` preconditioner context
1678 PCPreSolve(pc,ksp);
1680 PCPostSolve(pc,ksp);
1688 .seealso: [](ch_ksp), `PC`, `KSPSetPostSolve()`, `KSPSetPreSolve()`, `PCPreSolve()`, `KSPSolve()`
1690 PetscErrorCode PCPostSolve(PC pc, KSP ksp) in PCPostSolve() argument
1695 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCPostSolve()
1697 pc->presolvedone--; in PCPostSolve()
1700 PetscTryTypeMethod(pc, postsolve, ksp, rhs, x); in PCPostSolve()
1705 PCLoad - Loads a `PC` that has been stored in binary with `PCView()`.
1710 + newdm - the newly loaded `PC`, this needs to have been created with `PCCreate()` or
1717 …The type is determined by the data in the file, any `PCType` set into the `PC` before this call is…
1719 .seealso: [](ch_ksp), `PC`, `PetscViewerBinaryOpen()`, `PCView()`, `MatLoad()`, `VecLoad()`, `PETSC…
1721 PetscErrorCode PCLoad(PC newdm, PetscViewer viewer) in PCLoad()
1734 … PC_FILE_CLASSID, PetscObjectComm((PetscObject)newdm), PETSC_ERR_ARG_WRONG, "Not PC next in file"); in PCLoad()
1747 …PCViewFromOptions - View (print or provide information about) the `PC`, based on options in the op…
1752 + A - the `PC` context
1758 .seealso: [](ch_ksp), `PC`, `PCView`, `PetscObjectViewFromOptions()`, `PCCreate()`
1760 PetscErrorCode PCViewFromOptions(PC A, PetscObject obj, const char name[]) in PCViewFromOptions()
1769 PCView - Prints information about the `PC`
1774 + pc - the `PC` preconditioner context
1790 .seealso: [](ch_ksp), `PC`, `PetscViewer`, `PetscViewerType`, `KSPView()`, `PetscViewerASCIIOpen()`
1792 PetscErrorCode PCView(PC pc, PetscViewer viewer) in PCView() argument
1802 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCView()
1803 if (!viewer) PetscCall(PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)pc), &viewer)); in PCView()
1805 PetscCheckSameComm(pc, 1, viewer, 2); in PCView()
1816 PetscCall(PetscObjectPrintClassNamePrefixType((PetscObject)pc, viewer)); in PCView()
1817 …if (!pc->setupcalled) PetscCall(PetscViewerASCIIPrintf(viewer, " PC has not been set up so inform… in PCView()
1819 PetscTryTypeMethod(pc, view, viewer); in PCView()
1821 if (pc->mat) { in PCView()
1827 if (pc->pmat == pc->mat) { in PCView()
1830 PetscCall(MatView(pc->mat, viewer)); in PCView()
1833 if (pc->pmat) { in PCView()
1839 PetscCall(MatView(pc->mat, viewer)); in PCView()
1840 if (pc->pmat) PetscCall(MatView(pc->pmat, viewer)); in PCView()
1846 PetscCall(PCGetType(pc, &cstr)); in PCView()
1848 PetscTryTypeMethod(pc, view, viewer); in PCView()
1849 if (pc->mat) PetscCall(MatView(pc->mat, viewer)); in PCView()
1850 if (pc->pmat && pc->pmat != pc->mat) PetscCall(MatView(pc->pmat, viewer)); in PCView()
1857 PetscCall(PetscObjectGetComm((PetscObject)pc, &comm)); in PCView()
1861 PetscCall(PetscStrncpy(type, ((PetscObject)pc)->type_name, 256)); in PCView()
1864 PetscTryTypeMethod(pc, view, viewer); in PCView()
1873 if (pc->mat) { in PCView()
1874 PetscCall(MatGetSize(pc->mat, &n, NULL)); in PCView()
1875 … PetscCall(PetscSNPrintf(str, 25, "PC: %s (%" PetscInt_FMT ")", ((PetscObject)pc)->type_name, n)); in PCView()
1877 PetscCall(PetscSNPrintf(str, 25, "PC: %s", ((PetscObject)pc)->type_name)); in PCView()
1882 PetscTryTypeMethod(pc, view, viewer); in PCView()
1888 PetscCall(PetscObjectName((PetscObject)pc)); in PCView()
1890 …if (!((PetscObject)pc)->amsmem && rank == 0) PetscCall(PetscObjectViewSAWs((PetscObject)pc, viewer… in PCView()
1891 if (pc->mat) PetscCall(MatView(pc->mat, viewer)); in PCView()
1892 if (pc->pmat && pc->pmat != pc->mat) PetscCall(MatView(pc->pmat, viewer)); in PCView()
1905 - function - routine to create the method context which will be stored in a `PC` when `PCSetType()`…
1914 PCSetType(pc, "my_solver")
1924 …ing `PCRegister()` for an application specific preconditioner is to use a `PC` of `PCType` `PCSHEL…
1929 .seealso: [](ch_ksp), `PC`, `PCType`, `PCRegisterAll()`, `PCSetType()`, `PCShellSetContext()`, `PCS…
1931 PetscErrorCode PCRegister(const char sname[], PetscErrorCode (*function)(PC)) in PCRegister() argument
1941 PC pc; in MatMult_PC() local
1944 PetscCall(MatShellGetContext(A, &pc)); in MatMult_PC()
1945 PetscCall(PCApply(pc, X, Y)); in MatMult_PC()
1955 + pc - the `PC` preconditioner object
1971 .seealso: [](ch_ksp), `PC`, `KSPComputeOperator()`, `MatType`
1973 PetscErrorCode PCComputeOperator(PC pc, MatType mattype, Mat *mat) in PCComputeOperator() argument
1979 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCComputeOperator()
1981 PetscCall(PCGetOperators(pc, &A, NULL)); in PCComputeOperator()
1984 PetscCall(MatCreateShell(PetscObjectComm((PetscObject)pc), m, n, M, N, pc, &Apc)); in PCComputeOperator()
1997 + pc - the `PC` preconditioner context
2017 .seealso: [](ch_ksp), `PC`, `MatSetNearNullSpace()`
2019 PetscErrorCode PCSetCoordinates(PC pc, PetscInt dim, PetscInt nloc, PetscReal coords[]) in PCSetCoordinates() argument
2022 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCSetCoordinates()
2023 PetscValidLogicalCollectiveInt(pc, dim, 2); in PCSetCoordinates()
2024 …PetscTryMethod(pc, "PCSetCoordinates_C", (PC, PetscInt, PetscInt, PetscReal[]), (pc, dim, nloc, co… in PCSetCoordinates()
2034 . pc - the precondition context
2045 .seealso: [](ch_ksp), `PC`, `PCMG`, `PCMGGetRestriction()`, `PCMGSetInterpolation()`, `PCMGGetInter…
2047 PetscErrorCode PCGetInterpolations(PC pc, PetscInt *num_levels, Mat *interpolations[]) in PCGetInterpolations() argument
2050 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetInterpolations()
2053 …PetscUseMethod(pc, "PCGetInterpolations_C", (PC, PetscInt *, Mat *[]), (pc, num_levels, interpolat… in PCGetInterpolations()
2063 . pc - the precondition context
2074 .seealso: [](ch_ksp), `PC`, `PCMG`, `PCMGGetRestriction()`, `PCMGSetInterpolation()`, `PCMGGetRScal…
2076 PetscErrorCode PCGetCoarseOperators(PC pc, PetscInt *num_levels, Mat *coarseOperators[]) in PCGetCoarseOperators() argument
2079 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCGetCoarseOperators()
2082 …PetscUseMethod(pc, "PCGetCoarseOperators_C", (PC, PetscInt *, Mat *[]), (pc, num_levels, coarseOpe… in PCGetCoarseOperators()