grow_attitudes Subroutine

private subroutine grow_attitudes(self, n, exact)

Grow the attitudes' storage to hold at least n.

Arguments

Type IntentOptional Attributes Name
type(Trajectory), intent(inout) :: self
integer, intent(in) :: n

attitudes to hold

logical, intent(in), optional :: exact

(true: exactly n (default false))


Calls

proc~~grow_attitudes~~CallsGraph proc~grow_attitudes grow_attitudes proc~new_capacity new_capacity proc~grow_attitudes->proc~new_capacity

Called by

proc~~grow_attitudes~~CalledByGraph proc~grow_attitudes grow_attitudes proc~add_attitude Trajectory%add_attitude proc~add_attitude->proc~grow_attitudes proc~add_points Trajectory%add_points proc~add_points->proc~grow_attitudes proc~reserve~2 Trajectory%reserve proc~reserve~2->proc~grow_attitudes proc~add_point Trajectory%add_point proc~add_point->proc~add_attitude

Source Code

    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