Dictionary for generic data types. More...
Data Types | |
type | dict_typ |
type | int_t |
type | real_fived_t |
type | real_fourd_t |
type | real_t |
type | real_threed_t |
type | real_twod_t |
Functions/Subroutines | |
subroutine, public | initdict () |
subroutine, public | closedict () |
type(dict_typ) function, pointer | findpath (root, key, create) |
Search for the path in 'key' beginning at root and return a pointer to this node in 'res'. If create is set to true (default is false), the path is created if it is not existing. If create=false and the path does not exist, res is null(). More... | |
recursive subroutine | setattr0a (root, key, value) |
Set the dictionary 'value' as child at the path 'key' relative to 'root'. If a child at this path is already existing, it will be deleted. More... | |
subroutine | setattr0b (root, key, value, type) |
Create an empty node at path 'key' relative to 'root', if value and type are not defined. If they are defined, also fill the node with data. More... | |
subroutine | getattr0a (root, key, parent) |
Retrieve the node at path 'key' relative to 'root'. The result will be given as third argument 'parent'. If the path can not be found, the result is null(). More... | |
subroutine | getattr0b (root, key, type, value, default) |
Retrieve the data 'value' of kind 'type' at path 'key' relative to 'root'. If the path can not be found and default is not defined, an error is raised. If default is present, it is set and returned instead. More... | |
type(dict_typ) function, pointer | findchild (root, key) |
Find the direct child with key 'key' in a list of childs. 'root' points to the first child. If 'key' is not found, null() is returned. More... | |
type(dict_typ) function, pointer, public | getnext (root) |
Get the pointer to the next child. More... | |
type(dict_typ) function, pointer | getlast (root) |
Get the pointer to the last child. More... | |
type(dict_typ) function, pointer, public | getchild (root) |
Get the pointer to a direct child of the pointer 'root'. More... | |
function, public | getkey (root) |
Get the key of pointer 'root'. More... | |
integer function, public | getdatasize (root) |
Get the size of the data in node 'root'. If there is no data 0 is returned. note: This is also the byte size of the data. More... | |
integer function, public | getdatatype (root) |
Return the datatype of node 'root'. More... | |
pointer, public | getdata (root) |
Return the datatype of node 'root'. More... | |
logical function, public | haschild (root) |
Check if the node 'root' has one or more children. More... | |
logical function, public | hasdata (root) |
Checks if the node 'root' has data associated. More... | |
logical function, public | haskey (root, key) |
Checks if a node with key 'key' exists. More... | |
subroutine, public | setdata (node, val) |
Set data of 'node' ot 'val'. More... | |
function | tokenize (key, back) |
Cuts a path into two tokens, which is explained best with an example: back=.FALSE.: key = /sources/grav/mass => res = sources, key = /grav/mass back=.TRUE.: key = /sources/grav/mass => res = mass, key = /sources/grav. More... | |
type(dict_typ) function, pointer, public | dict (n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20) |
Construct a new dictionary from several key/value pairs. Together with the Assign subroutine and overloading the '/'-operator, this makes the syntactic sugar available to write the following syntax: physics => Dict( "problem" / EULER2D, & "gamma" / GAMMA) More... | |
subroutine | setattr1 (root, key, val) |
subroutine | setattr2 (root, key, val) |
subroutine | setattr3 (root, key, val) |
subroutine | setattr4 (root, key, val) |
subroutine | setattr5 (root, key, val) |
subroutine | setattr6 (root, key, val) |
subroutine | setattr7 (root, key, val) |
subroutine | setattr8 (root, key, val) |
subroutine | setattr9 (root, key, val) |
subroutine | setattr10 (root, key, val) |
subroutine | setattr11 (root, key, val) |
subroutine | setattr12 (root, key, val) |
recursive subroutine, public | printdict (root, prefix) |
recursive subroutine, public | copydict (root, outdir) |
Copy complete Dictionary. More... | |
recursive subroutine, public | copyhierarchy (root, outdir) |
Copy all nodes, which have children from 'root' to 'outdir'. More... | |
subroutine | getattr0 (root, key, res) |
Return the node at path 'key' relative to 'root' in 'res'. If this node has no data, but a child (e.g. a directory), return the child instead. More... | |
subroutine | getattr1 (root, key, res, default) |
subroutine | getattr2 (root, key, res, default) |
subroutine | getattr3 (root, key, res, default) |
subroutine | getattr4 (root, key, res, default) |
subroutine | getattr5 (root, key, res, default) |
subroutine | getattr6 (root, key, res, default) |
subroutine | getattr7 (root, key, res, default) |
subroutine | getattr8 (root, key, res, default) |
subroutine | getattr9 (root, key, res, default) |
subroutine | getattr10 (root, key, res, default) |
subroutine | getattr11 (root, key, res, default) |
subroutine | getattr12 (root, key, res, default) |
subroutine | deletenode (node, k) |
recursive subroutine, public | deletedict (root) |
Delete the dictionary 'root' and all subnodes. More... | |
type(dict_typ) function, pointer | assign0 (key, val) |
type(dict_typ) function, pointer | assign1 (key, val) |
type(dict_typ) function, pointer | assign2 (key, val) |
type(dict_typ) function, pointer | assign3 (key, val) |
type(dict_typ) function, pointer | assign4 (key, val) |
type(dict_typ) function, pointer | assign5 (key, val) |
type(dict_typ) function, pointer | assign6 (key, val) |
type(dict_typ) function, pointer | assign7 (key, val) |
type(dict_typ) function, pointer | assign8 (key, val) |
type(dict_typ) function, pointer | assign9 (key, val) |
type(dict_typ) function, pointer | assign10 (key, val) |
type(dict_typ) function, pointer | assign11 (key, val) |
type(dict_typ) function, pointer | assign12 (key, val) |
type(real_t) function | ref1 (p) |
type(int_t) function | ref2 (p) |
Variables | |
integer, parameter, public | max_char_len = 128 |
integer, parameter, public | dict_none = 0 |
integer, parameter, public | dict_int = 1 |
integer, parameter, public | dict_real = 2 |
integer, parameter, public | dict_char = 3 |
integer, parameter, public | dict_bool = 4 |
integer, parameter, public | dict_real_oned = 5 |
integer, parameter, public | dict_real_twod = 6 |
integer, parameter, public | dict_real_threed = 7 |
integer, parameter, public | dict_real_fourd = 8 |
integer, parameter, public | dict_int_oned = 9 |
integer, parameter, public | dict_real_p = 10 |
integer, parameter, public | dict_int_p = 11 |
integer, parameter, public | dict_real_fived = 12 |
type(logging_base), save | this |
Detailed Description
Dictionary for generic data types.
This module defines a dictionary (key/value storage) of arbitrary data types. At the moment the following are defined:
- Integer
- Real
- Character(len=MAX_CHAR_LEN)
- Logical
- 1D Real array
- Pointer to 2D Real array
- Pointer to 3D Real array
- Pointer to 4D Real array
- 1D Integer array
- Pointer to Real
- Pointer to Integer
- Pointer to 5D Real array
The dictionary is implemented as Trie(1) with comprepressed keys, which is called radix tree(2). Each node can hold data with a defined type, which is stored in a generic container with the TRANSFER intrinsic(3). This technique has been explained in (4), see also (5). Each node can have severall children. 'child' points to the first child and other can be found by iterating to the 'next' one.
References
- http://en.wikipedia.org/wiki/Trie
- http://en.wikipedia.org/wiki/Radix_tree
- http://fortranwiki.org/fortran/show/transfer
- Jason R. Blevins. A generic linked list implementation in fortran 95. [blevins2009]
- http://fortranwiki.org/fortran/show/gen_list
Function/Subroutine Documentation
◆ assign0()
|
private |
Definition at line 1160 of file common_dict.f90.
◆ assign1()
|
private |
Definition at line 1173 of file common_dict.f90.
◆ assign10()
|
private |
Definition at line 1289 of file common_dict.f90.
◆ assign11()
|
private |
Definition at line 1302 of file common_dict.f90.
◆ assign12()
|
private |
Definition at line 1315 of file common_dict.f90.
◆ assign2()
|
private |
Definition at line 1186 of file common_dict.f90.
◆ assign3()
|
private |
Definition at line 1199 of file common_dict.f90.
◆ assign4()
|
private |
Definition at line 1211 of file common_dict.f90.
◆ assign5()
|
private |
Definition at line 1224 of file common_dict.f90.
◆ assign6()
|
private |
Definition at line 1237 of file common_dict.f90.
◆ assign7()
|
private |
Definition at line 1250 of file common_dict.f90.
◆ assign8()
|
private |
Definition at line 1263 of file common_dict.f90.
◆ assign9()
|
private |
Definition at line 1276 of file common_dict.f90.
◆ closedict()
subroutine, public common_dict::closedict | ( | ) |
Definition at line 191 of file common_dict.f90.
◆ copydict()
recursive subroutine, public common_dict::copydict | ( | type(dict_typ), pointer | root, |
type(dict_typ), pointer | outdir | ||
) |
Copy complete Dictionary.
Definition at line 772 of file common_dict.f90.
◆ copyhierarchy()
recursive subroutine, public common_dict::copyhierarchy | ( | type(dict_typ), pointer | root, |
type(dict_typ), pointer | outdir | ||
) |
Copy all nodes, which have children from 'root' to 'outdir'.
Definition at line 804 of file common_dict.f90.
◆ deletedict()
recursive subroutine, public common_dict::deletedict | ( | type(dict_typ), pointer | root | ) |
Delete the dictionary 'root' and all subnodes.
Definition at line 1140 of file common_dict.f90.
◆ deletenode()
|
private |
Definition at line 1108 of file common_dict.f90.
◆ dict()
type(dict_typ) function, pointer, public common_dict::dict | ( | type(dict_typ), pointer | n1, |
type(dict_typ), optional, pointer | n2, | ||
type(dict_typ), optional, pointer | n3, | ||
type(dict_typ), optional, pointer | n4, | ||
type(dict_typ), optional, pointer | n5, | ||
type(dict_typ), optional, pointer | n6, | ||
type(dict_typ), optional, pointer | n7, | ||
type(dict_typ), optional, pointer | n8, | ||
type(dict_typ), optional, pointer | n9, | ||
type(dict_typ), optional, pointer | n10, | ||
type(dict_typ), optional, pointer | n11, | ||
type(dict_typ), optional, pointer | n12, | ||
type(dict_typ), optional, pointer | n13, | ||
type(dict_typ), optional, pointer | n14, | ||
type(dict_typ), optional, pointer | n15, | ||
type(dict_typ), optional, pointer | n16, | ||
type(dict_typ), optional, pointer | n17, | ||
type(dict_typ), optional, pointer | n18, | ||
type(dict_typ), optional, pointer | n19, | ||
type(dict_typ), optional, pointer | n20 | ||
) |
Construct a new dictionary from several key/value pairs. Together with the Assign subroutine and overloading the '/'-operator, this makes the syntactic sugar available to write the following syntax: physics => Dict( "problem" / EULER2D, & "gamma" / GAMMA)
Definition at line 559 of file common_dict.f90.
◆ findchild()
|
private |
Find the direct child with key 'key' in a list of childs. 'root' points to the first child. If 'key' is not found, null() is returned.
Definition at line 376 of file common_dict.f90.
◆ findpath()
|
private |
Search for the path in 'key' beginning at root and return a pointer to this node in 'res'. If create is set to true (default is false), the path is created if it is not existing. If create=false and the path does not exist, res is null().
Definition at line 202 of file common_dict.f90.
◆ getattr0()
|
private |
Return the node at path 'key' relative to 'root' in 'res'. If this node has no data, but a child (e.g. a directory), return the child instead.
Definition at line 830 of file common_dict.f90.
◆ getattr0a()
|
private |
Retrieve the node at path 'key' relative to 'root'. The result will be given as third argument 'parent'. If the path can not be found, the result is null().
Definition at line 313 of file common_dict.f90.
◆ getattr0b()
|
private |
Retrieve the data 'value' of kind 'type' at path 'key' relative to 'root'. If the path can not be found and default is not defined, an error is raised. If default is present, it is set and returned instead.
Definition at line 340 of file common_dict.f90.
◆ getattr1()
|
private |
Definition at line 846 of file common_dict.f90.
◆ getattr10()
|
private |
Definition at line 1045 of file common_dict.f90.
◆ getattr11()
|
private |
Definition at line 1065 of file common_dict.f90.
◆ getattr12()
|
private |
Definition at line 1085 of file common_dict.f90.
◆ getattr2()
|
private |
Definition at line 867 of file common_dict.f90.
◆ getattr3()
|
private |
Definition at line 888 of file common_dict.f90.
◆ getattr4()
|
private |
Definition at line 909 of file common_dict.f90.
◆ getattr5()
|
private |
Definition at line 930 of file common_dict.f90.
◆ getattr6()
|
private |
Definition at line 955 of file common_dict.f90.
◆ getattr7()
|
private |
Definition at line 978 of file common_dict.f90.
◆ getattr8()
|
private |
Definition at line 1001 of file common_dict.f90.
◆ getattr9()
|
private |
Definition at line 1024 of file common_dict.f90.
◆ getchild()
Get the pointer to a direct child of the pointer 'root'.
Definition at line 413 of file common_dict.f90.
◆ getdata()
pointer, public common_dict::getdata | ( | type(dict_typ), pointer | root | ) |
Return the datatype of node 'root'.
Definition at line 458 of file common_dict.f90.
◆ getdatasize()
integer function, public common_dict::getdatasize | ( | type(dict_typ), pointer | root | ) |
Get the size of the data in node 'root'. If there is no data 0 is returned. note: This is also the byte size of the data.
Definition at line 434 of file common_dict.f90.
◆ getdatatype()
integer function, public common_dict::getdatatype | ( | type(dict_typ), pointer | root | ) |
Return the datatype of node 'root'.
Definition at line 448 of file common_dict.f90.
◆ getkey()
function, public common_dict::getkey | ( | type(dict_typ), pointer | root | ) |
Get the key of pointer 'root'.
Definition at line 422 of file common_dict.f90.
◆ getlast()
Get the pointer to the last child.
Definition at line 399 of file common_dict.f90.
◆ getnext()
Get the pointer to the next child.
Definition at line 390 of file common_dict.f90.
◆ haschild()
logical function, public common_dict::haschild | ( | type(dict_typ), pointer | root | ) |
Check if the node 'root' has one or more children.
Definition at line 468 of file common_dict.f90.
◆ hasdata()
logical function, public common_dict::hasdata | ( | type(dict_typ), pointer | root | ) |
Checks if the node 'root' has data associated.
Definition at line 478 of file common_dict.f90.
◆ haskey()
logical function, public common_dict::haskey | ( | type(dict_typ), pointer | root, |
character(len=*) | key | ||
) |
Checks if a node with key 'key' exists.
Definition at line 488 of file common_dict.f90.
◆ initdict()
subroutine, public common_dict::initdict | ( | ) |
Definition at line 184 of file common_dict.f90.
◆ printdict()
recursive subroutine, public common_dict::printdict | ( | type(dict_typ), target | root, |
character(len=*), optional | prefix | ||
) |
Definition at line 742 of file common_dict.f90.
◆ ref1()
|
private |
Definition at line 1328 of file common_dict.f90.
◆ ref2()
|
private |
Definition at line 1337 of file common_dict.f90.
◆ setattr0a()
|
private |
Set the dictionary 'value' as child at the path 'key' relative to 'root'. If a child at this path is already existing, it will be deleted.
Definition at line 264 of file common_dict.f90.
◆ setattr0b()
|
private |
Create an empty node at path 'key' relative to 'root', if value and type are not defined. If they are defined, also fill the node with data.
Definition at line 293 of file common_dict.f90.
◆ setattr1()
|
private |
Definition at line 589 of file common_dict.f90.
◆ setattr10()
|
private |
Definition at line 704 of file common_dict.f90.
◆ setattr11()
|
private |
Definition at line 716 of file common_dict.f90.
◆ setattr12()
|
private |
Definition at line 728 of file common_dict.f90.
◆ setattr2()
|
private |
Definition at line 601 of file common_dict.f90.
◆ setattr3()
|
private |
Definition at line 613 of file common_dict.f90.
◆ setattr4()
|
private |
Definition at line 626 of file common_dict.f90.
◆ setattr5()
|
private |
Definition at line 638 of file common_dict.f90.
◆ setattr6()
|
private |
Definition at line 650 of file common_dict.f90.
◆ setattr7()
|
private |
Definition at line 664 of file common_dict.f90.
◆ setattr8()
|
private |
Definition at line 678 of file common_dict.f90.
◆ setattr9()
|
private |
Definition at line 692 of file common_dict.f90.
◆ setdata()
subroutine, public common_dict::setdata | ( | type(dict_typ), pointer | node, |
intent(in) | val | ||
) |
Set data of 'node' ot 'val'.
Definition at line 499 of file common_dict.f90.
◆ tokenize()
|
private |
Cuts a path into two tokens, which is explained best with an example: back=.FALSE.: key = /sources/grav/mass => res = sources, key = /grav/mass back=.TRUE.: key = /sources/grav/mass => res = mass, key = /sources/grav.
Definition at line 518 of file common_dict.f90.
Variable Documentation
◆ dict_bool
integer, parameter, public common_dict::dict_bool = 4 |
Definition at line 97 of file common_dict.f90.
◆ dict_char
integer, parameter, public common_dict::dict_char = 3 |
Definition at line 96 of file common_dict.f90.
◆ dict_int
integer, parameter, public common_dict::dict_int = 1 |
Definition at line 94 of file common_dict.f90.
◆ dict_int_oned
integer, parameter, public common_dict::dict_int_oned = 9 |
Definition at line 102 of file common_dict.f90.
◆ dict_int_p
integer, parameter, public common_dict::dict_int_p = 11 |
Definition at line 104 of file common_dict.f90.
◆ dict_none
integer, parameter, public common_dict::dict_none = 0 |
Definition at line 93 of file common_dict.f90.
◆ dict_real
integer, parameter, public common_dict::dict_real = 2 |
Definition at line 95 of file common_dict.f90.
◆ dict_real_fived
integer, parameter, public common_dict::dict_real_fived = 12 |
Definition at line 105 of file common_dict.f90.
◆ dict_real_fourd
integer, parameter, public common_dict::dict_real_fourd = 8 |
Definition at line 101 of file common_dict.f90.
◆ dict_real_oned
integer, parameter, public common_dict::dict_real_oned = 5 |
Definition at line 98 of file common_dict.f90.
◆ dict_real_p
integer, parameter, public common_dict::dict_real_p = 10 |
Definition at line 103 of file common_dict.f90.
◆ dict_real_threed
integer, parameter, public common_dict::dict_real_threed = 7 |
Definition at line 100 of file common_dict.f90.
◆ dict_real_twod
integer, parameter, public common_dict::dict_real_twod = 6 |
Definition at line 99 of file common_dict.f90.
◆ max_char_len
integer, parameter, public common_dict::max_char_len = 128 |
Definition at line 92 of file common_dict.f90.
◆ this
|
private |
Definition at line 149 of file common_dict.f90.