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