Actual source code: zdraw.c

     2:  #include src/fortran/custom/zpetsc.h

      4: #ifdef PETSC_HAVE_FORTRAN_CAPS
      5: #define petscdrawsettype_         PETSCDRAWSETTYPE
      6: #define petscdrawcreate_          PETSCDRAWCREATE
      7: #define petscdrawaxisdestroy_     PETSCDRAWAXISDESTROY
      8: #define petscdrawaxiscreate_      PETSCDRAWAXISCREATE
      9: #define petscdrawaxissetlabels_   PETSCDRAWAXISSETLABELS
     10: #define petscdrawlgcreate_        PETSCDRAWLGCREATE
     11: #define petscdrawlgdestroy_       PETSCDRAWLGDESTROY
     12: #define petscdrawlggetaxis_       PETSCDRAWLGGETAXIS
     13: #define petscdrawlggetdraw_       PETSCDRAWLGGETDRAW
     14: #define petscdrawopenx_           PETSCDRAWOPENX
     15: #define petscdrawstring_          PETSCDRAWSTRING
     16: #define petscdrawstringvertical_  PETSCDRAWSTRINGVERTICAL
     17: #define petscdrawdestroy_         PETSCDRAWDESTROY
     18: #define petscviewerdrawgetdraw_   PETSCVIEWERDRAWGETDRAW
     19: #define petscviewerdrawgetdrawlg_ PETSCVIEWERDRAWGETDRAWLG
     20: #define petscdrawgettitle_        PETSCDRAWGETTITLE
     21: #define petscdrawsettitle_        PETSCDRAWSETTITLE
     22: #define petscdrawappendtitle_     PETSCDRAWAPPENDTITLE
     23: #define petscdrawgetpopup_        PETSCDRAWGETPOPUP
     24: #define petscdrawzoom_            PETSCDRAWZOOM
     25: #elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
     26: #define petscdrawcreate_          petscdrawcreate
     27: #define petscdrawsettype_         petscdrawsettype
     28: #define petscdrawzoom_            petscdrawzoom
     29: #define petscdrawaxisdestroy_     petscdrawaxisdestroy
     30: #define petscdrawaxiscreate_      petscdrawaxiscreate
     31: #define petscdrawaxissetlabels_   petscdrawaxissetlabels
     32: #define petscdrawlgcreate_        petscdrawlgcreate
     33: #define petscdrawlgdestroy_       petscdrawlgdestroy
     34: #define petscdrawlggetaxis_       petscdrawlggetaxis
     35: #define petscdrawlggetdraw_       petscdrawlggetdraw
     36: #define petscdrawopenx_           petscdrawopenx
     37: #define petscdrawstring_          petscdrawstring
     38: #define petscdrawstringvertical_  petscdrawstringvertical
     39: #define petscdrawdestroy_         petscdrawdestroy
     40: #define petscviewerdrawgetdraw_   petscviewerdrawgetdraw
     41: #define petscviewerdrawgetdrawlg_ petscviewerdrawgetdrawlg
     42: #define petscdrawgettitle_        petscdrawgettitle
     43: #define petscdrawsettitle_        petscdrawsettitle
     44: #define petscdrawappendtitle_     petscdrawappendtitle
     45: #define petscdrawgetpopup_        petscdrawgetpopup
     46: #endif

     49: static FCN f1;

     51: static PetscErrorCode ourdrawzoom(PetscDraw draw,void *ctx)
     52: {
     53:   PetscErrorCode 0;

     55:   (*f1)(&draw,ctx,&ierr);
     56:   return 0;
     57: }

     61: void PETSC_STDCALL petscdrawzoom_(PetscDraw *draw,FCN f,void *ctx,PetscErrorCode *ierr)
     62: {
     63:   f1      = f;
     64:   *PetscDrawZoom(*draw,ourdrawzoom,ctx);
     65: }

     67: void PETSC_STDCALL petscviewerdrawgetdraw_(PetscViewer *vin,int *win,PetscDraw *draw,PetscErrorCode *ierr)
     68: {
     69:   PetscViewer v;
     70:   PetscPatchDefaultViewers_Fortran(vin,v);
     71:   *PetscViewerDrawGetDraw(v,*win,draw);
     72: }

     74: void PETSC_STDCALL petscviewerdrawgetdrawlg_(PetscViewer *vin,int *win,PetscDrawLG *drawlg,PetscErrorCode *ierr)
     75: {
     76:   PetscViewer v;
     77:   PetscPatchDefaultViewers_Fortran(vin,v);
     78:   *PetscViewerDrawGetDrawLG(v,*win,drawlg);
     79: }

     81: void PETSC_STDCALL petscdrawsettype_(PetscDraw *ctx,CHAR text PETSC_MIXED_LEN(len),
     82:                PetscErrorCode *ierr PETSC_END_LEN(len)){
     83:   char *t;
     84:   FIXCHAR(text,len,t);
     85:   *PetscDrawSetType(*ctx,t);
     86:   FREECHAR(text,t);
     87: }

     89: void PETSC_STDCALL petscdrawstring_(PetscDraw *ctx,double* xl,double* yl,int* cl,CHAR text PETSC_MIXED_LEN(len),
     90:                PetscErrorCode *ierr PETSC_END_LEN(len)){
     91:   char *t;
     92:   FIXCHAR(text,len,t);
     93:   *PetscDrawString(*ctx,*xl,*yl,*cl,t);
     94:   FREECHAR(text,t);
     95: }
     96: void PETSC_STDCALL petscdrawstringvertical_(PetscDraw *ctx,double *xl,double *yl,int *cl,
     97:                    CHAR text PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len))
     98: {
     99:   char *t;
    100:   FIXCHAR(text,len,t);
    101:   *PetscDrawStringVertical(*ctx,*xl,*yl,*cl,t);
    102:   FREECHAR(text,t);
    103: }

    105: void PETSC_STDCALL petscdrawdestroy_(PetscDraw *ctx,PetscErrorCode *ierr)
    106: {
    107:   *PetscDrawDestroy(*ctx);
    108: }

    110: void PETSC_STDCALL petscdrawcreate_(MPI_Comm *comm,CHAR display PETSC_MIXED_LEN(len1),
    111:                     CHAR title PETSC_MIXED_LEN(len2),int *x,int *y,int *w,int *h,PetscDraw* inctx,
    112:                     PetscErrorCode *ierr PETSC_END_LEN(len1) PETSC_END_LEN(len2))
    113: {
    114:   char *t1,*t2;

    116:   FIXCHAR(display,len1,t1);
    117:   FIXCHAR(title,len2,t2);
    118:   *PetscDrawCreate((MPI_Comm)PetscToPointerComm(*comm),t1,t2,*x,*y,*w,*h,inctx);
    119:   FREECHAR(display,t1);
    120:   FREECHAR(title,t2);
    121: }

    123: #if defined(PETSC_HAVE_X11)
    124: void PETSC_STDCALL petscdrawopenx_(MPI_Comm *comm,CHAR display PETSC_MIXED_LEN(len1),
    125:                     CHAR title PETSC_MIXED_LEN(len2),int *x,int *y,int *w,int *h,PetscDraw* inctx,
    126:                     PetscErrorCode *ierr PETSC_END_LEN(len1) PETSC_END_LEN(len2))
    127: {
    128:   char *t1,*t2;

    130:   FIXCHAR(display,len1,t1);
    131:   FIXCHAR(title,len2,t2);
    132:   *PetscDrawOpenX((MPI_Comm)PetscToPointerComm(*comm),t1,t2,*x,*y,*w,*h,inctx);
    133:   FREECHAR(display,t1);
    134:   FREECHAR(title,t2);
    135: }
    136: #endif

    138: void PETSC_STDCALL petscdrawlggetaxis_(PetscDrawLG *lg,PetscDrawAxis *axis,PetscErrorCode *ierr)
    139: {
    140:   *PetscDrawLGGetAxis(*lg,axis);
    141: }

    143: void PETSC_STDCALL petscdrawlggetdraw_(PetscDrawLG *lg,PetscDraw *win,PetscErrorCode *ierr)
    144: {
    145:   *PetscDrawLGGetDraw(*lg,win);
    146: }

    148: void PETSC_STDCALL petscdrawlgdestroy_(PetscDrawLG *lg,PetscErrorCode *ierr)
    149: {
    150:   *PetscDrawLGDestroy(*lg);
    151: }

    153: void PETSC_STDCALL petscdrawlgcreate_(PetscDraw *win,int *dim,PetscDrawLG *outctx,PetscErrorCode *ierr)
    154: {
    155:   *PetscDrawLGCreate(*win,*dim,outctx);
    156: }

    158: void PETSC_STDCALL petscdrawaxissetlabels_(PetscDrawAxis *axis,CHAR top PETSC_MIXED_LEN(len1),
    159:                     CHAR xlabel PETSC_MIXED_LEN(len2),CHAR ylabel PETSC_MIXED_LEN(len3),
    160:                     PetscErrorCode *ierr PETSC_END_LEN(len1) PETSC_END_LEN(len2) PETSC_END_LEN(len3))
    161: {
    162:   char *t1,*t2,*t3;
    163:
    164:   FIXCHAR(top,len1,t1);
    165:   FIXCHAR(xlabel,len2,t2);
    166:   FIXCHAR(ylabel,len3,t3);
    167:   *PetscDrawAxisSetLabels(*axis,t1,t2,t3);
    168:   FREECHAR(top,t1);
    169:   FREECHAR(xlabel,t2);
    170:   FREECHAR(ylabel,t3);
    171: }

    173: void PETSC_STDCALL petscdrawaxisdestroy_(PetscDrawAxis *axis,PetscErrorCode *ierr)
    174: {
    175:   *PetscDrawAxisDestroy(*axis);
    176: }

    178: void PETSC_STDCALL petscdrawaxiscreate_(PetscDraw *win,PetscDrawAxis *ctx,PetscErrorCode *ierr)
    179: {
    180:   *PetscDrawAxisCreate(*win,ctx);
    181: }

    183: void PETSC_STDCALL petscdrawgettitle_(PetscDraw *draw,CHAR title PETSC_MIXED_LEN(len),
    184:                                  PetscErrorCode *ierr PETSC_END_LEN(len))
    185: {
    186:   char *c3,*t;
    187:   int  len3;
    188: #if defined(PETSC_USES_CPTOFCD)
    189:     c3   = _fcdtocp(title);
    190:     len3 = _fcdlen(title) - 1;
    191: #else
    192:     c3   = title;
    193:     len3 = len - 1;
    194: #endif
    195:   *PetscDrawGetTitle(*draw,&t);
    196:   *PetscStrncpy(c3,t,len3);
    197: }

    199: void PETSC_STDCALL petscdrawsettitle_(PetscDraw *draw,CHAR title PETSC_MIXED_LEN(len),
    200:                                  PetscErrorCode *ierr PETSC_END_LEN(len))
    201: {
    202:   char *t1;
    203:   FIXCHAR(title,len,t1);
    204:   *PetscDrawSetTitle(*draw,t1);
    205:   FREECHAR(title,t1);
    206: }

    208: void PETSC_STDCALL petscdrawappendtitle_(PetscDraw *draw,CHAR title PETSC_MIXED_LEN(len),
    209:                                     PetscErrorCode *ierr PETSC_END_LEN(len))
    210: {
    211:   char *t1;
    212:   FIXCHAR(title,len,t1);
    213:   *PetscDrawAppendTitle(*draw,t1);
    214:   FREECHAR(title,t1);
    215: }

    217: void PETSC_STDCALL petscdrawgetpopup_(PetscDraw *draw,PetscDraw *popup,PetscErrorCode *ierr)
    218: {
    219:   *PetscDrawGetPopup(*draw,popup);
    220: }