TUV-x
Loading...
Searching...
No Matches
musica_map::map_t Interface Reference

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.
 

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:

{
: false,
: false,
: true,
: ,
: [
{
: ,
:
},
{
: ,
: ,
: 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

◆ add_default_matches()

procedure, private musica_map::map_t::add_default_matches ( class(map_t), intent(inout) this,
type(string_t), dimension(:), intent(in) from_labels,
type(string_t), dimension(:), intent(in) to_labels,
logical, intent(in) always )
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

Parameters
[in,out]thisMap
[in]from_labelsSource array element labels
[in]to_labelsDestination array element labels
[in]alwaysFlag indicating whether to always add default matches, or only do so for unmatched source elements

◆ apply()

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.

Parameters
[in]thisMap
[in]fromSource array
[out]toDestination array

◆ 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 )

Constructs a map_t object.

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

◆ mpi_pack()

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.

Parameters
[in]thisMap to pack
[in,out]bufferMemory buffer
[in,out]positionCurrent buffer position
[in]commMPI communicator

◆ mpi_unpack()

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.

Parameters
[out]thisMap to unpack
[in,out]bufferMemory buffer
[in,out]positionCurrent buffer position
[in]commMPI communicator

◆ pack_size()

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.

Parameters
[in]thisMap to pack
[in]commMPI communicator

◆ print()

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.

Parameters
[in]thisMap
[in]from_labelsSource array element labels
[in]to_labelsDestination array element labels
[in]out_unitOutput unit

◆ validate()

procedure, private musica_map::map_t::validate ( class(map_t), intent(in) this,
type(config_t), intent(inout) config,
type(string_t), dimension(:), intent(in) from_labels,
type(string_t), dimension(:), intent(in) to_labels )
private

Validates the matches based on user-selected options.

Parameters
[in]thisMap
[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: