xref: /petsc/src/sys/classes/draw/interface/dpause.c (revision df4cd43f92eaa320656440c40edb1046daee8f75)
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
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 {
21   PetscFunctionBegin;
22   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
23   PetscTryTypeMethod(draw, pause);
24   PetscFunctionReturn(PETSC_SUCCESS);
25 }
26 
27 /*@
28    PetscDrawSetPause - Sets the amount of time that program pauses after
29    a `PetscDrawPause()` is called.
30 
31    Logically Collective
32 
33    Input Parameters:
34 +  draw   - the drawing object
35 -  lpause - number of seconds to pause, -1 implies until user input, -2 pauses only on the `PetscDrawDestroy()`
36 
37    Options Database Key:
38 .  -draw_pause value - set the time to pause
39 
40    Level: intermediate
41 
42    Note:
43    By default the pause time is zero unless the -draw_pause option is given
44    during PetscDrawCreate().
45 
46 .seealso: `PetscDraw`, `PetscDrawGetPause()`, `PetscDrawPause()`
47 @*/
48 PetscErrorCode PetscDrawSetPause(PetscDraw draw, PetscReal lpause)
49 {
50   PetscFunctionBegin;
51   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
52   PetscValidLogicalCollectiveReal(draw, lpause, 2);
53   draw->pause = lpause;
54   PetscFunctionReturn(PETSC_SUCCESS);
55 }
56 
57 /*@
58    PetscDrawGetPause - Gets the amount of time that program pauses after
59    a `PetscDrawPause()` is called.
60 
61    Not collective
62 
63    Input Parameters:
64 +  draw   - the drawing object
65 -  lpause - number of seconds to pause, -1 implies until user input
66 
67    Level: intermediate
68 
69    Note:
70    By default the pause time is zero unless the -draw_pause option is given
71 
72 .seealso: `PetscDraw`, `PetscDrawSetPause()`, `PetscDrawPause()`
73 @*/
74 PetscErrorCode PetscDrawGetPause(PetscDraw draw, PetscReal *lpause)
75 {
76   PetscFunctionBegin;
77   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
78   PetscValidRealPointer(lpause, 2);
79   *lpause = draw->pause;
80   PetscFunctionReturn(PETSC_SUCCESS);
81 }
82