gtvargetattrsc.f90

Path: gtvargetattrsc.f90
Last Update: Sun Jan 15 16:10:30 JST 2006

文字型属性の入力

Authors:Eizi TOYODA, Yasuhiro MORIKAWA
Version:$Id: gtvargetattrsc.f90,v 1.3 2006/01/15 07:10:30 morikawa Exp $
Tag Name:$Name: gt4f90io-20060618 $
Copyright:Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
License:See COPYRIGHT

以下のサブルーチン, 関数は gtdata_generic から提供されます。

Required files

Methods

Included Modules

gtdata_types gt_map an_generic gt_mem dc_trace dc_types dc_string

Public Instance methods

Subroutine :
var :type(GT_VARIABLE), intent(in)
name :character(len = *), intent(in)
value :character(len = *), intent(out)
default :character(len = *), intent(in), optional

[Source]

subroutine GTVarGetAttrCC(var, name, value, default)


  use gtdata_types, only: GT_VARIABLE
  use gt_map, only: var_class, vtb_class_netcdf, vtb_class_memory
  use an_generic, only: get_attr, an_variable
  use gt_mem, only: mem_variable, get_attr
  use dc_trace, only: beginsub, endsub
  use dc_types, only: string
  implicit none
  type(GT_VARIABLE), intent(in):: var
  character(len = *), intent(in):: name
  character(len = *), intent(out):: value
  character(len = *), intent(in), optional:: default
  logical:: err
  integer:: class, cid, stat
  character(len = string):: p_default
  character(len = *), parameter:: subnam = "gtvargetattrcc"
continue
  call beginsub(subnam)
  call var_class(var, class, cid)
  p_default = ""
  if (present(default)) p_default = default
  if (class == vtb_class_netcdf) then
    call get_attr(an_variable(cid), name, value, p_default, stat)
  else if (class == vtb_class_memory) then
    call get_attr(mem_variable(cid), name, value, err)
    if (err) value = p_default
  endif
  call endsub(subnam, "%d:%d:%c = %c", i=(/class, cid/),  c1=trim(name), c2=trim(value))
end subroutine GTVarGetAttrCC
Subroutine :
var :type(GT_VARIABLE), intent(in)
name :character(len = *), intent(in)
value :type(VSTRING), intent(out)
default :character(len = *), intent(in), optional

[Source]

subroutine GTVarGetAttrSC(var, name, value, default)
  use dc_string, only: VSTRING, assignment(=), vchar, len
  use dc_types, only: STRING
  use gtdata_types, only: GT_VARIABLE
  use gt_map, only: var_class, vtb_class_netcdf, vtb_class_memory
  use an_generic, only: get_attr, an_variable
  use gt_mem, only: mem_variable, get_attr
  use dc_trace, only: beginsub, endsub
  implicit none
  type(GT_VARIABLE), intent(in):: var
  character(len = *), intent(in):: name
  type(VSTRING), intent(out):: value
  character(len = *), intent(in), optional:: default
  logical:: err
  integer:: class, cid, stat
  character(len = string):: buffer
  character(len = string):: p_default
  character(len = *), parameter:: subnam = "gtvargetattrsc"
continue
  call beginsub(subnam)
  call var_class(var, class, cid)
  p_default = ""
  if (present(default)) p_default = default
  if (class == vtb_class_netcdf) then
    call get_attr(an_variable(cid), name, buffer, p_default, stat)
  else if (class == vtb_class_memory) then
    call get_attr(mem_variable(cid), name, buffer, err)
    if (err) buffer = p_default
  endif
  value = trim(buffer)
  call endsub(subnam, "%d:%d:%c = %c", i=(/class, cid/),  c1=trim(name), c2=trim(buffer))
end subroutine GTVarGetAttrSC

[Validate]