D.8 Collected_Array Class Code Listing

The main documentation of the Collected_Array 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: 01/21/00
! CVS Info:   $Id: collected_array.F90,v 10.9 2008/09/30 16:19:07 hall Exp $

module Caesar_Collected_Array_Class

  ! Global use associations.

  use Caesar_Intrinsics_Module
  use Caesar_Trace_Class
  use Caesar_Communication_Class
  use Caesar_Base_Structure_Class
  use Caesar_Data_Index_Class
  use Caesar_Assembled_Vector_Class
  use Caesar_Distributed_Vector_Class
  use Caesar_Overlapped_Vector_Class

  ! Start up with everything untyped and private.

  implicit none
  private

  ! Public procedures.

  public :: Initialize, Finalize, Valid_State, Initialized
  public :: Assignment (=), Collect, Combine_with_Average, Combine_with_MAX, &
            Combine_with_MIN, Combine_with_SUM, Gather, Gather_and_Collect, &
            Get_Values, Many_Locus, Name, One_Locus, Output, Set_Values, &
            Set_Version, Version

  interface Initialize
    module procedure Initialize_Collected_Array_1
    module procedure Initialize_Collected_Array_2
  end interface

  interface Finalize
    module procedure Finalize_Collected_Array
  end interface

  interface Valid_State
    module procedure Valid_State_Collected_Array
  end interface

  interface Assignment (=)
    module procedure Collect_CA_from_OV
    module procedure Gather_and_Collect_CA_from_DV
    module procedure Get_Values_Collected_Array_1
    module procedure Get_Values_Collected_Array_2
    module procedure Get_Values_Collected_Array_3
    module procedure Get_Values_Collected_Array_4
    module procedure Get_Values_Collected_Array_5
    module procedure Set_Values_Collected_Array_1
    module procedure Set_Values_Collected_Array_2
    module procedure Set_Values_Collected_Array_3
    module procedure Set_Values_Collected_Array_4
    module procedure Set_Values_Collected_Array_5
    module procedure Set_Version_Collected_Array
    module procedure Combine_with_SUM_DV_from_CA
  end interface

  interface Collect
    module procedure Collect_CA_from_OV
  end interface

  fortext([Op],[Average MAX MIN SUM],[
    interface expand(Combine_with_Op)
      module procedure expand(Combine_with_Op_DV_from_CA)
    end interface
  ])

  interface Gather
    module procedure Gather_and_Collect_CA_from_DV
  end interface

  interface Gather_and_Collect
    module procedure Gather_and_Collect_CA_from_DV
  end interface

  interface Get_Values
    module procedure Get_Values_Collected_Array_1
    module procedure Get_Values_Collected_Array_2
    module procedure Get_Values_Collected_Array_3
    module procedure Get_Values_Collected_Array_4
    module procedure Get_Values_Collected_Array_5
  end interface

  interface Initialized
    module procedure Initialized_Collected_Array
  end interface

  interface Many_Locus
    module procedure Get_Many_Locus_CA
  end interface

  interface Name
    module procedure Get_Name_Collected_Array
  end interface

  interface One_Locus
    module procedure Get_One_Locus_CA
  end interface

  interface Output
    module procedure Output_Collected_Array
  end interface

  interface Set_Values
    module procedure Set_Values_Collected_Array_1
    module procedure Set_Values_Collected_Array_2
    module procedure Set_Values_Collected_Array_3
    module procedure Set_Values_Collected_Array_4
    module procedure Set_Values_Collected_Array_5
  end interface

  interface Set_Version
    module procedure Set_Version_Collected_Array
  end interface

  interface Version
    module procedure Get_Version_Collected_Array
  end interface

  ! Public type definitions.

  public :: Collected_Array_type

  type Collected_Array_type

    ! Initialization flag.

    type(integer) :: Initialized

    ! The name for this variable (especially useful in a vector of Collected
    ! Arrays).

    type(character,name_length) :: Name

    ! Version number which is incremented every time the array is modified,
    ! or is synced with the version number of a data structure that it
    ! depends on when it is updated.

    type(integer) :: Version

    ! Basic data structures. The Many_Structure corresponds to the structure
    ! of the Distributed Vector that this Collected Array is based on. The
    ! One_Structure corresponds to the way that this Collected Array
    ! has been formed. If this Collected Array were to be combined, it
    ! would result in a Distributed Vector with a One_Structure basis. This
    ! Collected Array can be thought of as a "Many of One" relationship
    ! (e.g. Many Faces of Each Cell, or Faces_of_Cells).

    type(Base_Structure_type), pointer :: Many_Structure
    type(Base_Structure_type), pointer :: One_Structure

    ! The number of dimensions that the "array" has, including the dimension
    ! that is spread over the processors (the One_Axis), but not including
    ! the Many_Axis, if it is present. "Ragged_Right" vectors are signified
    ! by a Dimensionality of -1. Note that the Collected Array will have the 
    ! same Dimensionality as the Distributed Vector it is based on and the 
    ! Distributed Vector it can be combined to form, even though in reality 
    ! it may have an extra dimension. The "Actual Dimensionality", which  
    ! potentially includes the Many_Axis, is given by A_Dimensionality.

    type(integer) :: Dimensionality
    type(integer) :: A_Dimensionality

    ! The extents of the dimensions that the "array" has, including
    ! the dimensions for the One_Axis and the Many_Axis (if present). 

    type(integer,1) :: Dimensions

    ! The Index that is used to translate between the Distributed Vectors.

    type(Data_Index_type), pointer :: Many_of_One_Index

    ! Values in the array, that are stored locally, with a different
    ! length on each PE. Values may have either 1, 2, 3, 4, or 5 dimensions,
    ! or be a ragged right array. The last dimension is the dimension
    ! that is spread across the processors, if the Many_of_One_Index is a
    ! vector index. Otherwise, the penultimate axis will be spread across the
    ! processors. The form of the Values array is:
    !
    !   Values( [dim1, [dim2, [dim3,]]] One_Axis [, Many_Axis] )
    !
    ! Only one of the following variables will be allocated for a given object.

    type(real,1) :: Values1
    type(real,2) :: Values2
    type(real,3) :: Values3
    type(real,4) :: Values4
    type(real,5) :: Values5
    ! Needed for Adaptive Angular Refinement.
    ! type(Ragged_Right_Real_type) :: ValuesRR 

  end type Collected_Array_type

  ! Global class variables.

  type(integer), parameter :: Version_Increment = 64

contains

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

* Initialize_Collected_Array
* Finalize_Collected_Array
* Valid_State_Collected_Array
* Initialized_Collected_Array
* Collect_CA_from_OV
* Combine_DV_from_CA
* Gather_and_Collect_CA_from_DV
* Get_Locus_Collected_Array
* Get_Name_Collected_Array
* Get_Values_Collected_Array
* Get_Version_Collected_Array
* Output_Collected_Array
* Set_Values_Collected_Array
* Set_Version_Collected_Array

end module Caesar_Collected_Array_Class



Subsections
Michael L. Hall