Actual source code: petscdraw.h
petsc-3.10.5 2019-03-28
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 PetscDrawFinalizePackage(void);
     14: PETSC_EXTERN PetscErrorCode PetscDrawRegister(const char[],PetscErrorCode(*)(PetscDraw));

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

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

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

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

     70: /*MC

     72:    PetscDrawRealToColor - Maps a real value within an interval to a color.
     73:    The color is an integer value in the range [PETSC_DRAW_BASIC_COLORS to 255]
     74:    that can be passed to various drawing routines.

     76:    Synopsis:
     77:    #include <petscdraw.h>
     78:    int PetscDrawRealToColor(PetscReal value,PetscReal min,PetscReal max)

     80:    Not Collective

     82:    Input Parameter:
     83: +  value - value to map within the interval [min,max]
     84: .  min - lower end of interval
     85: -  max - upper end of interval

     87:    Notes:
     88:     Values outside the interval [min,max] are clipped.

     90:    Level: intermediate

     92: .seealso: PetscDrawPointPixel(), PetscDrawPoint(), PetscDrawLine(), PetscDrawTriangle(), PetscDrawRectangle()

     94: M*/
     95: PETSC_STATIC_INLINE int PetscDrawRealToColor(PetscReal value,PetscReal min,PetscReal max)
     96: {
     97:   value = PetscClipInterval(value,min,max);
     98:   return PETSC_DRAW_BASIC_COLORS + (int)((255-PETSC_DRAW_BASIC_COLORS)*(value-min)/(max-min));
     99: }

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

    104: #define PETSC_DRAW_FULL_SIZE    -3
    105: #define PETSC_DRAW_HALF_SIZE    -4
    106: #define PETSC_DRAW_THIRD_SIZE   -5
    107: #define PETSC_DRAW_QUARTER_SIZE -6

    109: PETSC_EXTERN PetscErrorCode PetscDrawOpenImage(MPI_Comm,const char[],int,int,PetscDraw*);
    110: PETSC_EXTERN PetscErrorCode PetscDrawOpenNull(MPI_Comm,PetscDraw *);
    111: PETSC_EXTERN PetscErrorCode PetscDrawDestroy(PetscDraw*);
    112: PETSC_EXTERN PetscErrorCode PetscDrawIsNull(PetscDraw,PetscBool *);

    114: PETSC_EXTERN PetscErrorCode PetscDrawGetPopup(PetscDraw,PetscDraw*);
    115: PETSC_EXTERN PetscErrorCode PetscDrawScalePopup(PetscDraw,PetscReal,PetscReal);

    117: PETSC_EXTERN PetscErrorCode PetscDrawCheckResizedWindow(PetscDraw);
    118: PETSC_EXTERN PetscErrorCode PetscDrawResizeWindow(PetscDraw,int,int);
    119: PETSC_EXTERN PetscErrorCode PetscDrawGetWindowSize(PetscDraw,int*,int*);
    120: PETSC_EXTERN PetscErrorCode PetscDrawPixelToCoordinate(PetscDraw,int,int,PetscReal*,PetscReal*);
    121: PETSC_EXTERN PetscErrorCode PetscDrawCoordinateToPixel(PetscDraw,PetscReal,PetscReal,int*,int*);

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

    125: PETSC_EXTERN PetscErrorCode PetscDrawLine(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
    126: PETSC_EXTERN PetscErrorCode PetscDrawArrow(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
    127: PETSC_EXTERN PetscErrorCode PetscDrawLineSetWidth(PetscDraw,PetscReal);
    128: PETSC_EXTERN PetscErrorCode PetscDrawLineGetWidth(PetscDraw,PetscReal*);

    130: /*E
    131:     PetscDrawMarkerType - How a "mark" is indicate in a figure

    133:    Level: intermediate

    135: $  PETSC_MARKER_CROSS - a small pixel based x symbol or the character x if that is not available
    136: $  PETSC_MARKER_PLUS - a small pixel based + symbol or the character + if that is not available
    137: $  PETSC_MARKER_CIRCLE - a small pixel based circle symbol or the character o if that is not available
    138: $  PETSC_MARKER_POINT - the make obtained with PetscDrawPoint()

    140: .seealso: PetscDrawMarker(), PetscDrawSetMarkerType()
    141: E*/
    142: typedef enum {PETSC_DRAW_MARKER_CROSS, PETSC_DRAW_MARKER_POINT,PETSC_DRAW_MARKER_PLUS,PETSC_DRAW_MARKER_CIRCLE} PetscDrawMarkerType;
    143: PETSC_EXTERN const char *const PetscDrawMarkerTypes[];

    145: PETSC_EXTERN PetscErrorCode PetscDrawMarker(PetscDraw,PetscReal,PetscReal,int);
    146: PETSC_EXTERN PetscErrorCode PetscDrawSetMarkerType(PetscDraw,PetscDrawMarkerType);
    147: PETSC_EXTERN PetscErrorCode PetscDrawGetMarkerType(PetscDraw,PetscDrawMarkerType*);

    149: PETSC_EXTERN PetscErrorCode PetscDrawPoint(PetscDraw,PetscReal,PetscReal,int);
    150: PETSC_EXTERN PetscErrorCode PetscDrawPointPixel(PetscDraw,int,int,int);
    151: PETSC_EXTERN PetscErrorCode PetscDrawPointSetSize(PetscDraw,PetscReal);

    153: PETSC_EXTERN PetscErrorCode PetscDrawRectangle(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int,int,int,int);
    154: PETSC_EXTERN PetscErrorCode PetscDrawTriangle(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,int,int,int);
    155: PETSC_EXTERN PetscErrorCode PetscDrawEllipse(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
    156: PETSC_EXTERN PetscErrorCode PetscDrawTensorContourPatch(PetscDraw,int,int,PetscReal*,PetscReal*,PetscReal,PetscReal,PetscReal*);
    157: PETSC_EXTERN PetscErrorCode PetscDrawTensorContour(PetscDraw,int,int,const PetscReal[],const PetscReal[],PetscReal *);

    159: PETSC_EXTERN PetscErrorCode PetscDrawString(PetscDraw,PetscReal,PetscReal,int,const char[]);
    160: PETSC_EXTERN PetscErrorCode PetscDrawStringCentered(PetscDraw,PetscReal,PetscReal,int,const char[]);
    161: PETSC_EXTERN PetscErrorCode PetscDrawStringBoxed(PetscDraw,PetscReal,PetscReal,int,int,const char[],PetscReal*,PetscReal*);
    162: PETSC_EXTERN PetscErrorCode PetscDrawStringVertical(PetscDraw,PetscReal,PetscReal,int,const char[]);
    163: PETSC_EXTERN PetscErrorCode PetscDrawStringSetSize(PetscDraw,PetscReal,PetscReal);
    164: PETSC_EXTERN PetscErrorCode PetscDrawStringGetSize(PetscDraw,PetscReal*,PetscReal*);

    166: PETSC_EXTERN PetscErrorCode PetscDrawSetViewPort(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal);
    167: PETSC_EXTERN PetscErrorCode PetscDrawGetViewPort(PetscDraw,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
    168: PETSC_EXTERN PetscErrorCode PetscDrawSplitViewPort(PetscDraw);

    170: PETSC_EXTERN PetscErrorCode PetscDrawSetCoordinates(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal);
    171: PETSC_EXTERN PetscErrorCode PetscDrawGetCoordinates(PetscDraw,PetscReal*,PetscReal*,PetscReal*,PetscReal*);

    173: PETSC_EXTERN PetscErrorCode PetscDrawSetTitle(PetscDraw,const char[]);
    174: PETSC_EXTERN PetscErrorCode PetscDrawAppendTitle(PetscDraw,const char[]);
    175: PETSC_EXTERN PetscErrorCode PetscDrawGetTitle(PetscDraw,const char *[]);

    177: PETSC_EXTERN PetscErrorCode PetscDrawSetPause(PetscDraw,PetscReal);
    178: PETSC_EXTERN PetscErrorCode PetscDrawGetPause(PetscDraw,PetscReal*);
    179: PETSC_EXTERN PetscErrorCode PetscDrawPause(PetscDraw);
    180: PETSC_EXTERN PetscErrorCode PetscDrawSetDoubleBuffer(PetscDraw);
    181: PETSC_EXTERN PetscErrorCode PetscDrawClear(PetscDraw);
    182: PETSC_EXTERN PetscErrorCode PetscDrawFlush(PetscDraw);
    183: PETSC_EXTERN PetscErrorCode PetscDrawSave(PetscDraw);
    184: PETSC_EXTERN PetscErrorCode PetscDrawSaveMovie(PetscDraw);
    185: PETSC_EXTERN PetscErrorCode PetscDrawBOP(PetscDraw);
    186: PETSC_EXTERN PetscErrorCode PetscDrawEOP(PetscDraw);

    188: PETSC_EXTERN PetscErrorCode PetscDrawSetDisplay(PetscDraw,const char[]);
    189: PETSC_EXTERN PetscErrorCode PetscDrawGetSingleton(PetscDraw,PetscDraw*);
    190: PETSC_EXTERN PetscErrorCode PetscDrawRestoreSingleton(PetscDraw,PetscDraw*);

    192: PETSC_EXTERN PetscErrorCode PetscDrawGetCurrentPoint(PetscDraw,PetscReal*,PetscReal*);
    193: PETSC_EXTERN PetscErrorCode PetscDrawSetCurrentPoint(PetscDraw,PetscReal,PetscReal);
    194: PETSC_EXTERN PetscErrorCode PetscDrawPushCurrentPoint(PetscDraw,PetscReal,PetscReal);
    195: PETSC_EXTERN PetscErrorCode PetscDrawPopCurrentPoint(PetscDraw);
    196: PETSC_EXTERN PetscErrorCode PetscDrawGetBoundingBox(PetscDraw,PetscReal*,PetscReal*,PetscReal*,PetscReal*);

    198: /*E
    199:     PetscDrawButton - Used to determine which button was pressed

    201:    Level: intermediate

    203: .seealso: PetscDrawGetMouseButton()
    204: E*/
    205: typedef enum { PETSC_BUTTON_NONE = 0,
    206:                PETSC_BUTTON_LEFT,PETSC_BUTTON_CENTER,PETSC_BUTTON_RIGHT,
    207:                PETSC_BUTTON_WHEEL_UP,PETSC_BUTTON_WHEEL_DOWN,
    208:                PETSC_BUTTON_LEFT_SHIFT,PETSC_BUTTON_CENTER_SHIFT,PETSC_BUTTON_RIGHT_SHIFT } PetscDrawButton;

    210: PETSC_EXTERN PetscErrorCode PetscDrawGetMouseButton(PetscDraw,PetscDrawButton *,PetscReal*,PetscReal *,PetscReal *,PetscReal *);

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

    214: /*S
    215:      PetscDrawViewPorts - Subwindows in a PetscDraw object

    217:    Level: intermediate

    219:   Concepts: graphics

    221: .seealso:  PetscDrawViewPortsCreate(), PetscDrawViewPortsSet()
    222: S*/
    223: typedef struct {
    224:   PetscInt  nports;
    225:   PetscReal *xl;
    226:   PetscReal *xr;
    227:   PetscReal *yl;
    228:   PetscReal *yr;
    229:   PetscDraw draw;
    230:   PetscReal port_xl,port_yl,port_xr,port_yr;   /* original port of parent PetscDraw */
    231: } PetscDrawViewPorts;
    232: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsCreate(PetscDraw,PetscInt,PetscDrawViewPorts**);
    233: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsCreateRect(PetscDraw,PetscInt,PetscInt,PetscDrawViewPorts**);
    234: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsDestroy(PetscDrawViewPorts*);
    235: PETSC_EXTERN PetscErrorCode PetscDrawViewPortsSet(PetscDrawViewPorts*,PetscInt);

    237: PETSC_EXTERN PetscClassId PETSC_DRAWAXIS_CLASSID;

    239: PETSC_EXTERN PetscErrorCode PetscDrawAxisCreate(PetscDraw,PetscDrawAxis*);
    240: PETSC_EXTERN PetscErrorCode PetscDrawAxisDestroy(PetscDrawAxis*);
    241: PETSC_EXTERN PetscErrorCode PetscDrawAxisDraw(PetscDrawAxis);
    242: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetLimits(PetscDrawAxis,PetscReal,PetscReal,PetscReal,PetscReal);
    243: PETSC_EXTERN PetscErrorCode PetscDrawAxisGetLimits(PetscDrawAxis,PetscReal*,PetscReal*,PetscReal*,PetscReal*);
    244: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetHoldLimits(PetscDrawAxis,PetscBool);
    245: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetColors(PetscDrawAxis,int,int,int);
    246: PETSC_EXTERN PetscErrorCode PetscDrawAxisSetLabels(PetscDrawAxis,const char[],const char[],const char[]);

    248: PETSC_EXTERN PetscClassId PETSC_DRAWLG_CLASSID;

    250: PETSC_EXTERN PetscErrorCode PetscDrawLGCreate(PetscDraw,PetscInt,PetscDrawLG*);
    251: PETSC_EXTERN PetscErrorCode PetscDrawLGDestroy(PetscDrawLG*);
    252: PETSC_EXTERN PetscErrorCode PetscDrawLGAddPoint(PetscDrawLG,const PetscReal*,const PetscReal*);
    253: PETSC_EXTERN PetscErrorCode PetscDrawLGAddCommonPoint(PetscDrawLG,const PetscReal,const PetscReal*);
    254: PETSC_EXTERN PetscErrorCode PetscDrawLGAddPoints(PetscDrawLG,PetscInt,PetscReal**,PetscReal**);
    255: PETSC_EXTERN PetscErrorCode PetscDrawLGDraw(PetscDrawLG);
    256: PETSC_EXTERN PetscErrorCode PetscDrawLGSave(PetscDrawLG);
    257: PETSC_EXTERN PetscErrorCode PetscDrawLGView(PetscDrawLG,PetscViewer);
    258: PETSC_EXTERN PetscErrorCode PetscDrawLGReset(PetscDrawLG);
    259: PETSC_EXTERN PetscErrorCode PetscDrawLGSetDimension(PetscDrawLG,PetscInt);
    260: PETSC_EXTERN PetscErrorCode PetscDrawLGGetDimension(PetscDrawLG,PetscInt*);
    261: PETSC_EXTERN PetscErrorCode PetscDrawLGSetLegend(PetscDrawLG,const char *const*);
    262: PETSC_EXTERN PetscErrorCode PetscDrawLGGetAxis(PetscDrawLG,PetscDrawAxis*);
    263: PETSC_EXTERN PetscErrorCode PetscDrawLGGetDraw(PetscDrawLG,PetscDraw*);
    264: PETSC_EXTERN PetscErrorCode PetscDrawLGSetUseMarkers(PetscDrawLG,PetscBool);
    265: PETSC_EXTERN PetscErrorCode PetscDrawLGSetLimits(PetscDrawLG,PetscReal,PetscReal,PetscReal,PetscReal);
    266: PETSC_EXTERN PetscErrorCode PetscDrawLGSetColors(PetscDrawLG,const int[]);
    267: PETSC_EXTERN PetscErrorCode PetscDrawLGSetOptionsPrefix(PetscDrawLG,const char[]);
    268: PETSC_EXTERN PetscErrorCode PetscDrawLGSetFromOptions(PetscDrawLG);

    270: PETSC_EXTERN PetscClassId PETSC_DRAWSP_CLASSID;

    272: PETSC_EXTERN PetscErrorCode PetscDrawSPCreate(PetscDraw,int,PetscDrawSP*);
    273: PETSC_EXTERN PetscErrorCode PetscDrawSPDestroy(PetscDrawSP*);
    274: PETSC_EXTERN PetscErrorCode PetscDrawSPAddPoint(PetscDrawSP,PetscReal*,PetscReal*);
    275: PETSC_EXTERN PetscErrorCode PetscDrawSPAddPoints(PetscDrawSP,int,PetscReal**,PetscReal**);
    276: PETSC_EXTERN PetscErrorCode PetscDrawSPDraw(PetscDrawSP,PetscBool);
    277: PETSC_EXTERN PetscErrorCode PetscDrawSPSave(PetscDrawSP);
    278: PETSC_EXTERN PetscErrorCode PetscDrawSPReset(PetscDrawSP);
    279: PETSC_EXTERN PetscErrorCode PetscDrawSPSetDimension(PetscDrawSP,int);
    280: PETSC_EXTERN PetscErrorCode PetscDrawSPGetAxis(PetscDrawSP,PetscDrawAxis*);
    281: PETSC_EXTERN PetscErrorCode PetscDrawSPGetDraw(PetscDrawSP,PetscDraw*);
    282: PETSC_EXTERN PetscErrorCode PetscDrawSPSetLimits(PetscDrawSP,PetscReal,PetscReal,PetscReal,PetscReal);
    283: PETSC_EXTERN PetscErrorCode PetscDrawLGSPDraw(PetscDrawLG,PetscDrawSP);

    285: PETSC_EXTERN PetscClassId PETSC_DRAWHG_CLASSID;

    287: PETSC_EXTERN PetscErrorCode PetscDrawHGCreate(PetscDraw,int,PetscDrawHG*);
    288: PETSC_EXTERN PetscErrorCode PetscDrawHGDestroy(PetscDrawHG*);
    289: PETSC_EXTERN PetscErrorCode PetscDrawHGAddValue(PetscDrawHG,PetscReal);
    290: PETSC_EXTERN PetscErrorCode PetscDrawHGDraw(PetscDrawHG);
    291: PETSC_EXTERN PetscErrorCode PetscDrawHGSave(PetscDrawHG);
    292: PETSC_EXTERN PetscErrorCode PetscDrawHGView(PetscDrawHG,PetscViewer);
    293: PETSC_EXTERN PetscErrorCode PetscDrawHGReset(PetscDrawHG);
    294: PETSC_EXTERN PetscErrorCode PetscDrawHGGetAxis(PetscDrawHG,PetscDrawAxis*);
    295: PETSC_EXTERN PetscErrorCode PetscDrawHGGetDraw(PetscDrawHG,PetscDraw*);
    296: PETSC_EXTERN PetscErrorCode PetscDrawHGSetLimits(PetscDrawHG,PetscReal,PetscReal,int,int);
    297: PETSC_EXTERN PetscErrorCode PetscDrawHGSetNumberBins(PetscDrawHG,int);
    298: PETSC_EXTERN PetscErrorCode PetscDrawHGSetColor(PetscDrawHG,int);
    299: PETSC_EXTERN PetscErrorCode PetscDrawHGCalcStats(PetscDrawHG, PetscBool );
    300: PETSC_EXTERN PetscErrorCode PetscDrawHGIntegerBins(PetscDrawHG, PetscBool );

    302: PETSC_EXTERN PetscClassId PETSC_DRAWBAR_CLASSID;

    304: PETSC_EXTERN PetscErrorCode PetscDrawBarCreate(PetscDraw,PetscDrawBar*);
    305: PETSC_EXTERN PetscErrorCode PetscDrawBarSetData(PetscDrawBar,PetscInt,const PetscReal[],const char *const*);
    306: PETSC_EXTERN PetscErrorCode PetscDrawBarDestroy(PetscDrawBar*);
    307: PETSC_EXTERN PetscErrorCode PetscDrawBarDraw(PetscDrawBar);
    308: PETSC_EXTERN PetscErrorCode PetscDrawBarSave(PetscDrawBar);
    309: PETSC_EXTERN PetscErrorCode PetscDrawBarSetColor(PetscDrawBar,int);
    310: PETSC_EXTERN PetscErrorCode PetscDrawBarSetLimits(PetscDrawBar,PetscReal,PetscReal);
    311: PETSC_EXTERN PetscErrorCode PetscDrawBarSort(PetscDrawBar,PetscBool,PetscReal);
    312: PETSC_EXTERN PetscErrorCode PetscDrawBarSetFromOptions(PetscDrawBar);
    313: PETSC_EXTERN PetscErrorCode PetscDrawBarGetAxis(PetscDrawBar,PetscDrawAxis*);
    314: PETSC_EXTERN PetscErrorCode PetscDrawBarGetDraw(PetscDrawBar,PetscDraw*);

    316: PETSC_EXTERN PetscErrorCode PetscDrawUtilitySetCmap(const char[],int,unsigned char[],unsigned char[],unsigned char[]);
    317: PETSC_EXTERN PetscErrorCode PetscDrawUtilitySetGamma(PetscReal);

    319: /*
    320:     Handling of X11 I/O errors in parallel
    321: */
    322: #if defined(PETSC_HAVE_X) && defined(PETSC_HAVE_SETJMP_H)

    324: #include <setjmp.h>

    326: PETSC_EXTERN jmp_buf PetscXIOErrorHandlerJumpBuf;
    327: PETSC_EXTERN void    PetscXIOErrorHandlerJump(void *);
    328: PETSC_EXTERN_TYPEDEF typedef void (*PetscXIOErrorHandler)(void *);
    329: PETSC_EXTERN PetscXIOErrorHandler PetscSetXIOErrorHandler(PetscXIOErrorHandler);

    331: #define PetscDrawCollectiveBegin(draw) 0; do { \
    332:   PetscErrorCode                _Petsc_ierr; \
    333:   jmp_buf                       _Petsc_jmpbuf; \
    334:   volatile PetscXIOErrorHandler _Petsc_xioerrhdl = NULL; \
    335:   PetscBool                     _Petsc_isdrawx, _Petsc_xioerr, _Petsc_xioerr_local = PETSC_FALSE; \
    336:   _Petsc_PetscObjectTypeCompare((PetscObject)(draw),PETSC_DRAW_X,&_Petsc_isdrawx);CHKERRQ(_Petsc_ierr); \
    337:   if (_Petsc_isdrawx) { \
    338:     _Petsc_PetscMemcpy(&_Petsc_jmpbuf,&PetscXIOErrorHandlerJumpBuf,sizeof(_Petsc_jmpbuf));CHKERRQ(_Petsc_ierr); \
    339:     _Petsc_xioerrhdl = PetscSetXIOErrorHandler(PetscXIOErrorHandlerJump); \
    340:     if (setjmp(PetscXIOErrorHandlerJumpBuf)) {_Petsc_xioerr_local = PETSC_TRUE; do {_Petsc_PetscDrawCollectiveEnd(draw);CHKERRQ(_Petsc_ierr);} \
    341:   } do {} while(0)

    343: #define PetscDrawCollectiveEnd(draw) 0; \
    344:   if (_Petsc_isdrawx) { \
    345:     (void)PetscSetXIOErrorHandler(_Petsc_xioerrhdl); \
    346:     _Petsc_PetscMemcpy(&PetscXIOErrorHandlerJumpBuf,&_Petsc_jmpbuf,sizeof(PetscXIOErrorHandlerJumpBuf));CHKERRQ(_Petsc_ierr); \
    347:     _Petsc_MPI_Allreduce(&_Petsc_xioerr_local,&_Petsc_xioerr,1,MPIU_BOOL,MPI_LOR,PetscObjectComm((PetscObject)(draw)));CHKERRQ(_Petsc_ierr); \
    348:     if (_Petsc_xioerr) { \
    349:       _Petsc_PetscDrawSetType((draw),PETSC_DRAW_NULL);CHKERRQ(_Petsc_ierr); \
    350:       return(0); \
    351:     } \
    352:   } } while(0)

    354: #else

    356: #define PetscDrawCollectiveBegin(draw) 0; do {} while(0)
    357: #define PetscDrawCollectiveEnd(draw)   0; do {} while(0)

    359: #endif

    361: #endif