Actual source code: petscdrawtypes.h

  1: #pragma once

  3: #include <petscsystypes.h>

  5: /* MANSEC = Sys */
  6: /* SUBMANSEC = Draw */

  8: /*J
  9:    PetscDrawType - String with the name of a `PetscDraw` implementation, for example `PETSC_DRAW_X` is for X Windows.

 11:    Level: beginner

 13: .seealso: `PetscDrawSetType()`, `PetscDraw`, `PetscViewer`, `PetscDrawCreate()`, `PetscDrawRegister()`
 14: J*/
 15: typedef const char *PetscDrawType;
 16: #define PETSC_DRAW_X     "x"
 17: #define PETSC_DRAW_NULL  "null"
 18: #define PETSC_DRAW_WIN32 "win32"
 19: #define PETSC_DRAW_TIKZ  "tikz"
 20: #define PETSC_DRAW_IMAGE "image"
 21: #define PETSC_DRAW_SDL3  "sdl3"

 23: /*S
 24:    PetscDraw - Abstract PETSc object for graphics, often represents a window on the screen

 26:    Level: beginner

 28: .seealso: `PetscDrawCreate()`, `PetscDrawSetType()`, `PetscDrawType`
 29: S*/
 30: typedef struct _p_PetscDraw *PetscDraw;

 32: /*S
 33:    PetscDrawAxis - An object that manages X-Y axis for a `PetscDraw`

 35:    Level: advanced

 37: .seealso: `PetscDraw`, `PetscDrawAxisCreate()`, `PetscDrawAxisSetLimits()`, `PetscDrawAxisSetColors()`, `PetscDrawAxisSetLabels()`
 38: S*/
 39: typedef struct _p_PetscDrawAxis *PetscDrawAxis;

 41: /*S
 42:    PetscDrawLG - An object that manages drawing simple x-y plots

 44:    Level: advanced

 46: .seealso: `PetscDrawAxis`, `PetscDraw`, `PetscDrawBar`, `PetscDrawHG`, `PetscDrawSP`, `PetscDrawAxisCreate()`, `PetscDrawLGCreate()`, `PetscDrawLGAddPoint()`
 47: S*/
 48: typedef struct _p_PetscDrawLG *PetscDrawLG;

 50: /*S
 51:    PetscDrawSP - An object that manages drawing scatter plots

 53:    Level: advanced

 55: .seealso: `PetscDrawAxis`, `PetscDraw`, `PetscDrawLG`, `PetscDrawBar`, `PetscDrawHG`, `PetscDrawSPCreate()`
 56: S*/
 57: typedef struct _p_PetscDrawSP *PetscDrawSP;

 59: /*S
 60:    PetscDrawHG - An object that manages drawing histograms

 62:    Level: advanced

 64:    Note:
 65:    Use a series of calls to `PetscDrawHGAddValue()` to create a standard histogram <https://en.wikipedia.org/wiki/Histogram>, where the bins have integer counts.  Use calls to `PetscDrawHGAddWeightedValue()` to create a histogram with non-integer bin heights, such as the following <https://mathematica.stackexchange.com/questions/103928/histogram-from-relative-frequency-data>

 67: .seealso: `PetscDrawAxis`, `PetscDraw`, `PetscDrawLG`, `PetscDrawBar`, `PetscDrawSP`, `PetscDrawHGCreate()`, `PetscDrawHGAddValue()`, `PetscDrawHGAddWeightedValue()`
 68: S*/
 69: typedef struct _p_PetscDrawHG *PetscDrawHG;

 71: /*S
 72:    PetscDrawBar - An object that manages drawing bar graphs

 74:    Level: advanced

 76: .seealso: `PetscDrawAxis`, `PetscDraw`, `PetscDrawLG`, `PetscDrawHG`, `PetscDrawSP`, `PetscDrawBarCreate()`
 77: S*/
 78: typedef struct _p_PetscDrawBar *PetscDrawBar;

 80: /*
 81:    Number of basic colors in the draw routines, the others are used
 82:    for a uniform colormap.
 83: */
 84: #define PETSC_DRAW_BASIC_COLORS 33

 86: #define PETSC_DRAW_ROTATE      -1 /* will rotate through the colors, start with 2 */
 87: #define PETSC_DRAW_WHITE       0
 88: #define PETSC_DRAW_BLACK       1
 89: #define PETSC_DRAW_RED         2
 90: #define PETSC_DRAW_GREEN       3
 91: #define PETSC_DRAW_CYAN        4
 92: #define PETSC_DRAW_BLUE        5
 93: #define PETSC_DRAW_MAGENTA     6
 94: #define PETSC_DRAW_AQUAMARINE  7
 95: #define PETSC_DRAW_FORESTGREEN 8
 96: #define PETSC_DRAW_ORANGE      9
 97: #define PETSC_DRAW_VIOLET      10
 98: #define PETSC_DRAW_BROWN       11
 99: #define PETSC_DRAW_PINK        12
100: #define PETSC_DRAW_CORAL       13
101: #define PETSC_DRAW_GRAY        14
102: #define PETSC_DRAW_YELLOW      15

104: #define PETSC_DRAW_GOLD            16
105: #define PETSC_DRAW_LIGHTPINK       17
106: #define PETSC_DRAW_MEDIUMTURQUOISE 18
107: #define PETSC_DRAW_KHAKI           19
108: #define PETSC_DRAW_DIMGRAY         20
109: #define PETSC_DRAW_YELLOWGREEN     21
110: #define PETSC_DRAW_SKYBLUE         22
111: #define PETSC_DRAW_DARKGREEN       23
112: #define PETSC_DRAW_NAVYBLUE        24
113: #define PETSC_DRAW_SANDYBROWN      25
114: #define PETSC_DRAW_CADETBLUE       26
115: #define PETSC_DRAW_POWDERBLUE      27
116: #define PETSC_DRAW_DEEPPINK        28
117: #define PETSC_DRAW_THISTLE         29
118: #define PETSC_DRAW_LIMEGREEN       30
119: #define PETSC_DRAW_LAVENDERBLUSH   31
120: #define PETSC_DRAW_PLUM            32
121: #define PETSC_DRAW_MAXCOLOR        256

123: #define PETSC_DRAW_FULL_SIZE    -3
124: #define PETSC_DRAW_HALF_SIZE    -4
125: #define PETSC_DRAW_THIRD_SIZE   -5
126: #define PETSC_DRAW_QUARTER_SIZE -6

128: /*E
129:    PetscDrawMarkerType - How a "mark" is indicate in a figure

131:    Values:
132: +  `PETSC_MARKER_CROSS`  - a small pixel based x symbol or the character x if that is not available
133: .  `PETSC_MARKER_PLUS`   - a small pixel based + symbol or the character + if that is not available
134: .  `PETSC_MARKER_CIRCLE` - a small pixel based circle symbol or the character o if that is not available
135: -  `PETSC_MARKER_POINT`  - the make obtained with `PetscDrawPoint()`

137:    Level: intermediate

139: .seealso: `PetscDraw`, `PetscDrawMarker()`, `PetscDrawSetMarkerType()`
140: E*/
141: typedef enum {
142:   PETSC_DRAW_MARKER_CROSS,
143:   PETSC_DRAW_MARKER_POINT,
144:   PETSC_DRAW_MARKER_PLUS,
145:   PETSC_DRAW_MARKER_CIRCLE
146: } PetscDrawMarkerType;
147: PETSC_EXTERN const char *const PetscDrawMarkerTypes[];

149: /*E
150:    PetscDrawButton - Used to determine which button was pressed

152:    Values:
153: +  `PETSC_BUTTON_NONE`        - no button was pressed
154: .  `PETSC_BUTTON_LEFT`        - the left button
155: .  `PETSC_BUTTON_CENTER`      - the center button
156: .  `PETSC_BUTTON_RIGHT`       - the right button
157: .  `PETSC_BUTTON_WHEEL_UP`    - the wheel was moved up
158: .  `PETSC_BUTTON_WHEEL_DOWN`  - the wheel was moved down
159: .  `PETSC_BUTTON_LEFT_SHIFT`  - the left button and the shift key
160: .  `PETSC_BUTTON_CENTER_SHIFT`- the center button and the shift key
161: -  `PETSC_BUTTON_RIGHT_SHIFT` - the right button and the shift key

163:    Level: intermediate

165: .seealso: `PetscDraw`, `PetscDrawGetMouseButton()`
166: E*/
167: typedef enum {
168:   PETSC_BUTTON_NONE,
169:   PETSC_BUTTON_LEFT,
170:   PETSC_BUTTON_CENTER,
171:   PETSC_BUTTON_RIGHT,
172:   PETSC_BUTTON_WHEEL_UP,
173:   PETSC_BUTTON_WHEEL_DOWN,
174:   PETSC_BUTTON_LEFT_SHIFT,
175:   PETSC_BUTTON_CENTER_SHIFT,
176:   PETSC_BUTTON_RIGHT_SHIFT
177: } PetscDrawButton;

179: /*S
180:    PetscDrawViewPorts - Object representing subwindows in a `PetscDraw` object

182:    Level: intermediate

184: .seealso: `PetscDraw`, `PetscDrawViewPortsCreate()`, `PetscDrawViewPortsSet()`
185: S*/
186: typedef struct {
187:   PetscInt   nports;
188:   PetscReal *xl;
189:   PetscReal *xr;
190:   PetscReal *yl;
191:   PetscReal *yr;
192:   PetscDraw  draw;
193:   PetscReal  port_xl, port_yl, port_xr, port_yr; /* original port of parent PetscDraw */
194: } PetscDrawViewPorts;