point_at Function

private function point_at(self, t, sources, ok) result(v)

The point at time t (components from sources; default: the position's), linear in time between the points about it; outside the times, the first or last point. ok (optional) false, and v 0, if there is no point (or the search for the time failed).

Type Bound

Trajectory

Arguments

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

the time

type(DataSource), intent(in), optional :: sources(3)

where the components come from (default: the position)

logical, intent(out), optional :: ok

a point was found

Return Value real(kind=wp), (3)


Calls

proc~~point_at~~CallsGraph proc~point_at Trajectory%point_at proc~num_points Trajectory%num_points proc~point_at->proc~num_points proc~point_between Trajectory%point_between proc~point_at->proc~point_between proc~point~2 Trajectory%point proc~point_at->proc~point~2 proc~position_sources position_sources proc~point_at->proc~position_sources proc~time_index Trajectory%time_index proc~point_at->proc~time_index proc~point_between->proc~num_points proc~point_between->proc~point~2 proc~time_fraction Trajectory%time_fraction proc~point_between->proc~time_fraction proc~time_distance Trajectory%time_distance proc~time_index->proc~time_distance

Called by

proc~~point_at~~CalledByGraph proc~point_at Trajectory%point_at proc~trajectory_path_position TrajectoryPath%trajectory_path_position proc~trajectory_path_position->proc~point_at

Source Code

    function point_at(self, t, sources, ok) result(v)
        class(Trajectory), intent(in) :: self
        real(wp), intent(in) :: t                           !! the time
        type(DataSource), intent(in), optional :: sources(3)  !! where the components come from (default: the position)
        logical, intent(out), optional :: ok                !! a point was found
        real(wp) :: v(3)
        type(DataSource) :: src(3)
        integer :: n, i, status
        v = 0.0_wp
        if (present(ok)) ok = .false.
        src = position_sources(self%dof_)
        if (present(sources)) src = sources
        n = min(self%n_times, self%num_points(src))
        if (n == 0) return
        status = self%time_index(t, i)
        if (status == TIME_NOT_FOUND) return
        if (i < 1) then
            v = self%point(1, src)
        else if (i >= n) then
            v = self%point(n, src)
        else
            v = self%point_between(i, i + 1, t, src)
        end if
        if (present(ok)) ok = .true.
    end function point_at