Write the pairs of trajectory points i1 .. i2 into the chain, with their colors (and upload the chunks written to).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(RibbonArtist), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | i1 |
the trajectory points |
||
| integer, | intent(in) | :: | i2 |
the trajectory points |
subroutine write_ribbon(self, i1, i2) class(RibbonArtist), intent(inout) :: self integer, intent(in) :: i1, i2 !! the trajectory points real(c_float), dimension(:,:,:), pointer :: p real(c_float), dimension(:,:), pointer :: c, col real(c_float) :: own(4) real(wp), allocatable :: v(:,:) integer :: j, lo, hi, ia, ib, m, k do j = 1, self%chain%num_chunks() call self%chain%slice(j, 2 * i1 - 1, 2 * i2, lo, hi, p) ! chunks hold whole pairs if (.not. associated(p)) cycle ia = (lo + 1) / 2 ! the trajectory points of the pairs ib = hi / 2 allocate(v(3, ib - ia + 1)) call art_points(self, ia, ib, self%start_, v) call split_points(v, p(:, :, 1:hi-lo+1:2)) call art_points(self, ia, ib, self%end_, v) call split_points(v, p(:, :, 2:hi-lo+1:2)) deallocate(v) end do if (self%chain%is_colored()) then ! each pair in its point's color call self%traj%colors(col) m = self%traj%num_colors() own = real(self%color_, c_float) own(4) = 1.0_c_float ! (the style has the alpha) do j = 1, self%chain%num_chunks() call self%chain%color_slice(j, 2 * i1 - 1, 2 * i2, lo, hi, c) if (.not. associated(c)) cycle do k = (lo + 1) / 2, hi / 2 if (k <= m) then c(:, 2*k-lo:2*k-lo+1) = spread(col(:, k), 2, 2) else c(:, 2*k-lo:2*k-lo+1) = spread(own, 2, 2) end if end do end do self%n_colored = min(m, i2) end if call self%chain%written(2 * i1 - 1, 2 * i2) end subroutine write_ribbon