!
!= 隲也炊蝙句ｱ樊ｧ縺ｮ蜈･蜉�
!
! 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