is_descendant Function

private recursive function is_descendant(root, frame) result(yes)

True if frame is root or one of its descendants.

Arguments

Type IntentOptional Attributes Name
class(ReferenceFrame), intent(in), target :: root

the subtree's root; the frame looked for

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

the subtree's root; the frame looked for

Return Value logical


Calls

proc~~is_descendant~~CallsGraph proc~is_descendant is_descendant proc~is_descendant->proc~is_descendant proc~same_frame same_frame proc~is_descendant->proc~same_frame

Called by

proc~~is_descendant~~CalledByGraph proc~is_descendant is_descendant proc~is_descendant->proc~is_descendant proc~add_child ReferenceFrame%add_child proc~add_child->proc~is_descendant

Source Code

    recursive logical function is_descendant(root, frame) result(yes)
        class(ReferenceFrame), intent(in), target :: root, frame !! the subtree's root; the frame looked for
        integer :: k
        yes = same_frame(root, frame)
        do k = 1, root%n_children
            if (yes) return
            yes = is_descendant(root%children(k)%p, frame)
        end do
    end function is_descendant