D.4.6 Get_Values_Data_Index Procedure

The main documentation of the Get_Values_Data_Index Procedure contains additional explanation of this code listing.

  subroutine Get_Values_Data_Index_1 (Values, Index)

    ! Input variable.
  
    type(Data_Index_type), intent(in) :: Index   ! Variable to be queried.

    ! Input/Output variable.
      
    type(integer,1,np), intent(inout) :: Values  ! Values bare naked vector.
  
    ! Internal variables.

    type(integer) :: i                           ! Loop counter.

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ! Verify requirements.

    VERIFY(Valid_State(Index),5)           ! Index is valid.
    VERIFY(Index%Dimensionality==1,5)      ! Dimensionality is correct.

    ! Calculate the values, correcting for local/global and off-PE conversions.

    Values = zero
    do i = 1, SIZE(Index%Index1,1)
      if (Index%Index1(i) > 0) then
        Values(i) = Index%Index1(i) + First_PE(Index%Many_Structure) - 1
      else if (Index%Index1(i) < 0) then
        Values(i) = Index%Off_PE_Index(-Index%Index1(i))
      end if
    end do

    ! Verify guarantees.

    VERIFY(Valid_State_NP(Values),5)       ! Values is valid.

    return
  end subroutine Get_Values_Data_Index_1

  subroutine Get_Values_Data_Index_2 (Values, Index)

    ! Input variable.
  
    type(Data_Index_type), intent(in) :: Index  ! Variable to be queried.

    ! Input/Output variable.
      
    type(integer,2,np), intent(inout) :: Values ! Values bare naked vector.
  
    ! Internal variables.

    type(integer) :: i, j                       ! Loop counters.

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ! Verify requirements.

    VERIFY(Valid_State(Index),5)           ! Index is valid.
    VERIFY(Index%Dimensionality==2,5)      ! Dimensionality is correct.

    ! Calculate the values, correcting for local/global and off-PE conversions.

    Values = zero
    do i = 1, SIZE(Index%Index2,1)
      do j = 1, SIZE(Index%Index2,2)
        if (Index%Index2(i,j) > 0) then
          Values(i,j) = Index%Index2(i,j) + First_PE(Index%Many_Structure) - 1
        else if (Index%Index2(i,j) < 0) then
          Values(i,j) = Index%Off_PE_Index(-Index%Index2(i,j))
        end if
      end do
    end do

    ! Verify guarantees.

    VERIFY(Valid_State_NP(Values),5)       ! Values is valid.

    return
  end subroutine Get_Values_Data_Index_2



Michael L. Hall