35 real(dp),
allocatable :: times(:)
36 integer(I4B) :: selection(2)
56 deallocate (this%times)
62 integer(I4B),
optional,
intent(in) :: increment
65 this%selection = (/1,
size(this%times)/)
72 if (
allocated(this%times))
deallocate (this%times)
73 allocate (this%times(0))
74 this%selection = (/0, 0/)
93 if (.not.
allocated(this%times))
return
94 do i = 1,
size(this%times)
107 subroutine log(this, iout, verb)
110 integer(I4B),
intent(in) :: iout
111 character(len=*),
intent(in) :: verb
113 character(len=*),
parameter :: fmt = &
114 &
"(6x,'THE FOLLOWING TIMES WILL BE ',A,': ',50(G0,' '))"
117 write (iout, fmt) verb, this%times(this%selection(1):this%selection(2))
119 write (iout,
"(a,1x,a)")
'NO TIMES WILL BE', verb
145 real(DP),
intent(in) :: t0, t1
146 logical(LGP),
intent(inout),
optional :: changed
148 integer(I4B) :: i, i0, i1
149 integer(I4B) :: l, u, lp, up
154 i1 =
size(this%times)
161 lp = this%selection(1)
162 up = this%selection(2)
170 if (lp > 0 .and. up > 0)
then
172 if (this%times(lp - 1) <= t0 .and. &
173 this%times(lp) > t0)
then
178 if (up > 1 .and. up < i1)
then
179 if (this%times(up + 1) > t1 .and. &
180 this%times(up) <= t1)
then
185 if (l == lp .and. u == up)
then
186 this%selection = (/l, u/)
187 if (
present(changed)) changed = .false.
195 if (l < 0 .and. t > t0 .and. t <= t1) l = i
196 if (l > 0 .and. t <= t1) u = i
198 this%selection = (/l, u/)
199 if (
present(changed)) changed = l /= lp .or. u /= up
226 call this%select(l, u)
238 function any(this)
result(a)
242 a = all(this%selection > 0)
258 n = this%selection(2) - this%selection(1)
271 integer(I4B),
allocatable :: indx(:)
273 allocate (indx(
size(this%times)))
274 call qsort(indx, this%times)
288 this%times = [this%times, a]
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.
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 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.