*"表題 第２次元の格子選択 GTOOL3(GPYSEL)
*
*"履歴 90/08/17 沼口  敦
*
*
*********************************************************************
*"         << 第２次元の格子選択 >>
*********************************************************************
      SUBROUTINE GPYSEL
     I         ( HHEAD , GDATA , IYSEL  ,
     I           HEDIT , HETTL ,
     O           HHEADO, GDATAO          )
*
      CHARACTER  HHEAD  ( * )*(*)        !" ヘッダー(入力)
      REAL       GDATA  ( * )            !" データ(入力)
      INTEGER    IYSEL                   !" 選択する第2次元の格子
      CHARACTER  HEDIT       *(*)        !" 編集略記号
      CHARACTER  HETTL       *(*)        !" 編集タイトル
      CHARACTER  HHEADO ( * )*(*)        !" ヘッダー(出力)
      REAL       GDATAO ( * )            !" データ(出力)
*
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC
#else
#include         "gzsize.F"              !" NCC, NDC
#endif
      CHARACTER  HITM        *(NCC)
      CHARACTER  HAXIS       *(NCC)
      CHARACTER  HEDITD      *(NCC)      !" 編集略記号
      CHARACTER  HETTLD      *(NCC)      !" 編集タイトル
      LOGICAL    OCYCL                   !" サイクリックか？
*
*"         < 1. 大きさの取得 >
*
      CALL GUSMIS ( HHEAD )
*
      CALL GUQSIZ
     I         ( HHEAD ,
     O           IXSTR , IXEND , IXDIM ,
     O           IYSTR , IYEND , IYDIM ,
     O           IZSTR , IZEND , IZDIM  )
*
      CALL GUSZCK ( HHEADO, IXDIM*IZDIM )
*
      CALL GHCGET( HHEAD, 'AITM2', HAXIS )
      CALL GUQAXD
     I         ( HAXIS ,
     O           IADIM , OCYCL  )
*
*"         < 2. データ詰め替え >
*
      IF ( OCYCL ) THEN
         IYI = MOD( IYSEL-IYSTR, IADIM ) + 1
      ELSE
         IYI = IYSEL-IYSTR+1
      ENDIF
*
      IF ( ( 1.LE.IYI ).AND.( IYI.LE.IYDIM ) ) THEN
         DO 2100 IZ = 1, IZDIM
            CALL VRSET
     I       ( GDATA ( IXDIM*IYDIM*(IZ-1) + IXDIM*(IYI-1) + 1 ),
     O         GDATAO( IXDIM*(IZ-1) + 1 ),
     I         IXDIM  , 1    , 1                                 )
 2100    CONTINUE
      ELSE
         CALL GHPGET( HHEAD , 'MISS', VMISS )
         CALL RSET  ( GDATAO, IXDIM*IZDIM, VMISS )
      ENDIF
*
*"         < 3. ヘッダー変更 >
*
      CALL GHCOPY ( HHEAD, HHEADO )
      CALL GHCGET ( HHEAD , 'AITM3', HITM  )
      CALL GHCSET ( HHEADO, 'AITM2', HITM  )
      CALL GHPSET ( HHEADO, 'ASTR2', IZSTR )
      CALL GHPSET ( HHEADO, 'AEND2', IZEND )
      CALL GHCSET ( HHEADO, 'AITM3', ' '   )
      CALL GHPSET ( HHEADO, 'ASTR3', 1     )
      CALL GHPSET ( HHEADO, 'AEND3', 1     )
*
      IF ( ( IYSTR .EQ. IYSEL ).AND.( IYEND .EQ. IYSEL ) ) RETURN
*
      IF      ( HEDIT .EQ. ' ' ) THEN
         CALL GUEAXN
     I               ( HAXIS , 'YS'   , '-select',
     I                 IYSEL , IYSEL  ,
     O                 HEDITD, HETTLD          )
         CALL GHEADD ( HHEADO, HEDITD, HETTLD )
      ELSE IF ( HEDIT .NE. 'NUL' ) THEN
         CALL GHEADD ( HHEADO, HEDIT  , HETTL   )
      ENDIF
*
      RETURN
      END
*********************************************************************
*"         << 第２次元の格子選択 >>
*********************************************************************
      SUBROUTINE GMYSEL
     M         ( HHEAD , GDATA ,
     I           IYSEL ,
     I           HEDIT , HETTL  )
*
      CHARACTER  HHEAD  ( * )*(*)        !" ヘッダー(入力)
      REAL       GDATA  ( * )            !" データ(入力)
      INTEGER    IYSEL                   !" 選択する第2次元の格子
      CHARACTER  HEDIT       *(*)        !" 編集略記号
      CHARACTER  HETTL       *(*)        !" 編集タイトル
*
      COMMON     /GMWORK/ GDATAW
      REAL       GDATAW ( 1 )            !" データ(ワーク)
#ifdef SYS_IBMS
      INCLUDE    (GZSIZE)                !" NCC, NDC
#else
#include         "gzsize.F"              !" NCC, NDC
#endif
      CHARACTER  HHEADW ( NDC )*(NCC)    !" ヘッダー(ワーク)
*
      CALL       GMCSIZ ( HHEADW )
      CALL       GPYSEL
     I         ( HHEAD , GDATA , IYSEL  ,
     I           HEDIT , HETTL ,
     O           HHEADW, GDATAW          )
*
      CALL       GPFSET
     I         ( HHEADW, GDATAW,
     I           ' '   , ' '   ,
     O           HHEAD , GDATA   )
*
      RETURN
      END
