|
TUV-x
|
Map between arrays. More...
Public Member Functions | |
| procedure | apply (this, from, to) |
| Transfers data from source to destination arrays. | |
| procedure | pack_size (this, comm) |
| Returns the size of a character buffer required to pack the map. | |
| procedure | mpi_pack (this, buffer, position, comm) |
| Packs the map onto a character buffer. | |
| procedure | mpi_unpack (this, buffer, position, comm) |
| Unpacks the map from a character buffer. | |
| procedure | print (this, from_labels, to_labels, out_unit) |
| Prints the map. | |
| type(map_t) function | constructor (config, from_labels, to_labels) |
| Constructs a map_t object. | |
Public Attributes | |
| integer | from_size_ |
| Source array size. | |
| integer | to_size_ |
| Destination array size. | |
Private Member Functions | |
| procedure, private | add_default_matches (this, from_labels, to_labels, always) |
| Adds default matches by name to the map. | |
| procedure, private | validate (this, config, from_labels, to_labels) |
| Validates the matches based on user-selected options. | |
Private Attributes | |
| type(pair_t), dimension(:), allocatable | pairs_ |
| Mapped pairs of array elements. | |
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:
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.
|
private |
Adds default matches by name to the map.
If the always option is set to false, only unmatched source elements are included in the default matching
| [in,out] | this | Map |
| [in] | from_labels | Source array element labels |
| [in] | to_labels | Destination array element labels |
| [in] | always | Flag indicating whether to always add default matches, or only do so for unmatched source elements |
| procedure musica_map::map_t::apply | ( | class(map_t), intent(in) | this, |
| real(kind=dk), dimension(:), intent(in) | from, | ||
| real(kind=dk), dimension(:), intent(out) | to ) |
Transfers data from source to destination arrays.
| [in] | this | Map |
| [in] | from | Source array |
| [out] | to | Destination array |
| 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 ) |
Constructs a map_t object.
| [in,out] | config | Map configuration |
| [in] | from_labels | Source array element labels |
| [in] | to_labels | Destination array element labels |
| procedure musica_map::map_t::mpi_pack | ( | class(map_t), intent(in) | this, |
| character, dimension(:), intent(inout) | buffer, | ||
| integer, intent(inout) | position, | ||
| integer, intent(in) | comm ) |
Packs the map onto a character buffer.
| [in] | this | Map to pack |
| [in,out] | buffer | Memory buffer |
| [in,out] | position | Current buffer position |
| [in] | comm | MPI communicator |
| procedure musica_map::map_t::mpi_unpack | ( | class(map_t), intent(out) | this, |
| character, dimension(:), intent(inout) | buffer, | ||
| integer, intent(inout) | position, | ||
| integer, intent(in) | comm ) |
Unpacks the map from a character buffer.
| [out] | this | Map to unpack |
| [in,out] | buffer | Memory buffer |
| [in,out] | position | Current buffer position |
| [in] | comm | MPI communicator |
| procedure musica_map::map_t::pack_size | ( | class(map_t), intent(in) | this, |
| integer, intent(in) | comm ) |
Returns the size of a character buffer required to pack the map.
| [in] | this | Map to pack |
| [in] | comm | MPI communicator |
| procedure musica_map::map_t::print | ( | class(map_t), intent(in) | this, |
| type(string_t), dimension(:), intent(in) | from_labels, | ||
| type(string_t), dimension(:), intent(in) | to_labels, | ||
| integer, intent(in) | out_unit ) |
Prints the map.
| [in] | this | Map |
| [in] | from_labels | Source array element labels |
| [in] | to_labels | Destination array element labels |
| [in] | out_unit | Output unit |
|
private |
Validates the matches based on user-selected options.
| [in] | this | Map |
| [in,out] | config | Map configuration |
| [in] | from_labels | Source array element labels |
| [in] | to_labels | Destination array element labels |