Return the global index in the g_lo layout given the dimensional indices
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(g_layout_type), | intent(in) | :: | lo | |||
integer, | intent(in) | :: | ik | |||
integer, | intent(in) | :: | it | |||
integer, | intent(in) | :: | il | |||
integer, | intent(in) | :: | ie | |||
integer, | intent(in) | :: | is |
elemental function idx_g (lo, ik, it, il, ie, is)
implicit none
integer :: idx_g
type (g_layout_type), intent (in) :: lo
integer, intent (in) :: ik, it, il, ie, is
integer, dimension(5) :: i
i(lo%ik_ord) = ik - 1
i(lo%it_ord) = it - 1
i(lo%il_ord) = il - 1
i(lo%ie_ord) = ie - 1
i(lo%is_ord) = is - 1
idx_g = i(1) + lo%dim_size(1)*(i(2) + lo%dim_size(2)*(i(3) + lo%dim_size(3)*(i(4) + lo%dim_size(4)*i(5))))
end function idx_g