fdoc

subroutineadd_bodyprivate

subroutine add_body(c, node, condition)

Add a block to node, with condition condition.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

nodeintegerin

the node

conditionintegerin

its condition, or 0

Calls

Source

Show the code
subroutine add_body(c, node, condition)
    type(fypp_t), intent(inout) :: c    !! the state
    integer, intent(in) :: node         !! the node
    integer, intent(in) :: condition    !! its condition, or 0
    type(body_t), allocatable :: grown(:)
    integer :: k, n

    n = 0
    if (allocated(c%nodes(node)%block%bodies)) n = size(c%nodes(node)%block%bodies)
    allocate (grown(n + 1))
    do k = 1, n
        grown(k)%n = c%nodes(node)%block%bodies(k)%n
        call move_alloc(c%nodes(node)%block%bodies(k)%ids, grown(k)%ids)
    end do
    allocate (grown(n + 1)%ids(16))
    call move_alloc(grown, c%nodes(node)%block%bodies)
    call push_id(c%nodes(node)%block%conds, condition)
end subroutine add_body

Graphs

Calls

Called by