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