get set of pieces directly above piece i
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ip), | intent(in) | :: | i |
function get_pieces_above(i) result(ipieces) !! get set of pieces directly above piece i integer(ip),intent(in) :: i integer(ip),dimension(:),allocatable :: ipieces integer(ip) :: x,y,z !! counter allocate(ipieces(0)) do x = istart_array(i,1), iend_array(i,1) do y = istart_array(i,2), iend_array(i,2) do z = istart_array(i,3), iend_array(i,3) if (z+1<=ubound(array,3)) then if (array(x,y,z+1)/=0) ipieces = [ipieces,array(x,y,z+1)] ! above this one end if end do end do end do ipieces = unique(pack(ipieces, ipieces/=i)) ! exclude the ones in this piece end function get_pieces_above