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