get_array_elements Function

public pure function get_array_elements(list, indices)

Get an element for each array.

Arguments

Type IntentOptional Attributes Name
type(array_list), intent(in) :: list
integer, intent(in), DIMENSION(number_of_arrays(list)) :: indices

element index for each array

Return Value integer, DIMENSION(number_of_arrays(list))


Source Code

   PURE FUNCTION get_array_elements(list, indices)
      !! Get an element for each array.

      TYPE(array_list), INTENT(IN)                           :: list
      INTEGER, DIMENSION(number_of_arrays(list)), INTENT(IN) :: indices
         !! element index for each array
      INTEGER, DIMENSION(number_of_arrays(list))             :: get_array_elements

      INTEGER                                                :: i, ind

      DO i = 1, SIZE(indices)
         ind = indices(i) + list%ptr(i) - 1
         get_array_elements(i) = list%col_data(ind)
      END DO

   END FUNCTION get_array_elements