xref: /petsc/include/petscdraw.h (revision e26ad7d8ee88123bbdfe3b070a3e2d22b606b0ee)
1*e26ad7d8SSatish Balay /* $Id: draw.h,v 1.58 1998/06/09 21:25:54 bsmith Exp balay $ */
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 */
126d4a8577SBarry Smith #define DRAW_XWINDOW    0
136d4a8577SBarry Smith #define DRAW_NULLWINDOW 1
146d4a8577SBarry Smith #define DRAW_VRML       2
15d6dfbf8fSBarry Smith 
16783d1d5eSSatish Balay typedef struct _p_Draw* Draw;
1743e6b640SBarry Smith 
180752156aSBarry Smith /*
190752156aSBarry Smith    Number of basic colors in the draw routines, the others are used
200752156aSBarry Smith    for a uniform colormap.
210752156aSBarry Smith */
220752156aSBarry Smith #define DRAW_BASIC_COLORS 32
230752156aSBarry Smith 
24ba6fa466SBarry Smith #define DRAW_ROTATE          -1         /* will rotate through the colors, start with 2 */
2520563c6bSBarry Smith #define DRAW_WHITE            0
2620563c6bSBarry Smith #define DRAW_BLACK            1
2720563c6bSBarry Smith #define DRAW_RED              2
28f8d5e24aSBarry Smith #define DRAW_GREEN            3
29f8d5e24aSBarry Smith #define DRAW_CYAN             4
30f8d5e24aSBarry Smith #define DRAW_BLUE             5
31f8d5e24aSBarry Smith #define DRAW_MAGENTA          6
32f8d5e24aSBarry Smith #define DRAW_AQUAMARINE       7
33f8d5e24aSBarry Smith #define DRAW_FORESTGREEN      8
34f8d5e24aSBarry Smith #define DRAW_ORANGE           9
35f8d5e24aSBarry Smith #define DRAW_VIOLET          10
36f8d5e24aSBarry Smith #define DRAW_BROWN           11
37f8d5e24aSBarry Smith #define DRAW_PINK            12
38f8d5e24aSBarry Smith #define DRAW_CORAL           13
39f8d5e24aSBarry Smith #define DRAW_GRAY            14
40f8d5e24aSBarry Smith #define DRAW_YELLOW          15
4120563c6bSBarry Smith 
420752156aSBarry Smith #define DRAW_GOLD            16
430752156aSBarry Smith #define DRAW_LIGHTPINK       17
440752156aSBarry Smith #define DRAW_MEDIUMTURQUOISE 18
450752156aSBarry Smith #define DRAW_KHAKI           19
460752156aSBarry Smith #define DRAW_DIMGRAY         20
470752156aSBarry Smith #define DRAW_YELLOWGREEN     21
480752156aSBarry Smith #define DRAW_SKYBLUE         22
490752156aSBarry Smith #define DRAW_DARKGREEN       23
500752156aSBarry Smith #define DRAW_NAVYBLUE        24
510752156aSBarry Smith #define DRAW_SANDYBROWN      25
520752156aSBarry Smith #define DRAW_CADETBLUE       26
530752156aSBarry Smith #define DRAW_POWDERBLUE      27
540752156aSBarry Smith #define DRAW_DEEPPINK        28
550752156aSBarry Smith #define DRAW_THISTLE         29
560752156aSBarry Smith #define DRAW_LIMEGREEN       30
570752156aSBarry Smith #define DRAW_LAVENDERBLUSH   31
580752156aSBarry Smith 
590752156aSBarry Smith 
60*e26ad7d8SSatish Balay extern int DrawOpenX(MPI_Comm,const char[],const char[],int,int,int,int,Draw*);
61*e26ad7d8SSatish Balay extern int DrawOpenVRML( MPI_Comm,const char[],const char[], Draw* );
62e340e5c6SBarry Smith 
63d7e8b826SBarry Smith extern int DrawOpenNull(MPI_Comm,Draw *);
64d7e8b826SBarry Smith extern int DrawDestroy(Draw);
6519bcc07fSBarry Smith extern int DrawIsNull(Draw,PetscTruth*);
6643e6b640SBarry Smith 
67522c5e43SBarry Smith extern int DrawGetPopup(Draw,Draw*);
68d4fbbf0eSBarry Smith extern int DrawCheckResizedWindow(Draw);
69aa028dcaSBarry Smith extern int DrawResizeWindow(Draw,int,int);
70d4fbbf0eSBarry Smith 
71df85ffc0SBarry Smith extern int DrawScalePopup(Draw,double min,double max);
725311e20fSBarry Smith 
73d7e8b826SBarry Smith extern int DrawLine(Draw,double,double,double,double,int);
74d7e8b826SBarry Smith extern int DrawLineSetWidth(Draw,double);
759a28b0a6SLois Curfman McInnes extern int DrawLineGetWidth(Draw,double*);
7643e6b640SBarry Smith 
77d7e8b826SBarry Smith extern int DrawPoint(Draw,double,double,int);
78d7e8b826SBarry Smith extern int DrawPointSetSize(Draw,double);
798ed539a5SBarry Smith 
80d7e8b826SBarry Smith extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int);
81d7e8b826SBarry Smith extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int);
82c22c1629SBarry Smith extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*);
838ed539a5SBarry Smith 
847824c9abSSatish Balay extern int DrawString(Draw,double,double,int,char*);
857824c9abSSatish Balay extern int DrawStringVertical(Draw,double,double,int,char*);
867824c9abSSatish Balay extern int DrawStringSetSize(Draw,double,double);
877824c9abSSatish Balay extern int DrawStringGetSize(Draw,double*,double*);
88d6dfbf8fSBarry Smith 
89d7e8b826SBarry Smith extern int DrawSetViewPort(Draw,double,double,double,double);
902bdab257SBarry Smith extern int DrawSplitViewPort(Draw);
912bdab257SBarry Smith 
92d7e8b826SBarry Smith extern int DrawSetCoordinates(Draw,double,double,double,double);
93d7e8b826SBarry Smith extern int DrawGetCoordinates(Draw,double*,double*,double*,double*);
949e25ed09SBarry Smith 
95d4fbbf0eSBarry Smith extern int DrawSetTitle(Draw,char *);
96d4fbbf0eSBarry Smith extern int DrawAppendTitle(Draw,char *);
97d4fbbf0eSBarry Smith extern int DrawGetTitle(Draw,char **);
98d4fbbf0eSBarry Smith 
99d7e8b826SBarry Smith extern int DrawSetPause(Draw,int);
10077c4ece6SBarry Smith extern int DrawGetPause(Draw,int*);
10177c4ece6SBarry Smith extern int DrawPause(Draw);
102d7e8b826SBarry Smith extern int DrawSetDoubleBuffer(Draw);
103d7e8b826SBarry Smith extern int DrawFlush(Draw);
1042bdab257SBarry Smith extern int DrawSynchronizedFlush(Draw);
105d7e8b826SBarry Smith extern int DrawClear(Draw);
1062bdab257SBarry Smith extern int DrawSynchronizedClear(Draw);
107e340e5c6SBarry Smith extern int DrawBOP(Draw);
108e340e5c6SBarry Smith extern int DrawEOP(Draw);
109cddf8d76SBarry Smith 
110cddf8d76SBarry Smith typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
111d7e8b826SBarry Smith extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
1122bdab257SBarry Smith extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
11320563c6bSBarry Smith 
114ea06a074SBarry Smith extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
115d69bd51fSBarry Smith /*
116d69bd51fSBarry Smith     Routines for drawing X-Y axises in a Draw object
117d69bd51fSBarry Smith */
1186254e6afSSatish Balay typedef struct _p_DrawAxis* DrawAxis;
1196d4a8577SBarry Smith #define DRAWAXIS_COOKIE PETSC_COOKIE+16
120d7e8b826SBarry Smith extern int DrawAxisCreate(Draw,DrawAxis *);
121d7e8b826SBarry Smith extern int DrawAxisDestroy(DrawAxis);
122d7e8b826SBarry Smith extern int DrawAxisDraw(DrawAxis);
123d7e8b826SBarry Smith extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
124d7e8b826SBarry Smith extern int DrawAxisSetColors(DrawAxis,int,int,int);
125d7e8b826SBarry Smith extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
12620563c6bSBarry Smith 
127d69bd51fSBarry Smith /*
128d69bd51fSBarry Smith     Routines to draw line curves in X-Y space
129d69bd51fSBarry Smith */
1306254e6afSSatish Balay typedef struct _p_DrawLG*   DrawLG;
1316d4a8577SBarry Smith #define DRAWLG_COOKIE PETSC_COOKIE+7
132d7e8b826SBarry Smith extern int DrawLGCreate(Draw,int,DrawLG *);
133d7e8b826SBarry Smith extern int DrawLGDestroy(DrawLG);
134d7e8b826SBarry Smith extern int DrawLGAddPoint(DrawLG,double*,double*);
135d7e8b826SBarry Smith extern int DrawLGAddPoints(DrawLG,int,double**,double**);
136d7e8b826SBarry Smith extern int DrawLGDraw(DrawLG);
137d7e8b826SBarry Smith extern int DrawLGReset(DrawLG);
1385311e20fSBarry Smith extern int DrawLGSetDimension(DrawLG,int);
139d7e8b826SBarry Smith extern int DrawLGGetAxis(DrawLG,DrawAxis *);
140d7e8b826SBarry Smith extern int DrawLGGetDraw(DrawLG,Draw *);
141d7e8b826SBarry Smith extern int DrawLGIndicateDataPoints(DrawLG);
142d7e8b826SBarry Smith extern int DrawLGSetLimits(DrawLG,double,double,double,double);
14343e6b640SBarry Smith 
144d69bd51fSBarry Smith /*
145d69bd51fSBarry Smith     Routines to draw scatter plots in complex space
146d69bd51fSBarry Smith */
1476254e6afSSatish Balay typedef struct _p_DrawSP*   DrawSP;
148d4fbbf0eSBarry Smith #define DRAWSP_COOKIE PETSC_COOKIE+27
149d4fbbf0eSBarry Smith extern int DrawSPCreate(Draw,int,DrawSP *);
150d4fbbf0eSBarry Smith extern int DrawSPDestroy(DrawSP);
151d4fbbf0eSBarry Smith extern int DrawSPAddPoint(DrawSP,double*,double*);
152d4fbbf0eSBarry Smith extern int DrawSPAddPoints(DrawSP,int,double**,double**);
153d4fbbf0eSBarry Smith extern int DrawSPDraw(DrawSP);
154d4fbbf0eSBarry Smith extern int DrawSPReset(DrawSP);
155d4fbbf0eSBarry Smith extern int DrawSPSetDimension(DrawSP,int);
156d4fbbf0eSBarry Smith extern int DrawSPGetAxis(DrawSP,DrawAxis *);
157d4fbbf0eSBarry Smith extern int DrawSPGetDraw(DrawSP,Draw *);
158d4fbbf0eSBarry Smith extern int DrawSPSetLimits(DrawSP,double,double,double,double);
159d4fbbf0eSBarry Smith 
1603f1d51d7SBarry Smith /*
161ba6fa466SBarry Smith     Routines to draw histograms
162ba6fa466SBarry Smith */
163ba6fa466SBarry Smith typedef struct _p_DrawHist*   DrawHist;
164ba6fa466SBarry Smith extern int DrawHistCreate(Draw, int, DrawHist *);
165ba6fa466SBarry Smith extern int DrawHistDestroy(DrawHist);
166ba6fa466SBarry Smith extern int DrawHistAddValue(DrawHist, double);
167ba6fa466SBarry Smith extern int DrawHistDraw(DrawHist);
168ba6fa466SBarry Smith extern int DrawHistReset(DrawHist);
169ba6fa466SBarry Smith extern int DrawHistGetAxis(DrawHist, DrawAxis *);
170ba6fa466SBarry Smith extern int DrawHistGetDraw(DrawHist, Draw *);
171ba6fa466SBarry Smith extern int DrawHistSetLimits(DrawHist, double, double, int, int);
172ba6fa466SBarry Smith extern int DrawHistSetNumberBins(DrawHist, int);
173ba6fa466SBarry Smith extern int DrawHistSetColor(DrawHist,int);
174ba6fa466SBarry Smith 
175ba6fa466SBarry Smith /*
1763f1d51d7SBarry Smith     Viewer routines that allow you to access underlying Draw objects
1773f1d51d7SBarry Smith */
1783f1d51d7SBarry Smith extern int ViewerDrawGetDraw(Viewer, Draw*);
1795311e20fSBarry Smith extern int ViewerDrawGetDrawLG(Viewer, DrawLG*);
1803a40ed3dSBarry Smith extern int ViewerDrawGetDrawAxis(Viewer, DrawAxis*);
1815311e20fSBarry Smith 
182d557673fSLois Curfman McInnes /* Mesh management routines */
1836254e6afSSatish Balay typedef struct _p_DrawMesh* DrawMesh;
184d557673fSLois Curfman McInnes int DrawMeshCreate( DrawMesh *,
185d557673fSLois Curfman McInnes 		    double *, double *, double *,
186d557673fSLois Curfman McInnes 		    int, int, int, int, int, int, int, int, int,
187d557673fSLois Curfman McInnes 		    int, int, int, int, double *, int );
188d557673fSLois Curfman McInnes int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
189d557673fSLois Curfman McInnes 			  int, int, int, int, double *, int );
190d557673fSLois Curfman McInnes int DrawMeshDestroy( DrawMesh * );
191d557673fSLois Curfman McInnes 
192d557673fSLois Curfman McInnes /* Color spectrum managment */
193d557673fSLois Curfman McInnes typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *,
194d557673fSLois Curfman McInnes 				double * );
195d557673fSLois Curfman McInnes 
196d557673fSLois Curfman McInnes void *VRMLFindHue_setup( DrawMesh, int );
197d557673fSLois Curfman McInnes void VRMLFindHue( double, void *, int, double *, double *, double * );
198d557673fSLois Curfman McInnes void VRMLFindHue_destroy( void * );
199d557673fSLois Curfman McInnes void *VRMLGetHue_setup( DrawMesh, int );
200d557673fSLois Curfman McInnes void VRMLGetHue( double, void *, int, double *, double *, double * );
201d557673fSLois Curfman McInnes void VRMLGetHue_destroy( void * );
202d557673fSLois Curfman McInnes 
203d557673fSLois Curfman McInnes 
204d557673fSLois Curfman McInnes int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int );
205d557673fSLois Curfman McInnes int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int );
206d557673fSLois Curfman McInnes int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double,
207d557673fSLois Curfman McInnes 				int,int, VRMLGetHue_fcn, void *, int,double);
208d557673fSLois Curfman McInnes int DrawTensorSurface(Draw, DrawMesh, int);
209d557673fSLois Curfman McInnes /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */
210d557673fSLois Curfman McInnes 
21143e6b640SBarry Smith #endif
2123fdcb5c1SBarry Smith 
2133fdcb5c1SBarry Smith 
2143fdcb5c1SBarry Smith 
2153fdcb5c1SBarry Smith 
216