Back to OASIS3-MCT home
In
oasis3-mct/lib/mct/mct :
m_AttrVect.F90
:
definition of the global structure m_AttrVect
=
m_aVect in the psmile
! !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}.
type AttrVect
#ifdef SEQUENCE
sequence
#endif
type(List) :: iList
type(List) :: rList
integer,dimension(:,:),pointer :: iAttr
real(FP) ,dimension(:,:),pointer :: rAttr
end
type 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}
!
Type List
#ifdef SEQUENCE
sequence
#endif
character(len=1),dimension(:),pointer :: bf
integer,
dimension(:,:),pointer :: lc
End Type List