Lines Matching full:pc
11 PetscErrorCode (*computeasub)(PC, Mat, Mat, Mat *, void *);
15 static PetscErrorCode PCApply_Galerkin(PC pc, Vec x, Vec y)
17 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
26 PetscCall(KSPCheckSolve(jac->ksp, pc, jac->x));
35 static PetscErrorCode PCSetUp_Galerkin(PC pc)
37 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
44 if (!pc->setupcalled) {
45 PetscCall((*jac->computeasub)(pc, pc->pmat, NULL, &Ap, jac->computeasub_ctx));
50 PetscCall((*jac->computeasub)(pc, pc->pmat, Ap, NULL, jac->computeasub_ctx));
56 PetscCheck(a, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONGSTATE, "Must set operator of PCGALERKIN KSP with PCGalerkinGetKSP()/KSPSetOperators()");
63 PetscCheck(jac->R || jac->P, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONGSTATE, "Must set restriction or interpolation of PCGALERKIN with PCGalerkinSetRestriction()/Interpolation()");
68 static PetscErrorCode PCReset_Galerkin(PC pc)
70 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
81 static PetscErrorCode PCDestroy_Galerkin(PC pc)
83 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
86 PetscCall(PCReset_Galerkin(pc));
88 PetscCall(PetscFree(pc->data));
92 static PetscErrorCode PCView_Galerkin(PC pc, PetscViewer viewer)
94 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
107 static PetscErrorCode PCGalerkinGetKSP_Galerkin(PC pc, KSP *ksp)
109 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
116 static PetscErrorCode PCGalerkinSetRestriction_Galerkin(PC pc, Mat R)
118 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
127 static PetscErrorCode PCGalerkinSetInterpolation_Galerkin(PC pc, Mat P)
129 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
138 static PetscErrorCode PCGalerkinSetComputeSubmatrix_Galerkin(PC pc, PetscErrorCode (*computeAsub)(PC, Mat, Mat, Mat *, void *), PetscCtx ctx)
140 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
154 + pc - the preconditioner context
162 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`,
165 PetscErrorCode PCGalerkinSetRestriction(PC pc, Mat R)
168 PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
169 PetscTryMethod(pc, "PCGalerkinSetRestriction_C", (PC, Mat), (pc, R));
179 + pc - the preconditioner context
187 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`,
190 PetscErrorCode PCGalerkinSetInterpolation(PC pc, Mat P)
193 PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
194 PetscTryMethod(pc, "PCGalerkinSetInterpolation_C", (PC, Mat), (pc, P));
204 + pc - the preconditioner context
209 + pc - the `PCGALERKIN` preconditioner
228 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`,
231 PetscErrorCode PCGalerkinSetComputeSubmatrix(PC pc, PetscErrorCode (*computeAsub)(PC pc, Mat A, Mat Ap, Mat *cAp, PetscCtx ctx), PetscCtx ctx)
234 PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
235 PetscTryMethod(pc, "PCGalerkinSetComputeSubmatrix_C", (PC, PetscErrorCode (*)(PC, Mat, Mat, Mat *, void *), void *), (pc, computeAsub, ctx));
245 . pc - the preconditioner context
256 .seealso: [](ch_ksp), `PC`, `PCCreate()`, `PCSetType()`, `PCType`, `PCGALERKIN`,
259 PetscErrorCode PCGalerkinGetKSP(PC pc, KSP *ksp)
262 PetscValidHeaderSpecific(pc, PC_CLASSID, 1);
264 PetscUseMethod(pc, "PCGalerkinGetKSP_C", (PC, KSP *), (pc, ksp));
268 static PetscErrorCode PCSetFromOptions_Galerkin(PC pc, PetscOptionItems PetscOptionsObject)
270 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
278 PetscCall(PCGetOptionsPrefix(pc, &prefix));
297 `PCGalerkinSetRestriction`(pc,R) and/or `PCGalerkinSetInterpolation`(pc,P)
298 `PCGalerkinGetKSP`(pc,&ksp);
311 .seealso: [](ch_ksp), `PCCreate()`, `PCSetType()`, `PCType`, `PC`,
315 PETSC_EXTERN PetscErrorCode PCCreate_Galerkin(PC pc)
322 pc->ops->apply = PCApply_Galerkin;
323 pc->ops->setup = PCSetUp_Galerkin;
324 pc->ops->reset = PCReset_Galerkin;
325 pc->ops->destroy = PCDestroy_Galerkin;
326 pc->ops->view = PCView_Galerkin;
327 pc->ops->setfromoptions = PCSetFromOptions_Galerkin;
328 pc->ops->applyrichardson = NULL;
330 PetscCall(KSPCreate(PetscObjectComm((PetscObject)pc), &jac->ksp));
331 PetscCall(KSPSetNestLevel(jac->ksp, pc->kspnestlevel));
332 PetscCall(KSPSetErrorIfNotConverged(jac->ksp, pc->erroriffailure));
333 PetscCall(PetscObjectIncrementTabLevel((PetscObject)jac->ksp, (PetscObject)pc, 1));
335 pc->data = (void *)jac;
337 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCGalerkinSetRestriction_C", PCGalerkinSetRestriction_Galerkin));
338 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCGalerkinSetInterpolation_C", PCGalerkinSetInterpolation_Galerkin));
339 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCGalerkinGetKSP_C", PCGalerkinGetKSP_Galerkin));
340 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCGalerkinSetComputeSubmatrix_C", PCGalerkinSetComputeSubmatrix_Galerkin));