Lines Matching full:pc

8PC        innerpc;       /* A MG inner PC (Hypre or PCGAMG) to setup interpolations and coarse ope…
90 static PetscErrorCode PCSetUp_HMG(PC pc) in PCSetUp_HMG() argument
93 PC_MG *mg = (PC_MG *)pc->data; in PCSetUp_HMG()
104 PetscCall(PetscObjectGetComm((PetscObject)pc, &comm)); in PCSetUp_HMG()
105 if (pc->setupcalled) { in PCSetUp_HMG()
110 PetscCall(PCMGGetGalerkin(pc, &galerkin)); in PCSetUp_HMG()
111 …if (galerkin == PC_MG_GALERKIN_NONE || pc->flag != SAME_NONZERO_PATTERN) pc->setupcalled = PETSC_F… in PCSetUp_HMG()
112 PetscCall(PCMGSetGalerkin(pc, PC_MG_GALERKIN_PMAT)); in PCSetUp_HMG()
113 PetscCall(PCSetUp_MG(pc)); in PCSetUp_HMG()
116 PetscCall(PCReset_MG(pc)); in PCSetUp_HMG()
117 pc->setupcalled = PETSC_FALSE; in PCSetUp_HMG()
121 /* Create an inner PC (GAMG or HYPRE) */ in PCSetUp_HMG()
124 /* If users do not set an inner pc type, we need to set a default value */ in PCSetUp_HMG()
135 PetscCall(PCGetOperators(pc, NULL, &PA)); in PCSetUp_HMG()
146 /* Setup inner PC correctly. During this step, matrix will be coarsened */ in PCSetUp_HMG()
148 PetscCall(PetscObjectGetOptionsPrefix((PetscObject)pc, &prefix)); in PCSetUp_HMG()
161 PetscCall(PCMGSetLevels_MG(pc, num_levels, NULL)); in PCSetUp_HMG()
179 PetscCall(PCMGSetInterpolation(pc, level, P)); in PCSetUp_HMG()
180 PetscCall(PCMGSetRestriction(pc, level, P)); in PCSetUp_HMG()
185 PetscCall(PCMGSetOperators(pc, level - 1, pmat, pmat)); in PCSetUp_HMG()
188 PetscCall(PCMGSetRhs(pc, level - 1, b)); in PCSetUp_HMG()
190 PetscCall(PCMGSetR(pc, level, r)); in PCSetUp_HMG()
194 PetscCall(PCMGSetX(pc, level - 1, x)); in PCSetUp_HMG()
201 PetscCall(PCMGSetGalerkin(pc, hmg->subcoarsening ? PC_MG_GALERKIN_PMAT : PC_MG_GALERKIN_NONE)); in PCSetUp_HMG()
202 PetscCall(PCSetDM(pc, NULL)); in PCSetUp_HMG()
203 PetscCall(PCSetUseAmat(pc, PETSC_FALSE)); in PCSetUp_HMG()
204 PetscObjectOptionsBegin((PetscObject)pc); in PCSetUp_HMG()
205 …PetscCall(PCSetFromOptions_MG(pc, PetscOptionsObject)); /* should be called in PCSetFromOptions_HM… in PCSetUp_HMG()
207 PetscCall(PCSetUp_MG(pc)); in PCSetUp_HMG()
211 static PetscErrorCode PCDestroy_HMG(PC pc) in PCDestroy_HMG() argument
213 PC_MG *mg = (PC_MG *)pc->data; in PCDestroy_HMG()
220 PetscCall(PCDestroy_MG(pc)); in PCDestroy_HMG()
222 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetReuseInterpolation_C", NULL)); in PCDestroy_HMG()
223 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetUseSubspaceCoarsening_C", NULL)); in PCDestroy_HMG()
224 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetInnerPCType_C", NULL)); in PCDestroy_HMG()
225 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetCoarseningComponent_C", NULL)); in PCDestroy_HMG()
226 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGUseMatMAIJ_C", NULL)); in PCDestroy_HMG()
230 static PetscErrorCode PCView_HMG(PC pc, PetscViewer viewer) in PCView_HMG() argument
232 PC_MG *mg = (PC_MG *)pc->data; in PCView_HMG()
243 PetscCall(PetscViewerASCIIPrintf(viewer, " Inner PC type: %s \n", hmg->innerpctype)); in PCView_HMG()
245 PetscCall(PCView_MG(pc, viewer)); in PCView_HMG()
249 static PetscErrorCode PCSetFromOptions_HMG(PC pc, PetscOptionItems PetscOptionsObject) in PCSetFromOptions_HMG() argument
251 PC_MG *mg = (PC_MG *)pc->data; in PCSetFromOptions_HMG()
264 static PetscErrorCode PCHMGSetReuseInterpolation_HMG(PC pc, PetscBool reuse) in PCHMGSetReuseInterpolation_HMG() argument
266 PC_MG *mg = (PC_MG *)pc->data; in PCHMGSetReuseInterpolation_HMG()
280 + pc - the `PCHMG` context
289 …This decreases the set up time of the `PC` significantly but may slow the convergence of the itera…
293 PetscErrorCode PCHMGSetReuseInterpolation(PC pc, PetscBool reuse) in PCHMGSetReuseInterpolation() argument
296 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCHMGSetReuseInterpolation()
297 PetscUseMethod(pc, "PCHMGSetReuseInterpolation_C", (PC, PetscBool), (pc, reuse)); in PCHMGSetReuseInterpolation()
301 static PetscErrorCode PCHMGSetUseSubspaceCoarsening_HMG(PC pc, PetscBool subspace) in PCHMGSetUseSubspaceCoarsening_HMG() argument
303 PC_MG *mg = (PC_MG *)pc->data; in PCHMGSetUseSubspaceCoarsening_HMG()
317 + pc - the `PCHMG` context
327 PetscErrorCode PCHMGSetUseSubspaceCoarsening(PC pc, PetscBool subspace) in PCHMGSetUseSubspaceCoarsening() argument
330 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCHMGSetUseSubspaceCoarsening()
331 PetscUseMethod(pc, "PCHMGSetUseSubspaceCoarsening_C", (PC, PetscBool), (pc, subspace)); in PCHMGSetUseSubspaceCoarsening()
335 static PetscErrorCode PCHMGSetInnerPCType_HMG(PC pc, PCType type) in PCHMGSetInnerPCType_HMG() argument
337 PC_MG *mg = (PC_MG *)pc->data; in PCHMGSetInnerPCType_HMG()
346 …PCHMGSetInnerPCType - Set an inner `PC` type to be used in the `PCHMG` preconditioner. That is the…
352 + pc - the `PCHMG` context
362 PetscErrorCode PCHMGSetInnerPCType(PC pc, PCType type) in PCHMGSetInnerPCType() argument
365 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCHMGSetInnerPCType()
366 PetscUseMethod(pc, "PCHMGSetInnerPCType_C", (PC, PCType), (pc, type)); in PCHMGSetInnerPCType()
370 static PetscErrorCode PCHMGSetCoarseningComponent_HMG(PC pc, PetscInt component) in PCHMGSetCoarseningComponent_HMG() argument
372 PC_MG *mg = (PC_MG *)pc->data; in PCHMGSetCoarseningComponent_HMG()
386 + pc - the `PCHMG` context
387 - component - which component `PC` will coarsen
399 PetscErrorCode PCHMGSetCoarseningComponent(PC pc, PetscInt component) in PCHMGSetCoarseningComponent() argument
402 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCHMGSetCoarseningComponent()
403 PetscUseMethod(pc, "PCHMGSetCoarseningComponent_C", (PC, PetscInt), (pc, component)); in PCHMGSetCoarseningComponent()
407 static PetscErrorCode PCHMGUseMatMAIJ_HMG(PC pc, PetscBool usematmaij) in PCHMGUseMatMAIJ_HMG() argument
409 PC_MG *mg = (PC_MG *)pc->data; in PCHMGUseMatMAIJ_HMG()
423 + pc - the `PCHMG` context
433 PetscErrorCode PCHMGUseMatMAIJ(PC pc, PetscBool usematmaij) in PCHMGUseMatMAIJ() argument
436 PetscValidHeaderSpecific(pc, PC_CLASSID, 1); in PCHMGUseMatMAIJ()
437 PetscUseMethod(pc, "PCHMGUseMatMAIJ_C", (PC, PetscBool), (pc, usematmaij)); in PCHMGUseMatMAIJ()
457 .seealso: [](ch_ksp), `PCCreate()`, `PCSetType()`, `PCType`, `PC`, `PCMG`, `PCHYPRE`, `PCHMG`, `PCG…
460 PETSC_EXTERN PetscErrorCode PCCreate_HMG(PC pc) in PCCreate_HMG() argument
466 …/* if type was previously mg; must manually destroy it because call to PCSetType(pc,PCMG) will not… in PCCreate_HMG()
467 PetscTryTypeMethod(pc, destroy); in PCCreate_HMG()
468 pc->data = NULL; in PCCreate_HMG()
469 PetscCall(PetscFree(((PetscObject)pc)->type_name)); in PCCreate_HMG()
471 PetscCall(PCSetType(pc, PCMG)); in PCCreate_HMG()
472 PetscCall(PetscObjectChangeTypeName((PetscObject)pc, PCHMG)); in PCCreate_HMG()
475 mg = (PC_MG *)pc->data; in PCCreate_HMG()
483 pc->ops->setfromoptions = PCSetFromOptions_HMG; in PCCreate_HMG()
484 pc->ops->view = PCView_HMG; in PCCreate_HMG()
485 pc->ops->destroy = PCDestroy_HMG; in PCCreate_HMG()
486 pc->ops->setup = PCSetUp_HMG; in PCCreate_HMG()
488 …PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetReuseInterpolation_C", PCHMGSetReus… in PCCreate_HMG()
489 …PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetUseSubspaceCoarsening_C", PCHMGSetU… in PCCreate_HMG()
490 …PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetInnerPCType_C", PCHMGSetInnerPCType… in PCCreate_HMG()
491 …PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGSetCoarseningComponent_C", PCHMGSetCoa… in PCCreate_HMG()
492 PetscCall(PetscObjectComposeFunction((PetscObject)pc, "PCHMGUseMatMAIJ_C", PCHMGUseMatMAIJ_HMG)); in PCCreate_HMG()