1 #include <petsc/private/drawimpl.h> /*I "petscdraw.h" I*/
2
3 /*@
4 PetscDrawPause - Waits n seconds or until user input, depending on input
5 to `PetscDrawSetPause()`.
6
7 Collective
8
9 Input Parameter:
10 . draw - the drawing context
11
12 Level: beginner
13
14 .seealso: `PetscDraw`, `PetscDrawSetPause()`, `PetscDrawGetPause()`
15 @*/
PetscDrawPause(PetscDraw draw)16 PetscErrorCode PetscDrawPause(PetscDraw draw)
17 {
18 PetscFunctionBegin;
19 PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
20 PetscTryTypeMethod(draw, pause);
21 PetscFunctionReturn(PETSC_SUCCESS);
22 }
23
24 /*@
25 PetscDrawSetPause - Sets the amount of time that program pauses after
26 a `PetscDrawPause()` is called.
27
28 Logically Collective
29
30 Input Parameters:
31 + draw - the drawing object
32 - lpause - number of seconds to pause, -1 implies until user input, -2 pauses only on the `PetscDrawDestroy()`
33
34 Options Database Key:
35 . -draw_pause value - set the time to pause
36
37 Level: intermediate
38
39 Note:
40 By default the pause time is zero unless the -draw_pause option is given
41 during PetscDrawCreate().
42
43 .seealso: `PetscDraw`, `PetscDrawGetPause()`, `PetscDrawPause()`
44 @*/
PetscDrawSetPause(PetscDraw draw,PetscReal lpause)45 PetscErrorCode PetscDrawSetPause(PetscDraw draw, PetscReal lpause)
46 {
47 PetscFunctionBegin;
48 PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
49 PetscValidLogicalCollectiveReal(draw, lpause, 2);
50 draw->pause = lpause;
51 PetscFunctionReturn(PETSC_SUCCESS);
52 }
53
54 /*@
55 PetscDrawGetPause - Gets the amount of time that program pauses after
56 a `PetscDrawPause()` is called.
57
58 Not Collective
59
60 Input Parameters:
61 + draw - the drawing object
62 - lpause - number of seconds to pause, -1 implies until user input
63
64 Level: intermediate
65
66 Note:
67 By default the pause time is zero unless the -draw_pause option is given
68
69 .seealso: `PetscDraw`, `PetscDrawSetPause()`, `PetscDrawPause()`
70 @*/
PetscDrawGetPause(PetscDraw draw,PetscReal * lpause)71 PetscErrorCode PetscDrawGetPause(PetscDraw draw, PetscReal *lpause)
72 {
73 PetscFunctionBegin;
74 PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
75 PetscAssertPointer(lpause, 2);
76 *lpause = draw->pause;
77 PetscFunctionReturn(PETSC_SUCCESS);
78 }
79