85 INTERFACE OPERATOR (/)
106#define TYPE_DICT_KEY CHARACTER(LEN=MAX_CHAR_LEN)
107#define TYPE_DICT_INT INTEGER
108#define TYPE_DICT_REAL REAL
109#define TYPE_DICT_CHAR CHARACTER(LEN=MAX_CHAR_LEN)
110#define TYPE_DICT_BOOL LOGICAL
111#define TYPE_DICT_REAL_ONED REAL, DIMENSION(:)
112#define TYPE_DICT_REAL_TWOD REAL, DIMENSION(:,:), POINTER
113#define TYPE_DICT_REAL_THREED REAL, DIMENSION(:,:,:), POINTER
114#define TYPE_DICT_REAL_FOURD REAL, DIMENSION(:,:,:,:), POINTER
115#define TYPE_DICT_REAL_FIVED REAL, DIMENSION(:,:,:,:,:), POINTER
116#define TYPE_DICT_INT_ONED INTEGER, DIMENSION(:)
117#define TYPE_DICT_REAL_P REAL, POINTER
118#define TYPE_DICT_INT_P INTEGER, POINTER
120#define TYPE_DICT_MOLD CHARACTER(LEN=1), DIMENSION(:)
122 type_dict_mold,
ALLOCATABLE :: mold
125 CHARACTER(LEN=MAX_CHAR_LEN) :: key =
""
127 type_dict_mold,
POINTER ::
value => null()
132 type_dict_real_p :: p
138 type_dict_real_twod :: p
141 type_dict_real_threed :: p
144 type_dict_real_fourd :: p
147 type_dict_real_fived :: p
186 IF (.NOT.
ALLOCATED(mold))
ALLOCATE(mold(1))
193 IF (
ALLOCATED(mold))
DEALLOCATE(mold)
205 CHARACTER(LEN=*) :: key
206 LOGICAL,
OPTIONAL :: create
209 TYPE(
dict_typ),
POINTER :: parent,node
211 type_dict_char :: k, key_
213 INTENT(IN) :: key, create
216 IF(
PRESENT(create)) &
222 DO WHILE(len_trim(k).GT.0)
224 IF(
ASSOCIATED(node))
THEN
231 IF(
ASSOCIATED(parent))
THEN
232 IF(
ASSOCIATED(parent%child))
THEN
233 parent =>
getlast(parent%child)
239 IF(
ASSOCIATED(root))
THEN
257 IF(c.EQV..true.)
THEN
258 IF (.NOT.
ASSOCIATED(res)) &
259 CALL this%Error(
"FindPath",
"Create was activated, so res should be associated.")
269 CHARACTER(LEN=*) :: key
272 TYPE(
dict_typ),
POINTER :: node, parent
278 DO WHILE(
ASSOCIATED(node))
279 WRITE(k,
'(A,A,A)') trim(key),
'/',trim(node%key)
282 IF(
ASSOCIATED(node%child))
THEN
283 CALL setattr0a(root, trim(k), node%child)
285 CALL setattr0b(root, trim(k), node%value, node%type)
298 CHARACTER(LEN=*) :: key
300 type_dict_mold ::
value
304 INTENT(IN) :: key,
type, value
317 TYPE(
dict_typ),
POINTER :: root, parent, child
318 CHARACTER(LEN=*) :: key
320 type_dict_char :: k, key_
327 DO WHILE(
ASSOCIATED(child).AND.len_trim(key_).GT.0)
330 IF(
ASSOCIATED(parent)) &
331 child => parent%child
333 IF(len_trim(key_).GT.0) &
345 CHARACTER(LEN=*) :: key
347 type_dict_mold,
POINTER ::
value
348 type_dict_mold,
OPTIONAL :: default
351 CHARACTER(LEN=10) :: b1,b2
353 INTENT(IN) :: key,
type, default
356 IF(.NOT.
ASSOCIATED(node))
THEN
357 IF(
PRESENT(default))
THEN
360 IF(.NOT.
ASSOCIATED(node)) &
361 CALL this%Error(
"GetAttr",
"Setting a default value has gone wrong.")
363 CALL this%Error(
"GetAttr",
"Couldn't find key '"//trim(key)//
"'.")
366 IF(type.NE.node%type)
THEN
367 WRITE(b1,
"(I4.4)") node%type
368 WRITE(b2,
"(I4.4)")
type
369 CALL this%Error(
"GetAttr",
"Key '"//trim(key)//
"' is of type "//trim(b1) &
370 //
", but type "//trim(b2)//
" requested.")
380 CHARACTER(LEN=*),
INTENT(IN) :: key
384 DO WHILE(
ASSOCIATED(res))
385 IF(trim(res%key).EQ.trim(key))
EXIT
394 TYPE(
dict_typ),
POINTER :: root, res
403 TYPE(
dict_typ),
POINTER :: root, res
406 IF(
ASSOCIATED(res))
THEN
407 DO WHILE(
ASSOCIATED(res%next))
417 TYPE(
dict_typ),
POINTER :: root, res
427 type_dict_char :: res
441 IF(
ASSOCIATED(root%value))
THEN
442 res =
SIZE(root%value)
463 type_dict_mold,
POINTER :: res
475 res =
ASSOCIATED(root%child)
485 res =
ASSOCIATED(root%value)
493 CHARACTER(LEN=*) :: key
496 res =
ASSOCIATED(
findpath(root,trim(key)))
504 type_dict_mold :: val
509 CALL this%Error(
"SetData",
"Array size smaller 0 is not possible.")
510 IF(
ASSOCIATED(node%value)) &
511 DEALLOCATE(node%value)
512 ALLOCATE(node%value(
SIZE(val)))
522 CHARACTER(LEN=MAX_CHAR_LEN) :: key
523 LOGICAL,
OPTIONAL :: back
524 type_dict_char :: res
532 IF(
PRESENT(back))
THEN
538 IF(key(1:1).EQ.
'/') key = key(2:)
539 i = scan(key,
'/',back_)
559 FUNCTION dict(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,&
560 n18,n19,n20)
RESULT(res)
564 TYPE(
dict_typ),
POINTER,
OPTIONAL :: n2,n3,n4,n5,n6,n7,n8,n9,n10,n11, &
565 n12,n13,n14,n15,n16,n17,n18,n19,n20
569 IF(
PRESENT( n2))
CALL setattr0a(res,
'', n2)
570 IF(
PRESENT( n3))
CALL setattr0a(res,
'', n3)
571 IF(
PRESENT( n4))
CALL setattr0a(res,
'', n4)
572 IF(
PRESENT( n5))
CALL setattr0a(res,
'', n5)
573 IF(
PRESENT( n6))
CALL setattr0a(res,
'', n6)
574 IF(
PRESENT( n7))
CALL setattr0a(res,
'', n7)
575 IF(
PRESENT( n8))
CALL setattr0a(res,
'', n8)
576 IF(
PRESENT( n9))
CALL setattr0a(res,
'', n9)
577 IF(
PRESENT(n10))
CALL setattr0a(res,
'',n10)
578 IF(
PRESENT(n11))
CALL setattr0a(res,
'',n11)
579 IF(
PRESENT(n12))
CALL setattr0a(res,
'',n12)
580 IF(
PRESENT(n13))
CALL setattr0a(res,
'',n13)
581 IF(
PRESENT(n14))
CALL setattr0a(res,
'',n14)
582 IF(
PRESENT(n15))
CALL setattr0a(res,
'',n15)
583 IF(
PRESENT(n16))
CALL setattr0a(res,
'',n16)
584 IF(
PRESENT(n17))
CALL setattr0a(res,
'',n17)
585 IF(
PRESENT(n18))
CALL setattr0a(res,
'',n18)
586 IF(
PRESENT(n19))
CALL setattr0a(res,
'',n19)
587 IF(
PRESENT(n20))
CALL setattr0a(res,
'',n20)
594 CHARACTER(LEN=*) :: key
597 INTENT(IN) :: key, val
606 CHARACTER(LEN=*) :: key
607 type_dict_real :: val
609 INTENT(IN) :: key, val
618 CHARACTER(LEN=*) :: key, val
619 type_dict_char :: val_
621 INTENT(IN) :: key, val
631 CHARACTER(LEN=*) :: key
632 type_dict_bool :: val
634 INTENT(IN) :: key, val
643 CHARACTER(LEN=*) :: key
644 type_dict_real_oned :: val
646 INTENT(IN) :: key, val
655 CHARACTER(LEN=*) :: key
656 REAL,
DIMENSION(:,:),
TARGET :: val
659 INTENT(IN) :: key,val
669 CHARACTER(LEN=*) :: key
670 REAL,
DIMENSION(:,:,:),
TARGET :: val
673 INTENT(IN) :: key, val
683 CHARACTER(LEN=*) :: key
684 REAL,
DIMENSION(:,:,:,:),
TARGET :: val
687 INTENT(IN) :: key, val
697 CHARACTER(LEN=*) :: key
698 type_dict_int_oned :: val
700 INTENT(IN) :: key, val
709 CHARACTER(LEN=*) :: key
712 INTENT(IN) :: key, val
721 CHARACTER(LEN=*) :: key
724 INTENT(IN) :: key, val
733 CHARACTER(LEN=*) :: key
734 REAL,
DIMENSION(:,:,:,:,:),
TARGET :: val
737 INTENT(IN) :: key, val
747 CHARACTER(LEN=*),
OPTIONAL ::
prefix
750 type_dict_char :: prefix_
751 type_dict_char :: s,str
757 DO WHILE(
ASSOCIATED(node))
758 WRITE(s,
'(A,A,A)') trim(prefix_),
'/',trim(node%key)
759 IF(
ASSOCIATED(node%value))
THEN
760 WRITE(str,
'(A,I2,A,A,A,I4)')
"type=",node%type,
", key=",trim(s),&
761 ", size=",
SIZE(node%value)
763 WRITE(str,
'(A,I2,A,A)')
"type=",node%type,
", key=",trim(s)
766 IF(
ASSOCIATED(node%child)) &
776 TYPE(
dict_typ),
POINTER :: root, outdir, dir, odir, tmp
781 DO WHILE(
ASSOCIATED(dir))
782 IF(
ASSOCIATED(odir))
THEN
791 IF(
ASSOCIATED(dir%value))
THEN
795 IF(
ASSOCIATED(dir%child))
THEN
808 TYPE(
dict_typ),
POINTER :: root, outdir, dir, odir
813 DO WHILE(
ASSOCIATED(dir))
814 IF(
ASSOCIATED(dir%child))
THEN
815 IF(
ASSOCIATED(odir))
THEN
834 TYPE(
dict_typ),
POINTER :: root, res
835 CHARACTER(LEN=*) :: key
840 IF(
ASSOCIATED(res))
THEN
852 type_dict_int,
OPTIONAL :: default
853 CHARACTER(LEN=*) :: key
855 type_dict_mold,
POINTER ::
value
857 INTENT(IN) :: key, default
860 IF(
PRESENT(default))
THEN
865 res = transfer(
value,res)
872 type_dict_real :: res
873 type_dict_real,
OPTIONAL :: default
874 CHARACTER(LEN=*) :: key
876 type_dict_mold,
POINTER ::
value
878 INTENT(IN) :: key, default
881 IF(
PRESENT(default))
THEN
886 res = transfer(
value,res)
893 type_dict_char :: res
894 type_dict_char,
OPTIONAL :: default
895 CHARACTER(LEN=*) :: key
897 type_dict_mold,
POINTER ::
value
902 IF(
PRESENT(default))
THEN
907 res = transfer(
value,res)
914 type_dict_bool :: res
915 type_dict_bool,
OPTIONAL :: default
916 CHARACTER(LEN=*) :: key
918 type_dict_mold,
POINTER ::
value
923 IF(
PRESENT(default))
THEN
928 res = transfer(
value,res)
935 type_dict_real_oned :: res
936 type_dict_real_oned,
OPTIONAL :: default
937 CHARACTER(LEN=*) :: key
939 type_dict_mold,
POINTER ::
value
944 IF(
PRESENT(default))
THEN
949 IF(
SIZE(transfer(
value,res)).NE.
SIZE(res)) &
950 CALL this%Error(
"GetAttr5",
"1D array with key '" // trim(key) &
951 //
"' has the wrong size.")
953 res = transfer(
value,res)
960 type_dict_real_twod :: res
961 type_dict_real_twod,
OPTIONAL :: default
962 CHARACTER(LEN=*) :: key
964 type_dict_mold,
POINTER ::
value
969 IF(
PRESENT(default))
THEN
975 c = transfer(
value,c)
983 type_dict_real_threed :: res
984 type_dict_real_threed,
OPTIONAL :: default
985 CHARACTER(LEN=*) :: key
987 type_dict_mold,
POINTER ::
value
992 IF(
PRESENT(default))
THEN
998 c = transfer(
value,c)
1006 type_dict_real_fourd :: res
1007 type_dict_real_fourd,
OPTIONAL :: default
1008 CHARACTER(LEN=*) :: key
1010 type_dict_mold,
POINTER ::
value
1015 IF(
PRESENT(default))
THEN
1021 c = transfer(
value,c)
1029 type_dict_int_oned :: res
1030 type_dict_int_oned,
OPTIONAL :: default
1031 CHARACTER(LEN=*) :: key
1033 type_dict_mold,
POINTER ::
value
1036 INTENT(INOUT) :: res
1038 IF(
PRESENT(default))
THEN
1043 res = transfer(
value,res)
1051 TYPE(
real_t),
OPTIONAL :: default
1052 CHARACTER(LEN=*) :: key
1054 type_dict_mold,
POINTER ::
value
1058 IF(
PRESENT(default))
THEN
1063 res = transfer(
value,res)
1071 TYPE(
int_t),
OPTIONAL :: default
1072 CHARACTER(LEN=*) :: key
1074 type_dict_mold,
POINTER ::
value
1078 IF(
PRESENT(default))
THEN
1083 res = transfer(
value,res)
1090 type_dict_real_fived :: res
1091 type_dict_real_fived,
OPTIONAL :: default
1092 CHARACTER(LEN=*) :: key
1094 type_dict_mold,
POINTER ::
value
1099 IF(
PRESENT(default))
THEN
1105 c = transfer(
value,c)
1113 CHARACTER(LEN=*) :: k
1114 LOGICAL,
SAVE :: first=.true.
1117 CHARACTER(LEN=512) :: str
1119 NULLIFY(node%child,node%next)
1120 IF(
ASSOCIATED(node%value)) &
1121 DEALLOCATE(node%value)
1122 DEALLOCATE(node,stat=status)
1123 IF(status.NE.0.AND.first)
THEN
1129 WRITE(str,
'(A,A,A,I3)')&
1130 "Deallocating key '",trim(k),&
1131 "' throws the error nio.: ",status
1133 WRITE(str,
'(A,A,A,I3)')&
1134 "More invocations of this error will be suppressed."
1144 TYPE(
dict_typ),
POINTER :: root, node, next, child
1149 DO WHILE(
ASSOCIATED(node))
1154 IF (
ASSOCIATED(child)) &
1165 CHARACTER(LEN=*) :: key
1168 INTENT(IN) :: key,val
1171 CALL setattr(res, key, val)
1178 CHARACTER(LEN=*) :: key
1179 type_dict_int :: val
1181 INTENT(IN) :: key, val
1184 CALL setattr(res, key, val)
1191 CHARACTER(LEN=*) :: key
1192 type_dict_real :: val
1194 INTENT(IN) :: key, val
1197 CALL setattr(res, key, val)
1204 CHARACTER(LEN=*) :: key, val
1206 INTENT(IN) :: key, val
1209 CALL setattr(res, key, val)
1216 CHARACTER(LEN=*) :: key
1217 type_dict_bool :: val
1219 INTENT(IN) :: key, val
1222 CALL setattr(res, key, val)
1229 CHARACTER(LEN=*) :: key
1230 type_dict_real_oned :: val
1232 INTENT(IN) :: key, val
1235 CALL setattr(res, key, val)
1242 CHARACTER(LEN=*) :: key
1243 REAL,
DIMENSION(:,:),
TARGET :: val
1245 INTENT(IN) :: key, val
1248 CALL setattr(res, key, val)
1255 CHARACTER(LEN=*) :: key
1256 REAL,
DIMENSION(:,:,:),
TARGET :: val
1258 INTENT(IN) :: key, val
1261 CALL setattr(res, key, val)
1268 CHARACTER(LEN=*) :: key
1269 REAL,
DIMENSION(:,:,:,:),
TARGET :: val
1271 INTENT(IN) :: key, val
1274 CALL setattr(res, key, val)
1281 CHARACTER(LEN=*) :: key
1282 type_dict_int_oned :: val
1284 INTENT(IN) :: key, val
1287 CALL setattr(res, key, val)
1294 CHARACTER(LEN=*) :: key
1297 INTENT(IN) :: key, val
1300 CALL setattr(res, key, val)
1307 CHARACTER(LEN=*) :: key
1310 INTENT(IN) :: key, val
1313 CALL setattr(res, key, val)
1320 CHARACTER(LEN=*) :: key
1321 REAL,
DIMENSION(:,:,:,:,:),
TARGET :: val
1323 INTENT(IN) :: key, val
1326 CALL setattr(res, key, val)
1332 type_dict_real_p :: p
1341 type_dict_int_p :: p
Dictionary for generic data types.
integer, parameter, public dict_real
subroutine getattr8(root, key, res, default)
subroutine getattr6(root, key, res, default)
type(dict_typ) function, pointer assign9(key, val)
recursive subroutine, public deletedict(root)
Delete the dictionary 'root' and all subnodes.
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 ...
integer, parameter, public dict_int_oned
subroutine setattr5(root, key, val)
pointer, public getdata(root)
Return the datatype of node 'root'.
type(dict_typ) function, pointer assign10(key, val)
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'....
subroutine getattr4(root, key, res, default)
subroutine setattr0b(root, key, value, type)
Create an empty node at path 'key' relative to 'root', if value and type are not defined....
subroutine getattr1(root, key, res, default)
subroutine setattr12(root, key, val)
logical function, public haschild(root)
Check if the node 'root' has one or more children.
type(dict_typ) function, pointer assign1(key, val)
integer, parameter, public dict_real_fourd
logical function, public haskey(root, key)
Checks if a node with key 'key' exists.
logical function, public hasdata(root)
Checks if the node 'root' has data associated.
subroutine getattr11(root, key, res, default)
integer, parameter, public dict_real_threed
subroutine getattr9(root, key, res, default)
subroutine setattr8(root, key, val)
subroutine setattr3(root, key, val)
integer, parameter, public dict_int_p
integer function, public getdatatype(root)
Return the datatype of node 'root'.
function, public getkey(root)
Get the key of pointer 'root'.
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 by...
type(real_t) function ref1(p)
subroutine getattr3(root, key, res, default)
recursive subroutine, public copydict(root, outdir)
Copy complete Dictionary.
subroutine getattr10(root, key, res, default)
type(dict_typ) function, pointer assign5(key, val)
type(dict_typ) function, pointer assign6(key, val)
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 fou...
subroutine setattr6(root, key, val)
function tokenize(key, back)
Cuts a path into two tokens, which is explained best with an example: back=.FALSE....
subroutine deletenode(node, k)
integer, parameter, public dict_real_fived
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 over...
integer, parameter, public max_char_len
subroutine getattr0(root, key, res)
Return the node at path 'key' relative to 'root' in 'res'. If this node has no data,...
integer, parameter, public dict_real_twod
integer, parameter, public dict_real_p
type(int_t) function ref2(p)
type(dict_typ) function, pointer assign8(key, val)
subroutine, public initdict()
type(dict_typ) function, pointer assign2(key, val)
type(dict_typ) function, pointer assign4(key, val)
subroutine setattr2(root, key, val)
type(dict_typ) function, pointer assign0(key, val)
type(dict_typ) function, pointer getlast(root)
Get the pointer to the last child.
type(dict_typ) function, pointer assign12(key, val)
type(dict_typ) function, pointer assign7(key, val)
subroutine getattr2(root, key, res, default)
type(dict_typ) function, pointer assign11(key, val)
subroutine setattr1(root, key, val)
recursive subroutine, public copyhierarchy(root, outdir)
Copy all nodes, which have children from 'root' to 'outdir'.
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....
subroutine, public closedict()
type(dict_typ) function, pointer, public getnext(root)
Get the pointer to the next child.
subroutine setattr10(root, key, val)
integer, parameter, public dict_real_oned
recursive subroutine, public printdict(root, prefix)
subroutine getattr0a(root, key, parent)
Retrieve the node at path 'key' relative to 'root'. The result will be given as third argument 'paren...
type(dict_typ) function, pointer assign3(key, val)
type(logging_base), save this
integer, parameter, public dict_int
type(dict_typ) function, pointer, public getchild(root)
Get the pointer to a direct child of the pointer 'root'.
integer, parameter, public dict_char
subroutine getattr7(root, key, res, default)
subroutine setattr11(root, key, val)
subroutine getattr5(root, key, res, default)
subroutine setattr9(root, key, val)
integer, parameter, public dict_none
subroutine, public setdata(node, val)
Set data of 'node' ot 'val'.
subroutine getattr12(root, key, res, default)
subroutine setattr7(root, key, val)
integer, parameter, public dict_bool
subroutine setattr4(root, key, val)
character(len=1), save prefix
preceds info output