xref: /petsc/src/sys/classes/draw/impls/x/drawopenx.c (revision 5c6c1daec53e1d9ab0bec9db5309fd8fc7645b8d)
1*5c6c1daeSBarry Smith 
2*5c6c1daeSBarry Smith /*
3*5c6c1daeSBarry Smith     Defines the operations for the X PetscDraw implementation.
4*5c6c1daeSBarry Smith */
5*5c6c1daeSBarry Smith 
6*5c6c1daeSBarry Smith #include <../src/sys/classes/draw/impls/x/ximpl.h>         /*I  "petscsys.h" I*/
7*5c6c1daeSBarry Smith 
8*5c6c1daeSBarry Smith #undef __FUNCT__
9*5c6c1daeSBarry Smith #define __FUNCT__ "PetscDrawOpenX"
10*5c6c1daeSBarry Smith /*@C
11*5c6c1daeSBarry Smith    PetscDrawOpenX - Opens an X-window for use with the PetscDraw routines.
12*5c6c1daeSBarry Smith 
13*5c6c1daeSBarry Smith    Collective on MPI_Comm
14*5c6c1daeSBarry Smith 
15*5c6c1daeSBarry Smith    Input Parameters:
16*5c6c1daeSBarry Smith +  comm - the communicator that will share X-window
17*5c6c1daeSBarry Smith .  display - the X display on which to open,or null for the local machine
18*5c6c1daeSBarry Smith .  title - the title to put in the title bar,or null for no title
19*5c6c1daeSBarry Smith .  x,y - the screen coordinates of the upper left corner of window
20*5c6c1daeSBarry Smith           may use PETSC_DECIDE for these two arguments, then PETSc places the
21*5c6c1daeSBarry Smith           window
22*5c6c1daeSBarry Smith -  w, h - the screen width and height in pixels,  or PETSC_DRAW_HALF_SIZE, PETSC_DRAW_FULL_SIZE,
23*5c6c1daeSBarry Smith           or PETSC_DRAW_THIRD_SIZE or PETSC_DRAW_QUARTER_SIZE
24*5c6c1daeSBarry Smith 
25*5c6c1daeSBarry Smith    Output Parameters:
26*5c6c1daeSBarry Smith .  draw - the drawing context.
27*5c6c1daeSBarry Smith 
28*5c6c1daeSBarry Smith    Options Database Keys:
29*5c6c1daeSBarry Smith +  -nox - Disables all x-windows output
30*5c6c1daeSBarry Smith .  -display <name> - Sets name of machine for the X display
31*5c6c1daeSBarry Smith .  -draw_pause <pause> - Sets time (in seconds) that the
32*5c6c1daeSBarry Smith        program pauses after PetscDrawPause() has been called
33*5c6c1daeSBarry Smith        (0 is default, -1 implies until user input).
34*5c6c1daeSBarry Smith .  -draw_x_shared_colormap - Causes PETSc to use a shared
35*5c6c1daeSBarry Smith        colormap. By default PETSc creates a separate color
36*5c6c1daeSBarry Smith        for its windows, you must put the mouse into the graphics
37*5c6c1daeSBarry Smith        window to see  the correct colors. This options forces
38*5c6c1daeSBarry Smith        PETSc to use the default colormap which will usually result
39*5c6c1daeSBarry Smith        in bad contour plots.
40*5c6c1daeSBarry Smith .  -draw_fast - does not create colormap for countour plots
41*5c6c1daeSBarry Smith .  -draw_double_buffer - Uses double buffering for smooth animation.
42*5c6c1daeSBarry Smith -  -geometry - Indicates location and size of window
43*5c6c1daeSBarry Smith 
44*5c6c1daeSBarry Smith    Level: beginner
45*5c6c1daeSBarry Smith 
46*5c6c1daeSBarry Smith    Note:
47*5c6c1daeSBarry Smith    When finished with the drawing context, it should be destroyed
48*5c6c1daeSBarry Smith    with PetscDrawDestroy().
49*5c6c1daeSBarry Smith 
50*5c6c1daeSBarry Smith    Note for Fortran Programmers:
51*5c6c1daeSBarry Smith    Whenever indicating null character data in a Fortran code,
52*5c6c1daeSBarry Smith    PETSC_NULL_CHARACTER must be employed; using PETSC_NULL is not
53*5c6c1daeSBarry Smith    correct for character data!  Thus, PETSC_NULL_CHARACTER can be
54*5c6c1daeSBarry Smith    used for the display and title input parameters.
55*5c6c1daeSBarry Smith 
56*5c6c1daeSBarry Smith    Concepts: X windows^drawing to
57*5c6c1daeSBarry Smith 
58*5c6c1daeSBarry Smith .seealso: PetscDrawSynchronizedFlush(), PetscDrawDestroy(), PetscDrawCreate(), PetscDrawOpnOpenGL()
59*5c6c1daeSBarry Smith @*/
60*5c6c1daeSBarry Smith PetscErrorCode  PetscDrawOpenX(MPI_Comm comm,const char display[],const char title[],int x,int y,int w,int h,PetscDraw* draw)
61*5c6c1daeSBarry Smith {
62*5c6c1daeSBarry Smith   PetscErrorCode ierr;
63*5c6c1daeSBarry Smith 
64*5c6c1daeSBarry Smith   PetscFunctionBegin;
65*5c6c1daeSBarry Smith   ierr = PetscDrawCreate(comm,display,title,x,y,w,h,draw);CHKERRQ(ierr);
66*5c6c1daeSBarry Smith   ierr = PetscDrawSetType(*draw,PETSC_DRAW_X);CHKERRQ(ierr);
67*5c6c1daeSBarry Smith   PetscFunctionReturn(0);
68*5c6c1daeSBarry Smith }
69*5c6c1daeSBarry Smith 
70*5c6c1daeSBarry Smith 
71*5c6c1daeSBarry Smith 
72*5c6c1daeSBarry Smith 
73*5c6c1daeSBarry Smith 
74*5c6c1daeSBarry Smith 
75*5c6c1daeSBarry Smith 
76*5c6c1daeSBarry Smith 
77*5c6c1daeSBarry Smith 
78