xref: /petsc/src/sys/classes/draw/interface/dpause.c (revision 7a101e5e7ba9859de4c800924a501d6ea3cd325c)
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 {
21   PetscFunctionBegin;
22   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
23   if (draw->ops->pause) PetscCall((*draw->ops->pause)(draw));
24   PetscFunctionReturn(0);
25 }
26 
27 /*@
28    PetscDrawSetPause - Sets the amount of time that program pauses after
29    a PetscDrawPause() is called.
30 
31    Logically Collective on PetscDraw
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    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: `PetscDrawGetPause()`, `PetscDrawPause()`
44 @*/
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(0);
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: `PetscDrawSetPause()`, `PetscDrawPause()`
70 @*/
71 PetscErrorCode  PetscDrawGetPause(PetscDraw draw,PetscReal *lpause)
72 {
73   PetscFunctionBegin;
74   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
75   PetscValidRealPointer(lpause,2);
76   *lpause = draw->pause;
77   PetscFunctionReturn(0);
78 }
79