xref: /petsc/include/petscdraw.h (revision 6831982abb6453c2f3e25efecb5d0951d333371e)
1*6831982aSBarry Smith /* $Id: draw.h,v 1.66 1999/10/13 20:39:18 bsmith Exp bsmith $ */
243e6b640SBarry Smith /*
33fdcb5c1SBarry Smith   Interface to the PETSc graphics (currently only support for X-windows
443e6b640SBarry Smith */
53fdcb5c1SBarry Smith #if !defined(__DRAW_H)
63fdcb5c1SBarry Smith #define __DRAW_H
7d6dfbf8fSBarry Smith #include "petsc.h"
843e6b640SBarry Smith 
99e25ed09SBarry Smith #define DRAW_COOKIE PETSC_COOKIE+6
10f0479e8cSBarry Smith 
11d6dfbf8fSBarry Smith /* types of draw contexts */
127b2a1423SBarry Smith #define DRAW_X    "x"
137b2a1423SBarry Smith #define DRAW_NULL "null"
14d6dfbf8fSBarry Smith 
15783d1d5eSSatish Balay typedef struct _p_Draw* Draw;
1643e6b640SBarry Smith 
177b2a1423SBarry Smith typedef char* DrawType;
187b2a1423SBarry Smith extern FList DrawList;
197b2a1423SBarry Smith extern int DrawRegisterAll(char *);
207b2a1423SBarry Smith extern int DrawRegisterDestroy(void);
217b2a1423SBarry Smith 
227b2a1423SBarry Smith extern int DrawRegister_Private(char*,char*,char*,int(*)(Draw));
23aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
247b2a1423SBarry Smith #define DrawRegister(a,b,c,d) DrawRegister_Private(a,b,c,0)
257b2a1423SBarry Smith #else
267b2a1423SBarry Smith #define DrawRegister(a,b,c,d) DrawRegister_Private(a,b,c,d)
277b2a1423SBarry Smith #endif
287b2a1423SBarry Smith extern int DrawGetType(Draw,DrawType*);
297b2a1423SBarry Smith extern int DrawSetType(Draw,DrawType);
307b2a1423SBarry Smith extern int DrawCreate(MPI_Comm,const char[],const char[],int,int,int,int,Draw*);
317b2a1423SBarry Smith extern int DrawSetFromOptions(Draw);
327b2a1423SBarry Smith 
330752156aSBarry Smith /*
340752156aSBarry Smith    Number of basic colors in the draw routines, the others are used
350752156aSBarry Smith    for a uniform colormap.
360752156aSBarry Smith */
370752156aSBarry Smith #define DRAW_BASIC_COLORS 32
380752156aSBarry Smith 
39ba6fa466SBarry Smith #define DRAW_ROTATE          -1         /* will rotate through the colors, start with 2 */
4020563c6bSBarry Smith #define DRAW_WHITE            0
4120563c6bSBarry Smith #define DRAW_BLACK            1
4220563c6bSBarry Smith #define DRAW_RED              2
43f8d5e24aSBarry Smith #define DRAW_GREEN            3
44f8d5e24aSBarry Smith #define DRAW_CYAN             4
45f8d5e24aSBarry Smith #define DRAW_BLUE             5
46f8d5e24aSBarry Smith #define DRAW_MAGENTA          6
47f8d5e24aSBarry Smith #define DRAW_AQUAMARINE       7
48f8d5e24aSBarry Smith #define DRAW_FORESTGREEN      8
49f8d5e24aSBarry Smith #define DRAW_ORANGE           9
50f8d5e24aSBarry Smith #define DRAW_VIOLET          10
51f8d5e24aSBarry Smith #define DRAW_BROWN           11
52f8d5e24aSBarry Smith #define DRAW_PINK            12
53f8d5e24aSBarry Smith #define DRAW_CORAL           13
54f8d5e24aSBarry Smith #define DRAW_GRAY            14
55f8d5e24aSBarry Smith #define DRAW_YELLOW          15
5620563c6bSBarry Smith 
570752156aSBarry Smith #define DRAW_GOLD            16
580752156aSBarry Smith #define DRAW_LIGHTPINK       17
590752156aSBarry Smith #define DRAW_MEDIUMTURQUOISE 18
600752156aSBarry Smith #define DRAW_KHAKI           19
610752156aSBarry Smith #define DRAW_DIMGRAY         20
620752156aSBarry Smith #define DRAW_YELLOWGREEN     21
630752156aSBarry Smith #define DRAW_SKYBLUE         22
640752156aSBarry Smith #define DRAW_DARKGREEN       23
650752156aSBarry Smith #define DRAW_NAVYBLUE        24
660752156aSBarry Smith #define DRAW_SANDYBROWN      25
670752156aSBarry Smith #define DRAW_CADETBLUE       26
680752156aSBarry Smith #define DRAW_POWDERBLUE      27
690752156aSBarry Smith #define DRAW_DEEPPINK        28
700752156aSBarry Smith #define DRAW_THISTLE         29
710752156aSBarry Smith #define DRAW_LIMEGREEN       30
720752156aSBarry Smith #define DRAW_LAVENDERBLUSH   31
730752156aSBarry Smith 
740752156aSBarry Smith 
75e26ad7d8SSatish Balay extern int DrawOpenX(MPI_Comm,const char[],const char[],int,int,int,int,Draw*);
76e340e5c6SBarry Smith 
77d7e8b826SBarry Smith extern int DrawOpenNull(MPI_Comm,Draw *);
78d7e8b826SBarry Smith extern int DrawDestroy(Draw);
7919bcc07fSBarry Smith extern int DrawIsNull(Draw,PetscTruth*);
8043e6b640SBarry Smith 
81522c5e43SBarry Smith extern int DrawGetPopup(Draw,Draw*);
82d4fbbf0eSBarry Smith extern int DrawCheckResizedWindow(Draw);
83aa028dcaSBarry Smith extern int DrawResizeWindow(Draw,int,int);
84d4fbbf0eSBarry Smith 
85df85ffc0SBarry Smith extern int DrawScalePopup(Draw,double min,double max);
865311e20fSBarry Smith 
87d7e8b826SBarry Smith extern int DrawLine(Draw,double,double,double,double,int);
88d7e8b826SBarry Smith extern int DrawLineSetWidth(Draw,double);
899a28b0a6SLois Curfman McInnes extern int DrawLineGetWidth(Draw,double*);
9043e6b640SBarry Smith 
91d7e8b826SBarry Smith extern int DrawPoint(Draw,double,double,int);
92d7e8b826SBarry Smith extern int DrawPointSetSize(Draw,double);
938ed539a5SBarry Smith 
94d7e8b826SBarry Smith extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int);
95d7e8b826SBarry Smith extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int);
96c22c1629SBarry Smith extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*);
97d038840dSBarry Smith extern int DrawTensorContour(Draw,int,int,const double[],const double[],Scalar *);
988ed539a5SBarry Smith 
997824c9abSSatish Balay extern int DrawString(Draw,double,double,int,char*);
1007824c9abSSatish Balay extern int DrawStringVertical(Draw,double,double,int,char*);
1017824c9abSSatish Balay extern int DrawStringSetSize(Draw,double,double);
1027824c9abSSatish Balay extern int DrawStringGetSize(Draw,double*,double*);
103d6dfbf8fSBarry Smith 
104d7e8b826SBarry Smith extern int DrawSetViewPort(Draw,double,double,double,double);
1052bdab257SBarry Smith extern int DrawSplitViewPort(Draw);
1062bdab257SBarry Smith 
107d7e8b826SBarry Smith extern int DrawSetCoordinates(Draw,double,double,double,double);
108d7e8b826SBarry Smith extern int DrawGetCoordinates(Draw,double*,double*,double*,double*);
1099e25ed09SBarry Smith 
110d4fbbf0eSBarry Smith extern int DrawSetTitle(Draw,char *);
111d4fbbf0eSBarry Smith extern int DrawAppendTitle(Draw,char *);
112d4fbbf0eSBarry Smith extern int DrawGetTitle(Draw,char **);
113d4fbbf0eSBarry Smith 
114d7e8b826SBarry Smith extern int DrawSetPause(Draw,int);
11577c4ece6SBarry Smith extern int DrawGetPause(Draw,int*);
11677c4ece6SBarry Smith extern int DrawPause(Draw);
117d7e8b826SBarry Smith extern int DrawSetDoubleBuffer(Draw);
118d7e8b826SBarry Smith extern int DrawFlush(Draw);
1192bdab257SBarry Smith extern int DrawSynchronizedFlush(Draw);
120d7e8b826SBarry Smith extern int DrawClear(Draw);
1212bdab257SBarry Smith extern int DrawSynchronizedClear(Draw);
122e340e5c6SBarry Smith extern int DrawBOP(Draw);
123e340e5c6SBarry Smith extern int DrawEOP(Draw);
124cddf8d76SBarry Smith 
125*6831982aSBarry Smith extern int DrawGetSingleton(Draw,Draw*);
126*6831982aSBarry Smith extern int DrawRestoreSingleton(Draw,Draw*);
127*6831982aSBarry Smith 
128cddf8d76SBarry Smith typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
129d7e8b826SBarry Smith extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
1302bdab257SBarry Smith extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
13120563c6bSBarry Smith 
132ea06a074SBarry Smith extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
133d69bd51fSBarry Smith /*
134d69bd51fSBarry Smith     Routines for drawing X-Y axises in a Draw object
135d69bd51fSBarry Smith */
1366254e6afSSatish Balay typedef struct _p_DrawAxis* DrawAxis;
1376d4a8577SBarry Smith #define DRAWAXIS_COOKIE PETSC_COOKIE+16
138d7e8b826SBarry Smith extern int DrawAxisCreate(Draw,DrawAxis *);
139d7e8b826SBarry Smith extern int DrawAxisDestroy(DrawAxis);
140d7e8b826SBarry Smith extern int DrawAxisDraw(DrawAxis);
141d7e8b826SBarry Smith extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
142d7e8b826SBarry Smith extern int DrawAxisSetColors(DrawAxis,int,int,int);
143d7e8b826SBarry Smith extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
14420563c6bSBarry Smith 
145d69bd51fSBarry Smith /*
146d69bd51fSBarry Smith     Routines to draw line curves in X-Y space
147d69bd51fSBarry Smith */
1486254e6afSSatish Balay typedef struct _p_DrawLG*   DrawLG;
1496d4a8577SBarry Smith #define DRAWLG_COOKIE PETSC_COOKIE+7
150d7e8b826SBarry Smith extern int DrawLGCreate(Draw,int,DrawLG *);
151d7e8b826SBarry Smith extern int DrawLGDestroy(DrawLG);
152d7e8b826SBarry Smith extern int DrawLGAddPoint(DrawLG,double*,double*);
153d7e8b826SBarry Smith extern int DrawLGAddPoints(DrawLG,int,double**,double**);
154d7e8b826SBarry Smith extern int DrawLGDraw(DrawLG);
155d7e8b826SBarry Smith extern int DrawLGReset(DrawLG);
1565311e20fSBarry Smith extern int DrawLGSetDimension(DrawLG,int);
157d7e8b826SBarry Smith extern int DrawLGGetAxis(DrawLG,DrawAxis *);
158d7e8b826SBarry Smith extern int DrawLGGetDraw(DrawLG,Draw *);
159d7e8b826SBarry Smith extern int DrawLGIndicateDataPoints(DrawLG);
160d7e8b826SBarry Smith extern int DrawLGSetLimits(DrawLG,double,double,double,double);
16143e6b640SBarry Smith 
162d69bd51fSBarry Smith /*
163d69bd51fSBarry Smith     Routines to draw scatter plots in complex space
164d69bd51fSBarry Smith */
1656254e6afSSatish Balay typedef struct _p_DrawSP*   DrawSP;
166d4fbbf0eSBarry Smith #define DRAWSP_COOKIE PETSC_COOKIE+27
167d4fbbf0eSBarry Smith extern int DrawSPCreate(Draw,int,DrawSP *);
168d4fbbf0eSBarry Smith extern int DrawSPDestroy(DrawSP);
169d4fbbf0eSBarry Smith extern int DrawSPAddPoint(DrawSP,double*,double*);
170d4fbbf0eSBarry Smith extern int DrawSPAddPoints(DrawSP,int,double**,double**);
171d4fbbf0eSBarry Smith extern int DrawSPDraw(DrawSP);
172d4fbbf0eSBarry Smith extern int DrawSPReset(DrawSP);
173d4fbbf0eSBarry Smith extern int DrawSPSetDimension(DrawSP,int);
174d4fbbf0eSBarry Smith extern int DrawSPGetAxis(DrawSP,DrawAxis *);
175d4fbbf0eSBarry Smith extern int DrawSPGetDraw(DrawSP,Draw *);
176d4fbbf0eSBarry Smith extern int DrawSPSetLimits(DrawSP,double,double,double,double);
177d4fbbf0eSBarry Smith 
1783f1d51d7SBarry Smith /*
179ba6fa466SBarry Smith     Routines to draw histograms
180ba6fa466SBarry Smith */
181ba6fa466SBarry Smith typedef struct _p_DrawHist*   DrawHist;
1820f5bd95cSBarry Smith #define DRAWHIST_COOKIE PETSC_COOKIE+15
183ba6fa466SBarry Smith extern int DrawHistCreate(Draw, int, DrawHist *);
184ba6fa466SBarry Smith extern int DrawHistDestroy(DrawHist);
185ba6fa466SBarry Smith extern int DrawHistAddValue(DrawHist, double);
186ba6fa466SBarry Smith extern int DrawHistDraw(DrawHist);
187ba6fa466SBarry Smith extern int DrawHistReset(DrawHist);
188ba6fa466SBarry Smith extern int DrawHistGetAxis(DrawHist, DrawAxis *);
189ba6fa466SBarry Smith extern int DrawHistGetDraw(DrawHist, Draw *);
190ba6fa466SBarry Smith extern int DrawHistSetLimits(DrawHist, double, double, int, int);
191ba6fa466SBarry Smith extern int DrawHistSetNumberBins(DrawHist, int);
192ba6fa466SBarry Smith extern int DrawHistSetColor(DrawHist,int);
193ba6fa466SBarry Smith 
194ba6fa466SBarry Smith /*
1953f1d51d7SBarry Smith     Viewer routines that allow you to access underlying Draw objects
1963f1d51d7SBarry Smith */
19777ed5343SBarry Smith extern int ViewerDrawGetDraw(Viewer,int, Draw*);
19877ed5343SBarry Smith extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*);
19977ed5343SBarry Smith extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*);
2005311e20fSBarry Smith 
201d557673fSLois Curfman McInnes /* Mesh management routines */
2026254e6afSSatish Balay typedef struct _p_DrawMesh* DrawMesh;
203d557673fSLois Curfman McInnes int DrawMeshCreate( DrawMesh *,
204d557673fSLois Curfman McInnes 		    double *, double *, double *,
205d557673fSLois Curfman McInnes 		    int, int, int, int, int, int, int, int, int,
206d557673fSLois Curfman McInnes 		    int, int, int, int, double *, int );
207d557673fSLois Curfman McInnes int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
208d557673fSLois Curfman McInnes 			  int, int, int, int, double *, int );
209d557673fSLois Curfman McInnes int DrawMeshDestroy( DrawMesh * );
210d557673fSLois Curfman McInnes 
211d557673fSLois Curfman McInnes 
212d557673fSLois Curfman McInnes 
213d557673fSLois Curfman McInnes 
21443e6b640SBarry Smith #endif
2153fdcb5c1SBarry Smith 
2163fdcb5c1SBarry Smith 
2173fdcb5c1SBarry Smith 
2183fdcb5c1SBarry Smith 
2197b2a1423SBarry Smith 
220