TUV-x
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
musica_map::map_t Interface Reference

Map between arrays. More...

Public Member Functions

procedure apply
 Transfers data from source to destination arrays.
 
procedure pack_size
 Returns the size of a character buffer required to pack the map.
 
procedure mpi_pack
 Packs the map onto a character buffer.
 
procedure mpi_unpack
 Unpacks the map from a character buffer.
 
procedure print => print_map
 Prints the map.
 

Public Attributes

integer from_size_
 Source array size.
 
integer to_size_
 Destination array size.
 

Private Member Functions

procedure, private add_default_matches
 Adds default matches by name to the map.
 
procedure, private validate
 Validates the matches based on user-selected options.
 
type(map_t) function constructor (config, from_labels, to_labels)
 Constructs a map_t object. More...
 

Private Attributes

type(pair_t), dimension(:), allocatable pairs_
 Mapped pairs of array elements.
 

Detailed Description

Map between arrays.

Constructor of map_t objects.

Maps can be used to transfer data from a source to a destination array with optional scaling.

The mapped elements are identified by name according to the passed configuration. The configuration format for a map is:

{
"match full source": false,
"match full destination": false,
"sum multiple matches": true,
"default matching": "backup",
"pairs": [
{
"from": "foo",
"to": "bar"
},
{
"from": "baz",
"to": "quz",
"scale by": 1.2
}
]
}

The "match full source" and "match full destination" terms are optional and default to true. When these are true unmatched source/destination array elements will trigger an error. If unmatched destination elements are allowed, they will be set to zero when the map is applied to transfer data. The "sum multiple matches" term is optional and defaults to false. When this is true, multiple matches to a single destination array element will be summed when the map is applied to transfer data. When this is false, the second match to a destination array element will trigger an error. The "default matching" term is optional and indicates how matching names that appear in both source and destination label arrays should be treated. The three options for default matching are "always", "backup", and "never"; the default option is "never". Default matching "always" indicates that every time a name appears in both the source and destination label arrays, a set of paired elements should be created in the map with a scaling factor of 1.0. Default matching "backup" indicates that such a pair is only created when no explicit entries for the destination element exist in the configuration. Default mapping "never" means that no such pairs are created. If the default mapping is set to "always" or "backup", the "match full destination" term must be true.

The "pairs" term is required and is an array that describes each matched pair of elements. The matched pair terms must include "from" and "to" terms. The "scale by" term is optional and defaults to 1.0. This scaling factor will be applied to the source array element before additon to the destination array element.

The map_t constructor accepts an array of source element labels and an array of destination element labels that are used to identify the mapped array indices.

Member Function/Subroutine Documentation

◆ constructor()

type(map_t) function musica_map::map_t::constructor ( type(config_t), intent(inout)  config,
type(string_t), dimension(:), intent(in)  from_labels,
type(string_t), dimension(:), intent(in)  to_labels 
)
private

Constructs a map_t object.

Parameters
[in,out]configMap configuration
[in]from_labelsSource array element labels
[in]to_labelsDestination array element labels

The documentation for this interface was generated from the following file: