gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
hstnmlinfooutputstep.f90
Go to the documentation of this file.
1!> @file hstnmlinfooutputstep.f90
2!>
3!> @author Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2007-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Checker of output timing
9!> @enden
10!>
11!> @ja
12!> @brief 出力タイミングのチェック
13!> @endja
14
15 !> @en
16 !> @brief Check output timing of a variable
17 !>
18 !> If @p time is the time that a variable @p name is output,
19 !> .true. is returned, otherwise .false. is returned.
20 !> When @p gthstnml is not initialized, .false. is returned too.
21 !> When data corresponding to @p name is not found, .false. is returned too.
22 !>
23 !> If @p gthstnml is not initialized by HstNmlInfoCreate yet,
24 !> error is occurred.
25 !> @enden
26 !>
27 !> @ja
28 !> @brief 出力タイミングのチェック
29 !>
30 !> @p time が変数 @p name の出力されるタイミングであれば
31 !> .true. を, そうでなければ .false. を返します.
32 !> @p gthstnml が初期設定されていない場合にも .false. が返ります.
33 !> @p name に関するデータが存在しない場合にも .false. が返ります.
34 !>
35 !> なお, 与えられた @p gthstnml が HstNmlInfoCreate によって初期設定
36 !> されていない場合, プログラムはエラーを発生させます.
37 !> @endja
38 !>
39 !> @param[in] gthstnml gtool_history_nmlinfo_types::GTHST_NMLINFO 型変数
40 !> @param[in] name 変数名. 先頭の空白は無視されます.
41 !> Variable identifier. Blanks at the head of the name are ignored.
42 !> @param[in] time 現在時刻. Current time
43 !> @return 出力タイミングであれば .true.
44 logical function hstnmlinfooutputstep( gthstnml, &
45 & name, time ) result(result)
48 use dc_date_types, only: dc_difftime
49 use dc_date_generic, only: dcdifftimecreate, mod, operator(==)
50 use dc_types, only: dp
51 implicit none
52 type(gthst_nmlinfo), intent(in):: gthstnml
53 character(*), intent(in):: name
54 ! 変数名.
55 ! 先頭の空白は無視されます.
56 !
57 ! Variable identifier.
58 ! Blanks at the head of the name are ignored.
59 type(dc_difftime), intent(in):: time
60 ! 現在時刻. Current time
61
62 !-----------------------------------
63 ! 作業変数
64 ! Work variables
65 type(gthst_nmlinfo_entry), pointer:: hptr =>null()
66 type(dc_difftime):: interval_time
67!!$ character(*), parameter:: subname = 'HstNmlInfoOutputStep'
68 continue
69
70 result = .false.
71
72 !-----------------------------------------------------------------
73 ! 初期設定のチェック
74 ! Check initialization
75 !-----------------------------------------------------------------
76 if ( .not. gthstnml % initialized ) goto 999
77
78 !-----------------------------------------------------------------
79 ! 情報格納変数への結合
80 ! Associate a variable storing information
81 !-----------------------------------------------------------------
82 hptr => gthstnml % gthstnml_list
83 call listsearch( gthstnml_list = hptr, & ! (inout)
84 & name = name ) ! (in)
85
86 if ( .not. associated( hptr ) ) goto 999
87 if ( hptr % output_step_disable ) goto 999
88
89 !-----------------------------------------------------------------
90 ! 時刻のチェック
91 ! Check time
92 !-----------------------------------------------------------------
93 if ( .not. hptr % interval_value > 0.0 ) goto 999
94
95 call dcdifftimecreate( &
96 & diff = interval_time, & ! (out)
97 & value = real( hptr % interval_value, dp ), & ! (in)
98 & unit = hptr % interval_unit ) ! (in)
99
100 if ( mod( time, interval_time ) == 0 ) then
101 result = .true.
102 end if
103
104 !-----------------------------------------------------------------
105 ! 終了処理, 例外処理
106 ! Termination and Exception handling
107 !-----------------------------------------------------------------
108999 continue
109 nullify( hptr )
110 end function hstnmlinfooutputstep
logical function hstnmlinfooutputstep(gthstnml, name, time)
dc_date より提供される手続の引用仕様宣言
日付・時刻に関する構造データ型と定数
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92