xref: /petsc/src/sys/classes/draw/interface/dpause.c (revision 58d68138c660dfb4e9f5b03334792cd4f2ffd7cc) !
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 operation on PetscDraw object.
11 
12    Input Parameter:
13 .  draw - the drawing context
14 
15    Level: beginner
16 
17 .seealso: `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 PetscDraw
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    Level: intermediate
37 
38    Note:
39    By default the pause time is zero unless the -draw_pause option is given
40    during PetscDrawCreate().
41 
42 .seealso: `PetscDrawGetPause()`, `PetscDrawPause()`
43 @*/
44 PetscErrorCode PetscDrawSetPause(PetscDraw draw, PetscReal lpause) {
45   PetscFunctionBegin;
46   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
47   PetscValidLogicalCollectiveReal(draw, lpause, 2);
48   draw->pause = lpause;
49   PetscFunctionReturn(0);
50 }
51 
52 /*@
53    PetscDrawGetPause - Gets the amount of time that program pauses after
54    a PetscDrawPause() is called.
55 
56    Not collective
57 
58    Input Parameters:
59 +  draw   - the drawing object
60 -  lpause - number of seconds to pause, -1 implies until user input
61 
62    Level: intermediate
63 
64    Note:
65    By default the pause time is zero unless the -draw_pause option is given
66 
67 .seealso: `PetscDrawSetPause()`, `PetscDrawPause()`
68 @*/
69 PetscErrorCode PetscDrawGetPause(PetscDraw draw, PetscReal *lpause) {
70   PetscFunctionBegin;
71   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
72   PetscValidRealPointer(lpause, 2);
73   *lpause = draw->pause;
74   PetscFunctionReturn(0);
75 }
76