INDEX1()

Fortran version:

Fortran-90 generic routine INDEXDKEY() for I/O API-3.2: compiler selects the appropriate type-specific form depending upon the number and types of the keys and key-lists:
    INTEGER FUNCTION INDEXKEY( KEY, N, LIST )
        INTEGER  N              !   table size
        <type>   KEY
        <type>   LIST(N)

Type-specific forms:

    INTEGER FUNCTION INDEX1( NAME, N, LIST )
        CHARACTER*(*), INTENT(IN   ) :: NAME        !  Character string being searched for
        INTEGER      , INTENT(IN   ) :: N           !  Length of array to be searched
        CHARACTER*(*), INTENT(IN   ) :: LIST( N )   !  array to be searched

    INTEGER FUNCTION INDEXINT1( IKEY, N, LIST )
        INTEGER, INTENT(IN   ) :: IKEY          !  integer being searched for
        INTEGER, INTENT(IN   ) :: N             !  Length of array to be searched
        INTEGER, INTENT(IN   ) :: LIST(*)       !  array to be searched

    INTEGER FUNCTION INDEXL1( LKEY, N, LIST )
        INTEGER*8, INTENT(IN   ) :: LKEY        !  integer*8 being searched for
        INTEGER,   INTENT(IN   ) :: N           !  Length of array to be searched
        INTEGER*8, INTENT(IN   ) :: LIST(*)     !  array to be searched

NO C version:

Summary:

Searches for character-string key NAME, INTEGER IKEY, or INTEGER*8 LKEY in unsorted list NLIST and returns the subscript (1...N) at which it is found, or returns 0 when NAME (IKEY) not found in NLIST

See also:

FINDC(),
FIND1(), FIND2(), FIND3(), FIND4(),
FINDL1(), FINDL2(), FINDL3(), FINDL4(),
FINDR1(), FINDR2(), FINDR3(), FINDR4()
for use finding keys in sorted lists.

LOCATC(),
LOCAT1(), LOCAT2(), LOCAT3(), LOCAT4(),
LOCATL1(), LOCATL2(), LOCATL3(), LOCATL4(),
LOCATR1(), LOCATR2(), LOCATR3(), LOCATR4()
for use inserting items into sorted lists.

Preconditions:

String-lengths match: LEN( NAME ) = LEN( NLIST( I ) )

Fortran Usage:

For Fortran-90 declarations and interface checking:
    USE M3UTILIO
    

    ...
    USE M3UTILIO
    ...
    CHARACTER*4 :: NLIST( 4 ) = (/ 'aaaa', 'bbbb', 'cccc', 'dddd' /)
    INTEGER        ILIST( 5 ) = (/ 2, 3, 5, 7, 11 /)
    INTEGER        L
    ...
    L = INDEX1( 'cccc', 4, NLIST)    !  L = 3
    ...
    L = INDEX1( 'ffff', 4, NLIST)    !  L = 0
    ...
    L = INDEXINT1(   7, 5, ILIST)    !  L = 4
    ...
    

C Usage:

don't


Previous: GRIDOPS

Next: JUNIT

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages