write_colors Subroutine

private subroutine write_colors(self, i1, i2)

The colors of points i1 .. i2 into the chain: the trajectory's, and the artist's color for points without one yet.

Arguments

Type IntentOptional Attributes Name
type(CurveArtist), intent(inout) :: self
integer, intent(in) :: i1

the trajectory points

integer, intent(in) :: i2

the trajectory points


Calls

proc~~write_colors~~CallsGraph proc~write_colors write_colors color_slice color_slice proc~write_colors->color_slice colors colors proc~write_colors->colors num_chunks num_chunks proc~write_colors->num_chunks num_colors num_colors proc~write_colors->num_colors

Called by

proc~~write_colors~~CalledByGraph proc~write_colors write_colors proc~write_curve CurveArtist%write_curve proc~write_curve->proc~write_colors

Source Code

    subroutine write_colors(self, i1, i2)
        type(CurveArtist), intent(inout) :: self
        integer, intent(in) :: i1, i2                       !! the trajectory points
        real(c_float), dimension(:,:), pointer :: c, col
        integer :: j, lo, hi, m
        call self%traj%colors(col)
        m = self%traj%num_colors()
        do j = 1, self%chain%num_chunks()
            call self%chain%color_slice(j, i1, i2, lo, hi, c)
            if (.not. associated(c)) cycle
            if (m >= lo) c(:, 1:min(hi, m)-lo+1) = col(:, lo:min(hi, m))
            if (hi > m) c(:, max(lo, m+1)-lo+1:) = spread(real(self%color_, c_float), 2, hi - max(lo, m+1) + 1)
        end do
        self%n_colored = min(m, i2)
    end subroutine write_colors