gtvarsliceauto.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine gtvarsliceauto (var, compatible)
 

Function/Subroutine Documentation

◆ gtvarsliceauto()

subroutine gtvarsliceauto ( type(gt_variable), intent(inout)  var,
type(gt_variable), intent(in), optional  compatible 
)

Definition at line 15 of file gtvarsliceauto.f90.

References gtvarslice().

15  !
16  !== 入出力範囲をおまかせ指示
17  !
18  ! 変数 *var* の入出力範囲を「適当に」小さくします。
19  ! *compatible* を指定すると、その変数と全く同じ入出力範囲に
20  ! に指定します。
21  !
22  ! *Slice* は複数のサブルーチンの総称名であり、
23  ! 他にも文字列や番号で指定する方法があります。
24  ! 以下のサブルーチンを参照してください。
25  !
26  ! Slice に関連する手続きとして、Get_Slice と Slice_Next が
27  ! あります。Get_Slice は設定された入出力範囲を取得します。
28  ! Slice_Next は入出力範囲を移動することによって、変数全体を読み取る
29  ! ために利用するサブルーチンです。
30  !
31  use gtdata_types, only: gt_variable
33  type(gt_variable), intent(inout):: var
34  type(gt_variable), intent(in), optional:: compatible
35  integer:: nd, i
36  integer, allocatable:: start(:), count(:), stride(:)
37  call inquire(var, alldims=nd)
38  if (nd <= 0) return
39  allocate(start(nd), count(nd), stride(nd))
40  if (present(compatible)) then
41  call get_slice(compatible, start, count, stride)
42  do, i = 1, nd
43  call gtvarslice(var, i, start(i), count(i), stride(i))
44  enddo
45  else
46  call get_slice(var, start, count, stride)
47  do, i = 1, nd
48  if (count(i) < 1) count(i) = 1
49  call gtvarslice(var, i, start(i), count(i), stride(i))
50  enddo
51  endif
52  deallocate(start, count, stride)
subroutine gtvarslice(var, dimord, start, count, stride)
Definition: gtvarslice.f90:14
Here is the call graph for this function: