gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
gtvargetslice.f90
Go to the documentation of this file.
1!> @file gtvargetslice.f90
2!>
3!> @author Eizi TOYODA, Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Get variable I/O range restriction information
9!>
10!> This subroutine is provided as gtdata_generic#Get_Slice
11!> through gtdata_generic.
12!> @enden
13!>
14!> @ja
15!> @brief 変数入出力範囲限定情報を取得
16!>
17!> このサブルーチンは gtdata_generic から gtdata_generic#Get_Slice
18!> として提供されます。
19!> @endja
20!>
21
22!>
23!> @en
24!> @brief Get I/O range information for specified dimension
25!>
26!> Gets I/O range information set by Slice for dimension dimord
27!> of variable var. See Slice for start, count, stride.
28!>
29!> If count_compact is set to .true., queries including degenerate dimensions.
30!>
31!> Get_Slice is a generic name for 2 subroutines; there is also
32!> a method to bulk get information for all dimensions.
33!> @param[in] var Variable handle
34!> @param[in] dimord Dimension order number
35!> @param[out] start Start index (optional)
36!> @param[out] count Count (optional)
37!> @param[out] stride Stride (optional)
38!> @param[in] count_compact Include degenerate dimensions (optional)
39!> @enden
40!>
41!> @ja
42!> @brief 指定次元の入出力範囲情報を取得
43!>
44!> 変数 var の dimord 番目の次元に関して、
45!> Slice によって設定された入出力範囲の情報を取得します。
46!> start, count, stride に関しては Slice を参照してください。
47!>
48!> count_compact に .true. を指定すると、縮退された次元も含んで問い合わせを行います。
49!>
50!> Get_Slice は 2 つのサブルーチンの総称名であり、
51!> 他にも変数の依存する全ての次元に関して一括で情報を取得する方法もあります。
52!> @param[in] var 変数ハンドル
53!> @param[in] dimord 次元順序番号
54!> @param[out] start 開始インデックス (省略可能)
55!> @param[out] count カウント (省略可能)
56!> @param[out] stride ストライド (省略可能)
57!> @param[in] count_compact 縮退次元を含むか (省略可能)
58!> @endja
59!>
60subroutine gtvargetslice(var, dimord, start, count, stride, count_compact)
61 use gtdata_types, only: gt_variable
63 implicit none
64 type(gt_variable), intent(in):: var
65 integer, intent(in):: dimord
66 integer, intent(out), optional:: start
67 integer, intent(out), optional:: count
68 integer, intent(out), optional:: stride
69 logical, intent(in), optional:: count_compact
70 type(gt_dimmap), allocatable:: map(:)
71 integer:: vid, udimord, ndims
72 logical:: allmode
73continue
74 allmode = .true.
75 if (present(count_compact)) allmode = count_compact
76 call map_lookup(var, vid=vid, ndims=ndims)
77 if (vid < 0 .or. ndims <= 0) goto 999
78 allocate(map(ndims))
79 call map_lookup(var, map=map)
80 if (allmode) then
81 udimord = dimord
82 else
83 udimord = dimord_skip_compact(dimord, map)
84 endif
85 if (udimord < 1 .or. udimord > size(map)) goto 997
86
87 if (present(start)) start = map(udimord)%start
88 if (present(count)) count = map(udimord)%count
89 if (present(stride)) stride = map(udimord)%stride
90 deallocate(map)
91 return
92
93997 continue
94 deallocate(map)
95999 continue
96 if (present(start)) start = -1
97 if (present(count)) count = -1
98 if (present(stride)) stride = -1
99end subroutine gtvargetslice
subroutine gtvargetslice(var, dimord, start, count, stride, count_compact)
subroutine, public map_lookup(var, vid, map, ndims)
integer function dimord_skip_compact(dimord, map)