xref: /petsc/include/petscdraw.h (revision ac2a4f0d24b3b6a4ee93edbcad41f4bb9e923944)
1 /* $Id: draw.h,v 1.66 1999/10/13 20:39:18 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_Private(char*,char*,char*,int(*)(Draw));
23 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
24 #define DrawRegister(a,b,c,d) DrawRegister_Private(a,b,c,0)
25 #else
26 #define DrawRegister(a,b,c,d) DrawRegister_Private(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 
77 extern int DrawOpenNull(MPI_Comm,Draw *);
78 extern int DrawDestroy(Draw);
79 extern int DrawIsNull(Draw,PetscTruth*);
80 
81 extern int DrawGetPopup(Draw,Draw*);
82 extern int DrawCheckResizedWindow(Draw);
83 extern int DrawResizeWindow(Draw,int,int);
84 
85 extern int DrawScalePopup(Draw,double min,double max);
86 
87 extern int DrawLine(Draw,double,double,double,double,int);
88 extern int DrawLineSetWidth(Draw,double);
89 extern int DrawLineGetWidth(Draw,double*);
90 
91 extern int DrawPoint(Draw,double,double,int);
92 extern int DrawPointSetSize(Draw,double);
93 
94 extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int);
95 extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int);
96 extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*);
97 extern int DrawTensorContour(Draw,int,int,const double[],const double[],Scalar *);
98 
99 extern int DrawString(Draw,double,double,int,char*);
100 extern int DrawStringVertical(Draw,double,double,int,char*);
101 extern int DrawStringSetSize(Draw,double,double);
102 extern int DrawStringGetSize(Draw,double*,double*);
103 
104 extern int DrawSetViewPort(Draw,double,double,double,double);
105 extern int DrawSplitViewPort(Draw);
106 
107 extern int DrawSetCoordinates(Draw,double,double,double,double);
108 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*);
109 
110 extern int DrawSetTitle(Draw,char *);
111 extern int DrawAppendTitle(Draw,char *);
112 extern int DrawGetTitle(Draw,char **);
113 
114 extern int DrawSetPause(Draw,int);
115 extern int DrawGetPause(Draw,int*);
116 extern int DrawPause(Draw);
117 extern int DrawSetDoubleBuffer(Draw);
118 extern int DrawFlush(Draw);
119 extern int DrawSynchronizedFlush(Draw);
120 extern int DrawClear(Draw);
121 extern int DrawSynchronizedClear(Draw);
122 extern int DrawBOP(Draw);
123 extern int DrawEOP(Draw);
124 
125 extern int DrawGetSingleton(Draw,Draw*);
126 extern int DrawRestoreSingleton(Draw,Draw*);
127 
128 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
129 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
130 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
131 
132 extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
133 /*
134     Routines for drawing X-Y axises in a Draw object
135 */
136 typedef struct _p_DrawAxis* DrawAxis;
137 #define DRAWAXIS_COOKIE PETSC_COOKIE+16
138 extern int DrawAxisCreate(Draw,DrawAxis *);
139 extern int DrawAxisDestroy(DrawAxis);
140 extern int DrawAxisDraw(DrawAxis);
141 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
142 extern int DrawAxisSetColors(DrawAxis,int,int,int);
143 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
144 
145 /*
146     Routines to draw line curves in X-Y space
147 */
148 typedef struct _p_DrawLG*   DrawLG;
149 #define DRAWLG_COOKIE PETSC_COOKIE+7
150 extern int DrawLGCreate(Draw,int,DrawLG *);
151 extern int DrawLGDestroy(DrawLG);
152 extern int DrawLGAddPoint(DrawLG,double*,double*);
153 extern int DrawLGAddPoints(DrawLG,int,double**,double**);
154 extern int DrawLGDraw(DrawLG);
155 extern int DrawLGReset(DrawLG);
156 extern int DrawLGSetDimension(DrawLG,int);
157 extern int DrawLGGetAxis(DrawLG,DrawAxis *);
158 extern int DrawLGGetDraw(DrawLG,Draw *);
159 extern int DrawLGIndicateDataPoints(DrawLG);
160 extern int DrawLGSetLimits(DrawLG,double,double,double,double);
161 
162 /*
163     Routines to draw scatter plots in complex space
164 */
165 typedef struct _p_DrawSP*   DrawSP;
166 #define DRAWSP_COOKIE PETSC_COOKIE+27
167 extern int DrawSPCreate(Draw,int,DrawSP *);
168 extern int DrawSPDestroy(DrawSP);
169 extern int DrawSPAddPoint(DrawSP,double*,double*);
170 extern int DrawSPAddPoints(DrawSP,int,double**,double**);
171 extern int DrawSPDraw(DrawSP);
172 extern int DrawSPReset(DrawSP);
173 extern int DrawSPSetDimension(DrawSP,int);
174 extern int DrawSPGetAxis(DrawSP,DrawAxis *);
175 extern int DrawSPGetDraw(DrawSP,Draw *);
176 extern int DrawSPSetLimits(DrawSP,double,double,double,double);
177 
178 /*
179     Routines to draw histograms
180 */
181 typedef struct _p_DrawHist*   DrawHist;
182 #define DRAWHIST_COOKIE PETSC_COOKIE+15
183 extern int DrawHistCreate(Draw, int, DrawHist *);
184 extern int DrawHistDestroy(DrawHist);
185 extern int DrawHistAddValue(DrawHist, double);
186 extern int DrawHistDraw(DrawHist);
187 extern int DrawHistReset(DrawHist);
188 extern int DrawHistGetAxis(DrawHist, DrawAxis *);
189 extern int DrawHistGetDraw(DrawHist, Draw *);
190 extern int DrawHistSetLimits(DrawHist, double, double, int, int);
191 extern int DrawHistSetNumberBins(DrawHist, int);
192 extern int DrawHistSetColor(DrawHist,int);
193 
194 /*
195     Viewer routines that allow you to access underlying Draw objects
196 */
197 extern int ViewerDrawGetDraw(Viewer,int, Draw*);
198 extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*);
199 extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*);
200 
201 /* Mesh management routines */
202 typedef struct _p_DrawMesh* DrawMesh;
203 int DrawMeshCreate( DrawMesh *,
204 		    double *, double *, double *,
205 		    int, int, int, int, int, int, int, int, int,
206 		    int, int, int, int, double *, int );
207 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
208 			  int, int, int, int, double *, int );
209 int DrawMeshDestroy( DrawMesh * );
210 
211 
212 
213 
214 #endif
215 
216 
217 
218 
219 
220