Write the segments added (all of them on a redraw), and draw them all or, in trace mode, those at the points passed at time t.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(SegmentArtist), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in) | :: | t |
the current time |
subroutine segment_update(self, t) class(SegmentArtist), intent(inout) :: self real(wp), intent(in) :: t !! the current time integer :: m, s1, s2, i1, i2 logical :: changed, redraw if (.not. self%chain%is_built()) return m = segment_count(self) changed = data_changed(self, redraw) if (redraw .or. .not. associated(self%traj)) self%n_written = 0 if (changed) then s1 = max(1, min(self%n_written, m)) ! from the last segment written (set_optional) call self%chain%reserve(2 * m) if (m >= s1) call write_segments(self, s1, m) self%n_written = m end if self%n_drawn = self%n_written self%first_drawn_ = 1 if (self%trace .and. associated(self%traj)) then ! the segments at the points passed (times up to t) call trace_range(self%traj, t, self%traj%num_times(), i1, i2) s1 = (i1 - 1 + self%stride_ - 1) / self%stride_ + 1 s2 = 0 if (i2 >= 1) s2 = min(self%n_written, (i2 - 1) / self%stride_ + 1) self%first_drawn_ = s1 self%n_drawn = max(0, s2 - s1 + 1) end if call self%chain%draw_range(2 * self%first_drawn_ - 1, 2 * (self%first_drawn_ + self%n_drawn - 1)) end subroutine segment_update