markers_passed Subroutine

private subroutine markers_passed(self, t, first, count)

The intermediate markers (in trajectory order) whose times are at most t: count from first (the first ones for increasing times, the last for decreasing), by bisection.

Arguments

Type IntentOptional Attributes Name
type(MarkerArtist), intent(in) :: self
real(kind=wp), intent(in) :: t

the current time

integer, intent(out) :: first

the markers passed: the first, how many

integer, intent(out) :: count

the markers passed: the first, how many


Calls

proc~~markers_passed~~CallsGraph proc~markers_passed markers_passed num_times num_times proc~markers_passed->num_times proc~decreasing_times decreasing_times proc~markers_passed->proc~decreasing_times

Called by

proc~~markers_passed~~CalledByGraph proc~markers_passed markers_passed proc~marker_update MarkerArtist%marker_update proc~marker_update->proc~markers_passed

Source Code

    subroutine markers_passed(self, t, first, count)
        type(MarkerArtist), intent(in) :: self
        real(wp), intent(in) :: t                           !! the current time
        integer, intent(out) :: first, count                !! the markers passed: the first, how many
        integer :: low, high, mid, m
        m = self%n_inter_written
        low = 0
        high = m + 1
        if (.not. decreasing_times(self%traj, self%traj%num_times())) then   ! markers 1 .. low passed
            do while (high - low > 1)
                mid = (low + high) / 2
                if (self%inter_t(mid) <= t) then
                    low = mid
                else
                    high = mid
                end if
            end do
            first = 1
            count = low
        else                                              ! markers high .. m passed
            do while (high - low > 1)
                mid = (low + high) / 2
                if (self%inter_t(mid) <= t) then
                    high = mid
                else
                    low = mid
                end if
            end do
            first = high
            count = m - high + 1
        end if
    end subroutine markers_passed