append Subroutine

private subroutine append(list, n, frame)

Add frame to list(1:n) (growing the array).

Arguments

Type IntentOptional Attributes Name
type(FramePointer), intent(inout), allocatable :: list(:)

first n used (grown as needed)

integer, intent(inout) :: n

number of frames in list (incremented)

class(ReferenceFrame), intent(in), target :: frame

the frame to add (not owned)


Called by

proc~~append~2~~CalledByGraph proc~append~2 append proc~add_child ReferenceFrame%add_child proc~add_child->proc~append~2

Source Code

    subroutine append(list, n, frame)
        type(FramePointer), allocatable, intent(inout) :: list(:)  !! first n used (grown as needed)
        integer, intent(inout) :: n                         !! number of frames in list (incremented)
        class(ReferenceFrame), intent(in), target :: frame  !! the frame to add (not owned)
        type(FramePointer), allocatable :: tmp(:)
        if (.not. allocated(list)) allocate(list(4))
        if (n == size(list)) then
            allocate(tmp(2 * n))
            tmp(1:n) = list(1:n)
            call move_alloc(tmp, list)
        end if
        n = n + 1
        list(n)%p => frame
    end subroutine append