Actual source code: petscdraw.h

petsc-master 2015-03-03
Report Typos and Errors
  1: /*
  2:   Interface to the PETSc graphics
  3: */
  6: #include <petscsys.h>
  7: #include <petscdrawtypes.h>

  9: PETSC_EXTERN PetscClassId PETSC_DRAW_CLASSID;

 11: PETSC_EXTERN PetscFunctionList PetscDrawList;
 12: PETSC_EXTERN PetscErrorCode PetscDrawInitializePackage(void);
 13: PETSC_EXTERN PetscErrorCode PetscDrawRegister(const char[],PetscErrorCode(*)(PetscDraw));

 15: PETSC_EXTERN PetscErrorCode PetscDrawGetType(PetscDraw,PetscDrawType*);
 16: PETSC_EXTERN PetscErrorCode PetscDrawSetType(PetscDraw,PetscDrawType);
 17: PETSC_EXTERN PetscErrorCode PetscDrawCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscDraw*);
 18: PETSC_EXTERN PetscErrorCode PetscDrawSetFromOptions(PetscDraw);
 19: PETSC_EXTERN PetscErrorCode PetscDrawSetSave(PetscDraw,const char*,PetscBool);
 20: PETSC_EXTERN PetscErrorCode PetscDrawSetSaveFinalImage(PetscDraw,const char*);
 21: PETSC_EXTERN PetscErrorCode PetscDrawView(PetscDraw,PetscViewer);
 22: PETSC_STATIC_INLINE PetscErrorCode PetscDrawViewFromOptions(PetscDraw A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);}

 24: /*
 25:    Number of basic colors in the draw routines, the others are used
 26:    for a uniform colormap.
 27: */
 28: #define PETSC_DRAW_BASIC_COLORS 33

 30: #define PETSC_DRAW_ROTATE          -1         /* will rotate through the colors, start with 2 */
 31: #define PETSC_DRAW_WHITE            0
 32: #define PETSC_DRAW_BLACK            1
 33: #define PETSC_DRAW_RED              2
 34: #define PETSC_DRAW_GREEN            3
 35: #define PETSC_DRAW_CYAN             4
 36: #define PETSC_DRAW_BLUE             5
 37: #define PETSC_DRAW_MAGENTA          6
 38: #define PETSC_DRAW_AQUAMARINE       7
 39: #define PETSC_DRAW_FORESTGREEN      8
 40: #define PETSC_DRAW_ORANGE           9
 41: #define PETSC_DRAW_VIOLET          10
 42: #define PETSC_DRAW_BROWN           11
 43: #define PETSC_DRAW_PINK            12
 44: #define PETSC_DRAW_CORAL           13
 45: #define PETSC_DRAW_GRAY            14
 46: #define PETSC_DRAW_YELLOW          15

 48: #define PETSC_DRAW_GOLD            16
 49: #define PETSC_DRAW_LIGHTPINK       17
 50: #define PETSC_DRAW_MEDIUMTURQUOISE 18
 51: #define PETSC_DRAW_KHAKI           19
 52: #define PETSC_DRAW_DIMGRAY         20
 53: #define PETSC_DRAW_YELLOWGREEN     21
 54: #define PETSC_DRAW_SKYBLUE         22
 55: #define PETSC_DRAW_DARKGREEN       23
 56: #define PETSC_DRAW_NAVYBLUE        24
 57: #define PETSC_DRAW_SANDYBROWN      25
 58: #define PETSC_DRAW_CADETBLUE       26
 59: #define PETSC_DRAW_POWDERBLUE      27
 60: #define PETSC_DRAW_DEEPPINK        28
 61: #define PETSC_DRAW_THISTLE         29
 62: #define PETSC_DRAW_LIMEGREEN       30
 63: #define PETSC_DRAW_LAVENDERBLUSH   31
 64: #define PETSC_DRAW_PLUM            32

 66: PETSC_EXTERN PetscErrorCode PetscDrawOpenX(MPI_Comm,const char[],const char[],int,int,int,int,PetscDraw*);
 67: PETSC_EXTERN PetscErrorCode PetscDrawOpenGLUT(MPI_Comm,const char[],const char[],int,int,int,int,PetscDraw*);

 69: #define PETSC_DRAW_FULL_SIZE    -3
 70: #define PETSC_DRAW_HALF_SIZE    -4
 71: #define PETSC_DRAW_THIRD_SIZE   -5
 72: #define PETSC_DRAW_QUARTER_SIZE -6

 74: PETSC_EXTERN PetscErrorCode PetscDrawOpenNull(MPI_Comm,PetscDraw *);
 75: PETSC_EXTERN PetscErrorCode PetscDrawDestroy(PetscDraw*);
 76: PETSC_EXTERN PetscErrorCode PetscDrawIsNull(PetscDraw,PetscBool *);

 78: PETSC_EXTERN PetscErrorCode PetscDrawGetPopup(PetscDraw,PetscDraw*);
 79: PETSC_EXTERN PetscErrorCode PetscDrawCheckResizedWindow(PetscDraw);
 80: PETSC_EXTERN PetscErrorCode PetscDrawResizeWindow(PetscDraw,int,int);

 82: PETSC_EXTERN PetscErrorCode PetscDrawScalePopup(PetscDraw,PetscReal,PetscReal);

 84: PETSC_EXTERN PetscErrorCode PetscDrawPixelToCoordinate(PetscDraw,PetscInt,PetscInt,PetscReal*,PetscReal*);
 85: PETSC_EXTERN PetscErrorCode PetscDrawCoordinateToPixel(PetscDraw,PetscReal,PetscReal,PetscInt*,PetscInt*);

 87: PETSC_EXTERN PetscErrorCode PetscDrawIndicatorFunction(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int,PetscErrorCode (*)(void*,PetscReal,PetscReal,PetscBool*),void*);

 89: PETSC_EXTERN PetscErrorCode PetscDrawLine(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
 90: PETSC_EXTERN PetscErrorCode PetscDrawArrow(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
 91: PETSC_EXTERN PetscErrorCode PetscDrawLineSetWidth(PetscDraw,PetscReal);
 92: PETSC_EXTERN PetscErrorCode PetscDrawLineGetWidth(PetscDraw,PetscReal*);

 94: PETSC_EXTERN PetscErrorCode PetscDrawPoint(PetscDraw,PetscReal,PetscReal,int);
 95: PETSC_EXTERN PetscErrorCode PetscDrawPointPixel(PetscDraw,PetscInt,PetscInt,int);
 96: PETSC_EXTERN PetscErrorCode PetscDrawPointSetSize(PetscDraw,PetscReal);

 98: PETSC_EXTERN PetscErrorCode PetscDrawRectangle(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int,int,int,int);
 99: PETSC_EXTERN PetscErrorCode PetscDrawTriangle(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,int,int,int);
100: PETSC_EXTERN PetscErrorCode PetscDrawEllipse(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
101: PETSC_EXTERN PetscErrorCode PetscDrawTensorContourPatch(PetscDraw,int,int,PetscReal*,PetscReal*,PetscReal,PetscReal,PetscReal*);
102: PETSC_EXTERN PetscErrorCode PetscDrawTensorContour(PetscDraw,int,int,const PetscReal[],const PetscReal[],PetscReal *);

104: PETSC_EXTERN PetscErrorCode PetscDrawString(PetscDraw,PetscReal,PetscReal,int,const char[]);
105: PETSC_EXTERN PetscErrorCode PetscDrawBoxedString(PetscDraw,PetscReal,PetscReal,int,int,const char[],PetscReal*,PetscReal*);
106: PETSC_EXTERN PetscErrorCode PetscDrawBoxedStringSize(PetscDraw,const char[],PetscReal*,PetscReal*);
107: PETSC_EXTERN PetscErrorCode PetscDrawStringVertical(PetscDraw,PetscReal,PetscReal,int,const char[]);
108: PETSC_EXTERN PetscErrorCode PetscDrawStringSetSize(PetscDraw,PetscReal,PetscReal);
109: PETSC_EXTERN PetscErrorCode PetscDrawStringGetSize(PetscDraw,PetscReal*,PetscReal*);

111: PETSC_EXTERN PetscErrorCode PetscDrawSetViewPort(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal);
112: PETSC_EXTERN PetscErrorCode PetscDrawGetViewPort(PetscDraw,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
113: PETSC_EXTERN PetscErrorCode PetscDrawSplitViewPort(PetscDraw);

115: PETSC_EXTERN PetscErrorCode PetscDrawSetCoordinates(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal);
116: PETSC_EXTERN PetscErrorCode PetscDrawGetCoordinates(PetscDraw,PetscReal*,PetscReal*,PetscReal*,PetscReal*);

118: PETSC_EXTERN PetscErrorCode PetscDrawSetTitle(PetscDraw,const char[]);
119: PETSC_EXTERN PetscErrorCode PetscDrawAppendTitle(PetscDraw,const char[]);
120: PETSC_EXTERN PetscErrorCode PetscDrawGetTitle(PetscDraw,char **);

122: PETSC_EXTERN PetscErrorCode PetscDrawSetPause(PetscDraw,PetscReal);
123: PETSC_EXTERN PetscErrorCode PetscDrawGetPause(PetscDraw,PetscReal*);
124: PETSC_EXTERN PetscErrorCode PetscDrawPause(PetscDraw);
125: PETSC_EXTERN PetscErrorCode PetscDrawSetDoubleBuffer(PetscDraw);
126: PETSC_EXTERN PetscErrorCode PetscDrawFlush(PetscDraw);
127: PETSC_EXTERN PetscErrorCode PetscDrawSynchronizedFlush(PetscDraw);
128: PETSC_EXTERN PetscErrorCode PetscDrawClear(PetscDraw);
129: PETSC_EXTERN PetscErrorCode PetscDrawSave(PetscDraw);
130: PETSC_EXTERN PetscErrorCode PetscDrawSynchronizedClear(PetscDraw);
131: PETSC_EXTERN PetscErrorCode PetscDrawBOP(PetscDraw);
132: PETSC_EXTERN PetscErrorCode PetscDrawEOP(PetscDraw);

134: PETSC_EXTERN PetscErrorCode PetscDrawSetDisplay(PetscDraw,const char[]);
135: PETSC_EXTERN PetscErrorCode PetscDrawGetSingleton(PetscDraw,PetscDraw*);
136: PETSC_EXTERN PetscErrorCode PetscDrawRestoreSingleton(PetscDraw,PetscDraw*);

138: PETSC_EXTERN PetscErrorCode PetscDrawGetCurrentPoint(PetscDraw,PetscReal*,PetscReal*);
139: PETSC_EXTERN PetscErrorCode PetscDrawSetCurrentPoint(PetscDraw,PetscReal,PetscReal);
140: PETSC_EXTERN PetscErrorCode PetscDrawPushCurrentPoint(PetscDraw,PetscReal,PetscReal);
141: PETSC_EXTERN PetscErrorCode PetscDrawPopCurrentPoint(PetscDraw);
142: PETSC_EXTERN PetscErrorCode PetscDrawGetBoundingBox(PetscDraw,PetscReal*,PetscReal*,PetscReal*,PetscReal*);

144: /*E
145:     PetscDrawButton - Used to determine which button was pressed

147:    Level: intermediate

149: .seealso: PetscDrawGetMouseButton(), PetscDrawSynchronizedGetMouseButton()
150: E*/
151: typedef enum {PETSC_BUTTON_NONE,PETSC_BUTTON_LEFT,PETSC_BUTTON_CENTER,PETSC_BUTTON_RIGHT,PETSC_BUTTON_LEFT_SHIFT,PETSC_BUTTON_CENTER_SHIFT,PETSC_BUTTON_RIGHT_SHIFT} PetscDrawButton;

153: PETSC_EXTERN PetscErrorCode PetscDrawGetMouseButton(PetscDraw,PetscDrawButton *,PetscReal*,PetscReal *,PetscReal *,PetscReal *);
154: PETSC_EXTERN PetscErrorCode PetscDrawSynchronizedGetMouseButton(PetscDraw,PetscDrawButton *,PetscReal*,PetscReal *,PetscReal *,PetscReal *);

156: PETSC_EXTERN PetscErrorCode PetscDrawZoom(PetscDraw,PetscErrorCode (*)(PetscDraw,void *),void *);

158: /*S
159:      PetscDrawViewPorts - Subwindows in a PetscDraw object

161:    Level: intermediate

163:   Concepts: graphics

165: .seealso:  PetscDrawViewPortsCreate(), PetscDrawViewPortsSet()
166: S*/
167: typedef struct {
168:   PetscInt  nports;
169:   PetscReal *xl;
170:   PetscReal *xr;
171:   PetscReal *yl;
172:   PetscReal *yr;
173:   PetscDraw draw;
174:   PetscReal port_xl,port_yl,port_xr,port_yr;   /* original port of parent PetscDraw */

176: } PetscDrawViewPorts;
177: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsCreate(PetscDraw,PetscInt,PetscDrawViewPorts**);
178: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsCreateRect(PetscDraw,PetscInt,PetscInt,PetscDrawViewPorts**);
179: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsDestroy(PetscDrawViewPorts*);
180: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsSet(PetscDrawViewPorts*,PetscInt);

182: PETSC_EXTERN PetscClassId PETSC_DRAWAXIS_CLASSID;

184: PETSC_EXTERN PetscErrorCode PetscDrawAxisCreate(PetscDraw,PetscDrawAxis *);
185: PETSC_EXTERN PetscErrorCode PetscDrawAxisDestroy(PetscDrawAxis*);
186: PETSC_EXTERN PetscErrorCode PetscDrawAxisDraw(PetscDrawAxis);
187: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetLimits(PetscDrawAxis,PetscReal,PetscReal,PetscReal,PetscReal);
188: PETSC_EXTERN PetscErrorCode PetscDrawAxisGetLimits(PetscDrawAxis,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
189: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetHoldLimits(PetscDrawAxis,PetscBool );
190: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetColors(PetscDrawAxis,int,int,int);
191: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetLabels(PetscDrawAxis,const char[],const char[],const char[]);

193: PETSC_EXTERN PetscClassId PETSC_DRAWLG_CLASSID;

195: PETSC_EXTERN PetscErrorCode PetscDrawLGCreate(PetscDraw,PetscInt,PetscDrawLG *);
196: PETSC_EXTERN PetscErrorCode PetscDrawLGDestroy(PetscDrawLG*);
197: PETSC_EXTERN PetscErrorCode PetscDrawLGAddPoint(PetscDrawLG,const PetscReal*,const PetscReal*);
198: PETSC_EXTERN PetscErrorCode PetscDrawLGAddCommonPoint(PetscDrawLG,const PetscReal,const PetscReal*);
199: PETSC_EXTERN PetscErrorCode PetscDrawLGAddPoints(PetscDrawLG,PetscInt,PetscReal**,PetscReal**);
200: PETSC_EXTERN PetscErrorCode PetscDrawLGDraw(PetscDrawLG);
201: PETSC_EXTERN PetscErrorCode PetscDrawLGView(PetscDrawLG,PetscViewer);
202: PETSC_EXTERN PetscErrorCode PetscDrawLGReset(PetscDrawLG);
203: PETSC_EXTERN PetscErrorCode PetscDrawLGSetDimension(PetscDrawLG,PetscInt);
204: PETSC_EXTERN PetscErrorCode PetscDrawLGGetDimension(PetscDrawLG,PetscInt*);
205: PETSC_EXTERN PetscErrorCode PetscDrawLGSetLegend(PetscDrawLG,const char *const*);
206: PETSC_EXTERN PetscErrorCode PetscDrawLGGetAxis(PetscDrawLG,PetscDrawAxis *);
207: PETSC_EXTERN PetscErrorCode PetscDrawLGGetDraw(PetscDrawLG,PetscDraw *);
208: PETSC_EXTERN PetscErrorCode PetscDrawLGIndicateDataPoints(PetscDrawLG,PetscBool);
209: PETSC_EXTERN PetscErrorCode PetscDrawLGSetLimits(PetscDrawLG,PetscReal,PetscReal,PetscReal,PetscReal);
210: PETSC_EXTERN PetscErrorCode PetscDrawLGSetColors(PetscDrawLG,const int*);
211: PETSC_EXTERN PetscErrorCode PetscDrawLGSetFromOptions(PetscDrawLG);

213: PETSC_EXTERN PetscClassId PETSC_DRAWSP_CLASSID;

215: PETSC_EXTERN PetscErrorCode PetscDrawSPCreate(PetscDraw,int,PetscDrawSP *);
216: PETSC_EXTERN PetscErrorCode PetscDrawSPDestroy(PetscDrawSP*);
217: PETSC_EXTERN PetscErrorCode PetscDrawSPAddPoint(PetscDrawSP,PetscReal*,PetscReal*);
218: PETSC_EXTERN PetscErrorCode PetscDrawSPAddPoints(PetscDrawSP,int,PetscReal**,PetscReal**);
219: PETSC_EXTERN PetscErrorCode PetscDrawSPDraw(PetscDrawSP,PetscBool);
220: PETSC_EXTERN PetscErrorCode PetscDrawSPReset(PetscDrawSP);
221: PETSC_EXTERN PetscErrorCode PetscDrawSPSetDimension(PetscDrawSP,int);
222: PETSC_EXTERN PetscErrorCode PetscDrawSPGetAxis(PetscDrawSP,PetscDrawAxis *);
223: PETSC_EXTERN PetscErrorCode PetscDrawSPGetDraw(PetscDrawSP,PetscDraw *);
224: PETSC_EXTERN PetscErrorCode PetscDrawSPSetLimits(PetscDrawSP,PetscReal,PetscReal,PetscReal,PetscReal);
225: PETSC_EXTERN PetscErrorCode PetscDrawLGSPDraw(PetscDrawLG,PetscDrawSP);

227: PETSC_EXTERN PetscClassId PETSC_DRAWHG_CLASSID;

229: PETSC_EXTERN PetscErrorCode PetscDrawHGCreate(PetscDraw,int,PetscDrawHG *);
230: PETSC_EXTERN PetscErrorCode PetscDrawHGDestroy(PetscDrawHG*);
231: PETSC_EXTERN PetscErrorCode PetscDrawHGAddValue(PetscDrawHG,PetscReal);
232: PETSC_EXTERN PetscErrorCode PetscDrawHGDraw(PetscDrawHG);
233: PETSC_EXTERN PetscErrorCode PetscDrawHGView(PetscDrawHG,PetscViewer);
234: PETSC_EXTERN PetscErrorCode PetscDrawHGReset(PetscDrawHG);
235: PETSC_EXTERN PetscErrorCode PetscDrawHGGetAxis(PetscDrawHG,PetscDrawAxis *);
236: PETSC_EXTERN PetscErrorCode PetscDrawHGGetDraw(PetscDrawHG,PetscDraw *);
237: PETSC_EXTERN PetscErrorCode PetscDrawHGSetLimits(PetscDrawHG,PetscReal,PetscReal,int,int);
238: PETSC_EXTERN PetscErrorCode PetscDrawHGSetNumberBins(PetscDrawHG,int);
239: PETSC_EXTERN PetscErrorCode PetscDrawHGSetColor(PetscDrawHG,int);
240: PETSC_EXTERN PetscErrorCode PetscDrawHGCalcStats(PetscDrawHG, PetscBool );
241: PETSC_EXTERN PetscErrorCode PetscDrawHGIntegerBins(PetscDrawHG, PetscBool );

243: /*
244:     PetscViewer routines that allow you to access underlying PetscDraw objects
245: */
246: PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDraw(PetscViewer,PetscInt,PetscDraw*);
247: PETSC_EXTERN PetscErrorCode PetscViewerDrawBaseAdd(PetscViewer,PetscInt);
248: PETSC_EXTERN PetscErrorCode PetscViewerDrawBaseSet(PetscViewer,PetscInt);
249: PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDrawLG(PetscViewer,PetscInt,PetscDrawLG*);
250: PETSC_EXTERN PetscErrorCode PetscViewerDrawGetDrawAxis(PetscViewer,PetscInt,PetscDrawAxis*);

252: PETSC_EXTERN PetscErrorCode PetscDrawUtilitySetCmapHue(unsigned char *,unsigned char *,unsigned char *,int);
253: PETSC_EXTERN PetscErrorCode PetscDrawUtilitySetGamma(PetscReal);

255: #endif