*-----------------------------------------------------------------------
*     Copyright (C) 2000-2016 GFD Dennou Club. All rights reserved.
*-----------------------------------------------------------------------
      PROGRAM UUPK07

      PARAMETER (MAX=5)
      REAL  XNEC(MAX), XIBM(MAX), XAPL(MAX)

      DATA XNEC /1.2, 2.5, 3.3, 3.7, 3.1/
      DATA XAPL /1.3, 2.6, 3.8, 4.4, 4.5/
      DATA XIBM /1.7, 2.2, 3.5, 4.2, 5.7/


      CALL GLRGET('RUNDEF', RUNDEF)

      WRITE(*,*) ' WORKSTATION ID (I)  ? ;'
      CALL SGPWSN
      READ (*,*) IWS

      CALL GROPN(IWS)
      CALL GRFRM

      CALL GRSWND(0., 5., RUNDEF, RUNDEF)
      CALL USSPNT(MAX, RUNDEF, XIBM)
      CALL USSPNT(MAX, RUNDEF, XNEC)
      CALL USSPNT(MAX, RUNDEF, XAPL)
      CALL USSPNT(1,  RUNDEF, 0.)
      CALL USPFIT
      CALL GRSTRF

      CALL USDAXS

      CALL UUSIDV(0.3, 4.3)
      CALL UUSARP(2999, 2999)
      CALL UVBRA(MAX, RUNDEF, XNEC, RUNDEF)
      CALL UVBRF(MAX, RUNDEF, XNEC, RUNDEF)

      CALL UUSIDV(0.5, 4.5)
      CALL UUSARP(3999, 3999)
      CALL UVBRA(MAX, RUNDEF, XAPL, RUNDEF)
      CALL UVBRF(MAX, RUNDEF, XAPL, RUNDEF)

      CALL UUSIDV(0.7, 4.7)
      CALL UUSARP(4999, 4999)
      CALL UVBRA(MAX, RUNDEF, XIBM, RUNDEF)
      CALL UVBRF(MAX, RUNDEF, XIBM, RUNDEF)

      CALL GRFRM

      DO 10 I=1, MAX
        XAPL(I) = XNEC(I) + XAPL(I)
        XIBM(I) = XAPL(I) + XIBM(I)
  10  CONTINUE

      CALL GRSWND(0., 5., RUNDEF, RUNDEF)
      CALL USSPNT(MAX, RUNDEF, XIBM)
      CALL USSPNT(1,  RUNDEF, 0.)
      CALL USPFIT
      CALL GRSTRF

      CALL USDAXS

      CALL UUSIDV(0.5, 4.5)

      CALL UUSARP(2999, 2999)
      CALL UUSBRS(0.05)
      CALL UVBRA(MAX, RUNDEF, XNEC, RUNDEF)
      CALL UUSARP(3999, 3999)
      CALL UVBRA(MAX, RUNDEF, XNEC, XAPL)
      CALL UUSARP(4999, 4999)
      CALL UVBRA(MAX, RUNDEF, XAPL, XIBM)

      CALL UVBRF(MAX, RUNDEF, XNEC, RUNDEF)
      CALL UVBRF(MAX, RUNDEF, XNEC, XAPL)
      CALL UVBRF(MAX, RUNDEF, XAPL, XIBM)

      CALL UVBRL(MAX, RUNDEF, XNEC)
      CALL UVBRL(MAX, RUNDEF, XAPL)
      CALL UVBRL(MAX, RUNDEF, XIBM)

      CALL GRCLS

      END



