Automatic definition of the input dictionary the f_input_file module

In a Fortran program it is often useful to have a high-level handling of the input variables. The Fortran specification provides the namelist approach, which is relatively easy to use. However such an approach presents few drawbacks of portability and code-intrusivity, which limit its usage in a multi-language context. With this module we provide a set of rules to automatically parse, inspect, verify and convert a input file from the yaml format into a futile dictionary. With the usage of the f_input_file module developers might easily write _specifications_ for their program input file.

Such module is in tight connection with its python counterpart, futile.Inputvars, which employs the same conventions and make possible a full interplay between a yaml input file and a python dictionary.

Quick access

Variables

attrs

Routines

input_file_complete(), input_file_dump(), input_file_errors(), input_file_minimal(), input_keys_get_profile(), input_value_is_default()

Needed modules

Variables

  • f_input_file/attrs [character(len=*),public/parameter/optional/default="_attributes"]

Subroutines and functions

subroutine  f_input_file/input_file_errors()
Use

dictionaries (f_err_define())

Call to

f_err_define()

subroutine  f_input_file/input_file_complete(inputdef, dict[, imports, nocheck, verbose])
Parameters
Options
Use

dynamic_memory, yaml_output

Call to

f_routine(), dict_len(), dict_iter(), dict_update(), dict_value(), dict_next(), dict_size(), f_err_throw(), dict_copy(), dict_remove(), dict_free(), dict_key(), f_release_routine()

function  f_input_file/input_keys_get_profile(dict, key, user_defined)
Parameters
  • dict [dictionary, pointer]

  • key [character(len=*), in]

  • user_defined [logical, out]

Return

input_keys_get_profile [character(len=max_field_length)]

Use

dictionaries

Called from

input_value_is_default()

Call to

f_strcpy()

function  f_input_file/input_value_is_default(dict, key)
Parameters
  • dict [dictionary, pointer]

  • key [character(len=*), in]

Return

yes [logical]

Call to

input_keys_get_profile()

subroutine  f_input_file/input_file_minimal(inputdef, dict, minimal, nested, as_is)
Parameters
  • inputdef [dictionary, pointer] :: < Dictionary of the input definitions

  • dict [dictionary, in,pointer] :: < User input file

  • minimal [dictionary, out,pointer] :: < List of keys in dict that remain which require special treatments

  • nested [dictionary, in,pointer] :: < Add other keys (extracted by subcategories of nested elements)

  • as_is [dictionary, in,pointer] :: < Add keys in as_is and not in inputdef

Use

dynamic_memory, dictionaries, yaml_output

Call to

f_routine(), dict_iter(), dict_key(), has_key(), dict_init(), set(), dict_next(), dict_value(), dict_copy(), f_release_routine()

subroutine  f_input_file/input_file_dump(dict[, useronly, nodump_list, msg])
Parameters

dict [dictionary, pointer] :: < Dictionary to dump

Options
  • useronly [logical, in,]

  • nodump_list [dictionary, pointer] :: <list containing keys not to dump

  • msg [character(len=*), in,]

Use

yaml_output

Call to

yaml_comment(), dict_key()