Returns if the timeControl has triggered since last update.
This is true if now >= me%trigger and with in the bounds of min and max. Please note that, to allow arbitrary settings of min and interval, this routine might change the timeControl data given in me, by setting the trigger to now, when min is reached for the first time. This is required to allow independent time definitions for min, max and interval.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_timeControl_type), | intent(inout) | :: | me |
Time control to check if it was triggered. |
||
type(tem_time_type), | intent(in) | :: | now |
Current time that is to be used as comparison for the trigger check. |
Result indicating if the time control has triggered.
function tem_timeControl_triggered(me, now) result(hasTriggered)
! -------------------------------------------------------------------- !
!> Time control to check if it was triggered.
type(tem_timeControl_type), intent(inout) :: me
!> Current time that is to be used as comparison for the trigger check.
type(tem_time_type), intent(in) :: now
!> Result indicating if the time control has triggered.
logical :: hasTriggered
! -------------------------------------------------------------------- !
! -------------------------------------------------------------------- !
hasTriggered = .false.
! Time control intervals *only* are checked every check_iter iteration,
! in between the intervals, the triggered status remains false.
if (mod(now%iter, me%check_iter) == 0) then
! As long as the min was not reached yet, we need to do some extra checks,
! to ensure that the trigger can be set correctly when min is reached for
! first time.
if (.not. me%min_reached) then
me%min_reached = tem_time_ge_trigger(now, me%min)
! 'Now' has reached min, set the trigger accordingly for all those
! entries that are relevant in the interval configuration.
if (me%min_reached) then
me%trigger = tem_time_never()
if (me%interval%sim < huge(me%interval%sim)) then
me%trigger%sim = now%sim
end if
if (me%interval%iter < huge(me%interval%iter)) then
me%trigger%iter = now%iter
end if
if (me%interval%clock < huge(me%interval%clock)) then
me%trigger%clock = now%clock
end if
end if
end if
if (me%min_reached .and. (.not. tem_time_gt_trigger(now, me%max)) ) then
hasTriggered = tem_time_ge_trigger(now, me%trigger)
end if
end if
end function tem_timeControl_triggered