Actual source code: dmarker.c
petsc-3.10.5 2019-03-28
Report Typos and Errors

      2: /*
      3:        Provides the calling sequences for all the basic PetscDraw routines.
      4: */
      5:  #include <petsc/private/drawimpl.h>
      6: const char *const PetscDrawMarkerTypes[]     = {"CROSS","POINT","PLUS","CIRCLE","PetscDrawMarkerType","PETSC_DRAW_MARKER_",0};

      8: /*@
      9:    PetscDrawMarker - PetscDraws a marker onto a drawable.

     11:    Not collective

     13:    Input Parameters:
     14: +  draw - the drawing context
     15: .  xl,yl - the coordinates of the marker
     16: -  cl - the color of the marker

     18:    Level: beginner

     20:    Concepts: marker^drawing
     21:    Concepts: drawing^marker

     23: .seealso: PetscDrawPoint(), PetscDrawString(), PetscDrawSetMarkerType(), PetscDrawGetMarkerType()

     25: @*/
     26: PetscErrorCode  PetscDrawMarker(PetscDraw draw,PetscReal xl,PetscReal yl,int cl)
     27: {

     32:   if (draw->markertype == PETSC_DRAW_MARKER_CROSS){
     33:     if (draw->ops->coordinatetopixel && draw->ops->pointpixel) {
     34:       int i,j,k;
     35:       (*draw->ops->coordinatetopixel)(draw,xl,yl,&i,&j);
     36:       for (k=-2; k<=2; k++) {
     37:         (*draw->ops->pointpixel)(draw,i+k,j+k,cl);
     38:         (*draw->ops->pointpixel)(draw,i+k,j-k,cl);
     39:       }
     40:     } else if (draw->ops->string) {
     41:        (*draw->ops->string)(draw,xl,yl,cl,"x");
     42:     } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for drawing marker type CROSS");
     43:   } else if (draw->markertype == PETSC_DRAW_MARKER_PLUS){
     44:     if (draw->ops->coordinatetopixel && draw->ops->pointpixel) {
     45:       int i,j,k;
     46:       (*draw->ops->coordinatetopixel)(draw,xl,yl,&i,&j);
     47:       for (k=-2; k<=2; k++) {
     48:         (*draw->ops->pointpixel)(draw,i,j+k,cl);
     49:         (*draw->ops->pointpixel)(draw,i+k,j,cl);
     50:       }
     51:     } else if (draw->ops->string) {
     52:        (*draw->ops->string)(draw,xl,yl,cl,"+");
     53:     } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for drawing marker type PLUS");
     54:   } else if (draw->markertype == PETSC_DRAW_MARKER_CIRCLE){
     55:     if (draw->ops->coordinatetopixel && draw->ops->pointpixel) {
     56:       int i,j,k;
     57:       (*draw->ops->coordinatetopixel)(draw,xl,yl,&i,&j);
     58:       for (k=-1; k<=1; k++) {
     59:         (*draw->ops->pointpixel)(draw,i+2,j+k,cl);
     60:         (*draw->ops->pointpixel)(draw,i-2,j+k,cl);
     61:         (*draw->ops->pointpixel)(draw,i+k,j+2,cl);
     62:         (*draw->ops->pointpixel)(draw,i+k,j-2,cl);
     63:       }
     64:     } else if (draw->ops->string) {
     65:        (*draw->ops->string)(draw,xl,yl,cl,"+");
     66:     } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for drawing marker type CIRCLE");
     67:   } else {
     68:     (*draw->ops->point)(draw,xl,yl,cl);
     69:   }
     70:   return(0);
     71: }

     73: /*@
     74:    PetscDrawSetMarkerType - sets the type of marker to display with PetscDrawMarker()

     76:    Not collective

     78:    Input Parameters:
     79: +  draw - the drawing context
     80: -  mtype - either PETSC_DRAW_MARKER_CROSS (default) or PETSC_DRAW_MARKER_POINT

     82:    Options Database:
     83: .  -draw_marker_type - x or point

     85:    Level: beginner

     87:    Concepts: marker^drawing
     88:    Concepts: drawing^marker

     90: .seealso: PetscDrawPoint(), PetscDrawMarker(), PetscDrawGetMarkerType()

     92: @*/
     93: PetscErrorCode  PetscDrawSetMarkerType(PetscDraw draw,PetscDrawMarkerType mtype)
     94: {
     97:   draw->markertype = mtype;
     98:   return(0);
     99: }

    101: /*@
    102:    PetscDrawGetMarkerType - gets the type of marker to display with PetscDrawMarker()

    104:    Not collective

    106:    Input Parameters:
    107: +  draw - the drawing context
    108: -  mtype - either PETSC_DRAW_MARKER_CROSS (default) or PETSC_DRAW_MARKER_POINT

    110:    Level: beginner

    112:    Concepts: marker^drawing
    113:    Concepts: drawing^marker

    115: .seealso: PetscDrawPoint(), PetscDrawMarker(), PetscDrawSetMarkerType()

    117: @*/
    118: PetscErrorCode  PetscDrawGetMarkerType(PetscDraw draw,PetscDrawMarkerType *mtype)
    119: {
    122:   *mtype = draw->markertype;
    123:   return(0);
    124: }