!
!= ãƒ•ã‚¡ã‚¤ãƒ«å…¥å‡ºåŠ›ã®åŒæœŸ
!
! Authors::   Eizi TOYODA, Yasuhiro MORIKAWA
! Version::   $Id: gtvarsync.f90,v 1.4 2009-05-25 09:55:57 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#GTVarSync
! ã¨ã—ã¦æä¾›ã•ã‚Œã¾ã™ã€‚
!

subroutine GTVarSync(var, stat)
  !
  !== ãƒ•ã‚¡ã‚¤ãƒ«å…¥å‡ºåŠ›ã®åŒæœŸ
  !
  ! å¤‰æ•° *var* ã«é–¢ã™ã‚‹ãƒ¡ãƒ¢ãƒªå†…ã®ãƒãƒƒãƒ•ã‚¡ã¨ netCDF ãƒ•ã‚¡ã‚¤ãƒ«ã®ãƒ‡ã‚£ã‚¹ã‚¯ä¸Šã®
  ! ã‚³ãƒ”ãƒ¼ã¨ã‚’åŒæœŸã—ã¾ã™ã€‚*var* ãŒä¸Žãˆã‚‰ã‚Œãªã„å ´åˆã€ãƒ—ãƒã‚°ãƒ©ãƒ å†…ã§
  ! ã“ã‚Œã¾ã§ã«å…¥å‡ºåŠ›ã—ãŸå…¨ã¦ã®ãƒ•ã‚¡ã‚¤ãƒ«ã«é–¢ã—ã¦åŒæœŸãŒãŠã“ãªã‚ã‚Œã¾ã™ã€‚
  !
  ! *stat* ã«ã¯ã‚¹ãƒ†ãƒ¼ã‚¿ã‚¹ãŒè¿”ã‚Šã¾ã™ã€‚
  !
  use gtdata_types, only: GT_VARIABLE
  use gtdata_internal_map, only: var_class, vtb_class_netcdf, vtb_class_memory
  use gtdata_netcdf_generic, only: GDNcVarSync
  use gtdata_netcdf_types, only: GD_NC_VARIABLE
  type(GT_VARIABLE), intent(inout), optional:: var
  integer, intent(out), optional:: stat
  integer:: class, cid
  if (.not. present(var)) then
    call GDNcVarSync(stat=stat)
  else
    call var_class(var, class, cid)
    select case (class)
    case(vtb_class_netcdf)
      call GDNcVarSync(GD_NC_VARIABLE(cid), stat=stat)
    end select
  endif
end subroutine GTVarSync