Grow the times' storage to hold at least n (see new_capacity).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Trajectory), | intent(inout) | :: | self | |||
| integer, | intent(in) | :: | n |
times to hold |
||
| logical, | intent(in), | optional | :: | exact |
(true: exactly n (default false)) |
subroutine grow_times(self, n, exact) type(Trajectory), intent(inout) :: self integer, intent(in) :: n !! times to hold logical, intent(in), optional :: exact !! (true: exactly n (default false)) real(wp), allocatable :: tmp(:) integer :: cap cap = 0 if (allocated(self%t)) cap = size(self%t) if (n <= cap) return allocate(tmp(new_capacity(cap, n, exact))) if (self%n_times > 0) tmp(1:self%n_times) = self%t(1:self%n_times) call move_alloc(tmp, self%t) end subroutine grow_times