tem_time_last_interval Function

public elemental function tem_time_last_interval(now, interval) result(last)

Returns the last full interval before now.

If interval is 0 or smaller, the result is put to 0. This holds for time component individually.

Arguments

Type IntentOptional Attributes Name
type(tem_time_type), intent(in) :: now
type(tem_time_type), intent(in) :: interval

Return Value type(tem_time_type)


Called by

proc~~tem_time_last_interval~~CalledByGraph proc~tem_time_last_interval tem_time_last_interval proc~tem_timecontrol_align_trigger tem_timeControl_align_trigger proc~tem_timecontrol_align_trigger->proc~tem_time_last_interval proc~tem_load_restart tem_load_restart proc~tem_load_restart->proc~tem_timecontrol_align_trigger

Contents


Source Code

  elemental function tem_time_last_interval(now, interval) result(last)
    ! -------------------------------------------------------------------- !
    type(tem_time_type), intent(in) :: now
    type(tem_time_type), intent(in) :: interval
    type(tem_time_type) :: last
    ! -------------------------------------------------------------------- !
    ! -------------------------------------------------------------------- !

    last%sim   = 0.0_rk
    last%iter  = 0
    last%clock = 0.0_rk

    if (interval%sim > 0.0_rk) then
      last%sim = floor(now%sim / interval%sim) * interval%sim
    end if
    if (interval%iter > 0) then
      last%iter = (now%iter / interval%iter) * interval%iter
    end if
    if (interval%clock > 0.0_rk) then
      last%clock = floor(now%clock / interval%clock) * interval%clock
    end if
  end function tem_time_last_interval