D.7 Overlapped_Vector Class Code Listing

The main documentation of the Overlapped_Vector 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: 10/28/99
! CVS Info:   $Id: overlapped_vector.F90,v 9.7 2006/10/17 23:01:53 hall Exp $

module Caesar_Overlapped_Vector_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_Numbers_Module, only: zero

  ! Start up with everything untyped and private.

  implicit none
  private

  ! Public procedures.

  public :: Initialize, Finalize, Valid_State, Initialized
  public :: Assignment (=), Collect_and_Access, Collect_and_Average, &
            Collect_and_MAX, Collect_and_MIN, Collect_and_SUM, Gather, &
            Get_Values, Many_Locus, Name, One_Locus, Output, Set_Version, &
            Version

  interface Initialize
    module procedure Initialize_Overlapped_Vector_1
    module procedure Initialize_Overlapped_Vector_2
  end interface

  interface Finalize
    module procedure Finalize_Overlapped_Vector
  end interface

  interface Valid_State
    module procedure Valid_State_Overlapped_Vector
  end interface

  interface Assignment (=)
    module procedure Collect_and_SUM_DV_from_OV
    module procedure Gather_OV_from_DV
    module procedure Get_Values_Overlapped_Vector_1
    module procedure Get_Values_Overlapped_Vector_2
    module procedure Get_Values_Overlapped_Vector_3
    module procedure Get_Values_Overlapped_Vector_4
    module procedure Get_Values_Overlapped_Vector_5
    module procedure Set_Version_Overlapped_Vector
  end interface

  interface Collect_and_Access
    module procedure Get_Values_Overlapped_Vector_1
    module procedure Get_Values_Overlapped_Vector_2
    module procedure Get_Values_Overlapped_Vector_3
    module procedure Get_Values_Overlapped_Vector_4
    module procedure Get_Values_Overlapped_Vector_5
  end interface

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

  interface Gather
    module procedure Gather_OV_from_DV
  end interface

  interface Get_Values
    module procedure Get_Values_Overlapped_Vector_1
    module procedure Get_Values_Overlapped_Vector_2
    module procedure Get_Values_Overlapped_Vector_3
    module procedure Get_Values_Overlapped_Vector_4
    module procedure Get_Values_Overlapped_Vector_5
  end interface

  interface Initialized
    module procedure Initialized_Overlapped_Vector
  end interface

  interface Many_Locus
    module procedure Get_Many_Locus_OV
  end interface

  interface Name
    module procedure Get_Name_Overlapped_Vector
  end interface

  interface One_Locus
    module procedure Get_One_Locus_OV
  end interface

  interface Output
    module procedure Output_Overlapped_Vector
  end interface

  interface Set_Version
    module procedure Set_Version_Overlapped_Vector
  end interface

  interface Version
    module procedure Get_Version_Overlapped_Vector
  end interface

  ! Public type definitions.

  public :: Overlapped_Vector_type

  type Overlapped_Vector_type

    ! Initialization status.

    type(integer) :: Initialized               

    ! The name for this variable (especially useful in a vector of Overlapped
    ! Vectors).

    type(character,name_length) :: Name

    ! Version number which is incremented every time the vector 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 Overlapped Vector is based on. The
    ! One_Structure corresponds to the way that this Overlapped Vector
    ! has been formed. If this Overlapped Vector were to be combined, it
    ! would result in a Distributed Vector with a One_Structure basis. This
    ! Overlapped Vector 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 "vector" has, including the dimension
    ! that is spread over the processors. "Ragged_Right" vectors are signified
    ! by a Dimensionality of -1.

    type(integer) :: Dimensionality

    ! The extents of the dimensions that the "vector" has, including
    ! the dimension that is spread over the processors, which is last. 

    type(integer,1) :: Dimensions

    ! The Distributed Vector that this Overlapped Vector is based on. If
    ! this Overlapped Vector is not based on an external Distributed
    ! Vector, an internal Distributed Vector will be constructed and the
    ! Distributed_Vector variable will point to that one instead.

    type(Distributed_Vector_type), pointer :: DV
    type(Distributed_Vector_type) :: DV_Internal

    ! The Index that is used to modify the Distributed Vector.

    type(Data_Index_type), pointer :: Many_of_One_Index

    ! Off-PE values in the vector, that are stored locally, with a different
    ! length on each PE. Values may have either 1, 2, 3, or 4 dimensions,
    ! or be a ragged right array. The last dimension is always the dimension
    ! that is spread across the processors. Only one of the following
    ! variables will be allocated for a given object.

    type(real,1) :: Overlap_Values1
    type(real,2) :: Overlap_Values2
    type(real,3) :: Overlap_Values3
    type(real,4) :: Overlap_Values4
    ! Needed for Adaptive Angular Refinement.
    ! type(Ragged_Right_Real_type) :: Overlapped_ValuesRR 

    ! The index and trace for the distributed axis of the off-PE values.

    type(integer,1) :: Overlap_Index
    type(Trace_type), pointer :: Overlap_Trace

  end type Overlapped_Vector_type

  ! Global class variables.

  type(integer), parameter :: Version_Increment = 16

contains

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

* Initialize_Overlapped_Vector
* Finalize_Overlapped_Vector
* Valid_State_Overlapped_Vector
* Initialized_Overlapped_Vector
* Collect_and_Combine_DV_from_OV
* Gather_OV_from_DV
* Get_Locus_Overlapped_Vector
* Get_Name_Overlapped_Vector
* Get_Values_Overlapped_Vector
* Get_Version_Overlapped_Vector
* Output_Overlapped_Vector
* Set_Version_Overlapped_Vector

end module Caesar_Overlapped_Vector_Class



Subsections
Michael L. Hall