Lines Matching +full:test +full:- +full:basic

8                      "y_dot = -0.2*x\n"
11 "-dir d : zero-crossing direction for events\n"
12 "-flg : additional output in Postevent\n"
13 … "-errtol e : error tolerance, for printing 'pass/fail' for located events (1e-5 by default)\n"
14 "-restart : flag for TSRestartStep() in PostEvent\n"
15 … "-dtpost x : if x > 0, then on even PostEvent calls 1st-post-event-step = x is set,\n"
16 … " on odd PostEvent calls 1st-post-event-step = PETSC_DECIDE is set,\n"
26 PetscReal evres[MAX_NEV]; // times of found zero-crossings
27 PetscReal ref[MAX_NEV]; // reference times of zero-crossings, for checking
31 …errtol; // error tolerance, for printing 'pass/fail' for located events (1e-5 by default)
33 PetscReal dtpost; // post-event step
56 ctx.pi = PetscAcosReal(-1.0); in main()
60 ctx.errtol = 1e-5; in main()
71 vals[2] = -0.2; in main()
102 …PetscCall(PetscOptionsGetInt(NULL, NULL, "-dir", &dir0, NULL)); // desired zero-crossi… in main()
103 …PetscCall(PetscOptionsHasName(NULL, NULL, "-flg", &ctx.flg)); // flag for additional… in main()
104 …PetscCall(PetscOptionsGetReal(NULL, NULL, "-errtol", &ctx.errtol, NULL)); // error tolerance for… in main()
105 …PetscCall(PetscOptionsGetBool(NULL, NULL, "-restart", &ctx.restart, NULL)); // flag for TSRestartS… in main()
106 PetscCall(PetscOptionsGetReal(NULL, NULL, "-dtpost", &ctx.dtpost, NULL)); // post-event step in main()
109 if (ctx.rank == 0) { // first event -- on rank-0 in main()
127 if (j < ctx.cntref) err = PetscAbsReal(ctx.evres[j] - ctx.ref[j]); in main()
141 User callback for defining the event-functions
149 // for the test purposes, event-functions are defined based on t in EventFunction()
150 // first event -- on rank-0 in EventFunction()
151 if (Ctx->rank == 0) gval[n++] = PetscSinReal(Ctx->pi * t); in EventFunction()
156 User callback for the post-event stuff
163 if (Ctx->flg) { in Postevent()
164 PetscCallBack("EventFunction", EventFunction(ts, t, U, Ctx->fvals, ctx)); in Postevent()
165 …, "[%d] At t = %20.16g : %" PetscInt_FMT " events triggered, fvalues =", Ctx->rank, (double)t, nev… 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()
176 if (Ctx->dtpost > 0) { in Postevent()
177 if (Ctx->postcnt % 2 == 0) PetscCall(TSSetPostEventStep(ts, Ctx->dtpost)); in Postevent()
182 if (Ctx->restart) PetscCall(TSRestartStep(ts)); in Postevent()
185 /*---------------------------------------------------------------------------------------------*/
187 Note, in the tests below, -ts_event_post_event_step is occasionally set to -1,
189 explicitly specify -1 in this option. Rather, if PETSC_DECIDE behaviour is needed,
193 /*TEST
194 test:
198 args: -dir 0
199 args: -restart 0
200 args: -dtpost {{0 0.25}}
201 args: -ts_event_post_event_step -1
202 args: -ts_type {{beuler rk}}
203 args: -ts_adapt_type {{none basic}}
206 test:
210 args: -dir 1
211 args: -restart 1
212 args: -dtpost {{0 0.31}}
213 args: -ts_event_post_event_step {{-1 0.25}}
214 args: -ts_type rk
215 args: -ts_adapt_type {{none basic}}
220 test:
224 args: -dir -1
225 args: -restart {{0 1}}
226 args: -dtpost {{0 0.25}}
227 args: -ts_event_post_event_step 0.31
228 args: -ts_type {{beuler rk}}
229 args: -ts_adapt_type basic
234 test:
238 args: -dir 0 -ts_event_dt_min 1e-6 -errtol 5e-5
239 args: -restart 1
240 args: -dtpost {{0 0.25}}
241 args: -ts_event_post_event_step {{-1 0.31}}
242 args: -ts_type beuler
243 args: -ts_adapt_type {{none basic}}
248 test:
252 args: -dir 1 -ts_event_dt_min 1e-6 -errtol 5e-5
253 args: -restart 0
254 args: -dtpost {{0 0.31}}
255 args: -ts_event_post_event_step 0.25
256 args: -ts_type {{beuler rk}}
257 args: -ts_adapt_type {{none basic}}
260 test:
264 args: -dir -1 -ts_event_dt_min 1e-6 -errtol 5e-5
265 args: -restart 1
266 args: -dtpost {{0 0.25}}
267 args: -ts_event_post_event_step -1
268 args: -ts_type {{beuler rk}}
269 args: -ts_adapt_type {{none basic}}
273 TEST*/