!
!= å¤‰æ•°å…¥å‡ºåŠ›ç¯„å›²é™å®šæƒ…å ±ã‚’å–å¾— (å…¨ã¦ã®æ¬¡å…ƒã®æƒ…å ±ã‚’ä¸€æ‹¬å–å¾—)
!
! Authors::   Eizi TOYODA, Yasuhiro MORIKAWA
! Version::   $Id: gtvargetsliceall.f90,v 1.1 2009-03-20 09:09:51 morikawa Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
! ä»¥ä¸‹ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã€é–¢æ•°ã¯ gtdata_generic ã‹ã‚‰ gtdata_generic#Get_Slice
! ã¨ã—ã¦æä¾›ã•ã‚Œã¾ã™ã€‚

! Copyright (C) GFD Dennou Club, 2000.  All rights reserved.

subroutine GTVarGetSliceAll(var, start, count, stride)
  !
  !== å¤‰æ•°å…¥å‡ºåŠ›ç¯„å›²é™å®šæƒ…å ±ã‚’å–å¾— (å…¨ã¦ã®æ¬¡å…ƒã®æƒ…å ±ã‚’ä¸€æ‹¬å–å¾—)
  !
  ! å¤‰æ•° *var* ã«é–¢ã—ã¦ã€
  ! Slice ã«ã‚ˆã£ã¦è¨å®šã•ã‚ŒãŸå…¥å‡ºåŠ›ç¯„å›²ã®æƒ…å ±ã‚’å–å¾—ã—ã¾ã™ã€‚
  ! å…¨æ¬¡å…ƒã®å…¥å‡ºåŠ›ç¯„å›²ã«ã¤ã„ã¦ä¸€æ‹¬å–å¾—ã™ã‚‹ãŸã‚ã€
  ! ã‚ã‚‰ã‹ã˜ã‚ Inquire(var, alldims) ã—ã¦æ¬¡å…ƒã®æ•°ã‚’ç¢ºä¿
  ! ã—ãªã‘ã‚Œã°ãªã‚Šã¾ã›ã‚“ã€‚
  !
  ! *start*, *count*, *stride* ã«é–¢ã—ã¦ã¯ Slice ã‚’å‚ç…§ã—ã¦ãã ã•ã„ã€‚
  !
  ! *Get_Slice* ã¯ 2 ã¤ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã®ç·ç§°åã§ã‚ã‚Šã€
  ! ä»–ã«ã‚‚ã‚ã‚‹1ã¤ã®æ¬¡å…ƒã«é–¢ã—ã¦æƒ…å ±ã‚’å–å¾—ã™ã‚‹
  ! æ–¹æ³•ã‚‚ã‚ã‚Šã¾ã™ã€‚ä¸‹è¨˜ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã‚’å‚ç…§ãã ã•ã„ã€‚
  !
  use gtdata_types, only: GT_VARIABLE
  use gtdata_generic, only: GTVarGetSlice
  implicit none
  type(GT_VARIABLE), intent(in):: var
  integer, intent(out), optional:: start(:), count(:), stride(:)
  integer:: nd, i
  logical:: all
  nd = HUGE(1)
  all = present(start) .and. present(count) .and. present(stride)
  if (present(start)) nd = min(nd, size(start))
  if (present(count)) nd = min(nd, size(count))
  if (present(stride)) nd = min(nd, size(stride))
  do, i = 1, nd
    if (all) then
      call GTVarGetSlice(var, i, start(i), count(i), stride(i))
      cycle
    endif
    if (present(start)) call GTVarGetSlice(var, i, start=start(i))
    if (present(count)) call GTVarGetSlice(var, i, count=count(i))
    if (present(stride)) call GTVarGetSlice(var, i, stride=stride(i))
  enddo
end subroutine GTVarGetSliceAll