!
!= è«–ç†åž‹å±žæ€§ã®å…¥åŠ›
!
! Authors::   Eizi TOYODA, Yasuhiro MORIKAWA
! Version::   $Id: gtvarattrtrue.f90,v 1.5 2009-05-25 09:55:58 morikawa Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
! ä»¥ä¸‹ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³, é–¢æ•°ã¯ gtdata_generic ã‹ã‚‰æä¾›ã•ã‚Œã¾ã™ã€‚
!

logical function GTVarAttrTrue(var, name, default) result(result)
  !
  !== è«–ç†åž‹å±žæ€§ã®å…¥åŠ›
  !
  ! å¤‰æ•° *var* ã«ä»˜åŠ ã•ã‚Œã¦ã„ã‚‹å±žæ€§ *name* ã®å€¤ã‚’è¿”ã—ã¾ã™ã€‚
  ! å±žæ€§å€¤ãŒè«–ç†åž‹å±žæ€§ã®å ´åˆã®ã¿ç”¨ã„ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ã€‚
  !
  ! ä»¥ä¸‹ã®å ´åˆã«ã¯ .false. ãŒè¿”ã‚Šã¾ã™ã€‚
  !
  ! * å±žæ€§ã®å€¤ãŒæ–‡å—åž‹ã§ "", "0", "0.0", "0.", ".0", "FALSE",
  !   "false", ".FALSE.",  ".false.", "F", "f", "0.0D0", "0.0d0"
  !   ã®ã„ã¥ã‚Œã‹ã§ã‚ã£ãŸå ´åˆ
  ! * å±žæ€§ã®å€¤ãŒè² ã®å®Ÿæ•°ã§ã‚ã£ãŸå ´åˆ
  !
  ! å±žæ€§ã®å€¤ãŒæ£å¸¸ã«å–å¾—ã§ããšã€ä¸”ã¤ *default* ãŒä¸Žãˆã‚‰ã‚Œã¦
  ! ã„ãŸå ´åˆã€ãã®å€¤ãŒè¿”ã‚Šã¾ã™ã€‚*default* ãŒä¸Žãˆã‚‰ã‚Œã¦ã„ãªã‹ã£ãŸ
  ! å ´åˆã«ã¯ .false. ãŒè¿”ã‚Šã¾ã™ã€‚
  !
  use gtdata_types, only: GT_VARIABLE
  use gtdata_internal_map, only: var_class, vtb_class_netcdf, vtb_class_memory
  use gtdata_netcdf_generic, only: get_attr
  use gtdata_netcdf_types, only: GD_NC_VARIABLE
  use gtdata_memory_generic, only: Attr_True
  use gtdata_memory_types, only: memvar_t => GD_MEM_VARIABLE
  use dc_error, only: StoreError, GT_ENOTVAR
  implicit none
  type(GT_VARIABLE), intent(in):: var
  character(len = *), intent(in):: name
  logical, intent(in), optional:: default
  integer:: class, cid
continue
  call var_class(var, class, cid)
  if (class == vtb_class_netcdf) then
    call Get_Attr(GD_NC_VARIABLE(cid), name, result, default)
  else if (class == vtb_class_memory) then
    result = Attr_True(memvar_t(cid), name, default)
  else
    call StoreError(GT_ENOTVAR, "GTVarAttrTrue(NO VARIABLE)")
    result = .FALSE.
  endif
end function GTVarAttrTrue