1 /* $Id: petscdraw.h,v 1.70 2000/01/11 21:04:04 bsmith Exp balay $ */ 2 /* 3 Interface to the PETSc graphics (currently only support for X-windows 4 */ 5 #if !defined(__PETSCDRAW_H) 6 #define __PETSCDRAW_H 7 #include "petsc.h" 8 9 #define DRAW_COOKIE PETSC_COOKIE+6 10 11 /* types of draw contexts */ 12 #define DRAW_X "x" 13 #define DRAW_NULL "null" 14 #define DRAW_PS "ps" 15 16 typedef struct _p_Draw* Draw; 17 18 typedef char* DrawType; 19 extern FList DrawList; 20 extern int DrawRegisterAll(char *); 21 extern int DrawRegisterDestroy(void); 22 23 extern int DrawRegister(char*,char*,char*,int(*)(Draw)); 24 #if defined(PETSC_USE_DYNAMIC_LIBRARIES) 25 #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,0) 26 #else 27 #define DrawRegisterDynamic(a,b,c,d) DrawRegister(a,b,c,d) 28 #endif 29 extern int DrawGetType(Draw,DrawType*); 30 extern int DrawSetType(Draw,DrawType); 31 extern int DrawCreate(MPI_Comm,const char[],const char[],int,int,int,int,Draw*); 32 extern int DrawSetFromOptions(Draw); 33 34 /* 35 Number of basic colors in the draw routines, the others are used 36 for a uniform colormap. 37 */ 38 #define DRAW_BASIC_COLORS 32 39 40 #define DRAW_ROTATE -1 /* will rotate through the colors, start with 2 */ 41 #define DRAW_WHITE 0 42 #define DRAW_BLACK 1 43 #define DRAW_RED 2 44 #define DRAW_GREEN 3 45 #define DRAW_CYAN 4 46 #define DRAW_BLUE 5 47 #define DRAW_MAGENTA 6 48 #define DRAW_AQUAMARINE 7 49 #define DRAW_FORESTGREEN 8 50 #define DRAW_ORANGE 9 51 #define DRAW_VIOLET 10 52 #define DRAW_BROWN 11 53 #define DRAW_PINK 12 54 #define DRAW_CORAL 13 55 #define DRAW_GRAY 14 56 #define DRAW_YELLOW 15 57 58 #define DRAW_GOLD 16 59 #define DRAW_LIGHTPINK 17 60 #define DRAW_MEDIUMTURQUOISE 18 61 #define DRAW_KHAKI 19 62 #define DRAW_DIMGRAY 20 63 #define DRAW_YELLOWGREEN 21 64 #define DRAW_SKYBLUE 22 65 #define DRAW_DARKGREEN 23 66 #define DRAW_NAVYBLUE 24 67 #define DRAW_SANDYBROWN 25 68 #define DRAW_CADETBLUE 26 69 #define DRAW_POWDERBLUE 27 70 #define DRAW_DEEPPINK 28 71 #define DRAW_THISTLE 29 72 #define DRAW_LIMEGREEN 30 73 #define DRAW_LAVENDERBLUSH 31 74 75 76 extern int DrawOpenX(MPI_Comm,const char[],const char[],int,int,int,int,Draw*); 77 extern int DrawOpenPS(MPI_Comm,char *,Draw *); 78 #define DRAW_FULL_SIZE -3 79 #define DRAW_HALF_SIZE -4 80 #define DRAW_THIRD_SIZE -5 81 #define DRAW_QUARTER_SIZE -6 82 83 extern int DrawOpenNull(MPI_Comm,Draw *); 84 extern int DrawDestroy(Draw); 85 extern int DrawIsNull(Draw,PetscTruth*); 86 87 extern int DrawGetPopup(Draw,Draw*); 88 extern int DrawCheckResizedWindow(Draw); 89 extern int DrawResizeWindow(Draw,int,int); 90 91 extern int DrawScalePopup(Draw,double min,double max); 92 93 extern int DrawLine(Draw,double,double,double,double,int); 94 extern int DrawLineSetWidth(Draw,double); 95 extern int DrawLineGetWidth(Draw,double*); 96 97 extern int DrawPoint(Draw,double,double,int); 98 extern int DrawPointSetSize(Draw,double); 99 100 extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int); 101 extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int); 102 extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*); 103 extern int DrawTensorContour(Draw,int,int,const double[],const double[],Scalar *); 104 105 extern int DrawString(Draw,double,double,int,char*); 106 extern int DrawStringVertical(Draw,double,double,int,char*); 107 extern int DrawStringSetSize(Draw,double,double); 108 extern int DrawStringGetSize(Draw,double*,double*); 109 110 extern int DrawSetViewPort(Draw,double,double,double,double); 111 extern int DrawSplitViewPort(Draw); 112 113 extern int DrawSetCoordinates(Draw,double,double,double,double); 114 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*); 115 116 extern int DrawSetTitle(Draw,char *); 117 extern int DrawAppendTitle(Draw,char *); 118 extern int DrawGetTitle(Draw,char **); 119 120 extern int DrawSetPause(Draw,int); 121 extern int DrawGetPause(Draw,int*); 122 extern int DrawPause(Draw); 123 extern int DrawSetDoubleBuffer(Draw); 124 extern int DrawFlush(Draw); 125 extern int DrawSynchronizedFlush(Draw); 126 extern int DrawClear(Draw); 127 extern int DrawSynchronizedClear(Draw); 128 extern int DrawBOP(Draw); 129 extern int DrawEOP(Draw); 130 131 extern int DrawGetSingleton(Draw,Draw*); 132 extern int DrawRestoreSingleton(Draw,Draw*); 133 134 typedef enum {BUTTON_NONE,BUTTON_LEFT,BUTTON_CENTER,BUTTON_RIGHT } DrawButton; 135 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 136 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 137 138 extern int DrawZoom(Draw,int (*)(Draw,void *),void *); 139 140 /* Allows one to maintain a subset of viewports for a single window */ 141 typedef struct { 142 int nports; 143 double *xl,*xr,*yl,*yr; 144 Draw draw; 145 } DrawViewPorts; 146 extern int DrawViewPortsCreate(Draw,int,DrawViewPorts**); 147 extern int DrawViewPortsDestroy(DrawViewPorts*); 148 extern int DrawViewPortsSet(DrawViewPorts*,int); 149 150 /* 151 Routines for drawing X-Y axises in a Draw object 152 */ 153 typedef struct _p_DrawAxis* DrawAxis; 154 #define DRAWAXIS_COOKIE PETSC_COOKIE+16 155 extern int DrawAxisCreate(Draw,DrawAxis *); 156 extern int DrawAxisDestroy(DrawAxis); 157 extern int DrawAxisDraw(DrawAxis); 158 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 159 extern int DrawAxisSetColors(DrawAxis,int,int,int); 160 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 161 162 /* 163 Routines to draw line curves in X-Y space 164 */ 165 typedef struct _p_DrawLG* DrawLG; 166 #define DRAWLG_COOKIE PETSC_COOKIE+7 167 extern int DrawLGCreate(Draw,int,DrawLG *); 168 extern int DrawLGDestroy(DrawLG); 169 extern int DrawLGAddPoint(DrawLG,double*,double*); 170 extern int DrawLGAddPoints(DrawLG,int,double**,double**); 171 extern int DrawLGDraw(DrawLG); 172 extern int DrawLGReset(DrawLG); 173 extern int DrawLGSetDimension(DrawLG,int); 174 extern int DrawLGGetAxis(DrawLG,DrawAxis *); 175 extern int DrawLGGetDraw(DrawLG,Draw *); 176 extern int DrawLGIndicateDataPoints(DrawLG); 177 extern int DrawLGSetLimits(DrawLG,double,double,double,double); 178 179 /* 180 Routines to draw scatter plots in complex space 181 */ 182 typedef struct _p_DrawSP* DrawSP; 183 #define DRAWSP_COOKIE PETSC_COOKIE+27 184 extern int DrawSPCreate(Draw,int,DrawSP *); 185 extern int DrawSPDestroy(DrawSP); 186 extern int DrawSPAddPoint(DrawSP,double*,double*); 187 extern int DrawSPAddPoints(DrawSP,int,double**,double**); 188 extern int DrawSPDraw(DrawSP); 189 extern int DrawSPReset(DrawSP); 190 extern int DrawSPSetDimension(DrawSP,int); 191 extern int DrawSPGetAxis(DrawSP,DrawAxis *); 192 extern int DrawSPGetDraw(DrawSP,Draw *); 193 extern int DrawSPSetLimits(DrawSP,double,double,double,double); 194 195 /* 196 Routines to draw histograms 197 */ 198 typedef struct _p_DrawHG* DrawHG; 199 #define DRAWHG_COOKIE PETSC_COOKIE+15 200 extern int DrawHGCreate(Draw,int,DrawHG *); 201 extern int DrawHGDestroy(DrawHG); 202 extern int DrawHGAddValue(DrawHG,double); 203 extern int DrawHGDraw(DrawHG); 204 extern int DrawHGReset(DrawHG); 205 extern int DrawHGGetAxis(DrawHG,DrawAxis *); 206 extern int DrawHGGetDraw(DrawHG,Draw *); 207 extern int DrawHGSetLimits(DrawHG,double,double,int,int); 208 extern int DrawHGSetNumberBins(DrawHG,int); 209 extern int DrawHGSetColor(DrawHG,int); 210 211 /* 212 Viewer routines that allow you to access underlying Draw objects 213 */ 214 extern int ViewerDrawGetDraw(Viewer,int,Draw*); 215 extern int ViewerDrawGetDrawLG(Viewer,int,DrawLG*); 216 extern int ViewerDrawGetDrawAxis(Viewer,int,DrawAxis*); 217 218 extern int DrawUtilitySetCmapHue(unsigned char *,unsigned char *,unsigned char *,int); 219 extern int DrawUtilitySetGamma(double); 220 221 /* Mesh management routines */ 222 typedef struct _p_DrawMesh* DrawMesh; 223 int DrawMeshCreate(DrawMesh *, 224 double *,double *,double *, 225 int,int,int,int,int,int,int,int,int, 226 int,int,int,int,double *,int); 227 int DrawMeshCreateSimple(DrawMesh *,double *,double *,double *, 228 int,int,int,int,double *,int); 229 int DrawMeshDestroy(DrawMesh *); 230 231 232 233 234 #endif 235 236 237 238 239 240