get set of pieces directly below piece i
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ip), | intent(in) | :: | i |
function get_pieces_below(i) result(ipieces) !! get set of pieces directly below 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>0) then ! 0 is the floor if (array(x,y,z-1)/=0) ipieces = [ipieces,array(x,y,z-1)] ! below 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_below