Loading...
Searching...
No Matches
gtvarsliceauto.f90
Go to the documentation of this file.
1!
2!= 入出力範囲の指定
3!
4! Authors:: Eizi TOYODA, Yasuhiro MORIKAWA
5! Version:: $Id: gtvarsliceauto.f90,v 1.1 2009-03-20 09:09:51 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#Slice
11! として提供されます。
12
13
14subroutine gtvarsliceauto(var, compatible)
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
32 use gtdata_generic, only: inquire, get_slice, gtvarslice
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)
53end subroutine gtvarsliceauto
subroutine gtvarslice(var, dimord, start, count, stride)
subroutine gtvarsliceauto(var, compatible)