xref: /petsc/include/petscdraw.h (revision aa482453d04611e9360efce3590b89acd231a34e)
1*aa482453SBarry Smith /* $Id: draw.h,v 1.64 1999/03/07 17:17:40 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));
23*aa482453SBarry 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 
125cddf8d76SBarry Smith typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
126d7e8b826SBarry Smith extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
1272bdab257SBarry Smith extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
12820563c6bSBarry Smith 
129ea06a074SBarry Smith extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
130d69bd51fSBarry Smith /*
131d69bd51fSBarry Smith     Routines for drawing X-Y axises in a Draw object
132d69bd51fSBarry Smith */
1336254e6afSSatish Balay typedef struct _p_DrawAxis* DrawAxis;
1346d4a8577SBarry Smith #define DRAWAXIS_COOKIE PETSC_COOKIE+16
135d7e8b826SBarry Smith extern int DrawAxisCreate(Draw,DrawAxis *);
136d7e8b826SBarry Smith extern int DrawAxisDestroy(DrawAxis);
137d7e8b826SBarry Smith extern int DrawAxisDraw(DrawAxis);
138d7e8b826SBarry Smith extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
139d7e8b826SBarry Smith extern int DrawAxisSetColors(DrawAxis,int,int,int);
140d7e8b826SBarry Smith extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
14120563c6bSBarry Smith 
142d69bd51fSBarry Smith /*
143d69bd51fSBarry Smith     Routines to draw line curves in X-Y space
144d69bd51fSBarry Smith */
1456254e6afSSatish Balay typedef struct _p_DrawLG*   DrawLG;
1466d4a8577SBarry Smith #define DRAWLG_COOKIE PETSC_COOKIE+7
147d7e8b826SBarry Smith extern int DrawLGCreate(Draw,int,DrawLG *);
148d7e8b826SBarry Smith extern int DrawLGDestroy(DrawLG);
149d7e8b826SBarry Smith extern int DrawLGAddPoint(DrawLG,double*,double*);
150d7e8b826SBarry Smith extern int DrawLGAddPoints(DrawLG,int,double**,double**);
151d7e8b826SBarry Smith extern int DrawLGDraw(DrawLG);
152d7e8b826SBarry Smith extern int DrawLGReset(DrawLG);
1535311e20fSBarry Smith extern int DrawLGSetDimension(DrawLG,int);
154d7e8b826SBarry Smith extern int DrawLGGetAxis(DrawLG,DrawAxis *);
155d7e8b826SBarry Smith extern int DrawLGGetDraw(DrawLG,Draw *);
156d7e8b826SBarry Smith extern int DrawLGIndicateDataPoints(DrawLG);
157d7e8b826SBarry Smith extern int DrawLGSetLimits(DrawLG,double,double,double,double);
15843e6b640SBarry Smith 
159d69bd51fSBarry Smith /*
160d69bd51fSBarry Smith     Routines to draw scatter plots in complex space
161d69bd51fSBarry Smith */
1626254e6afSSatish Balay typedef struct _p_DrawSP*   DrawSP;
163d4fbbf0eSBarry Smith #define DRAWSP_COOKIE PETSC_COOKIE+27
164d4fbbf0eSBarry Smith extern int DrawSPCreate(Draw,int,DrawSP *);
165d4fbbf0eSBarry Smith extern int DrawSPDestroy(DrawSP);
166d4fbbf0eSBarry Smith extern int DrawSPAddPoint(DrawSP,double*,double*);
167d4fbbf0eSBarry Smith extern int DrawSPAddPoints(DrawSP,int,double**,double**);
168d4fbbf0eSBarry Smith extern int DrawSPDraw(DrawSP);
169d4fbbf0eSBarry Smith extern int DrawSPReset(DrawSP);
170d4fbbf0eSBarry Smith extern int DrawSPSetDimension(DrawSP,int);
171d4fbbf0eSBarry Smith extern int DrawSPGetAxis(DrawSP,DrawAxis *);
172d4fbbf0eSBarry Smith extern int DrawSPGetDraw(DrawSP,Draw *);
173d4fbbf0eSBarry Smith extern int DrawSPSetLimits(DrawSP,double,double,double,double);
174d4fbbf0eSBarry Smith 
1753f1d51d7SBarry Smith /*
176ba6fa466SBarry Smith     Routines to draw histograms
177ba6fa466SBarry Smith */
178ba6fa466SBarry Smith typedef struct _p_DrawHist*   DrawHist;
179ba6fa466SBarry Smith extern int DrawHistCreate(Draw, int, DrawHist *);
180ba6fa466SBarry Smith extern int DrawHistDestroy(DrawHist);
181ba6fa466SBarry Smith extern int DrawHistAddValue(DrawHist, double);
182ba6fa466SBarry Smith extern int DrawHistDraw(DrawHist);
183ba6fa466SBarry Smith extern int DrawHistReset(DrawHist);
184ba6fa466SBarry Smith extern int DrawHistGetAxis(DrawHist, DrawAxis *);
185ba6fa466SBarry Smith extern int DrawHistGetDraw(DrawHist, Draw *);
186ba6fa466SBarry Smith extern int DrawHistSetLimits(DrawHist, double, double, int, int);
187ba6fa466SBarry Smith extern int DrawHistSetNumberBins(DrawHist, int);
188ba6fa466SBarry Smith extern int DrawHistSetColor(DrawHist,int);
189ba6fa466SBarry Smith 
190ba6fa466SBarry Smith /*
1913f1d51d7SBarry Smith     Viewer routines that allow you to access underlying Draw objects
1923f1d51d7SBarry Smith */
19377ed5343SBarry Smith extern int ViewerDrawGetDraw(Viewer,int, Draw*);
19477ed5343SBarry Smith extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*);
19577ed5343SBarry Smith extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*);
1965311e20fSBarry Smith 
197d557673fSLois Curfman McInnes /* Mesh management routines */
1986254e6afSSatish Balay typedef struct _p_DrawMesh* DrawMesh;
199d557673fSLois Curfman McInnes int DrawMeshCreate( DrawMesh *,
200d557673fSLois Curfman McInnes 		    double *, double *, double *,
201d557673fSLois Curfman McInnes 		    int, int, int, int, int, int, int, int, int,
202d557673fSLois Curfman McInnes 		    int, int, int, int, double *, int );
203d557673fSLois Curfman McInnes int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
204d557673fSLois Curfman McInnes 			  int, int, int, int, double *, int );
205d557673fSLois Curfman McInnes int DrawMeshDestroy( DrawMesh * );
206d557673fSLois Curfman McInnes 
207d557673fSLois Curfman McInnes 
208d557673fSLois Curfman McInnes 
209d557673fSLois Curfman McInnes 
21043e6b640SBarry Smith #endif
2113fdcb5c1SBarry Smith 
2123fdcb5c1SBarry Smith 
2133fdcb5c1SBarry Smith 
2143fdcb5c1SBarry Smith 
2157b2a1423SBarry Smith 
216