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