linearIndex Function

public function linearIndex(p, q, dim) result(ind)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: p
integer, intent(in) :: q
integer, intent(in) :: dim

Return Value integer


Contents

Source Code


Source Code

    function linearIndex(p, q, dim) result(ind)
        ! fuse p,q into one contiguous index
        ! the resulting index is contiguous in q
        ! Input: p,q - 2d-array indices
        !        dim - dimension of the underlying array in q-direction
        ! Output: ind - contiguous 1d-array index
        integer, intent(in) :: p, q, dim
        integer :: ind

        ind = q + (p - 1) * dim
    end function linearIndex