E.2 Statistics Class Code Listing

The main documentation of the Statistics Class contains additional explanation of this code listing.

!
! Author: Michael L. Hall
!         P.O. Box 1663, MS-D413, LANL
!         Los Alamos, NM 87545
!         ph: 505-665-4312
!         email: Hall@LANL.gov
! 
! Created on: 07/10/01
! CVS Info:   $Id: statistics.F90,v 3.13 2006/10/17 23:01:53 hall Exp $

module Caesar_Statistics_Class

  ! Global use associations.

  use Caesar_Data_Structures_Module

  ! Start up with everything untyped and private.

  implicit none
  private

  ! Public procedures.

  public :: Initialize, Finalize, Valid_State, Initialized
  public :: Add_Value, Arithmetic_Mean, Average, Count, Geometric_Mean, &
            Harmonic_Mean, Maximum, Mean, Minimum, Name, Output, &
            Standard_Deviation, Sum, Total, Totally_Positive, Update_Global

  interface Initialize
    module procedure Initialize_Statistics
  end interface

  interface Finalize
    module procedure Finalize_Statistics
  end interface

  interface Valid_State
    module procedure Valid_State_Statistics
  end interface

  interface Initialized
    module procedure Initialized_Statistics
  end interface

  interface Add_Value
    module procedure Add_Value_Statistics
  end interface

  fortext([Value],[Arithmetic_Mean Count Geometric_Mean Harmonic_Mean Maximum 
                   Minimum Name Standard_Deviation Sum Totally_Positive],[
    interface Value
      module procedure expand(Get_Value_Stats)
    end interface
  ])

  interface Average
    module procedure Get_Arithmetic_Mean_Stats
  end interface

  interface Mean
    module procedure Get_Arithmetic_Mean_Stats
  end interface

  interface Output
    module procedure Output_Statistics
  end interface

  interface Total
    module procedure Get_Sum_Stats
  end interface

  interface Update_Global
    module procedure Update_Global_Statistics
  end interface

  ! Public type definitions.

  public :: Statistics_type

  type Statistics_type

    ! Initialization flag.

    type(integer) :: Initialized

    ! Update status.

    type(logical) :: Global_Updated

    ! The name for this statistics object.

    type(character,80) :: Name

    ! Item count.

    type(integer) :: PE_Count, Global_Count

    ! Positivity flags.

    type(logical) :: PE_Totally_Positive
    type(logical) :: Global_Totally_Positive

    ! First order variables.

    type(real) :: PE_Arithmetic_Mean, PE_Sum
    type(real) :: PE_Geometric_Mean, PE_Log_Sum
    type(real) :: PE_Harmonic_Mean, PE_Reciprocal_Sum
    type(real) :: Global_Arithmetic_Mean, Global_Sum
    type(real) :: Global_Geometric_Mean, Global_Log_Sum
    type(real) :: Global_Harmonic_Mean, Global_Reciprocal_Sum

    ! Second order variables.

    type(real) :: PE_Squared_Sum, PE_Standard_Deviation
    type(real) :: Global_Squared_Sum, Global_Standard_Deviation

    ! Extrema.

    type(real) :: PE_Maximum, PE_Minimum
    type(real) :: Global_Maximum, Global_Minimum

  end type Statistics_type

contains

The Statistics Class contains the following routines which are listed in separate sections:

* Initialize_Statistics
* Finalize_Statistics
* Valid_State_Statistics
* Initialized_Statistics
* Add_Value_Statistics
* Get Value Statistics
* Output_Statistics
* Update_Global_Statistics

end module Caesar_Statistics_Class



Subsections
Michael L. Hall