xref: /petsc/include/petscdraw.h (revision f1af5d2ffeae1f5fc391a89939f4818e47770ae3)
1 /* $Id: draw.h,v 1.67 1999/10/23 00:02:04 bsmith Exp bsmith $ */
2 /*
3   Interface to the PETSc graphics (currently only support for X-windows
4 */
5 #if !defined(__DRAW_H)
6 #define __DRAW_H
7 #include "petsc.h"
8 
9 #define DRAW_COOKIE PETSC_COOKIE+6
10 
11 /* types of draw contexts */
12 #define DRAW_X    "x"
13 #define DRAW_NULL "null"
14 
15 typedef struct _p_Draw* Draw;
16 
17 typedef char* DrawType;
18 extern FList DrawList;
19 extern int DrawRegisterAll(char *);
20 extern int DrawRegisterDestroy(void);
21 
22 extern int DrawRegister(char*,char*,char*,int(*)(Draw));
23 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
24 #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,0)
25 #else
26 #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,d)
27 #endif
28 extern int DrawGetType(Draw,DrawType*);
29 extern int DrawSetType(Draw,DrawType);
30 extern int DrawCreate(MPI_Comm,const char[],const char[],int,int,int,int,Draw*);
31 extern int DrawSetFromOptions(Draw);
32 
33 /*
34    Number of basic colors in the draw routines, the others are used
35    for a uniform colormap.
36 */
37 #define DRAW_BASIC_COLORS 32
38 
39 #define DRAW_ROTATE          -1         /* will rotate through the colors, start with 2 */
40 #define DRAW_WHITE            0
41 #define DRAW_BLACK            1
42 #define DRAW_RED              2
43 #define DRAW_GREEN            3
44 #define DRAW_CYAN             4
45 #define DRAW_BLUE             5
46 #define DRAW_MAGENTA          6
47 #define DRAW_AQUAMARINE       7
48 #define DRAW_FORESTGREEN      8
49 #define DRAW_ORANGE           9
50 #define DRAW_VIOLET          10
51 #define DRAW_BROWN           11
52 #define DRAW_PINK            12
53 #define DRAW_CORAL           13
54 #define DRAW_GRAY            14
55 #define DRAW_YELLOW          15
56 
57 #define DRAW_GOLD            16
58 #define DRAW_LIGHTPINK       17
59 #define DRAW_MEDIUMTURQUOISE 18
60 #define DRAW_KHAKI           19
61 #define DRAW_DIMGRAY         20
62 #define DRAW_YELLOWGREEN     21
63 #define DRAW_SKYBLUE         22
64 #define DRAW_DARKGREEN       23
65 #define DRAW_NAVYBLUE        24
66 #define DRAW_SANDYBROWN      25
67 #define DRAW_CADETBLUE       26
68 #define DRAW_POWDERBLUE      27
69 #define DRAW_DEEPPINK        28
70 #define DRAW_THISTLE         29
71 #define DRAW_LIMEGREEN       30
72 #define DRAW_LAVENDERBLUSH   31
73 
74 
75 extern int DrawOpenX(MPI_Comm,const char[],const char[],int,int,int,int,Draw*);
76 #define DRAW_FULL_SIZE    -3
77 #define DRAW_HALF_SIZE    -4
78 #define DRAW_THIRD_SIZE   -5
79 #define DRAW_QUARTER_SIZE -6
80 
81 extern int DrawOpenNull(MPI_Comm,Draw *);
82 extern int DrawDestroy(Draw);
83 extern int DrawIsNull(Draw,PetscTruth*);
84 
85 extern int DrawGetPopup(Draw,Draw*);
86 extern int DrawCheckResizedWindow(Draw);
87 extern int DrawResizeWindow(Draw,int,int);
88 
89 extern int DrawScalePopup(Draw,double min,double max);
90 
91 extern int DrawLine(Draw,double,double,double,double,int);
92 extern int DrawLineSetWidth(Draw,double);
93 extern int DrawLineGetWidth(Draw,double*);
94 
95 extern int DrawPoint(Draw,double,double,int);
96 extern int DrawPointSetSize(Draw,double);
97 
98 extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int);
99 extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int);
100 extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*);
101 extern int DrawTensorContour(Draw,int,int,const double[],const double[],Scalar *);
102 
103 extern int DrawString(Draw,double,double,int,char*);
104 extern int DrawStringVertical(Draw,double,double,int,char*);
105 extern int DrawStringSetSize(Draw,double,double);
106 extern int DrawStringGetSize(Draw,double*,double*);
107 
108 extern int DrawSetViewPort(Draw,double,double,double,double);
109 extern int DrawSplitViewPort(Draw);
110 
111 extern int DrawSetCoordinates(Draw,double,double,double,double);
112 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*);
113 
114 extern int DrawSetTitle(Draw,char *);
115 extern int DrawAppendTitle(Draw,char *);
116 extern int DrawGetTitle(Draw,char **);
117 
118 extern int DrawSetPause(Draw,int);
119 extern int DrawGetPause(Draw,int*);
120 extern int DrawPause(Draw);
121 extern int DrawSetDoubleBuffer(Draw);
122 extern int DrawFlush(Draw);
123 extern int DrawSynchronizedFlush(Draw);
124 extern int DrawClear(Draw);
125 extern int DrawSynchronizedClear(Draw);
126 extern int DrawBOP(Draw);
127 extern int DrawEOP(Draw);
128 
129 extern int DrawGetSingleton(Draw,Draw*);
130 extern int DrawRestoreSingleton(Draw,Draw*);
131 
132 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
133 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
134 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
135 
136 extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
137 /*
138     Routines for drawing X-Y axises in a Draw object
139 */
140 typedef struct _p_DrawAxis* DrawAxis;
141 #define DRAWAXIS_COOKIE PETSC_COOKIE+16
142 extern int DrawAxisCreate(Draw,DrawAxis *);
143 extern int DrawAxisDestroy(DrawAxis);
144 extern int DrawAxisDraw(DrawAxis);
145 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
146 extern int DrawAxisSetColors(DrawAxis,int,int,int);
147 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
148 
149 /*
150     Routines to draw line curves in X-Y space
151 */
152 typedef struct _p_DrawLG*   DrawLG;
153 #define DRAWLG_COOKIE PETSC_COOKIE+7
154 extern int DrawLGCreate(Draw,int,DrawLG *);
155 extern int DrawLGDestroy(DrawLG);
156 extern int DrawLGAddPoint(DrawLG,double*,double*);
157 extern int DrawLGAddPoints(DrawLG,int,double**,double**);
158 extern int DrawLGDraw(DrawLG);
159 extern int DrawLGReset(DrawLG);
160 extern int DrawLGSetDimension(DrawLG,int);
161 extern int DrawLGGetAxis(DrawLG,DrawAxis *);
162 extern int DrawLGGetDraw(DrawLG,Draw *);
163 extern int DrawLGIndicateDataPoints(DrawLG);
164 extern int DrawLGSetLimits(DrawLG,double,double,double,double);
165 
166 /*
167     Routines to draw scatter plots in complex space
168 */
169 typedef struct _p_DrawSP*   DrawSP;
170 #define DRAWSP_COOKIE PETSC_COOKIE+27
171 extern int DrawSPCreate(Draw,int,DrawSP *);
172 extern int DrawSPDestroy(DrawSP);
173 extern int DrawSPAddPoint(DrawSP,double*,double*);
174 extern int DrawSPAddPoints(DrawSP,int,double**,double**);
175 extern int DrawSPDraw(DrawSP);
176 extern int DrawSPReset(DrawSP);
177 extern int DrawSPSetDimension(DrawSP,int);
178 extern int DrawSPGetAxis(DrawSP,DrawAxis *);
179 extern int DrawSPGetDraw(DrawSP,Draw *);
180 extern int DrawSPSetLimits(DrawSP,double,double,double,double);
181 
182 /*
183     Routines to draw histograms
184 */
185 typedef struct _p_DrawHist*   DrawHist;
186 #define DRAWHIST_COOKIE PETSC_COOKIE+15
187 extern int DrawHistCreate(Draw, int, DrawHist *);
188 extern int DrawHistDestroy(DrawHist);
189 extern int DrawHistAddValue(DrawHist, double);
190 extern int DrawHistDraw(DrawHist);
191 extern int DrawHistReset(DrawHist);
192 extern int DrawHistGetAxis(DrawHist, DrawAxis *);
193 extern int DrawHistGetDraw(DrawHist, Draw *);
194 extern int DrawHistSetLimits(DrawHist, double, double, int, int);
195 extern int DrawHistSetNumberBins(DrawHist, int);
196 extern int DrawHistSetColor(DrawHist,int);
197 
198 /*
199     Viewer routines that allow you to access underlying Draw objects
200 */
201 extern int ViewerDrawGetDraw(Viewer,int, Draw*);
202 extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*);
203 extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*);
204 
205 /* Mesh management routines */
206 typedef struct _p_DrawMesh* DrawMesh;
207 int DrawMeshCreate( DrawMesh *,
208 		    double *, double *, double *,
209 		    int, int, int, int, int, int, int, int, int,
210 		    int, int, int, int, double *, int );
211 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
212 			  int, int, int, int, double *, int );
213 int DrawMeshDestroy( DrawMesh * );
214 
215 
216 
217 
218 #endif
219 
220 
221 
222 
223 
224