54 real,
intent(in),
optional:: time
64 type(
gt_history),
intent(inout),
optional,
target:: history
82 real(DP),
intent(in),
optional:: timed
94 real,
pointer:: buffer(:) =>null()
98 logical:: err, dbg_mode
100 character(*),
parameter:: subname =
"HistorySetTime"
105 if (
present(history))
then
110 call debug( dbg_mode )
112 if (
present(difftime) )
then
113 timew =
evalbyunit( difftime,
'', hst % unlimited_units_symbol )
115 elseif (
present(timed) )
then
117 elseif (
present(time) )
then
121 if (hst % unlimited_index == 0)
then
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 )
129 elseif (
present(timed) )
then
134 elseif (
present(time) )
then
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)
151 call put(var, (/timew/), 1, err)
152 if (err)
call dumperror()
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))
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 )
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 )
subroutine historysettime(time, history, difftime, timed)
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)