36 real(dp),
allocatable :: times(:)
37 integer(I4B) :: selection(2)
58 deallocate (this%times)
64 integer(I4B),
optional,
intent(in) :: increment
67 this%selection = (/1,
size(this%times)/)
74 if (
allocated(this%times))
deallocate (this%times)
75 allocate (this%times(0))
76 this%selection = (/0, 0/)
95 if (.not.
allocated(this%times))
return
96 do i = 1,
size(this%times)
109 subroutine log(this, iout, verb)
112 integer(I4B),
intent(in) :: iout
113 character(len=*),
intent(in) :: verb
115 character(len=*),
parameter :: fmt = &
116 &
"(6x,'THE FOLLOWING TIMES WILL BE ',A,': ',50(G0,' '))"
119 write (iout, fmt) verb, this%times(this%selection(1):this%selection(2))
121 write (iout,
"(a,1x,a)")
'NO TIMES WILL BE', verb
147 real(DP),
intent(in) :: t0, t1
148 logical(LGP),
intent(inout),
optional :: changed
150 integer(I4B) :: i, i0, i1
151 integer(I4B) :: l, u, lp, up
156 i1 =
size(this%times)
163 lp = this%selection(1)
164 up = this%selection(2)
172 if (lp > 0 .and. up > 0)
then
174 if (this%times(lp - 1) <= t0 .and. &
175 this%times(lp) > t0)
then
180 if (up > 1 .and. up < i1)
then
181 if (this%times(up + 1) > t1 .and. &
182 this%times(up) <= t1)
then
187 if (l == lp .and. u == up)
then
188 this%selection = (/l, u/)
189 if (
present(changed)) changed = .false.
197 if (l < 0 .and. t > t0 .and. t <= t1) l = i
198 if (l > 0 .and. t <= t1) u = i
200 this%selection = (/l, u/)
201 if (
present(changed)) changed = l /= lp .or. u /= up
228 call this%select(l, u)
240 function any(this)
result(a)
244 a = all(this%selection > 0)
260 n = this%selection(2) - this%selection(1)
273 integer(I4B),
allocatable :: indx(:)
275 allocate (indx(
size(this%times)))
276 call qsort(indx, this%times)
290 this%times = [this%times, a]
303 real(dp),
intent(in) :: t
304 real(dp),
intent(in) :: tolerance
305 logical(LGP) :: found
309 if (.not.
allocated(this%times))
return
310 do i = 1,
size(this%times)
311 if (
is_close(this%times(i), t, atol=tolerance))
then
This module contains simulation constants.
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
This module defines variable data types.
pure logical function, public is_close(a, b, rtol, atol, symmetric)
Check if a real value is approximately equal to another.
integer(i4b), dimension(:), pointer, public, contiguous nstp
number of time steps in each stress period
real(dp), pointer, public totimc
simulation time at start of time step
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
integer(i4b), pointer, public nper
number of stress period
Specify times for some event to occur.
logical(lgp) function increasing(this)
Determine if times strictly increase.
subroutine advance(this)
Update the selection to the current time step.
integer(i4b) function count(this)
Return the number of times currently selected.
subroutine log(this, iout, verb)
Show the current time selection, if any.
subroutine deallocate(this)
Deallocate the time selection object.
logical(lgp) function contains_close(this, t, tolerance)
Check whether any configured time is within tolerance of t.
logical(lgp) function any(this)
Check if any times are currently selected.
subroutine sort(this)
Sort the time selection in increasing order.
subroutine expand(this, increment)
Expand capacity by the given amount. Resets the current slice.
subroutine select(this, t0, t1, changed)
Select times in the interval (t0, t1] (exclusive lower, inclusive upper).
subroutine extend(this, a)
Extend the time selection with the given array.
Represents a series of instants at which some event should occur.