reursively get a list of all pieces above piece i
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ip), | intent(in) | :: | i |
recursive function get_all_pieces_above(i) result(ipieces) !! reursively get a list of all pieces above piece i integer(ip),intent(in) :: i integer(ip),dimension(:),allocatable :: ipieces integer :: j !! counter logical :: found integer(ip) :: idx call above_cache%get([i],idx,ipieces,found) if (.not. found) then allocate(ipieces(0)) associate(tmp => get_pieces_above(i)) if (size(tmp)>0) then ipieces = [ipieces, tmp] ! ones directly above do j = 1, size(tmp) ! go up the tree ipieces = [ipieces, get_all_pieces_above(tmp(j))] end do ipieces = unique(ipieces) end if end associate call above_cache%put(idx,[i],ipieces) end if end function get_all_pieces_above