1*7b2a1423SBarry Smith /* $Id: draw.h,v 1.60 1998/12/03 04:07:00 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 */ 12*7b2a1423SBarry Smith #define DRAW_X "x" 13*7b2a1423SBarry Smith #define DRAW_NULL "null" 14*7b2a1423SBarry Smith #define DRAW_VRML "vrml" 15d6dfbf8fSBarry Smith 16783d1d5eSSatish Balay typedef struct _p_Draw* Draw; 1743e6b640SBarry Smith 18*7b2a1423SBarry Smith typedef char* DrawType; 19*7b2a1423SBarry Smith extern FList DrawList; 20*7b2a1423SBarry Smith extern int DrawRegisterAll(char *); 21*7b2a1423SBarry Smith extern int DrawRegisterDestroy(void); 22*7b2a1423SBarry Smith 23*7b2a1423SBarry Smith extern int DrawRegister_Private(char*,char*,char*,int(*)(Draw)); 24*7b2a1423SBarry Smith #if defined(USE_DYNAMIC_LIBRARIES) 25*7b2a1423SBarry Smith #define DrawRegister(a,b,c,d) DrawRegister_Private(a,b,c,0) 26*7b2a1423SBarry Smith #else 27*7b2a1423SBarry Smith #define DrawRegister(a,b,c,d) DrawRegister_Private(a,b,c,d) 28*7b2a1423SBarry Smith #endif 29*7b2a1423SBarry Smith extern int DrawGetType(Draw,DrawType*); 30*7b2a1423SBarry Smith extern int DrawSetType(Draw,DrawType); 31*7b2a1423SBarry Smith extern int DrawCreate(MPI_Comm,const char[],const char[],int,int,int,int,Draw*); 32*7b2a1423SBarry Smith extern int DrawSetFromOptions(Draw); 33*7b2a1423SBarry 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*); 77e26ad7d8SSatish Balay extern int DrawOpenVRML( MPI_Comm,const char[],const char[], Draw* ); 78e340e5c6SBarry Smith 79d7e8b826SBarry Smith extern int DrawOpenNull(MPI_Comm,Draw *); 80d7e8b826SBarry Smith extern int DrawDestroy(Draw); 8119bcc07fSBarry Smith extern int DrawIsNull(Draw,PetscTruth*); 8243e6b640SBarry Smith 83522c5e43SBarry Smith extern int DrawGetPopup(Draw,Draw*); 84d4fbbf0eSBarry Smith extern int DrawCheckResizedWindow(Draw); 85aa028dcaSBarry Smith extern int DrawResizeWindow(Draw,int,int); 86d4fbbf0eSBarry Smith 87df85ffc0SBarry Smith extern int DrawScalePopup(Draw,double min,double max); 885311e20fSBarry Smith 89d7e8b826SBarry Smith extern int DrawLine(Draw,double,double,double,double,int); 90d7e8b826SBarry Smith extern int DrawLineSetWidth(Draw,double); 919a28b0a6SLois Curfman McInnes extern int DrawLineGetWidth(Draw,double*); 9243e6b640SBarry Smith 93d7e8b826SBarry Smith extern int DrawPoint(Draw,double,double,int); 94d7e8b826SBarry Smith extern int DrawPointSetSize(Draw,double); 958ed539a5SBarry Smith 96d7e8b826SBarry Smith extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int); 97d7e8b826SBarry Smith extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int); 98c22c1629SBarry Smith extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*); 998ed539a5SBarry Smith 1007824c9abSSatish Balay extern int DrawString(Draw,double,double,int,char*); 1017824c9abSSatish Balay extern int DrawStringVertical(Draw,double,double,int,char*); 1027824c9abSSatish Balay extern int DrawStringSetSize(Draw,double,double); 1037824c9abSSatish Balay extern int DrawStringGetSize(Draw,double*,double*); 104d6dfbf8fSBarry Smith 105d7e8b826SBarry Smith extern int DrawSetViewPort(Draw,double,double,double,double); 1062bdab257SBarry Smith extern int DrawSplitViewPort(Draw); 1072bdab257SBarry Smith 108d7e8b826SBarry Smith extern int DrawSetCoordinates(Draw,double,double,double,double); 109d7e8b826SBarry Smith extern int DrawGetCoordinates(Draw,double*,double*,double*,double*); 1109e25ed09SBarry Smith 111d4fbbf0eSBarry Smith extern int DrawSetTitle(Draw,char *); 112d4fbbf0eSBarry Smith extern int DrawAppendTitle(Draw,char *); 113d4fbbf0eSBarry Smith extern int DrawGetTitle(Draw,char **); 114d4fbbf0eSBarry Smith 115d7e8b826SBarry Smith extern int DrawSetPause(Draw,int); 11677c4ece6SBarry Smith extern int DrawGetPause(Draw,int*); 11777c4ece6SBarry Smith extern int DrawPause(Draw); 118d7e8b826SBarry Smith extern int DrawSetDoubleBuffer(Draw); 119d7e8b826SBarry Smith extern int DrawFlush(Draw); 1202bdab257SBarry Smith extern int DrawSynchronizedFlush(Draw); 121d7e8b826SBarry Smith extern int DrawClear(Draw); 1222bdab257SBarry Smith extern int DrawSynchronizedClear(Draw); 123e340e5c6SBarry Smith extern int DrawBOP(Draw); 124e340e5c6SBarry Smith extern int DrawEOP(Draw); 125cddf8d76SBarry Smith 126cddf8d76SBarry Smith typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton; 127d7e8b826SBarry Smith extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 1282bdab257SBarry Smith extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 12920563c6bSBarry Smith 130ea06a074SBarry Smith extern int DrawZoom(Draw,int (*)(Draw,void *),void *); 131d69bd51fSBarry Smith /* 132d69bd51fSBarry Smith Routines for drawing X-Y axises in a Draw object 133d69bd51fSBarry Smith */ 1346254e6afSSatish Balay typedef struct _p_DrawAxis* DrawAxis; 1356d4a8577SBarry Smith #define DRAWAXIS_COOKIE PETSC_COOKIE+16 136d7e8b826SBarry Smith extern int DrawAxisCreate(Draw,DrawAxis *); 137d7e8b826SBarry Smith extern int DrawAxisDestroy(DrawAxis); 138d7e8b826SBarry Smith extern int DrawAxisDraw(DrawAxis); 139d7e8b826SBarry Smith extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 140d7e8b826SBarry Smith extern int DrawAxisSetColors(DrawAxis,int,int,int); 141d7e8b826SBarry Smith extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 14220563c6bSBarry Smith 143d69bd51fSBarry Smith /* 144d69bd51fSBarry Smith Routines to draw line curves in X-Y space 145d69bd51fSBarry Smith */ 1466254e6afSSatish Balay typedef struct _p_DrawLG* DrawLG; 1476d4a8577SBarry Smith #define DRAWLG_COOKIE PETSC_COOKIE+7 148d7e8b826SBarry Smith extern int DrawLGCreate(Draw,int,DrawLG *); 149d7e8b826SBarry Smith extern int DrawLGDestroy(DrawLG); 150d7e8b826SBarry Smith extern int DrawLGAddPoint(DrawLG,double*,double*); 151d7e8b826SBarry Smith extern int DrawLGAddPoints(DrawLG,int,double**,double**); 152d7e8b826SBarry Smith extern int DrawLGDraw(DrawLG); 153d7e8b826SBarry Smith extern int DrawLGReset(DrawLG); 1545311e20fSBarry Smith extern int DrawLGSetDimension(DrawLG,int); 155d7e8b826SBarry Smith extern int DrawLGGetAxis(DrawLG,DrawAxis *); 156d7e8b826SBarry Smith extern int DrawLGGetDraw(DrawLG,Draw *); 157d7e8b826SBarry Smith extern int DrawLGIndicateDataPoints(DrawLG); 158d7e8b826SBarry Smith extern int DrawLGSetLimits(DrawLG,double,double,double,double); 15943e6b640SBarry Smith 160d69bd51fSBarry Smith /* 161d69bd51fSBarry Smith Routines to draw scatter plots in complex space 162d69bd51fSBarry Smith */ 1636254e6afSSatish Balay typedef struct _p_DrawSP* DrawSP; 164d4fbbf0eSBarry Smith #define DRAWSP_COOKIE PETSC_COOKIE+27 165d4fbbf0eSBarry Smith extern int DrawSPCreate(Draw,int,DrawSP *); 166d4fbbf0eSBarry Smith extern int DrawSPDestroy(DrawSP); 167d4fbbf0eSBarry Smith extern int DrawSPAddPoint(DrawSP,double*,double*); 168d4fbbf0eSBarry Smith extern int DrawSPAddPoints(DrawSP,int,double**,double**); 169d4fbbf0eSBarry Smith extern int DrawSPDraw(DrawSP); 170d4fbbf0eSBarry Smith extern int DrawSPReset(DrawSP); 171d4fbbf0eSBarry Smith extern int DrawSPSetDimension(DrawSP,int); 172d4fbbf0eSBarry Smith extern int DrawSPGetAxis(DrawSP,DrawAxis *); 173d4fbbf0eSBarry Smith extern int DrawSPGetDraw(DrawSP,Draw *); 174d4fbbf0eSBarry Smith extern int DrawSPSetLimits(DrawSP,double,double,double,double); 175d4fbbf0eSBarry Smith 1763f1d51d7SBarry Smith /* 177ba6fa466SBarry Smith Routines to draw histograms 178ba6fa466SBarry Smith */ 179ba6fa466SBarry Smith typedef struct _p_DrawHist* DrawHist; 180ba6fa466SBarry Smith extern int DrawHistCreate(Draw, int, DrawHist *); 181ba6fa466SBarry Smith extern int DrawHistDestroy(DrawHist); 182ba6fa466SBarry Smith extern int DrawHistAddValue(DrawHist, double); 183ba6fa466SBarry Smith extern int DrawHistDraw(DrawHist); 184ba6fa466SBarry Smith extern int DrawHistReset(DrawHist); 185ba6fa466SBarry Smith extern int DrawHistGetAxis(DrawHist, DrawAxis *); 186ba6fa466SBarry Smith extern int DrawHistGetDraw(DrawHist, Draw *); 187ba6fa466SBarry Smith extern int DrawHistSetLimits(DrawHist, double, double, int, int); 188ba6fa466SBarry Smith extern int DrawHistSetNumberBins(DrawHist, int); 189ba6fa466SBarry Smith extern int DrawHistSetColor(DrawHist,int); 190ba6fa466SBarry Smith 191ba6fa466SBarry Smith /* 1923f1d51d7SBarry Smith Viewer routines that allow you to access underlying Draw objects 1933f1d51d7SBarry Smith */ 19477ed5343SBarry Smith extern int ViewerDrawGetDraw(Viewer,int, Draw*); 19577ed5343SBarry Smith extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*); 19677ed5343SBarry Smith extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*); 1975311e20fSBarry Smith 198d557673fSLois Curfman McInnes /* Mesh management routines */ 1996254e6afSSatish Balay typedef struct _p_DrawMesh* DrawMesh; 200d557673fSLois Curfman McInnes int DrawMeshCreate( DrawMesh *, 201d557673fSLois Curfman McInnes double *, double *, double *, 202d557673fSLois Curfman McInnes int, int, int, int, int, int, int, int, int, 203d557673fSLois Curfman McInnes int, int, int, int, double *, int ); 204d557673fSLois Curfman McInnes int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *, 205d557673fSLois Curfman McInnes int, int, int, int, double *, int ); 206d557673fSLois Curfman McInnes int DrawMeshDestroy( DrawMesh * ); 207d557673fSLois Curfman McInnes 208d557673fSLois Curfman McInnes /* Color spectrum managment */ 209d557673fSLois Curfman McInnes typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *, 210d557673fSLois Curfman McInnes double * ); 211d557673fSLois Curfman McInnes 212d557673fSLois Curfman McInnes void *VRMLFindHue_setup( DrawMesh, int ); 213d557673fSLois Curfman McInnes void VRMLFindHue( double, void *, int, double *, double *, double * ); 214d557673fSLois Curfman McInnes void VRMLFindHue_destroy( void * ); 215d557673fSLois Curfman McInnes void *VRMLGetHue_setup( DrawMesh, int ); 216d557673fSLois Curfman McInnes void VRMLGetHue( double, void *, int, double *, double *, double * ); 217d557673fSLois Curfman McInnes void VRMLGetHue_destroy( void * ); 218d557673fSLois Curfman McInnes 219d557673fSLois Curfman McInnes 220d557673fSLois Curfman McInnes int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int ); 221d557673fSLois Curfman McInnes int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int ); 222d557673fSLois Curfman McInnes int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double, 223d557673fSLois Curfman McInnes int,int, VRMLGetHue_fcn, void *, int,double); 224d557673fSLois Curfman McInnes int DrawTensorSurface(Draw, DrawMesh, int); 225d557673fSLois Curfman McInnes /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */ 226d557673fSLois Curfman McInnes 22743e6b640SBarry Smith #endif 2283fdcb5c1SBarry Smith 2293fdcb5c1SBarry Smith 2303fdcb5c1SBarry Smith 2313fdcb5c1SBarry Smith 232*7b2a1423SBarry Smith 233