gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
historysettime.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine historysettime (time, history, difftime, timed)

Function/Subroutine Documentation

◆ historysettime()

subroutine historysettime ( real, intent(in), optional time,
type(gt_history), intent(inout), optional, target history,
type(dc_difftime), intent(in), optional difftime,
real(dp), intent(in), optional timed )

Definition at line 41 of file historysettime.f90.

42 !
45 use gtdata_generic, only: slice, put, get
46 use gtdata_types, only: gt_variable
47 use dc_date_generic, only: dcdifftimecreate, operator(<), operator(>), &
49 use dc_date_types, only: dc_difftime
51 use dc_types, only: dp
52 use mpi
53 implicit none
54 real, intent(in), optional:: time
55 ! 時刻
56 !
57 ! ここで言う "時刻" とは、
58 ! HistoryCreate の *dims* で "0"
59 ! と指定されたものです。
60 ! もしも時刻が定義されていな
61 ! い場合は、 このサブルーチン
62 ! は何の効果も及ぼしません。
63 !
64 type(GT_HISTORY), intent(inout), optional, target:: history
65 ! 出力ファイルの設定に関する情報を
66 ! 格納した構造体
67 !
68 ! ここに指定するものは、
69 ! HistoryCreate によって初期設定
70 ! されていなければなりません。
71 !
72 type(DC_DIFFTIME), intent(in), optional:: difftime
73 ! 時刻 (dc_date_types::DC_DIFFTIME 型)
74 !
75 ! ここで言う "時刻" とは、
76 ! HistoryCreate の *dims* で "0"
77 ! と指定されたものです。
78 ! もしも時刻が定義されていな
79 ! い場合は、 このサブルーチン
80 ! は何の効果も及ぼしません。
81 !
82 real(DP), intent(in), optional:: timed
83 ! 時刻 (倍精度実数型)
84 !
85 ! ここで言う "時刻" とは、
86 ! HistoryCreate の *dims* で "0"
87 ! と指定されたものです。
88 ! もしも時刻が定義されていな
89 ! い場合は、 このサブルーチン
90 ! は何の効果も及ぼしません。
91 !
92 type(GT_HISTORY), pointer:: hst =>null()
93 type(GT_VARIABLE):: var
94 real, pointer:: buffer(:) =>null()
95 real(DP):: dt
96! type(DC_DIFFTIME):: dt
97 real(DP):: timew
98 logical:: err, dbg_mode
99 integer:: err_mpi
100 character(*), parameter:: subname = "HistorySetTime"
101 continue
102 dt = 0.0_dp
103 timew = 0.0_dp
104 call beginsub(subname)
105 if (present(history)) then
106 hst => history
107 else
108 hst => default
109 endif
110 call debug( dbg_mode )
111 if ( dbg_mode ) then
112 if ( present(difftime) ) then
113 timew = evalbyunit( difftime, '', hst % unlimited_units_symbol )
114 call dbgmessage('time=%f', d = (/timew/) )
115 elseif ( present(timed) ) then
116 call dbgmessage('time=%f', d = (/timed/) )
117 elseif ( present(time) ) then
118 call dbgmessage('time=%r', r = (/time/) )
119 end if
120 end if
121 if (hst % unlimited_index == 0) then
122 goto 999
123 endif
124 var = hst % dimvars(hst % unlimited_index)
125 hst % dim_value_written(hst % unlimited_index) = .true.
126 if ( present(difftime) ) then
127 dt = evalbyunit( difftime, '', hst % unlimited_units_symbol )
128 timew = dt
129 elseif ( present(timed) ) then
130 dt = timed
131!!$ call DCDiffTimeCreate( dt, & ! (out)
132!!$ & real( timed ), '', hst % unlimited_units_symbol ) ! (in)
133 timew = timed
134 elseif ( present(time) ) then
135 dt = time
136!!$ call DCDiffTimeCreate( dt, & ! (out)
137!!$ & time, '', hst % unlimited_units_symbol ) ! (in)
138 timew = time
139 end if
140 if ( dt < hst % oldest &
141 & .or. dt > hst % newest &
142 & .or. hst % count(2) == 0 ) then
143 hst % count(:) = maxval(hst % count(:)) + 1
144 hst % newest = max(hst % newest, dt)
145 hst % oldest = min(hst % oldest, dt)
146 if ( .not. hst % mpi_gather &
147 & .or. ( hst % mpi_gather .and. hst % mpi_myrank == 0 ) ) then
148 call slice(var, 1, start=hst % count(1), count=1)
149 timew = dt
150! timew = EvalByUnit( dt, '', hst % unlimited_units_symbol )
151 call put(var, (/timew/), 1, err)
152 if (err) call dumperror()
153 end if
154 goto 999
155 endif
156 if ( .not. hst % mpi_gather &
157 & .or. ( hst % mpi_gather .and. hst % mpi_myrank == 0 ) ) then
158 call slice(var, 1, start=1, count=hst % count(2))
159 call get(var, buffer, err)
160 hst % count(1:1) = minloc(abs(buffer - timew))
161 deallocate(buffer)
162 if ( hst % mpi_gather .and. hst % mpi_myrank == 0 ) then
163 call mpi_bcast( hst % count(1:1), 1, mpi_integer, 0, mpi_comm_world, err_mpi )
164 end if
165 elseif ( hst % mpi_gather .and. hst % mpi_myrank /= 0 ) then
166 call mpi_bcast( hst % count(1:1), 1, mpi_integer, 0, mpi_comm_world, err_mpi )
167 end if
168999 continue
169 call endsub(subname)
Interface declarations for procedures provided from dc_date.
Derived types and parameters for date and time.
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
type(gt_history), target, save, public default

References dc_trace::beginsub(), dc_trace::dbgmessage(), gtool_history_internal::default, dc_types::dp, and dc_trace::endsub().

Here is the call graph for this function: