This module supports merging of state and flux
data from multiple components with overlapping spatial domains for use
by another component. For example, let the vectors and
be data from Components and that have been
interpolated onto the physical grid of another component . We wish
to combine the data from and to get a vector , which
represents the merged data on the grid of component . This merge
process is an element-by-element masked weighted average:
Currently, we assume that the integer and real masks are stored in the same GeneralGrid datatype. We also assume-and this is of critical importance to the user-that the attributes to be merged are the same for all the inputs and output. If the user violates this assumption, incorrect merges will occur for any attributes that are present in only some (that is not all) of the inputs.
This module supports explicitly the merging data from two, three, and four components. There is also a routine named MergeInData that allows the user to construct other merging schemes.
INTERFACE:
module m_MergeUSES:
No other modules used in the declaration section of this module. implicit none private ! exceptPUBLIC TYPES:
None.PUBLIC MEMBER FUNCTIONS:
public :: MergeTwo ! Merge Output from two components ! for use by a third. public :: MergeThree ! Merge Output from three components ! for use by a fourth. public :: MergeFour ! Merge Output from four components ! for use by a fifth. public :: MergeInData ! Merge in data from a single component. interface MergeTwo ; module procedure & MergeTwoGGSP_, & MergeTwoGGDP_ end interface interface MergeThree ; module procedure & MergeThreeGGSP_, & MergeThreeGGDP_ end interface interface MergeFour ; module procedure & MergeFourGGSP_, & MergeFourGGDP_ end interface interface MergeInData ; module procedure & MergeInDataGGSP_, & MergeInDataGGDP_ end interfacePUBLIC DATA MEMBERS:
None.REVISION HISTORY:
19Jun02 - J.W. Larson <[email protected]> - Initial version.
This routine merges REAL attribute data from two input AttrVect arguments inAv1 and inAv2 to a third AttrVect outAv. The attributes to be merged are determined entirely by the real attributes of outAv. If outAv shares one or more attributes with either of the inputs inAv1 or inAv2, a merge is performed on the individual intersections of attributes between the pairs and . Currently, it is assumed that these pairwise intersections are all equal. This assumption is of critical importance to the user. If the user violates this assumption, incorrect merges of attributes that are present in some (but not all) of the inputs will result.
The merge operatrion is a masked
weighted element-by-element sum, as outlined in the following example.
Let the vectors and be data from Components
and that have been interpolated onto the physical grid of another
component . We wish to combine the data from and to get
a vector , which represents the merged data on the grid of
component . The merge relation to obtain the th element of
c is
The integer and real masks are stored as attributes to the same input GeneralGrid argument GGrid. The mask attribute names are stored as substrings to the colon-separated strings contained in the input CHARACTER arguments iMaskTags1, iMaskTags2, rMaskTags1, and rMaskTags2. The LOGICAL input argument CheckMasks governs how the masks are applied. If , the entries are checked to ensure they meet the definitions of real and integer masks. If then the masks are multiplied together on an element-by-element basis with no validation of their entries (this option results in slightly higher performance).
This routine returns the sume of the masked weights as a diagnostic. This quantity is returned in the output REAL array WeightSum.
The correspondence between the quantities in the above merge relation and the arguments to this routine are summarized in the table.
Quantity | Stored in | Referenced by |
Argument | Argument | |
inAv1 | ||
inAv2 | ||
outAv | ||
GGrid | iMaskTags1 | |
( items) | ||
GGrid | rMaskTags1 | |
( items) | ||
GGrid | iMaskTags2 | |
( items) | ||
GGrid | rMaskTags2 | |
( items) | ||
WeightSum |
INTERFACE:
subroutine MergeTwoGGSP_(inAv1, iMaskTags1, rMaskTags1, & inAv2, iMaskTags2, rMaskTags2, & GGrid, CheckMasks, outAv, WeightSum)USES:
use m_stdio use m_die use m_realkinds, only : SP, FP use m_List, only : List use m_List, only : List_allocated => allocated use m_AttrVect, only : AttrVect use m_AttrVect, only : AttrVect_lsize => lsize use m_AttrVect, only : AttrVect_nRAttr => nRAttr use m_GeneralGrid, only : GeneralGrid use m_GeneralGrid, only : GeneralGrid_lsize => lsize implicit noneINPUT PARAMETERS:
type(AttrVect), intent(IN) :: inAv1 character(len=*), optional, intent(IN) :: iMaskTags1 character(len=*), optional, intent(IN) :: rMaskTags1 type(AttrVect), intent(IN) :: inAv2 character(len=*), optional, intent(IN) :: iMaskTags2 character(len=*), optional, intent(IN) :: rMaskTags2 type(GeneralGrid), intent(IN) :: GGrid logical, intent(IN) :: CheckMasksINPUT/OUTPUT PARAMETERS:
type(AttrVect), intent(INOUT) :: outAv real(SP), dimension(:), pointer :: WeightSumREVISION HISTORY:
19Jun02 - Jay Larson <[email protected]> - Interface spec. 3Jul02 - Jay Larson <[email protected]> - Implementation. 10Jul02 - J. Larson <[email protected]> - Improved argument checking.
This routine merges REAL attribute data from three input AttrVect arguments inAv1 , inAv2, and inAv3 to a fourth AttrVect outAv. The attributes to be merged are determined entirely by the real attributes of outAv. If outAv shares one or more attributes with any of the inputs inAv1, inAv2, or inAv3, a merge is performed on the individual intersections of attributes between the pairs , , and . Currently, it is assumed that these pairwise intersections are all equal. This assumption is of critical importance to the user. If the user violates this assumption, incorrect merges of any attributes present only in some (but not all) inputs will result.
The merge operatrion is a masked
weighted element-by-element sum, as outlined in the following example.
Let the vectors ,, and be data from
Components , , and that have been interpolated onto the
physical grid of another component . We wish to combine the data
from , and to get a vector , which represents the
merged data on the grid of component . The merge relation to obtain
the th element of is
The integer and real masks are stored as attributes to the same input GeneralGrid argument GGrid. The mask attribute names are stored as substrings to the colon-separated strings contained in the input CHARACTER arguments iMaskTags1, iMaskTags2, iMaskTags3, rMaskTags1, rMaskTags2, and rMaskTags3. The LOGICAL input argument CheckMasks governs how the masks are applied. If , the entries are checked to ensure they meet the definitions of real and integer masks. If then the masks are multiplied together on an element-by-element basis with no validation of their entries (this option results in slightly higher performance).
This routine returns the sum of the masked weights as a diagnostic. This quantity is returned in the output REAL array WeightSum.
The correspondence between the quantities in the above merge relation and the arguments to this routine are summarized in the table.
Quantity | Stored in | Referenced by |
Argument | Argument | |
inAv1 | ||
inAv2 | ||
inAv3 | ||
outAv | ||
GGrid | iMaskTags1 | |
( items) | ||
GGrid | rMaskTags1 | |
( items) | ||
GGrid | iMaskTags2 | |
( items) | ||
GGrid | rMaskTags2 | |
( items) | ||
GGrid | iMaskTags3 | |
( items) | ||
GGrid | rMaskTags3 | |
( items) | ||
WeightSum |
INTERFACE:
subroutine MergeThreeGGSP_(inAv1, iMaskTags1, rMaskTags1, & inAv2, iMaskTags2, rMaskTags2, & inAv3, iMaskTags3, rMaskTags3, & GGrid, CheckMasks, outAv, WeightSum)USES:
use m_stdio use m_die use m_realkinds, only : SP, FP use m_List, only : List use m_List, only : List_allocated => allocated use m_AttrVect, only : AttrVect use m_AttrVect, only : AttrVect_lsize => lsize use m_AttrVect, only : AttrVect_nRAttr => nRAttr use m_GeneralGrid, only : GeneralGrid use m_GeneralGrid, only : GeneralGrid_lsize => lsize implicit noneINPUT PARAMETERS:
type(AttrVect), intent(IN) :: inAv1 character(len=*), optional, intent(IN) :: iMaskTags1 character(len=*), optional, intent(IN) :: rMaskTags1 type(AttrVect), intent(IN) :: inAv2 character(len=*), optional, intent(IN) :: iMaskTags2 character(len=*), optional, intent(IN) :: rMaskTags2 type(AttrVect), intent(IN) :: inAv3 character(len=*), optional, intent(IN) :: iMaskTags3 character(len=*), optional, intent(IN) :: rMaskTags3 type(GeneralGrid), intent(IN) :: GGrid logical, intent(IN) :: CheckMasksINPUT/OUTPUT PARAMETERS:
type(AttrVect), intent(INOUT) :: outAv real(SP), dimension(:), pointer :: WeightSumREVISION HISTORY:
19Jun02 - Jay Larson <[email protected]> - Interface spec. 3Jul02 - Jay Larson <[email protected]> - Implementation. 10Jul02 - J. Larson <[email protected]> - Improved argument checking.
This routine merges REAL attribute data from four input AttrVect arguments inAv1 , inAv2, inAv3, and inAv4 to a fifth AttrVect outAv. The attributes to be merged are determined entirely by the real attributes of outAv. If outAv shares one or more attributes with any of the inputs inAv1, inAv2, inAv3, or inAv4, a merge is performed on the individual intersections of attributes between the pairs , , , and . Currently, it is assumed that these pairwise intersections are all equal. This assumption is of critical importance to the user. If the user violates this assumption, incorrect merges of any attributes present only in some (but not all) the inputs will result.
The merge operatrion is a masked
weighted element-by-element sum, as outlined in the following example.
Let the vectors ,, and be data from
Components , , , and that have been interpolated onto the
physical grid of another component . We wish to combine the data
from , , , and to get a vector , which represents the
merged data on the grid of component . The merge relation to obtain
the th element of e is
The integer and real masks are stored as attributes to the same input GeneralGrid argument GGrid. The mask attribute names are stored as substrings to the colon-separated strings contained in the input CHARACTER arguments iMaskTags1, iMaskTags2, iMaskTags3, iMaskTags4, rMaskTags1, and rMaskTags2, rMaskTags3, and rMaskTags4, . The LOGICAL input argument CheckMasks governs how the masks are applied. If , the entries are checked to ensure they meet the definitions of real and integer masks. If then the masks are multiplied together on an element-by-element basis with no validation of their entries (this option results in slightly higher performance).
This routine returns the sume of the masked weights as a diagnostic. This quantity is returned in the output REAL array WeightSum.
The correspondence between the quantities in the above merge relation and the arguments to this routine are summarized in the table.
Quantity | Stored in | Referenced by |
Argument | Argument | |
inAv1 | ||
inAv2 | ||
inAv3 | ||
inAv4 | ||
outAv | ||
GGrid | iMaskTags1 | |
( items) | ||
GGrid | rMaskTags1 | |
( items) | ||
GGrid | iMaskTags2 | |
( items) | ||
GGrid | rMaskTags2 | |
( items) | ||
GGrid | iMaskTags3 | |
( items) | ||
GGrid | rMaskTags3 | |
( items) | ||
GGrid | iMaskTags4 | |
( items) | ||
GGrid | rMaskTags4 | |
( items) | ||
WeightSum |
INTERFACE:
subroutine MergeFourGGSP_(inAv1, iMaskTags1, rMaskTags1, & inAv2, iMaskTags2, rMaskTags2, & inAv3, iMaskTags3, rMaskTags3, & inAv4, iMaskTags4, rMaskTags4, & GGrid, CheckMasks, outAv, WeightSum)USES:
use m_stdio use m_die use m_realkinds, only : SP, FP use m_List, only : List use m_List, only : List_allocated => allocated use m_AttrVect, only : AttrVect use m_AttrVect, only : AttrVect_lsize => lsize use m_AttrVect, only : AttrVect_nRAttr => nRAttr use m_GeneralGrid, only : GeneralGrid use m_GeneralGrid, only : GeneralGrid_lsize => lsize implicit noneINPUT PARAMETERS:
type(AttrVect), intent(IN) :: inAv1 character(len=*), optional, intent(IN) :: iMaskTags1 character(len=*), optional, intent(IN) :: rMaskTags1 type(AttrVect), intent(IN) :: inAv2 character(len=*), optional, intent(IN) :: iMaskTags2 character(len=*), optional, intent(IN) :: rMaskTags2 type(AttrVect), intent(IN) :: inAv3 character(len=*), optional, intent(IN) :: iMaskTags3 character(len=*), optional, intent(IN) :: rMaskTags3 type(AttrVect), intent(IN) :: inAv4 character(len=*), optional, intent(IN) :: iMaskTags4 character(len=*), optional, intent(IN) :: rMaskTags4 type(GeneralGrid), intent(IN) :: GGrid logical, intent(IN) :: CheckMasksINPUT/OUTPUT PARAMETERS:
type(AttrVect), intent(INOUT) :: outAv real(SP), dimension(:), pointer :: WeightSumREVISION HISTORY:
19Jun02 - Jay Larson <[email protected]> - Interface spec. 3Jul02 - Jay Larson <[email protected]> - Implementation. 10Jul02 - J. Larson <[email protected]> - Improved argument checking.
This routine takes input field data from the input
AttrVect argument inAv, and merges the real attributes it
shares with the input/output AttrVect argument outAv.
The merge is a masked merge of the form
N.B.: The lengths of the AttrVect arguments inAv and outAv must be equal, and this length must also equal the lengths of GGrid and WeightSum.
N.B.: This algorithm assumes the AttrVect argument outAv has been created, and its real attributes have been initialized.
N.B.: This algorithm assumes that the array WeightSum has been created and initialized.
INTERFACE:
subroutine MergeInDataGGSP_(inAv, iMaskTags, rMaskTags, GGrid, & CheckMasks, outAv, WeightSum)USES:
use m_stdio use m_die use m_realkinds, only : SP, FP use m_String, only : String use m_String, only : String_clean => clean use m_String, only : String_ToChar => toChar use m_List, only : List use m_List, only : List_init => init use m_List, only : List_clean => clean use m_List, only : List_nitem => nitem use m_List, only : List_get => get use m_List, only : List_identical => identical use m_List, only : List_allocated => allocated use m_AttrVect, only : AttrVect use m_AttrVect, only : AttrVect_lsize => lsize use m_AttrVect, only : AttrVect_nRAttr => nRAttr use m_AttrVect, only : SharedAttrIndexList use m_GeneralGrid, only : GeneralGrid use m_GeneralGrid, only : GeneralGrid_lsize => lsize use m_GeneralGrid, only : GeneralGrid_exportIAttr => exportIAttr use m_GeneralGrid, only : GeneralGrid_exportRAttr => exportRAttr implicit noneINPUT PARAMETERS:
type(AttrVect), intent(IN) :: inAv character(len=*), optional, intent(IN) :: iMaskTags character(len=*), optional, intent(IN) :: rMaskTags type(GeneralGrid), intent(IN) :: GGrid logical, intent(IN) :: CheckMasksINPUT/OUTPUT PARAMETERS:
type(AttrVect), intent(INOUT) :: outAv real(SP), dimension(:), pointer :: WeightSumREVISION HISTORY:
19Jun02 - Jay Larson <[email protected]> - initial verson. 10Jul02 - J. Larson <[email protected]> - Improved argument checking.