Given an it value get the it of the left connected cell
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(supercell_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | it |
function sc_get_left_it(self,it)
implicit none
class(supercell_type),intent(in) :: self
integer,intent(in)::it
integer :: sc_get_left_it, ic, tmp
!Default to no connection
tmp=-1
!Look for early exit
if((.not.self%has_it(it)).or.(self%ncell==1)) then
tmp=-1
else
!Now see which cell has this it
do ic=1,self%ncell
if(self%cells(ic)%it_ind==it) then
tmp=ic-1
exit
endif
enddo
!Now set appropriate value
if(tmp<=0) then
tmp=-1
else
tmp=self%cells(tmp)%it_ind
endif
endif
!Update result
sc_get_left_it=tmp
end function sc_get_left_it