Lines Matching defs:jac
17 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
20 if (jac->R) {
21 PetscCall(MatRestrict(jac->R, x, jac->b));
23 PetscCall(MatRestrict(jac->P, x, jac->b));
25 PetscCall(KSPSolve(jac->ksp, jac->b, jac->x));
26 PetscCall(KSPCheckSolve(jac->ksp, pc, jac->x));
27 if (jac->P) {
28 PetscCall(MatInterpolate(jac->P, jac->x, y));
30 PetscCall(MatInterpolate(jac->R, jac->x, y));
37 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
42 if (jac->computeasub) {
45 PetscCall((*jac->computeasub)(pc, pc->pmat, NULL, &Ap, jac->computeasub_ctx));
46 PetscCall(KSPSetOperators(jac->ksp, Ap, Ap));
49 PetscCall(KSPGetOperators(jac->ksp, NULL, &Ap));
50 PetscCall((*jac->computeasub)(pc, pc->pmat, Ap, NULL, jac->computeasub_ctx));
54 if (!jac->x) {
55 PetscCall(KSPGetOperatorsSet(jac->ksp, &a, NULL));
57 PetscCall(KSPCreateVecs(jac->ksp, 1, &xx, 1, &yy));
58 jac->x = *xx;
59 jac->b = *yy;
63 PetscCheck(jac->R || jac->P, PetscObjectComm((PetscObject)pc), PETSC_ERR_ARG_WRONGSTATE, "Must set restriction or interpolation of PCGALERKIN with PCGalerkinSetRestriction()/Interpolation()");
70 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
73 PetscCall(MatDestroy(&jac->R));
74 PetscCall(MatDestroy(&jac->P));
75 PetscCall(VecDestroy(&jac->x));
76 PetscCall(VecDestroy(&jac->b));
77 PetscCall(KSPReset(jac->ksp));
83 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
87 PetscCall(KSPDestroy(&jac->ksp));
94 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
103 PetscCall(KSPView(jac->ksp, viewer));
109 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
112 *ksp = jac->ksp;
118 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
122 PetscCall(MatDestroy(&jac->R));
123 jac->R = R;
129 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
133 PetscCall(MatDestroy(&jac->P));
134 jac->P = P;
140 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
143 jac->computeasub = computeAsub;
144 jac->computeasub_ctx = ctx;
270 PC_Galerkin *jac = (PC_Galerkin *)pc->data;
275 PetscCall(KSPGetOptionsPrefix(jac->ksp, &prefix));
279 PetscCall(KSPSetOptionsPrefix(jac->ksp, prefix));
280 PetscCall(KSPAppendOptionsPrefix(jac->ksp, "galerkin_"));
284 if (jac->ksp) PetscCall(KSPSetFromOptions(jac->ksp));
317 PC_Galerkin *jac;
320 PetscCall(PetscNew(&jac));
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;