E.2.6 Get Value Statistics Functions

The main documentation of the Get Value Statistics Functions contains additional explanation of this code listing.

  define([ACCESS_ROUTINE],[
    pushdef([VALUE], [$1])
    ifelse(
      VALUE, [Count],
        [pushdef([TYPE], [integer])],
      VALUE, [Totally_Positive],
        [pushdef([TYPE], [logical])],
      [pushdef([TYPE], [real])])
    pushdef([Get_VALUE_Stats], expand(Get_VALUE_Stats))
    pushdef([Global_VALUE], expand(Global_VALUE))
    pushdef([PE_VALUE], expand(PE_VALUE))

    function Get_VALUE_Stats (Statistics, Global) result(VALUE)

      ! Input variables.

      type(logical), optional, intent(in) :: Global    ! Global/Local toggle.

      ! Input/Output variables.

      type(Statistics_type), intent(inout) :: Statistics ! Statistics object.

      ! Output variables.

      type(TYPE) :: VALUE                     ! Statistics value to be output.
  
      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
      ! Verify requirements.
  
      VERIFY(Valid_State(Statistics),5)       ! Statistics is valid.

      ! Set value.

      if (PRESENT(Global)) then
        if (Global) then
          call Update_Global_Statistics (Statistics)
          VALUE = Statistics%Global_VALUE
        else
          VALUE = Statistics%PE_VALUE
        end if
      else
        VALUE = Statistics%PE_VALUE
      end if

      ! Verify guarantees - none.
  
      return
    end function Get_VALUE_Stats

    popdef([VALUE])
    popdef([Get_VALUE_Stats])
    popdef([Global_VALUE])
    popdef([PE_VALUE])
  ])

  fortext([Value],[Arithmetic_Mean Count Geometric_Mean Harmonic_Mean 
                   Maximum Minimum Standard_Deviation Sum Totally_Positive],[
    ACCESS_ROUTINE(Value)
  ])

  function Get_Name_Stats (Statistics) result(Name)
  
    ! Input variable.

    type(Statistics_type), intent(in) :: Statistics ! Statistics object.
  
    ! Output variable.
  
    type(character,80) :: Name              ! Statistics value to be output.
  
    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
    ! Verify requirements.
  
    VERIFY(Valid_State(Statistics),5)       ! Statistics is valid.
  
    ! Set value.
  
    Name = Statistics%Name
  
    ! Verify guarantees - none.
  
    return
  end function Get_Name_Stats



Michael L. Hall