Back to OASIS3-MCT home

In oasis3-mct/lib/mct/mct :

===========================================================
definition of the type AttrVect (<= mct_aVect in the psmile) in mct/m_AttrVect.F90
===========================================================

  type AttrVect
#ifdef SEQUENCE
      sequence
#endif
      type(List) :: iList
      type(List) :: rList
      integer,dimension(:,:),pointer :: iAttr
      real(FP) ,dimension(:,:),pointer :: rAttr
  end type AttrVect


      Type List
#ifdef SEQUENCE
     sequence
#endif
     character(len=1),dimension(:),pointer :: bf
     integer,       dimension(:,:),pointer :: lc
      End Type List


! !MODULE: m_AttrVect - Multi-field Storage
! An {\em attribute vector} is a scheme for storing bundles of integer
! and real data vectors, indexed by the names of the fields stored in
! {\tt List} format (see the mpeu module {\tt m\_List} for more
! information about the {\tt List} datatype).  The ordering of the
! fieldnames in the integer and real attribute {\tt List} components
! ({\tt AttrVect\%iList} and {\tt AttrVect\%rList}, respectively)
! corresponds to the storage order of the attributes in their respective
! data buffers (the components {\tt AttrVect\%iAttr(:,:)} and
! {\tt AttrVect\%rAttr(:,:)}, respectively).   The organization of
! the fieldnames in {\tt List} format, along with the direct mapping
! between {\tt List} items and locations in the data buffer, allows
! the user to have {\em random access} to the field data.  This
! approach also allows the user to set the number and the names of fields
! stored in an {\tt AttrVect} at run-time. 
!
! The {\tt AttrVect} stores field data in a {\em pointwise} fashion
! (that is, the data are grouped so that all the integer or real data
! associated with an individual point are adjacent to each other in memory.
! This amounts to the having the integer and real field data arrays in
! the {\tt AttrVect} (the components {\tt AttrVect\%iAttr(:,:)} and
! {\tt AttrVect\%rAttr(:,:)}, respectively) having the attribute index
! as the major (or fastest-varying) index.  A prime example of this is
! observational data input to a data assimilation system.  In the Model
! Coupling Toolkit, this datatype is the fundamental type for storing
! field data exchanged by component models, and forms a basis for other
! MCT datatypes that encapsulate time accumulation/averaging buffers (the
! {\tt Accumulator} datatype defined in the module {\tt m\_Accumulator}),
! coordinate grid information (the {\tt GeneralGrid} datatype defined in
! the module {\tt m\_GeneralGrid}), and sparse interpolation matrices
! (the {\tt SparseMatrix} datatype defined in the module
! {\tt m\_SparseMatrix}).
!
! The attribute vector is implemented in Fortran 90 using the
! {\tt AttrVect} derived type.  This module contains the definition
! of the {\tt AttrVect}, and the numerous methods that service it.  There
! are a number of initialization (creation) schemes, and a routine for
! zeroing out the elements of an {\tt AttrVect}.  There is a method
! to {\em clean} up allocated memory used by an {\tt AttrVect}
! (destruction).  There are numerous query methods that return:  the
! number of datapoints (or {\em length}; the numbers of integer and
! real attributes; the data buffer index of a given real or integer
! attribute; and return the lists of real and integer attributes.  There
! also exist methods for exporting a given attribute as a one-dimensional
! array and importing a given attribute from a one-dimensional array. 
! There is a method for copying attributes from one {\tt AttrVect} to
! another.  There is also a method for cross-indexing the attributes in
! two {\tt AttrVect} variables.  In addition, there are methods that
! return those cross-indexed attributes along with some auxiliary data
! in a {\tt AVSharedIndicesOneType} or {\tt AVSharedIndices} structure.
! Finally, there are methods for sorting and permuting {\tt AttrVect}
! entries using a MergeSort scheme keyed by the attributes of the {\tt
! AttrVect}.





In module m_List in mpeu

! !MODULE: m_List - A List Manager
!
! !DESCRIPTION:  A {\em List} is a character buffer comprising
! substrings called {\em items} separated by colons, combined with
! indexing information describing (1) the starting point in the character
! buffer of each substring, and  (2) the length of each substring.  The
! only constraints on the valid list items are (1) the value of an
! item does not contain the ``\verb":"'' delimitter, and (2) leading
! and trailing blanks are stripped from any character string presented
! to define a list item (although any imbeded blanks are retained).
!
! {\bf Example:}  Suppose we wish to define a List containing the
! items {\tt 'latitude'}, {\tt 'longitude'}, and {\tt 'pressure'}.
! The character buffer of the List containing these items will be the
! 27-character string
! \begin{verbatim}
! 'latitude:longitude:pressure'
! \end{verbatim}
! and the indexing information is summarized in the table below.
!
!\begin{table}[htbp]
!\begin{center}
!\begin{tabular}{|c|c|c|}
!\hline
!{\bf Item} & {\bf Starting Point in Buffer} & {\bf Length} \\
!\hline
!{\tt latitude} & 1 & 8 \\
!\hline
!{\tt longitude} & 9 & 9 \\
!\hline
!{\tt pressure} & 20 & 8\\
!\hline
!\end{tabular}
!\end{center}
!\end{table}
!


======================================================================
definition of the type GlobalSegMap (<= mct_gsmap in the psmile) in mct/m_GlobalSegMap.F90
======================================================================

Type GlobalSegMap (<= mct_gsmap in psmile)

#ifdef SEQUENCE
      sequence
#endif
      integer :: comp_id            ! Component ID number
      integer :: ngseg                ! No. of Global segments
      integer :: gsize                ! No. of Global elements
      integer,dimension(:),pointer :: start    ! global seg. start index
      integer,dimension(:),pointer :: length    ! segment lengths
      integer,dimension(:),pointer :: pe_loc    ! PE locations

end type GlobalSegMap


! !MODULE: m_GlobalSegMap - a nontrivial 1-D decomposition of an array.
!
! !DESCRIPTION:
! Consider the problem of the 1-dimensional decomposition of an array
! across multiple processes.  If each process owns only one contiguous
! segment, then the {\tt GlobalMap} (see {\tt m\_GlobalMap} or details)
! is sufficient to describe the decomposition.  If, however, each 
! process owns multiple, non-adjacent segments of the array, a more
! sophisticated approach is needed.   The {\tt GlobalSegMap} data type
! allows one to describe a one-dimensional decomposition of an array
! with each process owning multiple, non-adjacent segments of the array.
!
! In the current implementation of the {\tt GlobalSegMap}, there is no
! santity check to guarantee that
!$${\tt GlobalSegMap\%gsize} = \sum_{{\tt i}=1}^{\tt ngseg}
! {\tt GlobalSegMap\%length(i)} . $$
! The reason we have not implemented such a check is to allow the user
! to use the {\tt GlobalSegMap} type to support decompositions of both
! {\em haloed} and {\em masked} data.


==========================================================
definition of the type Router (<= mct_router in the psmile) in mct/m_Router.F90
==========================================================

Type Router (<= mct_router in psmile)

#ifdef SEQUENCE
      sequence
#endif
      integer :: comp1id                           ! myid
      integer :: comp2id                           ! id of second component
      integer :: nprocs                               ! number of procs to talk to
      integer :: maxsize                           ! maximum amount of data going to a processor
      integer :: lAvsize                           ! The local size of AttrVect which can be
                                                              ! used with this Router in MCT_Send/MCT_Recv
      integer :: numiatt                           ! Number of integer attributes currently in use
      integer :: numratt                           ! Number of real attributes currently in use
      integer,dimension(:),pointer   :: pe_list    ! processor ranks of send/receive in MCT_comm
      integer,dimension(:),pointer   :: num_segs   ! number of segments to send/receive
      integer,dimension(:),pointer   :: locsize    ! total of seg_lengths for a proc
      integer,dimension(:),pointer   :: permarr    ! possible permutation array
      integer,dimension(:,:),pointer :: seg_starts ! starting index
      integer,dimension(:,:),pointer :: seg_lengths! total length
      type(rptr),dimension(:),pointer :: rp1       ! buffer to hold real data
      type(iptr),dimension(:),pointer :: ip1       ! buffer to hold integer data
      integer,dimension(:),pointer   :: ireqs,rreqs  ! buffer for MPI_Requests
      integer,dimension(:,:),pointer :: istatus,rstatus  ! buffer for MPI_Status

end type Router

! The Router data type contains all the information needed
! to send an AttrVect between a component on M MPI-processes and a component
! on N MPI-processes.   This module defines the Router datatype and provides
! methods to create and destroy one.


=========================================================================
definition of the type SparseMatrixPlus (<= mct_sMatP in the psmile) in mct/m_SparseMatrixPlus.F90
=========================================================================
     
Type SparseMatrixPlus

#ifdef SEQUENCE
        sequence
#endif
        type(String) :: Strategy
        integer :: XPrimeLength
        type(Rearranger) :: XToXPrime
        integer :: YPrimeLength
        type(Rearranger) :: YPrimeToY
        type(SparseMatrix) :: Matrix
    integer :: Tag


End Type SparseMatrixPlus


! !IROUTINE: initFromRoot_ - Creation and Initializtion from the Root
!
! !DESCRIPTION: 
! This routine creates an {\tt SparseMatrixPlus} {\tt sMatPlus} using
! the following elements:
! \begin{itemize}
! \item A {\tt SparseMatrix} (the input argument {\tt sMat}), whose
! elements all reside only on the {\tt root} process of the MPI
! communicator with an integer handle defined by the input {\tt INTEGER}
! argument {\tt comm};
! \item A {\tt GlobalSegMap} (the input argument {\tt xGSMap}) describing
! the domain decomposition of the vector {\bf x} on the communicator
! {\tt comm};
! \item A {\tt GlobalSegMap} (the input argument {\tt yGSMap}) describing
! the domain decomposition of the vector {\bf y} on the communicator
! {\tt comm};
! \item The matrix-vector multiplication parallelization strategy.  This
! is set by the input {\tt CHARACTER} argument {\tt strategy}, which must
! have value corresponding to one of the following public data members
! defined in the declaration section of this module.  Acceptable values
! for use in this routine are: {\tt Xonly} and {\tt Yonly}.
! \end{itemize}
! The optional argument {\tt Tag} can be used to set the tag value used in
! the call to {\tt Rearranger}.  DefaultTag will be used otherwise.