| /petsc/src/ts/event/tests/ |
| H A D | ex4.c | 192 AppCtx *Ctx = (AppCtx *)ctx; in EventFunction() local 197 if (Ctx->rank == 0) { in EventFunction() 198 …if (Ctx->F == 0 || Ctx->F == -1) gval[n++] = PetscSinReal(Ctx->pi * t) / Ctx->pi; // FUNC-0, roots… in EventFunction() 199 …if (Ctx->F == 1 || Ctx->F == -1) gval[n++] = PetscLogReal(t); // FUNC-2, root 1 in EventFunction() 200 …if (Ctx->F == 2 || Ctx->F == -1) { // FUNC-3, root 1 in EventFunction() 204 …if (Ctx->F == 3 || Ctx->F == -1) gval[n++] = t - PetscExpReal(PetscSinReal(t)) + 1; … in EventFunction() 205 …if (Ctx->F == 4 || Ctx->F == -1) gval[n++] = (1e10 * PetscPowReal(t, 1 / t) - 1) / 100; … in EventFunction() 206 …if (Ctx->F == 5 || Ctx->F == -1) gval[n++] = PetscLogReal(t - 0.02) * PetscLogReal(t - 0.02) * Pet… in EventFunction() 207 …if (Ctx->F == 6 || Ctx->F == -1) gval[n++] = 4 * PetscCosReal(t) - PetscExpReal(t); … in EventFunction() 208 …if (Ctx->F == 7 || Ctx->F == -1) gval[n++] = (20.0 * t - 1) / (19.0 * t) / 10; … in EventFunction() [all …]
|
| H A D | ex3.c | 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() [all …]
|
| H A D | ex5.c | 181 AppCtx *Ctx = (AppCtx *)ctx; in EventFunction() local 187 if (Ctx->rank == (i + 3) % Ctx->size) { in EventFunction() 194 if (Ctx->rank == (i + 3) % Ctx->size) { in EventFunction() 200 …if (Ctx->rank == 0) gval[n++] = (t - 5) * (t - 5) * PetscSinReal(Ctx->pi * t); // sin-event -- on … in EventFunction() 201 …if (Ctx->rank == Ctx->size - 1) gval[n++] = 0.5 * PetscCosReal(Ctx->pi * t); // cos-event -- on … in EventFunction() 210 AppCtx *Ctx = (AppCtx *)ctx; in Postevent() local 213 if (Ctx->flg) { in Postevent() 214 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent() 215 …LD, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, n… in Postevent() 216 …; j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]]… in Postevent() [all …]
|
| H A D | ex3span.c | 217 AppCtx *Ctx = (AppCtx *)ctx; in EventFunction() local 222 if (Ctx->rank == 0) { in EventFunction() 228 if (Ctx->rank == Ctx->size - 1) { in EventFunction() 234 if (Ctx->rank == 1 % Ctx->size) gval[n++] = PetscSinReal(Ctx->pi * t); in EventFunction() 243 AppCtx *Ctx = (AppCtx *)ctx; in Postevent() local 247 if (Ctx->flg) { in Postevent() 248 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent() 249 …LD, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, n… in Postevent() 250 …; j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]]… in Postevent() 255 if (Ctx->cnt + nev_zero < MAX_NEV) in Postevent() [all …]
|
| H A D | ex2.c | 147 AppCtx *Ctx = (AppCtx *)ctx; in EventFunction() local 152 if (Ctx->rank == 0) { in EventFunction() 158 if (Ctx->rank == Ctx->size - 1) { in EventFunction() 170 AppCtx *Ctx = (AppCtx *)ctx; in Postevent() local 173 if (Ctx->flg) { in Postevent() 174 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent() 175 …LD, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, n… in Postevent() 176 …; j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]]… in Postevent() 181 if (Ctx->cnt + nev_zero < MAX_NEV) in Postevent() 182 …for (PetscInt i = 0; i < nev_zero; i++) Ctx->evres[Ctx->cnt++] = t; // save the repeating zeros se… in Postevent() [all …]
|
| H A D | ex1sin.c | 146 AppCtx *Ctx = (AppCtx *)ctx; in EventFunction() local 151 if (Ctx->rank == 0) gval[n++] = PetscSinReal(Ctx->pi * t); in EventFunction() 160 AppCtx *Ctx = (AppCtx *)ctx; in Postevent() local 163 if (Ctx->flg) { in Postevent() 164 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent() 165 …LD, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, n… in Postevent() 166 …; j++) PetscCall(PetscSynchronizedPrintf(PETSC_COMM_WORLD, "\t%g", (double)Ctx->fvals[evs_zero[j]]… in Postevent() 171 if (Ctx->cnt + nev_zero < MAX_NEV) in Postevent() 172 …for (PetscInt i = 0; i < nev_zero; i++) Ctx->evres[Ctx->cnt++] = t; // save the repeating zeros se… in Postevent() 175 Ctx->postcnt++; // sync in Postevent() [all …]
|
| /petsc/src/ts/tutorials/ |
| H A D | ex24.c | 12 } Ctx; typedef 23 Ctx ctx; in main() 99 Ctx *ctx = (Ctx *)ictx; in MonitorObjective() 150 Ctx *ctx = (Ctx *)ictx; in FormIFunction() 199 Ctx *ctx = (Ctx *)ictx; in FormIJacobian()
|
| /petsc/src/ts/tutorials/phasefield/ |
| H A D | heat.c | 150 PetscErrorCode FormFunction(TS ts, PetscReal ftime, Vec X, Vec F, PetscCtx Ctx) in FormFunction() argument 157 AppCtx *ctx = (AppCtx *)Ctx; in FormFunction() 274 PetscErrorCode MyMonitor(TS ts, PetscInt step, PetscReal time, Vec U, PetscCtx Ctx) in MyMonitor() argument 276 AppCtx *ctx = (AppCtx *)Ctx; in MyMonitor() 404 PetscErrorCode MyDestroy(PetscCtxRt Ctx) in MyDestroy() argument 406 AppCtx *ctx = *(AppCtx **)Ctx; in MyDestroy()
|
| H A D | biharmonic.c | 729 PetscErrorCode MyDestroy(PetscCtxRt Ctx) in MyDestroy() argument 731 UserCtx *ctx = *(UserCtx **)Ctx; in MyDestroy()
|
| /petsc/src/dm/impls/stag/tutorials/ |
| H A D | ex6.c | 50 } Ctx; typedef 52 static PetscErrorCode CreateLame(Ctx *); 53 static PetscErrorCode ForceStress(const Ctx *, Vec, PetscReal); 54 static PetscErrorCode DumpVelocity(const Ctx *, Vec, PetscInt); 55 static PetscErrorCode DumpStress(const Ctx *, Vec, PetscInt); 56 static PetscErrorCode UpdateVelocity(const Ctx *, Vec, Vec, Vec); 57 static PetscErrorCode UpdateStress(const Ctx *, Vec, Vec, Vec); 61 Ctx ctx; in main() 226 static PetscErrorCode CreateLame(Ctx *ctx) in CreateLame() 325 static PetscErrorCode ForceStress(const Ctx *ctx, Vec stress, PetscReal t) in ForceStress() [all …]
|
| H A D | ex4.c | 37 typedef CtxData *Ctx; typedef 41 Ctx ctx; 49 static PetscErrorCode CreateAuxiliaryOperator(Ctx, PetscInt, Mat *); 51 static PetscErrorCode CtxCreateAndSetFromOptions(Ctx *); 52 static PetscErrorCode CtxDestroy(Ctx *); 53 static PetscErrorCode DumpSolution(Ctx, PetscInt, Vec); 55 static PetscErrorCode PopulateCoefficientData(Ctx, PetscInt); 56 static PetscErrorCode SystemParametersCreate(SystemParameters *, Ctx); 61 Ctx ctx; in main() 316 static PetscScalar GetEta_constant(Ctx ctx, PetscScalar x, PetscScalar y, PetscScalar z) in GetEta_constant() [all …]
|
| /petsc/src/ts/tutorials/hamiltonian/ |
| H A D | ex4.c | 641 static PetscErrorCode ComputeEmaxResidual(Tao tao, Vec x, Vec res, void *Ctx) in ComputeEmaxResidual() argument 643 EmaxCtx *ctx = (EmaxCtx *)Ctx; in ComputeEmaxResidual() 662 static PetscErrorCode ComputeEmaxJacobian(Tao tao, Vec x, Mat J, Mat Jpre, void *Ctx) in ComputeEmaxJacobian() argument 664 EmaxCtx *ctx = (EmaxCtx *)Ctx; in ComputeEmaxJacobian() 691 static PetscErrorCode ComputeLogEmaxResidual(Tao tao, Vec x, Vec res, void *Ctx) in ComputeLogEmaxResidual() argument 693 EmaxCtx *ctx = (EmaxCtx *)Ctx; in ComputeLogEmaxResidual() 718 static PetscErrorCode ComputeLogEmaxJacobian(Tao tao, Vec x, Mat J, Mat Jpre, void *Ctx) in ComputeLogEmaxJacobian() argument 720 EmaxCtx *ctx = (EmaxCtx *)Ctx; in ComputeLogEmaxJacobian() 746 static PetscErrorCode MonitorEField(TS ts, PetscInt step, PetscReal t, Vec U, void *Ctx) in MonitorEField() argument 748 AppCtx *ctx = (AppCtx *)Ctx; in MonitorEField() [all …]
|
| H A D | ex2.c | 512 static PetscErrorCode MonitorEField(TS ts, PetscInt step, PetscReal t, Vec U, void *Ctx) in MonitorEField() argument 514 AppCtx *ctx = (AppCtx *)Ctx; in MonitorEField() 574 static PetscErrorCode MonitorMoments(TS ts, PetscInt step, PetscReal t, Vec U, void *Ctx) in MonitorMoments() argument 576 AppCtx *ctx = (AppCtx *)Ctx; in MonitorMoments() 591 PetscErrorCode MonitorInitialConditions(TS ts, PetscInt step, PetscReal t, Vec U, void *Ctx) in MonitorInitialConditions() argument 593 AppCtx *ctx = (AppCtx *)Ctx; in MonitorInitialConditions() 636 PetscErrorCode MonitorVelocity(TS ts, PetscInt step, PetscReal t, Vec U, void *Ctx) in MonitorVelocity() argument 638 AppCtx *ctx = (AppCtx *)Ctx; in MonitorVelocity() 732 static PetscErrorCode MonitorPositions_2D(TS ts, PetscInt step, PetscReal t, Vec U, void *Ctx) in MonitorPositions_2D() argument 734 AppCtx *ctx = (AppCtx *)Ctx; in MonitorPositions_2D() [all …]
|
| /petsc/src/snes/tutorials/ |
| H A D | ex58.c | 460 PetscErrorCode FormBoundaryConditions(SNES snes, PetscCtxRt Ctx) in FormBoundaryConditions() argument 477 *(void **)Ctx = ctx; in FormBoundaryConditions() 546 PetscErrorCode DestroyBoundaryConditions(PetscCtxRt Ctx) in DestroyBoundaryConditions() argument 548 AppCtx *ctx = *(AppCtx **)Ctx; in DestroyBoundaryConditions()
|
| /petsc/src/ts/interface/ |
| H A D | tsmon.c | 774 …ErrorCode TSMonitorDrawSolutionFunction(TS ts, PetscInt step, PetscReal ptime, Vec u, PetscCtx Ctx) in TSMonitorDrawSolutionFunction() argument 776 TSMonitorDrawCtx ctx = (TSMonitorDrawCtx)Ctx; in TSMonitorDrawSolutionFunction() 813 PetscErrorCode TSMonitorDrawError(TS ts, PetscInt step, PetscReal ptime, Vec u, PetscCtx Ctx) in TSMonitorDrawError() argument 815 TSMonitorDrawCtx ctx = (TSMonitorDrawCtx)Ctx; in TSMonitorDrawError() 1342 PetscErrorCode TSMonitorLGError(TS ts, PetscInt step, PetscReal ptime, Vec u, PetscCtx Ctx) in TSMonitorLGError() argument 1344 TSMonitorLGCtx ctx = (TSMonitorLGCtx)Ctx; in TSMonitorLGError()
|
| /petsc/doc/manual/ |
| H A D | vec.md | 621 :start-at: static PetscErrorCode UpdateVelocity_2d(const Ctx *ctx, Vec velocity, Vec
|