xref: /petsc/src/sys/classes/draw/impls/x/drawopenx.c (revision 10450e9e44b354a0a3da7bbd573407bdf051df10)
15c6c1daeSBarry Smith 
25c6c1daeSBarry Smith /*
35c6c1daeSBarry Smith     Defines the operations for the X PetscDraw implementation.
45c6c1daeSBarry Smith */
55c6c1daeSBarry Smith 
65c6c1daeSBarry Smith #include <../src/sys/classes/draw/impls/x/ximpl.h> /*I  "petscsys.h" I*/
75c6c1daeSBarry Smith 
85c6c1daeSBarry Smith /*@C
9811af0c4SBarry Smith   PetscDrawOpenX - Opens an X-window for use with the `PetscDraw` routines.
105c6c1daeSBarry Smith 
11d083f849SBarry Smith   Collective
125c6c1daeSBarry Smith 
135c6c1daeSBarry Smith   Input Parameters:
145c6c1daeSBarry Smith + comm    - the communicator that will share X-window
15*10450e9eSJacob Faibussowitsch . display - the X display on which to open, or `NULL` for the local machine
16*10450e9eSJacob Faibussowitsch . title   - the title to put in the title bar, or `NULL` for no title
17*10450e9eSJacob Faibussowitsch . x       - the x screen coordinates of the upper left corner of window (or `PETSC_DECIDE`)
18*10450e9eSJacob Faibussowitsch . y       - the y screen coordinates of the upper left corner of window (or `PETSC_DECIDE`)
19*10450e9eSJacob Faibussowitsch . w       - the screen width in pixels of (or `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, or `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE`)
20*10450e9eSJacob Faibussowitsch - h       - the screen height in pixels of (or `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, or `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE`)
215c6c1daeSBarry Smith 
22f899ff85SJose E. Roman   Output Parameter:
235c6c1daeSBarry Smith . draw - the drawing context.
245c6c1daeSBarry Smith 
255c6c1daeSBarry Smith   Options Database Keys:
265c6c1daeSBarry Smith + -nox                    - Disables all x-windows output
275c6c1daeSBarry Smith . -display <name>         - Sets name of machine for the X display
285c6c1daeSBarry Smith . -draw_pause <pause>     - Sets time (in seconds) that the
295c6c1daeSBarry Smith        program pauses after PetscDrawPause() has been called
305c6c1daeSBarry Smith        (0 is default, -1 implies until user input).
3100d931feSLisandro Dalcin . -draw_cmap <name>       - Sets the colormap to use.
3200d931feSLisandro Dalcin . -draw_cmap_reverse      - Reverses the colormap.
3300d931feSLisandro Dalcin . -draw_cmap_brighten     - Brighten (0 < beta < 1) or darken (-1 < beta < 0) the colormap.
345c6c1daeSBarry Smith . -draw_x_shared_colormap - Causes PETSc to use a shared
355c6c1daeSBarry Smith        colormap. By default PETSc creates a separate color
365c6c1daeSBarry Smith        for its windows, you must put the mouse into the graphics
375c6c1daeSBarry Smith        window to see  the correct colors. This options forces
385c6c1daeSBarry Smith        PETSc to use the default colormap which will usually result
395c6c1daeSBarry Smith        in bad contour plots.
4069d47153SPierre Jolivet . -draw_fast              - Does not create colormap for contour plots.
415c6c1daeSBarry Smith . -draw_double_buffer     - Uses double buffering for smooth animation.
4200d931feSLisandro Dalcin - -geometry               - Indicates location and size of window.
435c6c1daeSBarry Smith 
445c6c1daeSBarry Smith   Level: beginner
455c6c1daeSBarry Smith 
46*10450e9eSJacob Faibussowitsch   Notes:
47*10450e9eSJacob Faibussowitsch   If `x` and `y` are both `PETSC_DECIDE` then PETSc places the window automatically.
48*10450e9eSJacob Faibussowitsch 
495c6c1daeSBarry Smith   When finished with the drawing context, it should be destroyed
50811af0c4SBarry Smith   with `PetscDrawDestroy()`.
515c6c1daeSBarry Smith 
52*10450e9eSJacob Faibussowitsch   Fortran Notes:
535c6c1daeSBarry Smith   Whenever indicating null character data in a Fortran code,
54811af0c4SBarry Smith   `PETSC_NULL_CHARACTER` must be employed; using NULL is not
55811af0c4SBarry Smith   correct for character data!  Thus, `PETSC_NULL_CHARACTER` can be
565c6c1daeSBarry Smith   used for the display and title input parameters.
575c6c1daeSBarry Smith 
58db781477SPatrick Sanan .seealso: `PetscDrawFlush()`, `PetscDrawDestroy()`, `PetscDrawCreate()`, `PetscDrawOpnOpenGL()`
595c6c1daeSBarry Smith @*/
60d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscDrawOpenX(MPI_Comm comm, const char display[], const char title[], int x, int y, int w, int h, PetscDraw *draw)
61d71ae5a4SJacob Faibussowitsch {
625c6c1daeSBarry Smith   PetscFunctionBegin;
639566063dSJacob Faibussowitsch   PetscCall(PetscDrawCreate(comm, display, title, x, y, w, h, draw));
649566063dSJacob Faibussowitsch   PetscCall(PetscDrawSetType(*draw, PETSC_DRAW_X));
653ba16761SJacob Faibussowitsch   PetscFunctionReturn(PETSC_SUCCESS);
665c6c1daeSBarry Smith }
67