Add two time definitions to each other (provides the plus operator).
Entries set to huge (never) will be kept as this, all other entries are simply added to each other.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_time_type), | intent(in) | :: | left |
First operant in the addition of times. |
||
type(tem_time_type), | intent(in) | :: | right |
Second operant in the addition of times. |
Resulting sum of left and right.
elemental function tem_time_add_time(left, right) result(res) ! -------------------------------------------------------------------- ! !> First operant in the addition of times. type(tem_time_type), intent(in) :: left !> Second operant in the addition of times. type(tem_time_type), intent(in) :: right !> Resulting sum of left and right. type(tem_time_type) :: res ! -------------------------------------------------------------------- ! real(kind=rk) :: nvrReal integer :: nvrInt ! -------------------------------------------------------------------- ! nvrReal = huge(left%sim) nvrInt = huge(left%iter) if ( (left%sim < nvrReal) & & .and. (right%sim < (nvrReal-left%sim)) ) then res%sim = left%sim + right%sim else res%sim = nvrReal end if if ( (left%iter < nvrInt) & & .and. (right%iter < (nvrInt-left%iter)) ) then res%iter = left%iter + right%iter else res%iter = nvrInt end if if ( (left%clock < nvrReal) & & .and. (right%clock < (nvrReal-left%clock)) ) then res%clock = left%clock + right%clock else res%clock = nvrReal end if end function tem_time_add_time