1*0a835dfdSSatish Balay /* $Id: petscdraw.h,v 1.70 2000/01/11 21:04:04 bsmith Exp balay $ */ 243e6b640SBarry Smith /* 33fdcb5c1SBarry Smith Interface to the PETSc graphics (currently only support for X-windows 443e6b640SBarry Smith */ 5*0a835dfdSSatish Balay #if !defined(__PETSCDRAW_H) 6*0a835dfdSSatish Balay #define __PETSCDRAW_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" 147c922b88SBarry Smith #define DRAW_PS "ps" 15d6dfbf8fSBarry Smith 16783d1d5eSSatish Balay typedef struct _p_Draw* Draw; 1743e6b640SBarry Smith 187b2a1423SBarry Smith typedef char* DrawType; 197b2a1423SBarry Smith extern FList DrawList; 207b2a1423SBarry Smith extern int DrawRegisterAll(char *); 217b2a1423SBarry Smith extern int DrawRegisterDestroy(void); 227b2a1423SBarry Smith 23f1af5d2fSBarry Smith extern int DrawRegister(char*,char*,char*,int(*)(Draw)); 24aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 25f1af5d2fSBarry Smith #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,0) 267b2a1423SBarry Smith #else 27f1af5d2fSBarry Smith #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,d) 287b2a1423SBarry Smith #endif 297b2a1423SBarry Smith extern int DrawGetType(Draw,DrawType*); 307b2a1423SBarry Smith extern int DrawSetType(Draw,DrawType); 317b2a1423SBarry Smith extern int DrawCreate(MPI_Comm,const char[],const char[],int,int,int,int,Draw*); 327b2a1423SBarry Smith extern int DrawSetFromOptions(Draw); 337b2a1423SBarry Smith 340752156aSBarry Smith /* 350752156aSBarry Smith Number of basic colors in the draw routines, the others are used 360752156aSBarry Smith for a uniform colormap. 370752156aSBarry Smith */ 380752156aSBarry Smith #define DRAW_BASIC_COLORS 32 390752156aSBarry Smith 40ba6fa466SBarry Smith #define DRAW_ROTATE -1 /* will rotate through the colors, start with 2 */ 4120563c6bSBarry Smith #define DRAW_WHITE 0 4220563c6bSBarry Smith #define DRAW_BLACK 1 4320563c6bSBarry Smith #define DRAW_RED 2 44f8d5e24aSBarry Smith #define DRAW_GREEN 3 45f8d5e24aSBarry Smith #define DRAW_CYAN 4 46f8d5e24aSBarry Smith #define DRAW_BLUE 5 47f8d5e24aSBarry Smith #define DRAW_MAGENTA 6 48f8d5e24aSBarry Smith #define DRAW_AQUAMARINE 7 49f8d5e24aSBarry Smith #define DRAW_FORESTGREEN 8 50f8d5e24aSBarry Smith #define DRAW_ORANGE 9 51f8d5e24aSBarry Smith #define DRAW_VIOLET 10 52f8d5e24aSBarry Smith #define DRAW_BROWN 11 53f8d5e24aSBarry Smith #define DRAW_PINK 12 54f8d5e24aSBarry Smith #define DRAW_CORAL 13 55f8d5e24aSBarry Smith #define DRAW_GRAY 14 56f8d5e24aSBarry Smith #define DRAW_YELLOW 15 5720563c6bSBarry Smith 580752156aSBarry Smith #define DRAW_GOLD 16 590752156aSBarry Smith #define DRAW_LIGHTPINK 17 600752156aSBarry Smith #define DRAW_MEDIUMTURQUOISE 18 610752156aSBarry Smith #define DRAW_KHAKI 19 620752156aSBarry Smith #define DRAW_DIMGRAY 20 630752156aSBarry Smith #define DRAW_YELLOWGREEN 21 640752156aSBarry Smith #define DRAW_SKYBLUE 22 650752156aSBarry Smith #define DRAW_DARKGREEN 23 660752156aSBarry Smith #define DRAW_NAVYBLUE 24 670752156aSBarry Smith #define DRAW_SANDYBROWN 25 680752156aSBarry Smith #define DRAW_CADETBLUE 26 690752156aSBarry Smith #define DRAW_POWDERBLUE 27 700752156aSBarry Smith #define DRAW_DEEPPINK 28 710752156aSBarry Smith #define DRAW_THISTLE 29 720752156aSBarry Smith #define DRAW_LIMEGREEN 30 730752156aSBarry Smith #define DRAW_LAVENDERBLUSH 31 740752156aSBarry Smith 750752156aSBarry Smith 76e26ad7d8SSatish Balay extern int DrawOpenX(MPI_Comm,const char[],const char[],int,int,int,int,Draw*); 777c922b88SBarry Smith extern int DrawOpenPS(MPI_Comm,char *,Draw *); 78f1af5d2fSBarry Smith #define DRAW_FULL_SIZE -3 79f1af5d2fSBarry Smith #define DRAW_HALF_SIZE -4 80f1af5d2fSBarry Smith #define DRAW_THIRD_SIZE -5 81f1af5d2fSBarry Smith #define DRAW_QUARTER_SIZE -6 82e340e5c6SBarry Smith 83d7e8b826SBarry Smith extern int DrawOpenNull(MPI_Comm,Draw *); 84d7e8b826SBarry Smith extern int DrawDestroy(Draw); 8519bcc07fSBarry Smith extern int DrawIsNull(Draw,PetscTruth*); 8643e6b640SBarry Smith 87522c5e43SBarry Smith extern int DrawGetPopup(Draw,Draw*); 88d4fbbf0eSBarry Smith extern int DrawCheckResizedWindow(Draw); 89aa028dcaSBarry Smith extern int DrawResizeWindow(Draw,int,int); 90d4fbbf0eSBarry Smith 91df85ffc0SBarry Smith extern int DrawScalePopup(Draw,double min,double max); 925311e20fSBarry Smith 93d7e8b826SBarry Smith extern int DrawLine(Draw,double,double,double,double,int); 94d7e8b826SBarry Smith extern int DrawLineSetWidth(Draw,double); 959a28b0a6SLois Curfman McInnes extern int DrawLineGetWidth(Draw,double*); 9643e6b640SBarry Smith 97d7e8b826SBarry Smith extern int DrawPoint(Draw,double,double,int); 98d7e8b826SBarry Smith extern int DrawPointSetSize(Draw,double); 998ed539a5SBarry Smith 100d7e8b826SBarry Smith extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int); 101d7e8b826SBarry Smith extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int); 102c22c1629SBarry Smith extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*); 103d038840dSBarry Smith extern int DrawTensorContour(Draw,int,int,const double[],const double[],Scalar *); 1048ed539a5SBarry Smith 1057824c9abSSatish Balay extern int DrawString(Draw,double,double,int,char*); 1067824c9abSSatish Balay extern int DrawStringVertical(Draw,double,double,int,char*); 1077824c9abSSatish Balay extern int DrawStringSetSize(Draw,double,double); 1087824c9abSSatish Balay extern int DrawStringGetSize(Draw,double*,double*); 109d6dfbf8fSBarry Smith 110d7e8b826SBarry Smith extern int DrawSetViewPort(Draw,double,double,double,double); 1112bdab257SBarry Smith extern int DrawSplitViewPort(Draw); 1122bdab257SBarry Smith 113d7e8b826SBarry Smith extern int DrawSetCoordinates(Draw,double,double,double,double); 114d7e8b826SBarry Smith extern int DrawGetCoordinates(Draw,double*,double*,double*,double*); 1159e25ed09SBarry Smith 116d4fbbf0eSBarry Smith extern int DrawSetTitle(Draw,char *); 117d4fbbf0eSBarry Smith extern int DrawAppendTitle(Draw,char *); 118d4fbbf0eSBarry Smith extern int DrawGetTitle(Draw,char **); 119d4fbbf0eSBarry Smith 120d7e8b826SBarry Smith extern int DrawSetPause(Draw,int); 12177c4ece6SBarry Smith extern int DrawGetPause(Draw,int*); 12277c4ece6SBarry Smith extern int DrawPause(Draw); 123d7e8b826SBarry Smith extern int DrawSetDoubleBuffer(Draw); 124d7e8b826SBarry Smith extern int DrawFlush(Draw); 1252bdab257SBarry Smith extern int DrawSynchronizedFlush(Draw); 126d7e8b826SBarry Smith extern int DrawClear(Draw); 1272bdab257SBarry Smith extern int DrawSynchronizedClear(Draw); 128e340e5c6SBarry Smith extern int DrawBOP(Draw); 129e340e5c6SBarry Smith extern int DrawEOP(Draw); 130cddf8d76SBarry Smith 1316831982aSBarry Smith extern int DrawGetSingleton(Draw,Draw*); 1326831982aSBarry Smith extern int DrawRestoreSingleton(Draw,Draw*); 1336831982aSBarry Smith 134cddf8d76SBarry Smith typedef enum {BUTTON_NONE,BUTTON_LEFT,BUTTON_CENTER,BUTTON_RIGHT } DrawButton; 135d7e8b826SBarry Smith extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 1362bdab257SBarry Smith extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 13720563c6bSBarry Smith 138ea06a074SBarry Smith extern int DrawZoom(Draw,int (*)(Draw,void *),void *); 1397c922b88SBarry Smith 1407c922b88SBarry Smith /* Allows one to maintain a subset of viewports for a single window */ 1417c922b88SBarry Smith typedef struct { 1427c922b88SBarry Smith int nports; 1437c922b88SBarry Smith double *xl,*xr,*yl,*yr; 1447c922b88SBarry Smith Draw draw; 1457c922b88SBarry Smith } DrawViewPorts; 1467c922b88SBarry Smith extern int DrawViewPortsCreate(Draw,int,DrawViewPorts**); 1477c922b88SBarry Smith extern int DrawViewPortsDestroy(DrawViewPorts*); 1487c922b88SBarry Smith extern int DrawViewPortsSet(DrawViewPorts*,int); 1497c922b88SBarry Smith 150d69bd51fSBarry Smith /* 151d69bd51fSBarry Smith Routines for drawing X-Y axises in a Draw object 152d69bd51fSBarry Smith */ 1536254e6afSSatish Balay typedef struct _p_DrawAxis* DrawAxis; 1546d4a8577SBarry Smith #define DRAWAXIS_COOKIE PETSC_COOKIE+16 155d7e8b826SBarry Smith extern int DrawAxisCreate(Draw,DrawAxis *); 156d7e8b826SBarry Smith extern int DrawAxisDestroy(DrawAxis); 157d7e8b826SBarry Smith extern int DrawAxisDraw(DrawAxis); 158d7e8b826SBarry Smith extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 159d7e8b826SBarry Smith extern int DrawAxisSetColors(DrawAxis,int,int,int); 160d7e8b826SBarry Smith extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 16120563c6bSBarry Smith 162d69bd51fSBarry Smith /* 163d69bd51fSBarry Smith Routines to draw line curves in X-Y space 164d69bd51fSBarry Smith */ 1656254e6afSSatish Balay typedef struct _p_DrawLG* DrawLG; 1666d4a8577SBarry Smith #define DRAWLG_COOKIE PETSC_COOKIE+7 167d7e8b826SBarry Smith extern int DrawLGCreate(Draw,int,DrawLG *); 168d7e8b826SBarry Smith extern int DrawLGDestroy(DrawLG); 169d7e8b826SBarry Smith extern int DrawLGAddPoint(DrawLG,double*,double*); 170d7e8b826SBarry Smith extern int DrawLGAddPoints(DrawLG,int,double**,double**); 171d7e8b826SBarry Smith extern int DrawLGDraw(DrawLG); 172d7e8b826SBarry Smith extern int DrawLGReset(DrawLG); 1735311e20fSBarry Smith extern int DrawLGSetDimension(DrawLG,int); 174d7e8b826SBarry Smith extern int DrawLGGetAxis(DrawLG,DrawAxis *); 175d7e8b826SBarry Smith extern int DrawLGGetDraw(DrawLG,Draw *); 176d7e8b826SBarry Smith extern int DrawLGIndicateDataPoints(DrawLG); 177d7e8b826SBarry Smith extern int DrawLGSetLimits(DrawLG,double,double,double,double); 17843e6b640SBarry Smith 179d69bd51fSBarry Smith /* 180d69bd51fSBarry Smith Routines to draw scatter plots in complex space 181d69bd51fSBarry Smith */ 1826254e6afSSatish Balay typedef struct _p_DrawSP* DrawSP; 183d4fbbf0eSBarry Smith #define DRAWSP_COOKIE PETSC_COOKIE+27 184d4fbbf0eSBarry Smith extern int DrawSPCreate(Draw,int,DrawSP *); 185d4fbbf0eSBarry Smith extern int DrawSPDestroy(DrawSP); 186d4fbbf0eSBarry Smith extern int DrawSPAddPoint(DrawSP,double*,double*); 187d4fbbf0eSBarry Smith extern int DrawSPAddPoints(DrawSP,int,double**,double**); 188d4fbbf0eSBarry Smith extern int DrawSPDraw(DrawSP); 189d4fbbf0eSBarry Smith extern int DrawSPReset(DrawSP); 190d4fbbf0eSBarry Smith extern int DrawSPSetDimension(DrawSP,int); 191d4fbbf0eSBarry Smith extern int DrawSPGetAxis(DrawSP,DrawAxis *); 192d4fbbf0eSBarry Smith extern int DrawSPGetDraw(DrawSP,Draw *); 193d4fbbf0eSBarry Smith extern int DrawSPSetLimits(DrawSP,double,double,double,double); 194d4fbbf0eSBarry Smith 1953f1d51d7SBarry Smith /* 196ba6fa466SBarry Smith Routines to draw histograms 197ba6fa466SBarry Smith */ 198329f5518SBarry Smith typedef struct _p_DrawHG* DrawHG; 199329f5518SBarry Smith #define DRAWHG_COOKIE PETSC_COOKIE+15 200329f5518SBarry Smith extern int DrawHGCreate(Draw,int,DrawHG *); 201329f5518SBarry Smith extern int DrawHGDestroy(DrawHG); 202329f5518SBarry Smith extern int DrawHGAddValue(DrawHG,double); 203329f5518SBarry Smith extern int DrawHGDraw(DrawHG); 204329f5518SBarry Smith extern int DrawHGReset(DrawHG); 205329f5518SBarry Smith extern int DrawHGGetAxis(DrawHG,DrawAxis *); 206329f5518SBarry Smith extern int DrawHGGetDraw(DrawHG,Draw *); 207329f5518SBarry Smith extern int DrawHGSetLimits(DrawHG,double,double,int,int); 208329f5518SBarry Smith extern int DrawHGSetNumberBins(DrawHG,int); 209329f5518SBarry Smith extern int DrawHGSetColor(DrawHG,int); 210ba6fa466SBarry Smith 211ba6fa466SBarry Smith /* 2123f1d51d7SBarry Smith Viewer routines that allow you to access underlying Draw objects 2133f1d51d7SBarry Smith */ 21477ed5343SBarry Smith extern int ViewerDrawGetDraw(Viewer,int,Draw*); 21577ed5343SBarry Smith extern int ViewerDrawGetDrawLG(Viewer,int,DrawLG*); 21677ed5343SBarry Smith extern int ViewerDrawGetDrawAxis(Viewer,int,DrawAxis*); 2175311e20fSBarry Smith 2187c922b88SBarry Smith extern int DrawUtilitySetCmapHue(unsigned char *,unsigned char *,unsigned char *,int); 2197c922b88SBarry Smith extern int DrawUtilitySetGamma(double); 2207c922b88SBarry Smith 221d557673fSLois Curfman McInnes /* Mesh management routines */ 2226254e6afSSatish Balay typedef struct _p_DrawMesh* DrawMesh; 223d557673fSLois Curfman McInnes int DrawMeshCreate(DrawMesh *, 224d557673fSLois Curfman McInnes double *,double *,double *, 225d557673fSLois Curfman McInnes int,int,int,int,int,int,int,int,int, 226d557673fSLois Curfman McInnes int,int,int,int,double *,int); 227d557673fSLois Curfman McInnes int DrawMeshCreateSimple(DrawMesh *,double *,double *,double *, 228d557673fSLois Curfman McInnes int,int,int,int,double *,int); 229d557673fSLois Curfman McInnes int DrawMeshDestroy(DrawMesh *); 230d557673fSLois Curfman McInnes 231d557673fSLois Curfman McInnes 232d557673fSLois Curfman McInnes 233d557673fSLois Curfman McInnes 23443e6b640SBarry Smith #endif 2353fdcb5c1SBarry Smith 2363fdcb5c1SBarry Smith 2373fdcb5c1SBarry Smith 2383fdcb5c1SBarry Smith 2397b2a1423SBarry Smith 240