C******************** START FILE GRF3X2.FOR ; GROUP GRF3X2 ******************
C============================================================
C  MOD DMC JUN 1988 - MADE THIS A SHELL FOR GRF3F2
C  REORGANIZING/ MODULARIZING THESE 3D PLOT INTERFACE ROUTINES
C
C  MOD DMC FEB 1986 - MAINTENANCE
C   *REMOVE ENCODE STATEMENTS
C   *IMPROVE 2D GRAPHICS LABELING
C   *REPLACE OBSOLETE "AGX" LABELING OF 3D ISOMETRIC PLOT
C   *GENERAL CLEANUP
C
C  *AG SECTION NOT CLEANED UP -- LOOKING TO CREATE NEW COMMON ROUTINE
C  TOO SHARE W/ GRF3 AND RPLOT VSN GRF3 ... SOMETIME SOON
C
C ====>>> COMPARITIVE GRAPHICS ****
C   COMPARE 2 FUNCTIONS OF 2 INDEPENDANT VARIABLES.
C   3D PLOTS OF EITHER FUNCTION INDEPENDANTLY;
C   2D PLOTS OF BOTH FUNCTIONS SIMULTANEOUSLY
C    BASED ON 1-FCN VERSION "GRF3TR.FOR"
C    D. MC CUNE 20 OCT 1980
C
C
C
C
      SUBROUTINE GRF3X2(X,Z,Z2,Y,ZWK,NX,NY,NZ1,
     >                  XLAB,YLAB,ZLAB1,ZLAB2,
     >                  XUN,YUN,ZUN,
     >                  ZTITLE,ITITLE,
     >                  IDIR,ISF,
     >                  IDEV,NSHOT,IAVTYP,NSHOT2,NS2,ISMTYP)
C
C  INTERACTIVE ROUTINE TO CONTROL PRODUCTION OF TWO AND
C  THREE DIMENSIONAL GRAPHS OF DATA FUNCTION OF TWO
C  INDEPENDANT VARIABLES.
C    3-D GRAPHS:  LABELING AND TITLEING CONTROLLED BY PASSED
C                 VARIABLES
C                 USER MAY SPECIFY SUBSET OF X-Y DOMAIN, AND
C                 # OF LINES OF CONSTANT X AND Y TO DRAW
C                 BY INTERACTIVE I/O.
C    2-D GRAPHS:  LABELING AND TITLEING CONTROLLED BY PASSED
C                 VARIABLES;
C                 USER HAS CONTROL OF HORIZONTAL AND VERTICAL
C                 SCALE BY INTERACTIVE I/O.
C                 USER SPECIFIES X CONSTANT WHILE Y VARIES OR
C                 VICE VERSA, BY INTERACTIVE I/O.
C
C  INPUT VARIABLES:
C    X       1ST INDEPENDANT VARIABLE VALUES, IN ASCENDING ORDER
C            CORRESPONDS TO FIRST DIMENSION OF Z ARRAY
C    Z,Z2    2-D ARRAYS OF DEPENDANT VARIABLES VALUES
C    Y       2ND INDEPENDANT VARIABLE VALUES, IN ASCENDING ORDER
C            CORRESNPONDS TO SECOND DIMENSION OF Z ARRAY.
C    Z(I,J) = Z AT (X(I),Y(J))
C
C    NX      # OF X VALUES
C    NY      # OF Y VALUES
C    NZ1     FIRST DIMENSION OF Z
C
C    XLAB    NAME OF FIRST INDEP. VARIABLE (E.G. 'RADIUS    ')
C            10 CHARACTERS ASCII.
C    YLAB    NAME OF SECOND INDP. VARIABLE (E.G. 'TIME      ')
C            10 CHARACTERS ASCII
C    ZLAB1,ZLAB2    NAMES OF DEPENDANT VARIABLES
C            (E.G. 'ELECTRON TEMPERATURE')
C            20 CHARACTERS ASCII
C    XUN     UNITS OF FIRST INDEP. VARIABLE (E.G. 'CM       $')
C            9 CHARACTERS ASCII TERMINATED BY '$' REQUIRED BY
C            FS ROUTINES.
C    YUN     UNITS OF SECOND INDEP. VARIABLE (E.G. 'SECONDS  $')
C    ZUN     UNITS OF DEPENDANT VARIABLE (E.G. 'EV       $')
C
C    ZTITLE  30 CHARACTER TITLE TO GO ON TOP OF 3-D GRAPH
C    ITITLE  WRITE ZTITLE IFF ITITLE=1
C
C    IDIR    =0==>X-AXIS ALONG BOTTOM OF SCREEN, Y-AXIS GOING
C                 'INTO' SCREEN FOR 3-D PLOTS.
C            =1==>INTERCHANGE X AND Y AXES.
C
C    ISF     FORMAT FLAG FOR SHOT NUMBERS TO BE DISPLAYED:
C            =0==> INTEGER   =1==> ASCII (A5)
C
C    NSHOT   5 DIGIT SINGLE SHOT NUMBER FOR DISPLAY ON 2-D
C            GRAPHS AND ON 3-D GRAPHS IF IAVTYP.EQ.0
C    IAVTYP  =0==> DATA IS DERIVED FROM A SINGLE SHOT
C            =1==> DATA IS AVERAGED FROM SEVERAL SHOTS
C
C    NSHOT2  LIST OF 5 DIGIT SHOT NUMBERS GOING INTO DATA AVG
C            IF IAVTYP.EQ.1
C    NS2     # OF SHOT NUMBERS IN NSHOT2
C
C    ISMTYP  =0==> DATA IS 'RAW' (NOT SMOOTHED)
C            =1==> DATA IS SMOOTHED.
C
C    ZWK      WORKSPACE OF DIMENSION 2 * NY AT LEAST.
C---------------------------
C
C  EXTERNAL REFERENCES:
C   3-D GRAFICS:  EZISUS    [MILLER.EZ]
C   2-D GRAFICS:  GRFHX2    (LOAD GRFHX2.FOR[TRANSP],
C                            DPLOT1.FOR)
C
C----------------------------
C
C  AUTHOR:  D. MC CUNE    15-MAY-79
C
C  REVISIONS:
C
C
C
C
C
C
C----------------------------
C   DECLARATIONS:
C
      DIMENSION X(NX),Y(NY),ZWK(NY,2),Z(NZ1,NY),NSHOT2(NS2)
      DIMENSION Z2(NZ1,NY)
      CHARACTER*10 ZLAB1(2),ZLAB2(2),ZTITLE(3),ZLAB(2),
     >     YLAB,XLAB,XUN,YUN,ZUN
      CHARACTER*4 IDEV
C--------------------------------------------------------------
C  DMC - MAINTENANCE - FEB 1986 - NEW LABELING BUFFERS
C
      CHARACTER*30 ZTITL
      CHARACTER*15 ZSHOT
C
C--------------------------------------------------------------
C
C DMC FEB 1986 - FIX LABELS
C
C
C *LISMAK* 12-APR-88  GENERATED LOGICAL DECLARATIONS
      LOGICAL LCHAR
      LOGICAL LYES
      LOGICAL LYESC
      LOGICAL LXOUT
C *LISMAK* END OF GENERATED LOGICAL DECLARATIONS
C
C ====================
C  START OF EXECUTABLE CODE
C
      LUNTRM=LNOUT(0)
C
      IF(ITITLE.EQ.1) THEN
        ZTITL=ZTITLE(1)//ZTITLE(2)//ZTITLE(3)
      ELSE
        ZTITL='                              '
      ENDIF
C
      zshot=' '
      IF((ISF.LE.1).AND.(NSHOT.NE.0)) THEN
         if(nshot.le.999999) then
            WRITE(ZSHOT,8005) IDEV,NSHOT
         else
            write(zshot,80051) idev,nshot
         endif
      ELSE IF(ISF.EQ.2) THEN
         WRITE(ZSHOT,80041) NSHOT
      ENDIF
C
 8005 FORMAT(A4,1x,I6)
80051 format(a4,1x,i10)
80041 FORMAT('RUN # ',I4)
C
      IPROC=0
      IPROC=IPROC+IAVTYP+2*ISMTYP
C
      CALL GRF3F2(X,Z,Z2,Y,ZWK,NX,NY,NZ1,
     >    XLAB,ZLAB1(1)//ZLAB1(2),ZLAB2(1)//ZLAB2(2),YLAB,
     >    XUN,ZUN,YUN,ZTITL,ZSHOT,IPROC)
C
      RETURN
      END
