gtvargetslice.f90
Go to the documentation of this file.
1 !
2 != 変数入出力範囲限定情報を取得
3 !
4 ! Authors:: Eizi TOYODA, Yasuhiro MORIKAWA
5 ! Version:: $Id: gtvargetslice.f90,v 1.4 2009-10-12 04:02:30 morikawa Exp $
6 ! Tag Name:: $Name: $
7 ! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
8 ! License:: See COPYRIGHT[link:../../COPYRIGHT]
9 !
10 ! 以下のサブルーチン、関数は gtdata_generic から gtdata_generic#Get_Slice
11 ! として提供されます。
12 
13 subroutine gtvargetslice(var, dimord, start, count, stride, count_compact)
14  !
15  !== 変数入出力範囲限定情報を取得
16  !
17  ! 変数 *var* の *dimord* 番目の次元に関して、
18  ! Slice によって設定された入出力範囲の情報を取得します。
19  !
20  ! *start*, *count*, *stride* に関しては Slice を参照してください。
21  !
22  ! *count_compact* に .true. に指定すると、縮退された次元も
23  ! 含んで問い合わせを行います。
24  !
25  ! *Get_Slice* は 2 つのサブルーチンの総称名であり、
26  ! 他にも変数の依存する全ての次元に関して一括で情報を取得する
27  ! 方法もあります。上記のサブルーチンを参照ください。
28  !
29  use gtdata_types, only: gt_variable
31  implicit none
32  type(gt_variable), intent(in):: var
33  integer, intent(in):: dimord
34  integer, intent(out), optional:: start
35  integer, intent(out), optional:: count
36  integer, intent(out), optional:: stride
37  logical, intent(in), optional:: count_compact
38  type(gt_dimmap), allocatable:: map(:)
39  integer:: vid, udimord, ndims
40  logical:: allmode
41 continue
42  allmode = .true.
43  if (present(count_compact)) allmode = count_compact
44  call map_lookup(var, vid=vid, ndims=ndims)
45  if (vid < 0 .or. ndims <= 0) goto 999
46  allocate(map(ndims))
47  call map_lookup(var, map=map)
48  if (allmode) then
49  udimord = dimord
50  else
51  udimord = dimord_skip_compact(dimord, map)
52  endif
53  if (udimord < 1 .or. udimord > size(map)) goto 997
54 
55  if (present(start)) start = map(udimord)%start
56  if (present(count)) count = map(udimord)%count
57  if (present(stride)) stride = map(udimord)%stride
58  deallocate(map)
59  return
60 
61 997 continue
62  deallocate(map)
63 999 continue
64  if (present(start)) start = -1
65  if (present(count)) count = -1
66  if (present(stride)) stride = -1
67 end subroutine gtvargetslice
subroutine gtvargetslice(var, dimord, start, count, stride, count_compact)
integer function dimord_skip_compact(dimord, map)
subroutine, public map_lookup(var, vid, map, ndims)