1*f1af5d2fSBarry Smith /* $Id: draw.h,v 1.67 1999/10/23 00:02:04 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 22*f1af5d2fSBarry Smith extern int DrawRegister(char*,char*,char*,int(*)(Draw)); 23aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 24*f1af5d2fSBarry Smith #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,0) 257b2a1423SBarry Smith #else 26*f1af5d2fSBarry Smith #define DrawRegisterDynamic(a,b,c,d) DrawRegister(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*); 76*f1af5d2fSBarry Smith #define DRAW_FULL_SIZE -3 77*f1af5d2fSBarry Smith #define DRAW_HALF_SIZE -4 78*f1af5d2fSBarry Smith #define DRAW_THIRD_SIZE -5 79*f1af5d2fSBarry Smith #define DRAW_QUARTER_SIZE -6 80e340e5c6SBarry Smith 81d7e8b826SBarry Smith extern int DrawOpenNull(MPI_Comm,Draw *); 82d7e8b826SBarry Smith extern int DrawDestroy(Draw); 8319bcc07fSBarry Smith extern int DrawIsNull(Draw,PetscTruth*); 8443e6b640SBarry Smith 85522c5e43SBarry Smith extern int DrawGetPopup(Draw,Draw*); 86d4fbbf0eSBarry Smith extern int DrawCheckResizedWindow(Draw); 87aa028dcaSBarry Smith extern int DrawResizeWindow(Draw,int,int); 88d4fbbf0eSBarry Smith 89df85ffc0SBarry Smith extern int DrawScalePopup(Draw,double min,double max); 905311e20fSBarry Smith 91d7e8b826SBarry Smith extern int DrawLine(Draw,double,double,double,double,int); 92d7e8b826SBarry Smith extern int DrawLineSetWidth(Draw,double); 939a28b0a6SLois Curfman McInnes extern int DrawLineGetWidth(Draw,double*); 9443e6b640SBarry Smith 95d7e8b826SBarry Smith extern int DrawPoint(Draw,double,double,int); 96d7e8b826SBarry Smith extern int DrawPointSetSize(Draw,double); 978ed539a5SBarry Smith 98d7e8b826SBarry Smith extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int); 99d7e8b826SBarry Smith extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int); 100c22c1629SBarry Smith extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*); 101d038840dSBarry Smith extern int DrawTensorContour(Draw,int,int,const double[],const double[],Scalar *); 1028ed539a5SBarry Smith 1037824c9abSSatish Balay extern int DrawString(Draw,double,double,int,char*); 1047824c9abSSatish Balay extern int DrawStringVertical(Draw,double,double,int,char*); 1057824c9abSSatish Balay extern int DrawStringSetSize(Draw,double,double); 1067824c9abSSatish Balay extern int DrawStringGetSize(Draw,double*,double*); 107d6dfbf8fSBarry Smith 108d7e8b826SBarry Smith extern int DrawSetViewPort(Draw,double,double,double,double); 1092bdab257SBarry Smith extern int DrawSplitViewPort(Draw); 1102bdab257SBarry Smith 111d7e8b826SBarry Smith extern int DrawSetCoordinates(Draw,double,double,double,double); 112d7e8b826SBarry Smith extern int DrawGetCoordinates(Draw,double*,double*,double*,double*); 1139e25ed09SBarry Smith 114d4fbbf0eSBarry Smith extern int DrawSetTitle(Draw,char *); 115d4fbbf0eSBarry Smith extern int DrawAppendTitle(Draw,char *); 116d4fbbf0eSBarry Smith extern int DrawGetTitle(Draw,char **); 117d4fbbf0eSBarry Smith 118d7e8b826SBarry Smith extern int DrawSetPause(Draw,int); 11977c4ece6SBarry Smith extern int DrawGetPause(Draw,int*); 12077c4ece6SBarry Smith extern int DrawPause(Draw); 121d7e8b826SBarry Smith extern int DrawSetDoubleBuffer(Draw); 122d7e8b826SBarry Smith extern int DrawFlush(Draw); 1232bdab257SBarry Smith extern int DrawSynchronizedFlush(Draw); 124d7e8b826SBarry Smith extern int DrawClear(Draw); 1252bdab257SBarry Smith extern int DrawSynchronizedClear(Draw); 126e340e5c6SBarry Smith extern int DrawBOP(Draw); 127e340e5c6SBarry Smith extern int DrawEOP(Draw); 128cddf8d76SBarry Smith 1296831982aSBarry Smith extern int DrawGetSingleton(Draw,Draw*); 1306831982aSBarry Smith extern int DrawRestoreSingleton(Draw,Draw*); 1316831982aSBarry Smith 132cddf8d76SBarry Smith typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton; 133d7e8b826SBarry Smith extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 1342bdab257SBarry Smith extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 13520563c6bSBarry Smith 136ea06a074SBarry Smith extern int DrawZoom(Draw,int (*)(Draw,void *),void *); 137d69bd51fSBarry Smith /* 138d69bd51fSBarry Smith Routines for drawing X-Y axises in a Draw object 139d69bd51fSBarry Smith */ 1406254e6afSSatish Balay typedef struct _p_DrawAxis* DrawAxis; 1416d4a8577SBarry Smith #define DRAWAXIS_COOKIE PETSC_COOKIE+16 142d7e8b826SBarry Smith extern int DrawAxisCreate(Draw,DrawAxis *); 143d7e8b826SBarry Smith extern int DrawAxisDestroy(DrawAxis); 144d7e8b826SBarry Smith extern int DrawAxisDraw(DrawAxis); 145d7e8b826SBarry Smith extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 146d7e8b826SBarry Smith extern int DrawAxisSetColors(DrawAxis,int,int,int); 147d7e8b826SBarry Smith extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 14820563c6bSBarry Smith 149d69bd51fSBarry Smith /* 150d69bd51fSBarry Smith Routines to draw line curves in X-Y space 151d69bd51fSBarry Smith */ 1526254e6afSSatish Balay typedef struct _p_DrawLG* DrawLG; 1536d4a8577SBarry Smith #define DRAWLG_COOKIE PETSC_COOKIE+7 154d7e8b826SBarry Smith extern int DrawLGCreate(Draw,int,DrawLG *); 155d7e8b826SBarry Smith extern int DrawLGDestroy(DrawLG); 156d7e8b826SBarry Smith extern int DrawLGAddPoint(DrawLG,double*,double*); 157d7e8b826SBarry Smith extern int DrawLGAddPoints(DrawLG,int,double**,double**); 158d7e8b826SBarry Smith extern int DrawLGDraw(DrawLG); 159d7e8b826SBarry Smith extern int DrawLGReset(DrawLG); 1605311e20fSBarry Smith extern int DrawLGSetDimension(DrawLG,int); 161d7e8b826SBarry Smith extern int DrawLGGetAxis(DrawLG,DrawAxis *); 162d7e8b826SBarry Smith extern int DrawLGGetDraw(DrawLG,Draw *); 163d7e8b826SBarry Smith extern int DrawLGIndicateDataPoints(DrawLG); 164d7e8b826SBarry Smith extern int DrawLGSetLimits(DrawLG,double,double,double,double); 16543e6b640SBarry Smith 166d69bd51fSBarry Smith /* 167d69bd51fSBarry Smith Routines to draw scatter plots in complex space 168d69bd51fSBarry Smith */ 1696254e6afSSatish Balay typedef struct _p_DrawSP* DrawSP; 170d4fbbf0eSBarry Smith #define DRAWSP_COOKIE PETSC_COOKIE+27 171d4fbbf0eSBarry Smith extern int DrawSPCreate(Draw,int,DrawSP *); 172d4fbbf0eSBarry Smith extern int DrawSPDestroy(DrawSP); 173d4fbbf0eSBarry Smith extern int DrawSPAddPoint(DrawSP,double*,double*); 174d4fbbf0eSBarry Smith extern int DrawSPAddPoints(DrawSP,int,double**,double**); 175d4fbbf0eSBarry Smith extern int DrawSPDraw(DrawSP); 176d4fbbf0eSBarry Smith extern int DrawSPReset(DrawSP); 177d4fbbf0eSBarry Smith extern int DrawSPSetDimension(DrawSP,int); 178d4fbbf0eSBarry Smith extern int DrawSPGetAxis(DrawSP,DrawAxis *); 179d4fbbf0eSBarry Smith extern int DrawSPGetDraw(DrawSP,Draw *); 180d4fbbf0eSBarry Smith extern int DrawSPSetLimits(DrawSP,double,double,double,double); 181d4fbbf0eSBarry Smith 1823f1d51d7SBarry Smith /* 183ba6fa466SBarry Smith Routines to draw histograms 184ba6fa466SBarry Smith */ 185ba6fa466SBarry Smith typedef struct _p_DrawHist* DrawHist; 1860f5bd95cSBarry Smith #define DRAWHIST_COOKIE PETSC_COOKIE+15 187ba6fa466SBarry Smith extern int DrawHistCreate(Draw, int, DrawHist *); 188ba6fa466SBarry Smith extern int DrawHistDestroy(DrawHist); 189ba6fa466SBarry Smith extern int DrawHistAddValue(DrawHist, double); 190ba6fa466SBarry Smith extern int DrawHistDraw(DrawHist); 191ba6fa466SBarry Smith extern int DrawHistReset(DrawHist); 192ba6fa466SBarry Smith extern int DrawHistGetAxis(DrawHist, DrawAxis *); 193ba6fa466SBarry Smith extern int DrawHistGetDraw(DrawHist, Draw *); 194ba6fa466SBarry Smith extern int DrawHistSetLimits(DrawHist, double, double, int, int); 195ba6fa466SBarry Smith extern int DrawHistSetNumberBins(DrawHist, int); 196ba6fa466SBarry Smith extern int DrawHistSetColor(DrawHist,int); 197ba6fa466SBarry Smith 198ba6fa466SBarry Smith /* 1993f1d51d7SBarry Smith Viewer routines that allow you to access underlying Draw objects 2003f1d51d7SBarry Smith */ 20177ed5343SBarry Smith extern int ViewerDrawGetDraw(Viewer,int, Draw*); 20277ed5343SBarry Smith extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*); 20377ed5343SBarry Smith extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*); 2045311e20fSBarry Smith 205d557673fSLois Curfman McInnes /* Mesh management routines */ 2066254e6afSSatish Balay typedef struct _p_DrawMesh* DrawMesh; 207d557673fSLois Curfman McInnes int DrawMeshCreate( DrawMesh *, 208d557673fSLois Curfman McInnes double *, double *, double *, 209d557673fSLois Curfman McInnes int, int, int, int, int, int, int, int, int, 210d557673fSLois Curfman McInnes int, int, int, int, double *, int ); 211d557673fSLois Curfman McInnes int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *, 212d557673fSLois Curfman McInnes int, int, int, int, double *, int ); 213d557673fSLois Curfman McInnes int DrawMeshDestroy( DrawMesh * ); 214d557673fSLois Curfman McInnes 215d557673fSLois Curfman McInnes 216d557673fSLois Curfman McInnes 217d557673fSLois Curfman McInnes 21843e6b640SBarry Smith #endif 2193fdcb5c1SBarry Smith 2203fdcb5c1SBarry Smith 2213fdcb5c1SBarry Smith 2223fdcb5c1SBarry Smith 2237b2a1423SBarry Smith 224