fdoc

functionrank_ofpureprivate

pure integer function rank_of(dimension)

The rank given by dimension, such as (:,:): one more than the commas outside inner parentheses.

Arguments

NameTypeIntentAttributesDescription
dimensioncharacter(len=*)in

the dimensions

Result

NameTypeAttributesDescription
rank_ofinteger

Source

Show the code
pure integer function rank_of(dimension)
    character(len=*), intent(in) :: dimension   !! the dimensions
    integer :: k, depth

    rank_of = 0
    if (len(dimension) < 2) return
    if (dimension(1:1) /= '(') return
    if (index(dimension, '..') > 0) then
        rank_of = ANY_RANK
        return
    end if
    rank_of = 1
    depth = 0
    do k = 1, len(dimension)
        select case (dimension(k:k))
        case ('('); depth = depth + 1
        case (')'); depth = depth - 1
        case (','); if (depth == 1) rank_of = rank_of + 1
        end select
    end do
end function rank_of

Graphs

Called by