xref: /petsc/include/petscdraw.h (revision 606d414c6e034e02e67059b83ebaefc3ebe99698)
1 /* $Id: draw.h,v 1.64 1999/03/07 17:17:40 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 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
126 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
127 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
128 
129 extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
130 /*
131     Routines for drawing X-Y axises in a Draw object
132 */
133 typedef struct _p_DrawAxis* DrawAxis;
134 #define DRAWAXIS_COOKIE PETSC_COOKIE+16
135 extern int DrawAxisCreate(Draw,DrawAxis *);
136 extern int DrawAxisDestroy(DrawAxis);
137 extern int DrawAxisDraw(DrawAxis);
138 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
139 extern int DrawAxisSetColors(DrawAxis,int,int,int);
140 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
141 
142 /*
143     Routines to draw line curves in X-Y space
144 */
145 typedef struct _p_DrawLG*   DrawLG;
146 #define DRAWLG_COOKIE PETSC_COOKIE+7
147 extern int DrawLGCreate(Draw,int,DrawLG *);
148 extern int DrawLGDestroy(DrawLG);
149 extern int DrawLGAddPoint(DrawLG,double*,double*);
150 extern int DrawLGAddPoints(DrawLG,int,double**,double**);
151 extern int DrawLGDraw(DrawLG);
152 extern int DrawLGReset(DrawLG);
153 extern int DrawLGSetDimension(DrawLG,int);
154 extern int DrawLGGetAxis(DrawLG,DrawAxis *);
155 extern int DrawLGGetDraw(DrawLG,Draw *);
156 extern int DrawLGIndicateDataPoints(DrawLG);
157 extern int DrawLGSetLimits(DrawLG,double,double,double,double);
158 
159 /*
160     Routines to draw scatter plots in complex space
161 */
162 typedef struct _p_DrawSP*   DrawSP;
163 #define DRAWSP_COOKIE PETSC_COOKIE+27
164 extern int DrawSPCreate(Draw,int,DrawSP *);
165 extern int DrawSPDestroy(DrawSP);
166 extern int DrawSPAddPoint(DrawSP,double*,double*);
167 extern int DrawSPAddPoints(DrawSP,int,double**,double**);
168 extern int DrawSPDraw(DrawSP);
169 extern int DrawSPReset(DrawSP);
170 extern int DrawSPSetDimension(DrawSP,int);
171 extern int DrawSPGetAxis(DrawSP,DrawAxis *);
172 extern int DrawSPGetDraw(DrawSP,Draw *);
173 extern int DrawSPSetLimits(DrawSP,double,double,double,double);
174 
175 /*
176     Routines to draw histograms
177 */
178 typedef struct _p_DrawHist*   DrawHist;
179 extern int DrawHistCreate(Draw, int, DrawHist *);
180 extern int DrawHistDestroy(DrawHist);
181 extern int DrawHistAddValue(DrawHist, double);
182 extern int DrawHistDraw(DrawHist);
183 extern int DrawHistReset(DrawHist);
184 extern int DrawHistGetAxis(DrawHist, DrawAxis *);
185 extern int DrawHistGetDraw(DrawHist, Draw *);
186 extern int DrawHistSetLimits(DrawHist, double, double, int, int);
187 extern int DrawHistSetNumberBins(DrawHist, int);
188 extern int DrawHistSetColor(DrawHist,int);
189 
190 /*
191     Viewer routines that allow you to access underlying Draw objects
192 */
193 extern int ViewerDrawGetDraw(Viewer,int, Draw*);
194 extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*);
195 extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*);
196 
197 /* Mesh management routines */
198 typedef struct _p_DrawMesh* DrawMesh;
199 int DrawMeshCreate( DrawMesh *,
200 		    double *, double *, double *,
201 		    int, int, int, int, int, int, int, int, int,
202 		    int, int, int, int, double *, int );
203 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
204 			  int, int, int, int, double *, int );
205 int DrawMeshDestroy( DrawMesh * );
206 
207 
208 
209 
210 #endif
211 
212 
213 
214 
215 
216