mod_get_indices Module

Module defining convenient index retrieval functions on various arrays.


Interfaces

public interface get_index

interface to retrieve the index of an element in an array.

Note

replace get_index by findloc once we drop support for gfortran<9

  • private pure function find_index_in_character_array(name, array) result(match_idx)

    Function to locate the index of a given character in a character array. Iterates over the elements and returns on the first hit, if no match was found zero is returned.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: name

    the name to search for

    character(len=*), intent(in) :: array(:)

    array with the names to search in

    Return Value integer

    index of first match

  • private pure function find_indices_in_character_array(names, array) result(match_idxs)

    Function to locate the indices of an array of characters in another character array. Returns the indices of the first hit, it no match was found zero is returned.

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: names(:)

    the names to search for

    character(len=*), intent(in) :: array(:)

    array in which to sarch in

    Return Value integer, (size(names))

    index of first matches


Functions

private pure function find_index_in_character_array(name, array) result(match_idx)

Function to locate the index of a given character in a character array. Iterates over the elements and returns on the first hit, if no match was found zero is returned.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

the name to search for

character(len=*), intent(in) :: array(:)

array with the names to search in

Return Value integer

index of first match

private pure function find_indices_in_character_array(names, array) result(match_idxs)

Function to locate the indices of an array of characters in another character array. Returns the indices of the first hit, it no match was found zero is returned.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: names(:)

the names to search for

character(len=*), intent(in) :: array(:)

array in which to sarch in

Return Value integer, (size(names))

index of first matches