Write segments s1 .. s2 into the chain (and upload the chunks written to).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(SegmentArtist), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | s1 |
the segments |
||
| integer, | intent(in) | :: | s2 |
the segments |
subroutine write_segments(self, s1, s2) type(SegmentArtist), intent(inout) :: self integer, intent(in) :: s1, s2 !! the segments real(c_float), dimension(:,:,:), pointer :: p real(wp), allocatable :: v(:,:), w(:,:) integer :: j, lo, hi, sa, sb, ia, ib do j = 1, self%chain%num_chunks() call self%chain%slice(j, 2 * s1 - 1, 2 * s2, lo, hi, p) ! chunks hold whole segments if (.not. associated(p)) cycle ! segments sa .. sb: their start points (odd chain points) and end points (even) sa = (lo + 1) / 2 sb = hi / 2 ia = 1 + (sa - 1) * self%stride_ ib = 1 + (sb - 1) * self%stride_ allocate(v(3, sb - sa + 1), w(3, sb - sa + 1)) call self%traj%points(ia, ib, self%start_, v, self%stride_) call self%traj%points(ia, ib, self%end_, w, self%stride_) if (self%end_relative_) w = v + w ! (no offset: exactly the start, a segment drawn as nothing) call to_shown_at(self, ia, v, self%stride_) ! (data in another frame: both ends, at their time) call to_shown_at(self, ia, w, self%stride_) call split_points(v, p(:, :, 2*sa-lo:2*sb-lo:2)) call split_points(w, p(:, :, 2*sa-lo+1:2*sb-lo+1:2)) deallocate(v, w) end do call self%chain%written(2 * s1 - 1, 2 * s2) end subroutine write_segments