subroutineappendprivate
subroutine append(c, node)
Put node at the end of the block being read.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| c | type(fypp_t) | inout | the state | |
| node | integer | in | the node |
Source
Show the code
subroutine append(c, node)
type(fypp_t), intent(inout) :: c !! the state
integer, intent(in) :: node !! the node
integer, allocatable :: grown(:)
integer :: parent, body, n
parent = c%root
if (c%depth > 0) parent = c%stack(c%depth)
body = size(c%nodes(parent)%block%bodies)
associate (b => c%nodes(parent)%block%bodies(body))
n = b%n
if (n == size(b%ids)) then
allocate (grown(2*n))
grown(1:n) = b%ids(1:n)
call move_alloc(grown, b%ids)
end if
b%ids(n + 1) = node
b%n = n + 1
end associate
end subroutine append