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