Lines Matching refs:Ctx
179 AppCtx *Ctx = (AppCtx *)ctx; in EventFunction() local
184 if (Ctx->rank == 0) { in EventFunction()
190 if (Ctx->rank == Ctx->size - 1) { in EventFunction()
196 if (Ctx->rank == 1 % Ctx->size) gval[n++] = Ctx->V * PetscSinReal(Ctx->pi * t); in EventFunction()
207 AppCtx *Ctx = (AppCtx *)ctx; in Postevent() local
210 if (Ctx->flg) { in Postevent()
211 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent()
212 …LD, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, n… in Postevent()
213 …; j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]]… in Postevent()
219 if (PetscAbsReal(t - (PetscReal)5.0) < 0.01 && Ctx->change5) { in Postevent()
221 if (Ctx->rank == 0) x[1] = -x[1]; in Postevent()
226 if (Ctx->rank == 0) n++; // first event -- on rank-0 in Postevent()
227 if (Ctx->rank == Ctx->size - 1) n++; // second event -- on last rank in Postevent()
228 if (Ctx->rank == 1 % Ctx->size) { // third event -- on rank = 1%ctx.size in Postevent()
229 …if (Ctx->flg) PetscCall(PetscPrintf(PETSC_COMM_SELF, "vtol for sin: %g -> ", (double)Ctx->vtol[n])… in Postevent()
230 Ctx->vtol[n] *= 4; in Postevent()
231 if (PetscAbsReal(t - (PetscReal)5.0) < 0.01) Ctx->vtol[n] /= 100; // one-off decrease in Postevent()
232 if (Ctx->flg) PetscCall(PetscPrintf(PETSC_COMM_SELF, "%g\n", (double)Ctx->vtol[n])); in Postevent()
235 PetscCall(TSSetEventTolerances(ts, 0, Ctx->vtol)); in Postevent()
237 if (Ctx->cnt + nev_zero < MAX_NEV) in Postevent()
238 …for (PetscInt i = 0; i < nev_zero; i++) Ctx->evres[Ctx->cnt++] = t; // save the repeating zeros se… in Postevent()
241 Ctx->postcnt++; // sync in Postevent()
242 if (Ctx->dtpost > 0) { in Postevent()
243 if (Ctx->postcnt % 2 == 0) PetscCall(TSSetPostEventStep(ts, Ctx->dtpost)); in Postevent()
248 if (Ctx->restart) PetscCall(TSRestartStep(ts)); in Postevent()