afivo-streamer 1.1
1D/2D/3D streamer simulations with AMR
Loading...
Searching...
No Matches
Data Types | Functions/Subroutines | Variables
m_config Module Reference

Module that allows working with a configuration file. More...

Data Types

interface  cfg_add
 Interface to add variables to the configuration. More...
 
interface  cfg_add_get
 Interface to get variables from the configuration. More...
 
interface  cfg_get
 Interface to get variables from the configuration. More...
 
type  cfg_t
 The configuration that contains all the variables. More...
 

Functions/Subroutines

subroutine, public cfg_update_from_arguments (cfg, ignore_unknown)
 Read command line arguments. Both files and variables can be specified, for example as: ./my_program config.cfg -n_runs=3.
 
subroutine, public cfg_update_from_line (cfg, line)
 Update the configuration by parsing a line.
 
subroutine, public cfg_read_file (cfg, filename)
 Update the variables in the configartion with the values found in 'filename'.
 
subroutine, public cfg_check (cfg)
 
subroutine, public cfg_write (cfg_in, filename, hide_unused, custom_first)
 This routine writes the current configuration to a file with descriptions.
 
subroutine, public cfg_write_markdown (cfg_in, filename, hide_unused)
 This routine writes the current configuration to a markdown file.
 
subroutine, public cfg_get_size (cfg, var_name, res)
 Get the size of a variable.
 
subroutine, public cfg_get_type (cfg, var_name, res)
 Get the type of a given variable of a configuration type.
 
subroutine, public cfg_sort (cfg)
 Sort the variables for faster lookup.
 
subroutine, public cfg_clear (cfg)
 Clear all data from a CFG_t object, so that it can be reused. Note that this also happens automatically when such an object goes out of scope.
 

Variables

integer, parameter, public cfg_integer_type = 1
 Integer type.
 
integer, parameter, public cfg_real_type = 2
 Real number type.
 
integer, parameter, public cfg_string_type = 3
 String type.
 
integer, parameter, public cfg_logic_type = 4
 Boolean/logical type.
 
character(len=10), dimension(0:cfg_num_types), parameter, public cfg_type_names = [character(len=10) :: "storage", "integer", "real", "string ", "logical"]
 Names of the types.
 
integer, parameter, public cfg_name_len = 80
 Maximum length of variable names.
 
integer, parameter, public cfg_string_len = 200
 Fixed length of string type.
 
integer, parameter, public cfg_max_line_len = 1000
 Maximum length of line containing multiple arguments/values.
 
integer, parameter, public cfg_max_array_size = 1000
 Maximum number of entries in a variable (if it's an array)
 

Detailed Description

Module that allows working with a configuration file.

Author: Jannis Teunissen and others Repository: https://github.com/jannisteunissen/config_fortran

Function/Subroutine Documentation

◆ cfg_check()

subroutine, public m_config::cfg_check ( type(cfg_t), intent(in) cfg)

Definition at line 464 of file m_config.f90.

◆ cfg_clear()

subroutine, public m_config::cfg_clear ( type(cfg_t) cfg)

Clear all data from a CFG_t object, so that it can be reused. Note that this also happens automatically when such an object goes out of scope.

Definition at line 1338 of file m_config.f90.

◆ cfg_get_size()

subroutine, public m_config::cfg_get_size ( type(cfg_t), intent(in) cfg,
character(len=*), intent(in) var_name,
integer, intent(out) res )

Get the size of a variable.

Definition at line 1146 of file m_config.f90.

◆ cfg_get_type()

subroutine, public m_config::cfg_get_type ( type(cfg_t), intent(in) cfg,
character(len=*), intent(in) var_name,
integer, intent(out) res )

Get the type of a given variable of a configuration type.

Definition at line 1162 of file m_config.f90.

◆ cfg_read_file()

subroutine, public m_config::cfg_read_file ( type(cfg_t), intent(inout) cfg,
character(len=*), intent(in) filename )

Update the variables in the configartion with the values found in 'filename'.

Definition at line 238 of file m_config.f90.

◆ cfg_sort()

subroutine, public m_config::cfg_sort ( type(cfg_t), intent(inout) cfg)

Sort the variables for faster lookup.

Definition at line 1276 of file m_config.f90.

◆ cfg_update_from_arguments()

subroutine, public m_config::cfg_update_from_arguments ( type(cfg_t), intent(inout) cfg,
logical, intent(in), optional ignore_unknown )

Read command line arguments. Both files and variables can be specified, for example as: ./my_program config.cfg -n_runs=3.

config files should have an extension .cfg or .txt command line arguments should be preceded by a single dash

Parameters
[in]ignore_unknownIgnore unknown arguments (default: false)

Definition at line 145 of file m_config.f90.

Here is the call graph for this function:

◆ cfg_update_from_line()

subroutine, public m_config::cfg_update_from_line ( type(cfg_t), intent(inout) cfg,
character(len=*), intent(in) line )

Update the configuration by parsing a line.

Definition at line 189 of file m_config.f90.

◆ cfg_write()

subroutine, public m_config::cfg_write ( type(cfg_t), intent(in) cfg_in,
character(len=*), intent(in) filename,
logical, intent(in), optional hide_unused,
logical, intent(in), optional custom_first )

This routine writes the current configuration to a file with descriptions.

Parameters
[in]hide_unusedHide variables whose value was not requested
[in]custom_firstShow user-set variables first (default: false)

Definition at line 479 of file m_config.f90.

Here is the call graph for this function:

◆ cfg_write_markdown()

subroutine, public m_config::cfg_write_markdown ( type(cfg_t), intent(in) cfg_in,
character(len=*), intent(in) filename,
logical, intent(in), optional hide_unused )

This routine writes the current configuration to a markdown file.

Definition at line 614 of file m_config.f90.

Here is the call graph for this function:

Variable Documentation

◆ cfg_integer_type

integer, parameter, public m_config::cfg_integer_type = 1

Integer type.

Definition at line 14 of file m_config.f90.

◆ cfg_logic_type

integer, parameter, public m_config::cfg_logic_type = 4

Boolean/logical type.

Definition at line 17 of file m_config.f90.

◆ cfg_max_array_size

integer, parameter, public m_config::cfg_max_array_size = 1000

Maximum number of entries in a variable (if it's an array)

Definition at line 37 of file m_config.f90.

◆ cfg_max_line_len

integer, parameter, public m_config::cfg_max_line_len = 1000

Maximum length of line containing multiple arguments/values.

Definition at line 34 of file m_config.f90.

◆ cfg_name_len

integer, parameter, public m_config::cfg_name_len = 80

Maximum length of variable names.

Definition at line 31 of file m_config.f90.

◆ cfg_real_type

integer, parameter, public m_config::cfg_real_type = 2

Real number type.

Definition at line 15 of file m_config.f90.

◆ cfg_string_len

integer, parameter, public m_config::cfg_string_len = 200

Fixed length of string type.

Definition at line 32 of file m_config.f90.

◆ cfg_string_type

integer, parameter, public m_config::cfg_string_type = 3

String type.

Definition at line 16 of file m_config.f90.

◆ cfg_type_names

character(len=10), dimension(0:cfg_num_types), parameter, public m_config::cfg_type_names = [character(len=10) :: "storage", "integer", "real", "string ", "logical"]

Names of the types.

Definition at line 28 of file m_config.f90.