TUV-x
|
The config_t type and related functions. More...
Data Types | |
type | config_iterator_t |
Configuration data iterator. More... | |
type | config_t |
Model configuration data. More... | |
Functions/Subroutines | |
subroutine | empty (this) |
Empties the configuration. More... | |
subroutine | construct_from_file (this, file_name) |
Constructs a configuration from a file. More... | |
subroutine | to_file (this, file_name) |
Writes a configuration to a file. More... | |
integer(kind=musica_ik) function | number_of_children (this) |
Returns the number of child objects. More... | |
class(iterator_t) function, pointer | get_iterator (this) |
Gets an interator for the configuration data. More... | |
type(string_t) function | key (this, iterator) |
Gets the key name using an iterator. More... | |
subroutine | get_config (this, key, value, caller, default, found) |
Gets a subset of the configuration data. More... | |
subroutine | get_string_string_default (this, key, value, caller, default, found) |
Gets a string from the configuration data. More... | |
subroutine | get_string (this, key, value, caller, default, found) |
Gets a string from the configuration data. More... | |
subroutine | get_int (this, key, value, caller, default, found) |
Gets an integer from the configuration data. More... | |
subroutine | get_float (this, key, value, caller, default, found) |
Gets a single-precision real number from the configuration data. More... | |
subroutine | get_double (this, key, value, caller, default, found) |
Gets a double-precision real number from the configuration data. More... | |
subroutine | get_logical (this, key, value, caller, default, found) |
Gets a boolean value from the configuration data. More... | |
subroutine | get_string_array (this, key, value, caller, default, found) |
Gets an array of strings from the configuration data. More... | |
subroutine | get_double_array (this, key, value, caller, default, found) |
Gets an array of doubles from the configuration data. More... | |
subroutine | get_config_array (this, key, value, caller, default, found) |
Gets an array of config_t objects. More... | |
subroutine | get_from_iterator (this, iterator, value, caller) |
Gets a value using an iterator. More... | |
subroutine | get_array_from_iterator (this, iterator, value, caller) |
Gets an array value using an iterator. More... | |
subroutine | add_config (this, key, value, caller) |
Adds a subset of configuration data. More... | |
subroutine | add_char_array (this, key, value, caller) |
Adds a string to the configuration data. More... | |
subroutine | add_string (this, key, value, caller) |
Adds a string to the configuration data. More... | |
subroutine | add_int (this, key, value, caller) |
Adds an integer to the configuration data. More... | |
subroutine | add_float (this, key, value, caller) |
Adds a single-precision real number to the configuration data. More... | |
subroutine | add_double (this, key, value, caller) |
Adds a double-precision real number to the configuration data. More... | |
subroutine | add_logical (this, key, value, caller) |
Adds a boolean to the configuration data. More... | |
subroutine | add_string_array (this, key, value, caller) |
Adds a string array to the configuration data. More... | |
subroutine | add_double_array (this, key, value, caller) |
Adds a double array to the configuration data. More... | |
subroutine | add_config_array (this, key, value, caller) |
Adds a config_t array to the configuration data. More... | |
subroutine | config_assign_config (a, b) |
Assigns a config_t from a config_t. More... | |
subroutine | config_assign_string (config, string) |
Assigns a config_t from a string. More... | |
subroutine | config_assign_char (config, string) |
Assigns a config_t from a character array. More... | |
subroutine | string_assign_config (string, config) |
Assigns a string from a configuration. More... | |
subroutine | finalize (this) |
Cleans up memory. More... | |
subroutine | finalize_1d_array (this) |
Cleans up memory. More... | |
subroutine | find_by_prefix (this, prefix, full_key, found) |
Finds a full key name by a prefix. More... | |
recursive subroutine | merge_in (this, other, caller) |
Merges another config_t object into the config_t object. More... | |
logical function | find_key_in_list (key_to_find, list) |
Returns true if the given key is in the given list of keys. | |
logical function | validate (this, required_keys, optional_keys) |
Validates the format of the configuration data. More... | |
subroutine | do_print (this) |
Print out the raw contents of the configuration. More... | |
integer function | pack_size (this, comm) |
Returns the size of a binary buffer required to pack the object. | |
subroutine | mpi_pack (this, buffer, position, comm) |
Packs the configuration onto a character buffer. More... | |
subroutine | mpi_unpack (this, buffer, position, comm) |
Unpacks the configuration from a character buffer. More... | |
logical function | iterator_next (this) |
Advances the iterator. More... | |
subroutine | iterator_reset (this, parent) |
Resets the iterator. More... | |
subroutine | iterator_finalize (this) |
Cleans up memory assoicated with an iterator. More... | |
subroutine | initialize_config_t (config, string) |
Initialize a config_t object. More... | |
character(len=1, kind=c_char) function, dimension(:), allocatable | to_c_string (f_string) |
Convert a fortran character array to a c string. More... | |
character(len=:) function, allocatable | to_f_string (c_string) |
Convert a c string to a fortran character array. More... | |
The config_t type and related functions.
subroutine musica_config::add_char_array | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
character(len=*), intent(in) | value, | ||
character(len=*), intent(in) | caller | ||
) |
Adds a string to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
subroutine musica_config::add_config | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
type(config_t), intent(in) | value, | ||
character(len=*), intent(in) | caller | ||
) |
Adds a subset of configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
|
private |
Adds a config_t array to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
|
private |
Adds a double-precision real number to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
subroutine musica_config::add_double_array | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
real(kind=musica_dk), dimension(:), intent(in) | value, | ||
character(len=*), intent(in) | caller | ||
) |
Adds a double array to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key to insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
|
private |
Adds a single-precision real number to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
subroutine musica_config::add_int | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
integer, intent(in) | value, | ||
character(len=*), intent(in) | caller | ||
) |
Adds an integer to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
|
private |
Adds a boolean to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
|
private |
Adds a string to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
|
private |
Adds a string array to the configuration data.
[in,out] | this | Configuration |
[in] | key | Key in insert |
[in] | value | Value to set |
[in] | caller | Name of the calling function (only for use in error messages) |
subroutine musica_config::config_assign_char | ( | class(config_t), intent(out) | config, |
character(len=*), intent(in) | string | ||
) |
Assigns a config_t from a character array.
[out] | config | Configuration to assign to |
[in] | string | String to assign from |
subroutine musica_config::config_assign_string | ( | class(config_t), intent(out) | config, |
class(string_t), intent(in) | string | ||
) |
Assigns a config_t from a string.
[out] | config | Configuration to assign to |
[in] | string | String to assign from |
|
private |
Constructs a configuration from a file.
[out] | this | New configuration |
[in] | file_name | File name containing configuration data |
subroutine musica_config::do_print | ( | class(config_t), intent(inout) | this | ) |
Print out the raw contents of the configuration.
[in,out] | this | Configuration |
subroutine musica_config::empty | ( | class(config_t), intent(out) | this | ) |
Empties the configuration.
[out] | this | Configuration |
subroutine musica_config::finalize | ( | type(config_t), intent(inout) | this | ) |
Cleans up memory.
[in,out] | this | Configuration |
|
private |
Cleans up memory.
[in,out] | this | Configuration |
|
private |
Finds a full key name by a prefix.
Returns the first instance of the prefix if found
[in,out] | this | Configuration |
[in] | prefix | Prefix to search for (first instance is returned) |
[out] | full_key | Full key found |
[out] | found | Flag indicating whether the key was found |
subroutine musica_config::get_array_from_iterator | ( | class(config_t), intent(inout) | this, |
class(iterator_t), intent(in) | iterator, | ||
type(string_t), dimension(:), intent(out), allocatable | value, | ||
character(len=*), intent(in) | caller | ||
) |
Gets an array value using an iterator.
[in,out] | this | Configuration |
[in] | iterator | Iterator to use to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
subroutine musica_config::get_config | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
class(config_t), intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
class(config_t), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets a subset of the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_config_array | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
type(config_t), dimension(:), intent(out), allocatable | value, | ||
character(len=*), intent(in) | caller, | ||
type(config_t), dimension(:), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets an array of config_t objects.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_double | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
real(kind=musica_dk), intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
real(kind=musica_dk), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets a double-precision real number from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_double_array | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
real(musica_dk), dimension(:), intent(out), allocatable | value, | ||
character(len=*), intent(in) | caller, | ||
real(musica_dk), dimension(:), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets an array of doubles from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_float | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
real(kind=musica_rk), intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
real(kind=musica_rk), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets a single-precision real number from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_from_iterator | ( | class(config_t), intent(inout) | this, |
class(iterator_t), intent(in) | iterator, | ||
class(*), intent(out) | value, | ||
character(len=*), intent(in) | caller | ||
) |
Gets a value using an iterator.
[in,out] | this | Configuration |
[in] | iterator | Iterator to use to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
subroutine musica_config::get_int | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
integer(kind=musica_ik), intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
integer(kind=musica_ik), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets an integer from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
class(iterator_t) function, pointer musica_config::get_iterator | ( | class(config_t), intent(in), target | this | ) |
Gets an interator for the configuration data.
[in] | this | Configuration |
subroutine musica_config::get_logical | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
logical, intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
logical, intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets a boolean value from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_string | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
class(string_t), intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
character(len=*), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets a string from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_string_array | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
type(string_t), dimension(:), intent(out), allocatable | value, | ||
character(len=*), intent(in) | caller, | ||
type(string_t), dimension(:), intent(in), optional | default, | ||
logical, intent(out), optional | found | ||
) |
Gets an array of strings from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
subroutine musica_config::get_string_string_default | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | key, | ||
class(string_t), intent(out) | value, | ||
character(len=*), intent(in) | caller, | ||
class(string_t), intent(in) | default, | ||
logical, intent(out), optional | found | ||
) |
Gets a string from the configuration data.
[in,out] | this | Configuration |
[in] | key | Key used to find value |
[out] | value | Returned value |
[in] | caller | Name of the calling function (only for use in error messages) |
[in] | default | Default value if not found |
[out] | found | Flag indicating whether key was found |
|
private |
Initialize a config_t object.
[in,out] | config | Configuration |
[in] | string | YAML string |
subroutine musica_config::iterator_finalize | ( | type(config_iterator_t), intent(inout) | this | ) |
Cleans up memory assoicated with an iterator.
[in,out] | this | Iterator |
logical function musica_config::iterator_next | ( | class(config_iterator_t), intent(inout) | this | ) |
Advances the iterator.
Returns false if the end of the collection has been reached
[in,out] | this | Iterator |
subroutine musica_config::iterator_reset | ( | class(config_iterator_t), intent(inout) | this, |
class(iterator_t), intent(in), optional | parent | ||
) |
Resets the iterator.
[in,out] | this | Iterator |
[in] | parent | Iterator for parent model element |
type(string_t) function musica_config::key | ( | class(config_t), intent(inout) | this, |
class(iterator_t), intent(in) | iterator | ||
) |
Gets the key name using an iterator.
[in,out] | this | Configuration |
[in] | iterator | Configuration iterator |
subroutine musica_config::mpi_pack | ( | class(config_t), intent(inout) | this, |
character, dimension(:), intent(inout) | buffer, | ||
integer, intent(inout) | position, | ||
integer, intent(in), optional | comm | ||
) |
Packs the configuration onto a character buffer.
[in,out] | this | Configuration to pack |
[in,out] | buffer | Memory buffer |
[in,out] | position | Current buffer position |
[in] | comm | MPI communicator |
subroutine musica_config::mpi_unpack | ( | class(config_t), intent(out) | this, |
character, dimension(:), intent(inout) | buffer, | ||
integer, intent(inout) | position, | ||
integer, intent(in), optional | comm | ||
) |
Unpacks the configuration from a character buffer.
[out] | this | Configuration to unpack |
[in,out] | buffer | Memory buffer |
[in,out] | position | Current buffer position |
[in] | comm | MPI communicator |
|
private |
Returns the number of child objects.
[in,out] | this | Configuration |
|
private |
Assigns a string from a configuration.
[out] | string | String to assign to |
[in] | config | Configuration to assign from |
character(len=1, kind=c_char) function, dimension(:), allocatable musica_config::to_c_string | ( | character(len=*), intent(in) | f_string | ) |
Convert a fortran character array to a c string.
[in] | f_string | Fortran string to convert |
|
private |
Convert a c string to a fortran character array.
[in] | c_string | C pointer to const char* |
subroutine musica_config::to_file | ( | class(config_t), intent(inout) | this, |
character(len=*), intent(in) | file_name | ||
) |
Writes a configuration to a file.
[in,out] | this | Configuration |
[in] | file_name | File name to save configuration with |
logical function musica_config::validate | ( | class(config_t), intent(inout) | this, |
type(string_t), dimension(:), intent(in) | required_keys, | ||
type(string_t), dimension(:), intent(in) | optional_keys | ||
) |
Validates the format of the configuration data.
Ensures that the required keys are present, and that user-defined keys start with a "`__`" prefix.
[in,out] | this | Configuration |
[in] | required_keys | Required keys |
[in] | optional_keys | Optional keys |