CFPRIME X11OAP                                                          X11OAP      1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*               Output Analysis Program for ETMSP (OAP)               *RIGHTE      4
C*               =======================================               *RIGHTE      5
C*                                                                     *RIGHTE     11
C*        copyright @(1993) Electric Power Research Institute          *RIGHTE     12
C*                                                                     *RIGHTE     13
C* EPRI reserves all rights in the software and associated             *RIGHTE     14
C* documentation as delivered. The software and its associated         *RIGHTE     15
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     16
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     17
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     18
C* of any changes or modifications to the software within two (2)      *RIGHTE     19
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     20
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     21
C* new designation sufficiently different from its then current        *RIGHTE     22
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     23
C* the current software as changed or modified.                        *RIGHTE     24
C*                                                                     *RIGHTE     25
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     26
C* directly from EPRI.                                                 *RIGHTE     27
C*                                                                     *RIGHTE     28
C* This program and supporting materials may be independently available*RIGHTE     29
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     30
C* distribution fee. The EPSC is a service of                          *RIGHTE     31
C*                                                                     *RIGHTE     32
C*                    Power Computing Company                          *RIGHTE     33
C*                    1930 Hi Line                                     *RIGHTE     34
C*                    Dallas, Tx 75207                                 *RIGHTE     35
C*                                                                     *RIGHTE     36
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     37
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     38
C*                                                                     *RIGHTE     39
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     40
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     41
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     42
C*    DOCUMENTATION; OR                                                *RIGHTE     43
C*                                                                     *RIGHTE     44
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     45
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     46
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     47
C*                                                                     *RIGHTE     48
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     49
C* THEREOF.                                                            *RIGHTE     50
C*                                                                     *RIGHTE     51
C***********************************************************************RIGHTE     52
CD                                                                      X11OAP      3
CD  THIS SUBROUTINE IS THE MAIN DRIVER FOR THE X11 LIBRARY              X11OAP      4
CD  GRAPHICAL INTERFACE                                                 X11OAP      5
CD                                                                      X11OAP      6
*IF WSX11                                                               X11OAP      7
      SUBROUTINE X3DPLT(IDP)                                            X11OAP      8
CD                                                                      X11OAP      9
CD   PURPOSE : THE MAIN DRIVER FOR X3D GRAPHIC PLOT                     X11OAP     10
CD    IDP 0: INIT, IDP 1: PLOT                                          X11OAP     11
      INCLUDE 'PARAM.INS'                                               X11OAP     12
      INCLUDE 'XYARAY.INS'                                              X11OAP     13
      INCLUDE 'DPPLOT.INS'                                              X11OAP     14
      INCLUDE 'SOAPC1.INS'                                              X11OAP     15
      COMMON /XP3D/ XTEM(1000),YTEM(1000),ZTEM(1000)                    X11OAP     16
      COMMON /RLD/ XS(4), YS(4), XD(4), YD(4), ICC, ICS(12),IK2         X11OAP     17
      CHARACTER*80 XL, ZL                                               X11OAP     18
      COMMON /XSA/ IDX1, IDX2                                           X11OAP     19
      INTEGER IDX1(6),IDX2(6)                                           X11OAP     20
      COMMON /SCFLAG/ IFLG                                              X11OAP     21
                                                                        X11OAP     22
C PLOT RELAY DATA                                                       X11OAP     23
        IF (IFLG.EQ.2) THEN                                             X11OAP     24
           XL='TIME IN SECONDS'                                         X11OAP     25
           LENX=LENS(XL)                                                X11OAP     26
           LENY=LENS(XTITLE)                                            X11OAP     27
           LENZ=LENS(YTITLE(1))                                         X11OAP     28
           CALL GPCOPY(YTEM,XTEM,XARAY,XARAY,MXPT,MXPLOT,               X11OAP     29
     +     1,MAXPT(1),XMIN,XMAX)                                        X11OAP     30
           CALL GPCOPY(ZTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,               X11OAP     31
     +     1,MAXPT(1),YMIN(1),YMAX(1))                                  X11OAP     32
        DO 50 I=1,MAXPT(1)                                              X11OAP     33
         XTEM(I)=T(I,1)                                                 X11OAP     34
 50     CONTINUE                                                        X11OAP     35
        CALL INIT_3D_DATA(T(1,1),T(MAXPT(1),1),XMIN,XMAX,               X11OAP     36
     +     YMIN(1),YMAX(1),XL,LENX,XTITLE,LENY,                         X11OAP     37
     +     YTITLE(1),LENZ)                                              X11OAP     38
C INPUT PLATE BOUNDARY CONDITION                                        X11OAP     39
        CALL RELDAT                                                     X11OAP     40
                                                                        X11OAP     41
        ELSEIF (IFLG.EQ.4) THEN                                         X11OAP     42
          LENX=LENS(XTITLE)                                             X11OAP     43
          LENY=LENS(YTITLE(1))                                          X11OAP     44
C         ZL = 'Z'                                                      X11OAP     45
         WRITE(*,*) 'Input Z Title'                                     X11OAP     46
         READ (*,'(A)') ZL                                              X11OAP     47
                                                                        X11OAP     48
         LENZ=LENS(ZL)                                                  X11OAP     49
         YM=1.0E10                                                      X11OAP     50
         YA=-1.0E10                                                     X11OAP     51
         ZM=1.0E10                                                      X11OAP     52
         ZA=-1.0E10                                                     X11OAP     53
         DO 60 I=1, KCH(1)                                              X11OAP     54
         WRITE(*,*) I,'      INPUT Z RANGE'                             X11OAP     55
         READ (*,*) ZTEM(I)                                             X11OAP     56
         IF (YMIN(I).LT.YM) YM=YMIN(I)                                  X11OAP     57
         IF (YMAX(I).GT.YA) YA=YMAX(I)                                  X11OAP     58
         IF (ZTEM(I).LT.ZM) ZM=ZTEM(I)                                  X11OAP     59
         IF (ZTEM(I).GT.ZA) ZA=ZTEM(I)                                  X11OAP     60
 60     CONTINUE                                                        X11OAP     61
         IK2 = KCH(1)                                                   X11OAP     62
          CALL INIT_3D_DATA(XMIN,XMAX,ZM,ZA,YM,YA,XTITLE,               X11OAP     63
     +   LENX, ZL,LENZ, YTITLE(1),LENY)                                 X11OAP     64
                                                                        X11OAP     65
        ELSEIF (KCH(1).EQ.2) THEN                                       X11OAP     66
           XL='TIME IN SECONDS'                                         X11OAP     67
           LENX=LENS(XL)                                                X11OAP     68
           LENY=LENS(YTITLE(1))                                         X11OAP     69
           LENZ=LENS(YTITLE(2))                                         X11OAP     70
C          CALL DPXMAM(XARAY,MXPT,XMIN,XMAX)                            X11OAP     71
           CALL GPCOPY(YTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,               X11OAP     72
     +     1,MAXPT(1),YMIN(1),YMAX(1))                                  X11OAP     73
           CALL GPCOPY(ZTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,               X11OAP     74
     +     2,MAXPT(2),YMIN(2),YMAX(2))                                  X11OAP     75
        CALL INIT_3D_DATA(XMIN,XMAX,YMIN(1),YMAX(1),                    X11OAP     76
     +     YMIN(2),YMAX(2),XL,LENX,YTITLE(1),LENY,                      X11OAP     77
     +     YTITLE(2),LENZ)                                              X11OAP     78
                                                                        X11OAP     79
        ELSEIF (KCH(1).EQ.3) THEN                                       X11OAP     80
           LENX=LENS(YTITLE(1))                                         X11OAP     81
           LENY=LENS(YTITLE(2))                                         X11OAP     82
           LENZ=LENS(YTITLE(3))                                         X11OAP     83
           CALL GPCOPY(YTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,               X11OAP     84
     +     2,MAXPT(2),YMIN(2),YMAX(2))                                  X11OAP     85
           CALL GPCOPY(ZTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,               X11OAP     86
     +     3,MAXPT(3),YMIN(3),YMAX(3))                                  X11OAP     87
           CALL GPCOPY(XTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,               X11OAP     88
     +     1,MAXPT(1),YMIN(1),YMAX(1))                                  X11OAP     89
        CALL INIT_3D_DATA(YMIN(1),YMAX(1),YMIN(2),YMAX(2),              X11OAP     90
     +     YMIN(3),YMAX(3),YTITLE(1),LENX,YTITLE(2),LENY,               X11OAP     91
     +     YTITLE(3),LENZ)                                              X11OAP     92
        ENDIF                                                           X11OAP     93
                                                                        X11OAP     94
        IF (IDP.EQ.0) THEN                                              X11OAP     95
        CALL INIT_3D_W                                                  X11OAP     96
        ENDIF                                                           X11OAP     97
        CALL CLEAR_3D_W                                                 X11OAP     98
        CALL EVENT_3D(IDX1,IDX2,MAXPT,XTEM,YTEM,ZTEM,XARAY,YARAY,       X11OAP     99
     +    IK2, XS, YS, XD, YD, IFLG, ICS, ICC)                          X11OAP    100
                                                                        X11OAP    101
        RETURN                                                          X11OAP    102
        END                                                             X11OAP    103
                                                                        X11OAP    104
      SUBROUTINE RELDAT                                                 X11OAP    105
      INCLUDE 'PARAM.INS'                                               X11OAP    106
      INCLUDE 'XYARAY.INS'                                              X11OAP    107
      INCLUDE 'DPPLOT.INS'                                              X11OAP    108
      INCLUDE 'SOAPC1.INS'                                              X11OAP    109
      COMMON /RLD/ XS(4), YS(4), XD(4), YD(4), ICC, ICS(12),IK2         X11OAP    110
                                                                        X11OAP    111
           IJ=2                                                         X11OAP    112
           IK1=0                                                        X11OAP    113
           IK2=0                                                        X11OAP    114
           IX=0                                                         X11OAP    115
           ICC=0                                                        X11OAP    116
 101       IX=IX+1                                                      X11OAP    117
           XX=XARAY(1001-IX,6)                                          X11OAP    118
           IF(XX.GE.0.99.AND.XX.LE.3.01)THEN                            X11OAP    119
              IK2=IK2+1                                                 X11OAP    120
              ANG=YARAY(IK2,6)                                          X11OAP    121
              R=XARAY(IK2,6)                                            X11OAP    122
              IF(ABS(ANG).LE.1.0E-5)THEN                                X11OAP    123
                 XS(IK2)=R                                              X11OAP    124
                 XD(IK2)=R                                              X11OAP    125
                 YS(IK2)=YMIN(1)                                        X11OAP    126
                 YD(IK2)=YMAX(1)                                        X11OAP    127
              ELSEIF(ABS(ANG-90).LE.1.0E-5)THEN                         X11OAP    128
                 XS(IK2)=XMIN                                           X11OAP    129
                 XD(IK2)=XMAX                                           X11OAP    130
                 YS(IK2)=R                                              X11OAP    131
                 YD(IK2)=R                                              X11OAP    132
              ELSEIF(ABS(ANG+90).LE.1.0E-5)THEN                         X11OAP    133
                 XS(IK2)=XMIN                                           X11OAP    134
                 XD(IK2)=XMAX                                           X11OAP    135
                 YS(IK2)=-R                                             X11OAP    136
                 YD(IK2)=-R                                             X11OAP    137
              ELSEIF(ABS(ANG-180).LE.1.0E-5.OR.                         X11OAP    138
     +               ABS(ANG+180).LE.1.0E-5)THEN                        X11OAP    139
                 XS(IK2)=-R                                             X11OAP    140
                 XD(IK2)=-R                                             X11OAP    141
                 YS(IK2)=YMIN(1)                                        X11OAP    142
                 YD(IK2)=YMAX(1)                                        X11OAP    143
              ELSE                                                      X11OAP    144
                 ANG=ANG*3.14159/180                                    X11OAP    145
                 Y=XMIN/TAN(ANG)+R/SIN(ANG)                             X11OAP    146
                 IF(Y.LT.YMAX(1).AND.Y.GE.YMIN(1))THEN                  X11OAP    147
                    XD(IK2)=XMIN                                        X11OAP    148
                    YD(IK2)=Y                                           X11OAP    149
                 ENDIF                                                  X11OAP    150
                 X=YMIN(1)*TAN(ANG)+R/COS(ANG)                          X11OAP    151
                 IF(X.LE.XMAX.AND.X.GT.XMIN)THEN                        X11OAP    152
                    XS(IK2)=XD(IK2)                                     X11OAP    153
                    YS(IK2)=YD(IK2)                                     X11OAP    154
                    XD(IK2)=X                                           X11OAP    155
                    YD(IK2)=YMIN(1)                                     X11OAP    156
                 ENDIF                                                  X11OAP    157
                 Y=R/SIN(ANG)-XMAX/TAN(ANG)                             X11OAP    158
                 IF(Y.LE.YMAX(1).AND.Y.GT.YMIN(1))THEN                  X11OAP    159
                    XS(IK2)=XD(IK2)                                     X11OAP    160
                    YS(IK2)=YD(IK2)                                     X11OAP    161
                    XD(IK2)=XMAX                                        X11OAP    162
                    YD(IK2)=Y                                           X11OAP    163
                 ENDIF                                                  X11OAP    164
                 X=R/COS(ANG)-YMAX(1)*TAN(ANG)                          X11OAP    165
                 IF(X.LT.XMAX.AND.X.GE.XMIN)THEN                        X11OAP    166
                    XS(IK2)=XD(IK2)                                     X11OAP    167
                    YS(IK2)=YD(IK2)                                     X11OAP    168
                    XD(IK2)=X                                           X11OAP    169
                    YD(IK2)=YMAX(1)                                     X11OAP    170
                 ENDIF                                                  X11OAP    171
              ENDIF                                                     X11OAP    172
           ELSEIF(XX.EQ.-1)THEN                                         X11OAP    173
              GOTO 200                                                  X11OAP    174
           ELSE                                                         X11OAP    175
              IF(IK1+245.GE.1000)THEN                                   X11OAP    176
                 IJ=IJ+1                                                X11OAP    177
                 IK1=0                                                  X11OAP    178
              ENDIF                                                     X11OAP    179
              ICC=ICC+1                                                 X11OAP    180
              ICS(ICC)=IK1+(IJ-1)*1000                                  X11OAP    181
              IK1=IK1+245                                               X11OAP    182
           ENDIF                                                        X11OAP    183
           GOTO 101                                                     X11OAP    184
  200      CONTINUE                                                     X11OAP    185
          RETURN                                                        X11OAP    186
          END                                                           X11OAP    187
                                                                        X11OAP    188
      SUBROUTINE X11OAP(IDP)                                            X11OAP    189
CD                                                                      X11OAP    190
CD   PURPOSE : THE MAIN DRIVER FOR XLIB GRAPHIC PLOT                    X11OAP    191
CD    IDP 0: INIT, IDP 1: PLOT                                          X11OAP    192
                                                                        X11OAP    193
      INCLUDE 'PARAM.INS'                                               X11OAP    194
      INCLUDE 'XYARAY.INS'                                              X11OAP    195
      INCLUDE 'DPPLOT.INS'                                              X11OAP    196
      INCLUDE 'SOAPC1.INS'                                              X11OAP    197
      INCLUDE 'CHDISP.INS'                                              X11OAP    198
      COMMON /XSA/ IDX1, IDX2                                           X11OAP    199
      INTEGER IDX1(6),IDX2(6)                                           X11OAP    200
      REAL XTEM(MXPT),YTEM(MXPT)                                        X11OAP    201
        COMMON /SCFLAG/ IFLG                                            X11OAP    202
                                                                        X11OAP    203
                                                                        X11OAP    204
        IF(SSCALE)THEN                                                  X11OAP    205
          IP1M1=IP1+1                                                   X11OAP    206
          CALL SCALES(IP1M1,KCH(1),XARAY)                               X11OAP    207
        ENDIF                                                           X11OAP    208
        IF(GSCALE) SSCALE=.TRUE.                                        X11OAP    209
        IF(GSCALE) SSCALE=.TRUE.                                        X11OAP    210
        IF (CFLRUN)RETURN                                               X11OAP    211
                                                                        X11OAP    212
        LENX=LENS(FTITLE)                                               X11OAP    213
        CALL INITG (LENX,LENP,XMIN,XMAX,10,10,5,5)                      X11OAP    214
        IF (IDP.EQ.0) THEN                                              X11OAP    215
C       CALL DPXMAM(XARAY,MXPT,XMIN,XMAX)                               X11OAP    216
        CALL INITWINDOW                                                 X11OAP    217
        ENDIF                                                           X11OAP    218
                                                                        X11OAP    219
        CALL CLEAR_W                                                    X11OAP    220
        CALL XP_BOX                                                     X11OAP    221
        I=0                                                             X11OAP    222
 100    I=I+1                                                           X11OAP    223
        LENC2 = LENS(CTITL2(I))                                         X11OAP    224
        LENY  = LENS(YTITLE(I))                                         X11OAP    225
        LENL1 = LENS(LTITLE(I))                                         X11OAP    226
        LENL2 = LENS(LTITL2(I))                                         X11OAP    227
        CALL XP_LABEL (I,LENC2,LENP,LENY,                               X11OAP    228
     +       LENL1,LENL2,YMIN(I),YMAX(I),IFLG)                          X11OAP    229
          CALL GPCOPY(YTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,                X11OAP    230
     +     I,MAXPT(I),YMIN(I),YMAX(I))                                  X11OAP    231
          CALL XPLOT(I,IDX1(I), IDX2(I),XTEM,YTEM,I,0,0,IFLG)           X11OAP    232
        IF(IFLG.EQ.2)THEN                                               X11OAP    233
           IJ=2                                                         X11OAP    234
           IK1=0                                                        X11OAP    235
           IK2=0                                                        X11OAP    236
           IX=0                                                         X11OAP    237
 101       IX=IX+1                                                      X11OAP    238
           XX=XARAY(1001-IX,6)                                          X11OAP    239
           IF(XX.GE.0.99.AND.XX.LE.3.01)THEN                            X11OAP    240
              IK2=IK2+1                                                 X11OAP    241
              ANG=YARAY(IK2,6)                                          X11OAP    242
              R=XARAY(IK2,6)                                            X11OAP    243
              IF(ABS(ANG).LE.1.0E-5)THEN                                X11OAP    244
                 XTEM(1)=R                                              X11OAP    245
                 XTEM(2)=R                                              X11OAP    246
                 YTEM(1)=YMIN(1)                                        X11OAP    247
                 YTEM(2)=YMAX(1)                                        X11OAP    248
              ELSEIF(ABS(ANG-90).LE.1.0E-5)THEN                         X11OAP    249
                 XTEM(1)=XMIN                                           X11OAP    250
                 XTEM(2)=XMAX                                           X11OAP    251
                 YTEM(1)=R                                              X11OAP    252
                 YTEM(2)=R                                              X11OAP    253
              ELSEIF(ABS(ANG+90).LE.1.0E-5)THEN                         X11OAP    254
                 XTEM(1)=XMIN                                           X11OAP    255
                 XTEM(2)=XMAX                                           X11OAP    256
                 YTEM(1)=-R                                             X11OAP    257
                 YTEM(2)=-R                                             X11OAP    258
              ELSEIF(ABS(ANG-180).LE.1.0E-5.OR.                         X11OAP    259
     +               ABS(ANG+180).LE.1.0E-5)THEN                        X11OAP    260
                 XTEM(1)=-R                                             X11OAP    261
                 XTEM(2)=-R                                             X11OAP    262
                 YTEM(1)=YMIN(1)                                        X11OAP    263
                 YTEM(2)=YMAX(1)                                        X11OAP    264
              ELSE                                                      X11OAP    265
                 ANG=ANG*3.14159/180                                    X11OAP    266
                 Y=XMIN/TAN(ANG)+R/SIN(ANG)                             X11OAP    267
                 IF(Y.LT.YMAX(1).AND.Y.GE.YMIN(1))THEN                  X11OAP    268
                    XTEM(2)=XMIN                                        X11OAP    269
                    YTEM(2)=Y                                           X11OAP    270
                 ENDIF                                                  X11OAP    271
                 X=YMIN(1)*TAN(ANG)+R/COS(ANG)                          X11OAP    272
                 IF(X.LE.XMAX.AND.X.GT.XMIN)THEN                        X11OAP    273
                    XTEM(1)=XTEM(2)                                     X11OAP    274
                    YTEM(1)=YTEM(2)                                     X11OAP    275
                    XTEM(2)=X                                           X11OAP    276
                    YTEM(2)=YMIN(1)                                     X11OAP    277
                 ENDIF                                                  X11OAP    278
                 Y=R/SIN(ANG)-XMAX/TAN(ANG)                             X11OAP    279
                 IF(Y.LE.YMAX(1).AND.Y.GT.YMIN(1))THEN                  X11OAP    280
                    XTEM(1)=XTEM(2)                                     X11OAP    281
                    YTEM(1)=YTEM(2)                                     X11OAP    282
                    XTEM(2)=XMAX                                        X11OAP    283
                    YTEM(2)=Y                                           X11OAP    284
                 ENDIF                                                  X11OAP    285
                 X=R/COS(ANG)-YMAX(1)*TAN(ANG)                          X11OAP    286
                 IF(X.LT.XMAX.AND.X.GE.XMIN)THEN                        X11OAP    287
                    XTEM(1)=XTEM(2)                                     X11OAP    288
                    YTEM(1)=YTEM(2)                                     X11OAP    289
                    XTEM(2)=X                                           X11OAP    290
                    YTEM(2)=YMAX(1)                                     X11OAP    291
                 ENDIF                                                  X11OAP    292
              ENDIF                                                     X11OAP    293
              CALL XPLOT(1,1,2,XTEM,YTEM,1,0,0,IFLG)                    X11OAP    294
           ELSEIF(XX.EQ.-1)THEN                                         X11OAP    295
              GOTO 200                                                  X11OAP    296
           ELSE                                                         X11OAP    297
              IF(IK1+245.GE.1000)THEN                                   X11OAP    298
                 IJ=IJ+1                                                X11OAP    299
                 IK1=0                                                  X11OAP    300
              ENDIF                                                     X11OAP    301
              DO 400 IY=1,245                                           X11OAP    302
                 XTEM(IY)=XARAY(IY+IK1,IJ)                              X11OAP    303
                 YTEM(IY)=YARAY(IY+IK1,IJ)                              X11OAP    304
  400         CONTINUE                                                  X11OAP    305
              IK1=IK1+245                                               X11OAP    306
              CALL XPLOT(1,1,245,XTEM,YTEM,1,0,0,IFLG)                  X11OAP    307
           ENDIF                                                        X11OAP    308
           GOTO 101                                                     X11OAP    309
  200      CONTINUE                                                     X11OAP    310
        ENDIF                                                           X11OAP    311
        IF(I.LT.KCH(1).AND.IFLG.NE.2) GOTO 100                          X11OAP    312
                                                                        X11OAP    313
        CALL REFRESH                                                    X11OAP    314
        CALL EVENT_HANDLING                                             X11OAP    315
                                                                        X11OAP    316
        IP1=KCH(1)                                                      X11OAP    317
        IF(IP1.EQ.6)IP1=0                                               X11OAP    318
        SSCALE=.FALSE.                                                  X11OAP    319
                                                                        X11OAP    320
 9999 RETURN                                                            X11OAP    321
        END                                                             X11OAP    322
C                                                                       X11OAP    323
      SUBROUTINE PS3PRT                                                 X11OAP    324
      INCLUDE 'PARAM.INS'                                               X11OAP    325
      INCLUDE 'XYARAY.INS'                                              X11OAP    326
      INCLUDE 'DPPLOT.INS'                                              X11OAP    327
      INCLUDE 'SOAPC1.INS'                                              X11OAP    328
      COMMON /XP3D/ XTEM(1000),YTEM(1000),ZTEM(1000)                    X11OAP    329
      COMMON /RLD/ XS(4), YS(4), XD(4), YD(4), ICC, ICS(12),IK2         X11OAP    330
      COMMON /XSA/ IDX1, IDX2                                           X11OAP    331
      INTEGER IDX1(6),IDX2(6)                                           X11OAP    332
      COMMON /SCFLAG/ IFLG                                              X11OAP    333
      CHARACTER*80 PSFNAME                                              X11OAP    334
                                                                        X11OAP    335
      IF(.NOT.P3INT) THEN                                               X11OAP    336
        WRITE (*,*) 'INPUT POSTSCRIPT FILENAME'                         X11OAP    337
        READ (5,'(A)') PSFNAME                                          X11OAP    338
        LENFN=LENS(PSFNAME)                                             X11OAP    339
        CALL PS_3D_PAGE_SETUP                                           X11OAP    340
        ENDIF                                                           X11OAP    341
                                                                        X11OAP    342
        CALL PS_3D_BEGIN(PSFNAME,LENFN,P3INT)                           X11OAP    343
        CALL TRANSFOR_PS                                                X11OAP    344
        CALL PLOT3D_PS(IDX1,IDX2,XTEM,YTEM,ZTEM,XARAY,YARAY,            X11OAP    345
     +  MAXPT,IK2, XS, YS, XD, YD, IFLG, ICS, ICC)                      X11OAP    346
        CALL AXES_PS                                                    X11OAP    347
        CALL PS_3DPAGE_END                                              X11OAP    348
        RETURN                                                          X11OAP    349
        END                                                             X11OAP    350
                                                                        X11OAP    351
        SUBROUTINE PSPRINT                                              X11OAP    352
                                                                        X11OAP    353
      INCLUDE 'PARAM.INS'                                               X11OAP    354
      INCLUDE 'XYARAY.INS'                                              X11OAP    355
      INCLUDE 'DPPLOT.INS'                                              X11OAP    356
      INCLUDE 'SOAPC1.INS'                                              X11OAP    357
      COMMON /XSA/ IDX1, IDX2                                           X11OAP    358
      COMMON /SCFLAG/ IFLG                                              X11OAP    359
      INTEGER IDX1(6),IDX2(6)                                           X11OAP    360
                                                                        X11OAP    361
      REAL XTEM(MXPT),YTEM(MXPT)                                        X11OAP    362
                                                                        X11OAP    363
        CHARACTER*80  PSFNAME                                           X11OAP    364
        INTEGER*4 LENFN, IGRID                                          X11OAP    365
                                                                        X11OAP    366
      IF(.NOT.PINT) THEN                                                X11OAP    367
        WRITE (LOUT,'(A)') 'INPUT POSTSCRIPT FILENAME'                  X11OAP    368
        READ (LIN,'(A)') PSFNAME                                        X11OAP    369
        IF(RECORD) WRITE(IREC,'(A)') PSFNAME                            X11OAP    370
        LENFN=LENS(PSFNAME)                                             X11OAP    371
C       PSFNAME=PSFNAME(1:LENFN)                                        X11OAP    372
C                                                                       X11OAP    373
C                                                                       X11OAP    374
C                                                                       X11OAP    375
  100   CONTINUE                                                        X11OAP    376
        WRITE(LOUT,'(A,/)') '        CHOOSE AN OPTION'                  X11OAP    377
        WRITE(LOUT,'(A)') '                INPUT 1: ONE PLOT PER PAGE.' X11OAP    378
        WRITE(LOUT,'(A)') '                      2: TWO PLOT PER PAGE.' X11OAP    379
        WRITE(LOUT,'(A)') '                      3: FOUR PLOT PER PAGE.'X11OAP    380
        READ(LIN,*,IOSTAT=IOS) ID                                       X11OAP    381
        IF(IOS.NE.0.OR.ID.LE.0.OR.ID.GE.4) GOTO 100                     X11OAP    382
        IF(RECORD) WRITE(IREC,'(I1)') ID                                X11OAP    383
C                                                                       X11OAP    384
C                                                                       X11OAP    385
C                                                                       X11OAP    386
        CALL PS_PAGE_SETUP(ID)                                          X11OAP    387
        ENDIF                                                           X11OAP    388
C                                                                       X11OAP    389
C  SET GRID FLAG ON                                                     X11OAP    390
        IGRID =1                                                        X11OAP    391
        LENX=LENS(FTITLE)                                               X11OAP    392
        CALL INITG (LENX,LENP,XMIN,XMAX,10,10,5,5)                      X11OAP    393
        CALL PS_BEGIN (PSFNAME,LENFN,PINT,IPSPLT,IGRID)                 X11OAP    394
                                                                        X11OAP    395
        DO 200 I=1, KCH(1)                                              X11OAP    396
        LENTL = LENS(CTITL2(I))                                         X11OAP    397
        LENYL = LENS(YTITLE(I))                                         X11OAP    398
        LENL1 = LENS(LTITLE(I))                                         X11OAP    399
        LENL2 = LENS(LTITL2(I))                                         X11OAP    400
        CALL PS_Y_LABEL (I,CTITL2(I),LENTL,YTITLE(I),LENYL,             X11OAP    401
     +       LTITLE(I),LENL1,LTITL2(I),LENL2,YMIN(I),YMAX(I),IFLG)      X11OAP    402
        CALL GPCOPY(YTEM,XTEM,XARAY,YARAY,MXPT,MXPLOT,                  X11OAP    403
     +     I,MAXPT(I),YMIN(I),YMAX(I))                                  X11OAP    404
C  SET MARKER FLAG OFF                                                  X11OAP    405
        CALL PS_PLOT_LINE (I,IDX1(I), IDX2(I),XTEM,YTEM,I,0,I)          X11OAP    406
 200    CONTINUE                                                        X11OAP    407
C  QUIT WILL CLOSE PS-FILE                                              X11OAP    408
        CALL PS_PAGE_END                                                X11OAP    409
        RETURN                                                          X11OAP    410
      END                                                               X11OAP    411
      SUBROUTINE FREC(FN)                                               X11OAP    412
C                                                                       X11OAP    413
      INCLUDE 'SOAPC1.INS'                                              X11OAP    414
*IF WSX11                                                               X11OAP    415
      INCLUDE 'STRTUP.INS'                                              X11OAP    416
*ENDIF                                                                  X11OAP    417
      CHARACTER PNM*80, CPNB*6,FN*(*)                                   X11OAP    418
      CHARACTER STEST*80                                                X11OAP    419
C                                                                       X11OAP    420
  100 CONTINUE                                                          X11OAP    421
      WRITE(LOUT,'(16X,A)') 'Input 1: Print PostScript File Now'        X11OAP    422
      WRITE(LOUT,'(22X,A)') '2: Do Not Print'                           X11OAP    423
      READ(LIN,*,IOSTAT=IOS) I                                          X11OAP    424
      IF(IOS.NE.0.OR.I.LE.0.OR.I.GT.2) GOTO 100                         X11OAP    425
      IF(RECORD) WRITE(IREC,'(I1)') I                                   X11OAP    426
      IF(I.EQ.2) RETURN                                                 X11OAP    427
C                                                                       X11OAP    428
  200 CONTINUE                                                          X11OAP    429
      WRITE(LOUT,2100) (PRTNAM(I),I=1,3)                                X11OAP    430
      READ(LIN,*,IOSTAT=IOS) I                                          X11OAP    431
      IF(IOS.NE.0.OR.I.LE.0.OR.I.GT.5) GOTO 200                         X11OAP    432
      IF(RECORD) WRITE(IREC,'(I1)') I                                   X11OAP    433
      IF(I.GE.1.AND.I.LE.3)THEN                                         X11OAP    434
         PNM=PRTNAM(I)                                                  X11OAP    435
         DO 111 L=80,1,-1                                               X11OAP    436
          IF(PNM(L:L).NE.CHAR(0)) GOTO 250                              X11OAP    437
 111  CONTINUE                                                          X11OAP    438
 250  CONTINUE                                                          X11OAP    439
      ELSEIF(I.EQ.4)THEN                                                X11OAP    440
         WRITE(LOUT,'(8X,A)') 'Input Printer Name'                      X11OAP    441
         READ(LIN,'(A)') PNM                                            X11OAP    442
         IF(RECORD) WRITE(IREC,'(A)') PNM                               X11OAP    443
         L=LENS(PNM)                                                    X11OAP    444
         PNM(L+1:L+1)=CHAR(0)                                           X11OAP    445
      ELSEIF(I.EQ.5) THEN                                               X11OAP    446
         RETURN                                                         X11OAP    447
      ENDIF                                                             X11OAP    448
  300 CONTINUE                                                          X11OAP    449
      WRITE(LOUT ,'(8X,A)') 'Input Number of Copies'                    X11OAP    450
      READ(LIN,*,IOSTAT=IOS) I                                          X11OAP    451
      IF(IOS.NE.0.OR.I.LE.0) GOTO 300                                   X11OAP    452
      IF(RECORD) WRITE(IREC,'(I2)') I                                   X11OAP    453
      CPNB(1:3)=' -#'                                                   X11OAP    454
      WRITE(CPNB(4:5),'(I2)') I                                         X11OAP    455
      CPNB(6:6)=' '                                                     X11OAP    456
      STEST='lpr -P'//PNM(1:L)//CPNB//FN(1:30)                          X11OAP    457
      II=SYSTEM('lpr -P'//PNM(1:L)//CPNB//FN(1:30))                     X11OAP    458
      RETURN                                                            X11OAP    459
 2100 FORMAT(T15,'Input 1: Use Printer ',A40,/                          X11OAP    460
     * ,T21, '2: Use Printer ',A40,/                                    X11OAP    461
     * ,T21, '3: Use Printer ',A40,/                                    X11OAP    462
     *, T21, '4: Select a Printer by Name',/                            X11OAP    463
     *, T21, '5: Do Not Print After ALL')                               X11OAP    464
      END                                                               X11OAP    465
                                                                        X11OAP    466
      SUBROUTINE GPCOPY(YTEM,XTEM,XARAY,YARAY,MPT,MPLOT,NC,IMAXPT,      X11OAP    467
     1     YS,YE)                                                       X11OAP    468
CD                                                                      X11OAP    469
CD   PURPOSE : COPY THE TWO-DIMENSION XARAY AND YARAY TO SINGLE         X11OAP    470
CD             DIMENSION VECTORS                                        X11OAP    471
CD                                                                      X11OAP    472
      INCLUDE 'PARAM.INS'                                               X11OAP    473
      INCLUDE 'DPPLOT.INS'                                              X11OAP    474
      REAL YTEM(MXPT),YARAY(MXPT,MXPLOT),XTEM(MXPT)                     X11OAP    475
      REAL XARAY(MXPT,MXPLOT),YS,YE                                     X11OAP    476
      INTEGER NC,IMAXPT                                                 X11OAP    477
                                                                        X11OAP    478
      DO 10 I=1,IMAXPT                                                  X11OAP    479
         IF (YARAY(I,NC).LT.YS) THEN                                    X11OAP    480
           YTEM(I)=YS                                                   X11OAP    481
         ELSE IF (YARAY(I,NC).GT.YE) THEN                               X11OAP    482
                YTEM(I)=YE                                              X11OAP    483
         ELSEIF(XARAY(I,NC).GT.XMAX)THEN                                X11OAP    484
            IF(XMAX.GT.XTEM(I-1))THEN                                   X11OAP    485
               YTEM(I)=(YARAY(I,NC)-YTEM(I-1))*(XMAX-XTEM(I-1))         X11OAP    486
     *            /(XARAY(I,NC)-XTEM(I-1))+YTEM(I-1)                    X11OAP    487
            ELSE                                                        X11OAP    488
               YTEM(I)=YTEM(I-1)                                        X11OAP    489
            ENDIF                                                       X11OAP    490
         ELSE                                                           X11OAP    491
           YTEM(I)=YARAY(I,NC)                                          X11OAP    492
         END IF                                                         X11OAP    493
         IF(XARAY(I,NC).LT.XMIN)THEN                                    X11OAP    494
            XTEM(I)=XMIN                                                X11OAP    495
         ELSEIF(XARAY(I,NC).GT.XMAX)THEN                                X11OAP    496
            XTEM(I)=XMAX                                                X11OAP    497
         ELSE                                                           X11OAP    498
            XTEM(I)=XARAY(I,NC)                                         X11OAP    499
         ENDIF                                                          X11OAP    500
 10   CONTINUE                                                          X11OAP    501
      RETURN                                                            X11OAP    502
      END                                                               X11OAP    503
*ENDIF                                                                  X11OAP    504
*IF -WSX11                                                              X11OAP    505
*ENDIF                                                                  X11OAP    513
