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