xref: /petsc/src/sys/classes/draw/impls/x/drawopenx.c (revision 09b68a49ed2854d1e4985cc2aa6af33c7c4e69b3)
15c6c1daeSBarry Smith /*
25c6c1daeSBarry Smith     Defines the operations for the X PetscDraw implementation.
35c6c1daeSBarry Smith */
45c6c1daeSBarry Smith 
5cc4c1da9SBarry Smith #include <../src/sys/classes/draw/impls/x/ximpl.h> /*I  "petscdraw.h" I*/
65c6c1daeSBarry Smith 
7cc4c1da9SBarry Smith /*@
8811af0c4SBarry Smith   PetscDrawOpenX - Opens an X-window for use with the `PetscDraw` routines.
95c6c1daeSBarry Smith 
10d083f849SBarry Smith   Collective
115c6c1daeSBarry Smith 
125c6c1daeSBarry Smith   Input Parameters:
135c6c1daeSBarry Smith + comm    - the communicator that will share X-window
1410450e9eSJacob Faibussowitsch . display - the X display on which to open, or `NULL` for the local machine
1510450e9eSJacob Faibussowitsch . title   - the title to put in the title bar, or `NULL` for no title
1610450e9eSJacob Faibussowitsch . x       - the x screen coordinates of the upper left corner of window (or `PETSC_DECIDE`)
1710450e9eSJacob Faibussowitsch . y       - the y screen coordinates of the upper left corner of window (or `PETSC_DECIDE`)
1810450e9eSJacob 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`)
1910450e9eSJacob 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`)
205c6c1daeSBarry Smith 
21f899ff85SJose E. Roman   Output Parameter:
225c6c1daeSBarry Smith . draw - the drawing context.
235c6c1daeSBarry Smith 
245c6c1daeSBarry Smith   Options Database Keys:
255c6c1daeSBarry Smith + -nox                    - Disables all x-windows output
265c6c1daeSBarry Smith . -display <name>         - Sets name of machine for the X display
27*feaf08eaSBarry Smith . -draw_pause <pause>     - Sets time (in seconds) that the program pauses after `PetscDrawPause()` has been called
285c6c1daeSBarry Smith                             (0 is default, -1 implies until user input).
2900d931feSLisandro Dalcin . -draw_cmap <name>       - Sets the colormap to use.
3000d931feSLisandro Dalcin . -draw_cmap_reverse      - Reverses the colormap.
3100d931feSLisandro Dalcin . -draw_cmap_brighten     - Brighten (0 < beta < 1) or darken (-1 < beta < 0) the colormap.
32*feaf08eaSBarry Smith . -draw_x_shared_colormap - Causes PETSc to use a shared colormap. By default PETSc creates a separate color
335c6c1daeSBarry Smith                             for its windows, you must put the mouse into the graphics
345c6c1daeSBarry Smith                             window to see  the correct colors. This options forces
355c6c1daeSBarry Smith                             PETSc to use the default colormap which will usually result
365c6c1daeSBarry Smith                             in bad contour plots.
3769d47153SPierre Jolivet . -draw_fast              - Does not create colormap for contour plots.
385c6c1daeSBarry Smith . -draw_double_buffer     - Uses double buffering for smooth animation.
3900d931feSLisandro Dalcin - -geometry               - Indicates location and size of window.
405c6c1daeSBarry Smith 
415c6c1daeSBarry Smith   Level: beginner
425c6c1daeSBarry Smith 
4310450e9eSJacob Faibussowitsch   Notes:
4410450e9eSJacob Faibussowitsch   If `x` and `y` are both `PETSC_DECIDE` then PETSc places the window automatically.
4510450e9eSJacob Faibussowitsch 
465c6c1daeSBarry Smith   When finished with the drawing context, it should be destroyed
47811af0c4SBarry Smith   with `PetscDrawDestroy()`.
485c6c1daeSBarry Smith 
49*feaf08eaSBarry Smith   Fortran Note:
505c6c1daeSBarry Smith   Whenever indicating null character data in a Fortran code,
51*feaf08eaSBarry Smith   `PETSC_NULL_CHARACTER` must be employed. Thus, `PETSC_NULL_CHARACTER` can be
52*feaf08eaSBarry Smith   used for the `display` and `title` input parameters.
535c6c1daeSBarry Smith 
54db781477SPatrick Sanan .seealso: `PetscDrawFlush()`, `PetscDrawDestroy()`, `PetscDrawCreate()`, `PetscDrawOpnOpenGL()`
555c6c1daeSBarry Smith @*/
PetscDrawOpenX(MPI_Comm comm,const char display[],const char title[],int x,int y,int w,int h,PetscDraw * draw)56d71ae5a4SJacob Faibussowitsch PetscErrorCode PetscDrawOpenX(MPI_Comm comm, const char display[], const char title[], int x, int y, int w, int h, PetscDraw *draw)
57d71ae5a4SJacob Faibussowitsch {
585c6c1daeSBarry Smith   PetscFunctionBegin;
599566063dSJacob Faibussowitsch   PetscCall(PetscDrawCreate(comm, display, title, x, y, w, h, draw));
609566063dSJacob Faibussowitsch   PetscCall(PetscDrawSetType(*draw, PETSC_DRAW_X));
613ba16761SJacob Faibussowitsch   PetscFunctionReturn(PETSC_SUCCESS);
625c6c1daeSBarry Smith }
63