1 /* $Id: draw.h,v 1.60 1998/12/03 04:07:00 bsmith Exp bsmith $ */ 2 /* 3 Interface to the PETSc graphics (currently only support for X-windows 4 */ 5 #if !defined(__DRAW_H) 6 #define __DRAW_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_VRML "vrml" 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_Private(char*,char*,char*,int(*)(Draw)); 24 #if defined(USE_DYNAMIC_LIBRARIES) 25 #define DrawRegister(a,b,c,d) DrawRegister_Private(a,b,c,0) 26 #else 27 #define DrawRegister(a,b,c,d) DrawRegister_Private(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 DrawOpenVRML( MPI_Comm,const char[],const char[], Draw* ); 78 79 extern int DrawOpenNull(MPI_Comm,Draw *); 80 extern int DrawDestroy(Draw); 81 extern int DrawIsNull(Draw,PetscTruth*); 82 83 extern int DrawGetPopup(Draw,Draw*); 84 extern int DrawCheckResizedWindow(Draw); 85 extern int DrawResizeWindow(Draw,int,int); 86 87 extern int DrawScalePopup(Draw,double min,double max); 88 89 extern int DrawLine(Draw,double,double,double,double,int); 90 extern int DrawLineSetWidth(Draw,double); 91 extern int DrawLineGetWidth(Draw,double*); 92 93 extern int DrawPoint(Draw,double,double,int); 94 extern int DrawPointSetSize(Draw,double); 95 96 extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int); 97 extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int); 98 extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*); 99 100 extern int DrawString(Draw,double,double,int,char*); 101 extern int DrawStringVertical(Draw,double,double,int,char*); 102 extern int DrawStringSetSize(Draw,double,double); 103 extern int DrawStringGetSize(Draw,double*,double*); 104 105 extern int DrawSetViewPort(Draw,double,double,double,double); 106 extern int DrawSplitViewPort(Draw); 107 108 extern int DrawSetCoordinates(Draw,double,double,double,double); 109 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*); 110 111 extern int DrawSetTitle(Draw,char *); 112 extern int DrawAppendTitle(Draw,char *); 113 extern int DrawGetTitle(Draw,char **); 114 115 extern int DrawSetPause(Draw,int); 116 extern int DrawGetPause(Draw,int*); 117 extern int DrawPause(Draw); 118 extern int DrawSetDoubleBuffer(Draw); 119 extern int DrawFlush(Draw); 120 extern int DrawSynchronizedFlush(Draw); 121 extern int DrawClear(Draw); 122 extern int DrawSynchronizedClear(Draw); 123 extern int DrawBOP(Draw); 124 extern int DrawEOP(Draw); 125 126 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton; 127 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 128 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 129 130 extern int DrawZoom(Draw,int (*)(Draw,void *),void *); 131 /* 132 Routines for drawing X-Y axises in a Draw object 133 */ 134 typedef struct _p_DrawAxis* DrawAxis; 135 #define DRAWAXIS_COOKIE PETSC_COOKIE+16 136 extern int DrawAxisCreate(Draw,DrawAxis *); 137 extern int DrawAxisDestroy(DrawAxis); 138 extern int DrawAxisDraw(DrawAxis); 139 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 140 extern int DrawAxisSetColors(DrawAxis,int,int,int); 141 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 142 143 /* 144 Routines to draw line curves in X-Y space 145 */ 146 typedef struct _p_DrawLG* DrawLG; 147 #define DRAWLG_COOKIE PETSC_COOKIE+7 148 extern int DrawLGCreate(Draw,int,DrawLG *); 149 extern int DrawLGDestroy(DrawLG); 150 extern int DrawLGAddPoint(DrawLG,double*,double*); 151 extern int DrawLGAddPoints(DrawLG,int,double**,double**); 152 extern int DrawLGDraw(DrawLG); 153 extern int DrawLGReset(DrawLG); 154 extern int DrawLGSetDimension(DrawLG,int); 155 extern int DrawLGGetAxis(DrawLG,DrawAxis *); 156 extern int DrawLGGetDraw(DrawLG,Draw *); 157 extern int DrawLGIndicateDataPoints(DrawLG); 158 extern int DrawLGSetLimits(DrawLG,double,double,double,double); 159 160 /* 161 Routines to draw scatter plots in complex space 162 */ 163 typedef struct _p_DrawSP* DrawSP; 164 #define DRAWSP_COOKIE PETSC_COOKIE+27 165 extern int DrawSPCreate(Draw,int,DrawSP *); 166 extern int DrawSPDestroy(DrawSP); 167 extern int DrawSPAddPoint(DrawSP,double*,double*); 168 extern int DrawSPAddPoints(DrawSP,int,double**,double**); 169 extern int DrawSPDraw(DrawSP); 170 extern int DrawSPReset(DrawSP); 171 extern int DrawSPSetDimension(DrawSP,int); 172 extern int DrawSPGetAxis(DrawSP,DrawAxis *); 173 extern int DrawSPGetDraw(DrawSP,Draw *); 174 extern int DrawSPSetLimits(DrawSP,double,double,double,double); 175 176 /* 177 Routines to draw histograms 178 */ 179 typedef struct _p_DrawHist* DrawHist; 180 extern int DrawHistCreate(Draw, int, DrawHist *); 181 extern int DrawHistDestroy(DrawHist); 182 extern int DrawHistAddValue(DrawHist, double); 183 extern int DrawHistDraw(DrawHist); 184 extern int DrawHistReset(DrawHist); 185 extern int DrawHistGetAxis(DrawHist, DrawAxis *); 186 extern int DrawHistGetDraw(DrawHist, Draw *); 187 extern int DrawHistSetLimits(DrawHist, double, double, int, int); 188 extern int DrawHistSetNumberBins(DrawHist, int); 189 extern int DrawHistSetColor(DrawHist,int); 190 191 /* 192 Viewer routines that allow you to access underlying Draw objects 193 */ 194 extern int ViewerDrawGetDraw(Viewer,int, Draw*); 195 extern int ViewerDrawGetDrawLG(Viewer,int, DrawLG*); 196 extern int ViewerDrawGetDrawAxis(Viewer,int, DrawAxis*); 197 198 /* Mesh management routines */ 199 typedef struct _p_DrawMesh* DrawMesh; 200 int DrawMeshCreate( DrawMesh *, 201 double *, double *, double *, 202 int, int, int, int, int, int, int, int, int, 203 int, int, int, int, double *, int ); 204 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *, 205 int, int, int, int, double *, int ); 206 int DrawMeshDestroy( DrawMesh * ); 207 208 /* Color spectrum managment */ 209 typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *, 210 double * ); 211 212 void *VRMLFindHue_setup( DrawMesh, int ); 213 void VRMLFindHue( double, void *, int, double *, double *, double * ); 214 void VRMLFindHue_destroy( void * ); 215 void *VRMLGetHue_setup( DrawMesh, int ); 216 void VRMLGetHue( double, void *, int, double *, double *, double * ); 217 void VRMLGetHue_destroy( void * ); 218 219 220 int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int ); 221 int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int ); 222 int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double, 223 int,int, VRMLGetHue_fcn, void *, int,double); 224 int DrawTensorSurface(Draw, DrawMesh, int); 225 /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */ 226 227 #endif 228 229 230 231 232 233