Align the trigger to intervals since min.
Only the time components given in the configuration will be considered for the alignment the other components remain untouched.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_timeControl_type), | intent(inout) | :: | me |
Time control definition to load from a Lua config. |
||
type(flu_State) | :: | conf |
Handle for the Lua script. |
|||
type(tem_time_type), | intent(in) | :: | now |
Current point in time to find alignement of trigger. |
||
integer, | intent(in), | optional | :: | parent |
Parent table to read from. |
|
character(len=*), | intent(in), | optional | :: | key |
Name of the time control table. Default: 'time_control' |
subroutine tem_timeControl_align_trigger(me, conf, now, parent, key)
! -------------------------------------------------------------------- !
!> Time control definition to load from a Lua config.
type(tem_timeControl_type), intent(inout) :: me
!> Handle for the Lua script.
type(flu_state) :: conf
!> Current point in time to find alignement of trigger.
type(tem_time_type), intent(in) :: now
!> Parent table to read from.
integer, intent(in), optional :: parent
!> Name of the time control table. Default: 'time_control'
character(len=*), intent(in), optional :: key
! -------------------------------------------------------------------- !
integer :: thandle
character(len=labelLen) :: localKey
logical :: alignmask(3)
type(tem_time_type) :: align_interval
! -------------------------------------------------------------------- !
if (present(key)) then
localKey = key
else
localKey = 'time_control'
endif
call aot_table_open( L = conf, &
& parent = parent, &
& thandle = thandle, &
& key = localKey )
if (thandle /= 0) then
call load_alignmask( mask = alignmask, &
& conf = conf, &
& key = 'align_trigger', &
& parent = thandle )
else
alignmask = .false.
end if
align_interval%sim = 0.0_rk
align_interval%iter = 0
align_interval%clock = 0.0_rk
if (alignmask(sim)) align_interval%sim = me%interval%sim
if (alignmask(iter)) align_interval%iter = me%interval%iter
if (alignmask(clock)) align_interval%clock = me%interval%clock
me%trigger = me%min + tem_time_last_interval( now = now-me%min, &
& interval = align_interval )
me%min_reached = tem_time_ge_trigger(now, me%min)
end subroutine tem_timeControl_align_trigger