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