gtvargetslice.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine gtvargetslice (var, dimord, start, count, stride, count_compact)
 

Function/Subroutine Documentation

◆ gtvargetslice()

subroutine gtvargetslice ( type(gt_variable), intent(in)  var,
integer, intent(in)  dimord,
integer, intent(out), optional  start,
integer, intent(out), optional  count,
integer, intent(out), optional  stride,
logical, intent(in), optional  count_compact 
)

Definition at line 14 of file gtvargetslice.f90.

References gtdata_internal_map::dimord_skip_compact(), and gtdata_internal_map::map_lookup().

Referenced by gtvargetsliceall().

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
integer function dimord_skip_compact(dimord, map)
subroutine, public map_lookup(var, vid, map, ndims)
Here is the call graph for this function:
Here is the caller graph for this function: