Lines Matching refs:ctx

36   PC_LMVM  *ctx;  in PCLMVMSetUpdateVec()  local
44 ctx = (PC_LMVM *)pc->data; in PCLMVMSetUpdateVec()
46 PetscCall(VecDestroy(&ctx->X)); in PCLMVMSetUpdateVec()
47 ctx->X = X; in PCLMVMSetUpdateVec()
48 ctx->Xstate = -1; in PCLMVMSetUpdateVec()
65 PC_LMVM *ctx; in PCLMVMSetMatLMVM() local
75 ctx = (PC_LMVM *)pc->data; in PCLMVMSetMatLMVM()
77 PetscCall(MatDestroy(&ctx->B)); in PCLMVMSetMatLMVM()
78 ctx->B = B; in PCLMVMSetMatLMVM()
97 PC_LMVM *ctx; in PCLMVMGetMatLMVM() local
104 ctx = (PC_LMVM *)pc->data; in PCLMVMGetMatLMVM()
105 if (!ctx->B) { in PCLMVMGetMatLMVM()
116 PetscCall(MatCreate(PetscObjectComm((PetscObject)pc), &ctx->B)); in PCLMVMGetMatLMVM()
117 PetscCall(MatSetOptionsPrefix(ctx->B, prefix)); in PCLMVMGetMatLMVM()
118 PetscCall(MatAppendOptionsPrefix(ctx->B, "pc_lmvm_")); in PCLMVMGetMatLMVM()
119 PetscCall(MatSetType(ctx->B, MATLMVMBFGS)); in PCLMVMGetMatLMVM()
120 PetscCall(PetscObjectIncrementTabLevel((PetscObject)ctx->B, (PetscObject)pc, 1)); in PCLMVMGetMatLMVM()
121 *B = ctx->B; in PCLMVMGetMatLMVM()
123 } else *B = ctx->B; in PCLMVMGetMatLMVM()
143 PC_LMVM *ctx; in PCLMVMSetIS() local
151 ctx = (PC_LMVM *)pc->data; in PCLMVMSetIS()
154 ctx->inactive = inactive; in PCLMVMSetIS()
170 PC_LMVM *ctx; in PCLMVMClearIS() local
177 ctx = (PC_LMVM *)pc->data; in PCLMVMClearIS()
178 PetscCall(ISDestroy(&ctx->inactive)); in PCLMVMClearIS()
184 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCApply_LMVM() local
186 Mat B = ctx->B ? ctx->B : (pc->useAmat ? pc->mat : pc->pmat); in PCApply_LMVM()
189 if (ctx->inactive) { in PCApply_LMVM()
190 if (!ctx->xwork) PetscCall(MatCreateVecs(B, &ctx->xwork, &ctx->ywork)); in PCApply_LMVM()
191 PetscCall(VecZeroEntries(ctx->xwork)); in PCApply_LMVM()
192 PetscCall(VecGetSubVector(ctx->xwork, ctx->inactive, &xsub)); in PCApply_LMVM()
194 PetscCall(VecRestoreSubVector(ctx->xwork, ctx->inactive, &xsub)); in PCApply_LMVM()
195 Bx = ctx->xwork; in PCApply_LMVM()
196 By = ctx->ywork; in PCApply_LMVM()
199 if (ctx->inactive) { in PCApply_LMVM()
200 PetscCall(VecGetSubVector(ctx->ywork, ctx->inactive, &ysub)); in PCApply_LMVM()
202 PetscCall(VecRestoreSubVector(ctx->ywork, ctx->inactive, &ysub)); in PCApply_LMVM()
209 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCReset_LMVM() local
212 PetscCall(VecDestroy(&ctx->xwork)); in PCReset_LMVM()
213 PetscCall(VecDestroy(&ctx->ywork)); in PCReset_LMVM()
222 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCSetUp_LMVM() local
239 if (B == ctx->B && ctx->setfromoptionscalled) PetscCall(MatSetFromOptions(ctx->B)); in PCSetUp_LMVM()
240 ctx->setfromoptionscalled = PETSC_FALSE; in PCSetUp_LMVM()
246 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCView_LMVM() local
251 if (isascii && ctx->B && ctx->B->assembled) { in PCView_LMVM()
253 PetscCall(MatView(ctx->B, viewer)); in PCView_LMVM()
261 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCSetFromOptions_LMVM() local
265 ctx->setfromoptionscalled = PETSC_TRUE; in PCSetFromOptions_LMVM()
271 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCPreSolve_LMVM() local
274 …if (ctx->X && ctx->B) { /* Perform update only if requested. Otherwise we assume the user, e.g. TA… in PCPreSolve_LMVM()
277 PetscCall(PetscObjectStateGet((PetscObject)ctx->X, &Xstate)); in PCPreSolve_LMVM()
278 if (ctx->Xstate != Xstate) PetscCall(MatLMVMUpdate(ctx->B, ctx->X, F)); in PCPreSolve_LMVM()
279 ctx->Xstate = Xstate; in PCPreSolve_LMVM()
286 PC_LMVM *ctx = (PC_LMVM *)pc->data; in PCDestroy_LMVM() local
289 PetscCall(ISDestroy(&ctx->inactive)); in PCDestroy_LMVM()
290 PetscCall(VecDestroy(&ctx->xwork)); in PCDestroy_LMVM()
291 PetscCall(VecDestroy(&ctx->ywork)); in PCDestroy_LMVM()
292 PetscCall(VecDestroy(&ctx->X)); in PCDestroy_LMVM()
293 PetscCall(MatDestroy(&ctx->B)); in PCDestroy_LMVM()
310 PC_LMVM *ctx; in PCCreate_LMVM() local
313 PetscCall(PetscNew(&ctx)); in PCCreate_LMVM()
314 pc->data = (void *)ctx; in PCCreate_LMVM()