add_points Subroutine

private subroutine add_points(self, t, pos, att, color)

Add points in bulk: times t(n), with optional positions pos(dof, n), attitudes att(4, n) and colors color(3 or 4, n). Times, positions, attitudes and colors must all have been complete before (as many of each as times) for the given ones to line up with t.

Points computed elsewhere, all at once (times(n), positions(3, n)):

call orbit%add(times, pos=positions)

Type Bound

Trajectory

Arguments

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

(n): times

real(kind=wp), intent(in), optional :: pos(:,:)

(dof, n): positions

real(kind=wp), intent(in), optional :: att(:,:)

(4, n): attitude quaternions [x, y, z, w]

real(kind=wp), intent(in), optional :: color(:,:)

(3 or 4, n): colors [r, g, b(, a)] (0 to 1)


Calls

proc~~add_points~~CallsGraph proc~add_points Trajectory%add_points proc~grow_attitudes grow_attitudes proc~add_points->proc~grow_attitudes proc~grow_colors grow_colors proc~add_points->proc~grow_colors proc~grow_positions grow_positions proc~add_points->proc~grow_positions proc~grow_times grow_times proc~add_points->proc~grow_times proc~new_capacity new_capacity proc~grow_attitudes->proc~new_capacity proc~grow_colors->proc~new_capacity proc~grow_positions->proc~new_capacity proc~grow_times->proc~new_capacity

Source Code

    subroutine add_points(self, t, pos, att, color)
        class(Trajectory), intent(inout) :: self
        real(wp), intent(in) :: t(:)                    !! (n): times
        real(wp), intent(in), optional :: pos(:,:)      !! (dof, n): positions
        real(wp), intent(in), optional :: att(:,:)      !! (4, n): attitude quaternions [x, y, z, w]
        real(wp), intent(in), optional :: color(:,:)    !! (3 or 4, n): colors [r, g, b(, a)] (0 to 1)
        integer :: n, i0, d
        n = size(t)
        i0 = self%n_times
        call grow_times(self, i0 + n)
        self%t(i0+1:i0+n) = t
        self%n_times = i0 + n
        if (present(pos)) then
            n = min(size(pos, 2), self%n_times - self%n_pos)
            d = min(self%dof_, size(pos, 1))
            call grow_positions(self, self%n_pos + n)
            self%posopt(:, :, self%n_pos+1:self%n_pos+n) = 0.0_wp
            self%posopt(1:d, 0, self%n_pos+1:self%n_pos+n) = pos(1:d, 1:n)
            self%n_pos = self%n_pos + n
        end if
        if (present(att)) then
            n = min(size(att, 2), self%n_times - self%n_att)
            call grow_attitudes(self, self%n_att + n)
            self%att(:, self%n_att+1:self%n_att+n) = att(:, 1:n)
            self%n_att = self%n_att + n
        end if
        if (present(color)) then
            n = min(size(color, 2), self%n_times - self%n_col)
            d = min(4, size(color, 1))
            call grow_colors(self, self%n_col + n)
            self%col(:, self%n_col+1:self%n_col+n) = 1.0_c_float
            self%col(1:d, self%n_col+1:self%n_col+n) = real(color(1:d, 1:n), c_float)
            self%n_col = self%n_col + n
        end if
        self%revision_ = self%revision_ + 1
    end subroutine add_points