common_dict.f90
Go to the documentation of this file.
1 !#############################################################################
2 !# #
3 !# fosite - 3D hydrodynamical simulation program #
4 !# module: common_dict.f90 #
5 !# #
6 !# Copyright (C) 2015 Manuel Jung <mjung@astrophysik.uni-kiel.de> #
7 !# #
8 !# This program is free software; you can redistribute it and/or modify #
9 !# it under the terms of the GNU General Public License as published by #
10 !# the Free Software Foundation; either version 2 of the License, or (at #
11 !# your option) any later version. #
12 !# #
13 !# This program is distributed in the hope that it will be useful, but #
14 !# WITHOUT ANY WARRANTY; without even the implied warranty of #
15 !# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or #
16 !# NON INFRINGEMENT. See the GNU General Public License for more #
17 !# details. #
18 !# #
19 !# You should have received a copy of the GNU General Public License #
20 !# along with this program; if not, write to the Free Software #
21 !# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
22 !# #
23 !#############################################################################
24 !----------------------------------------------------------------------------!
60 !----------------------------------------------------------------------------!
62  !USE dict_common, InitDict_common => InitDict
64  !--------------------------------------------------------------------------!
65  IMPLICIT NONE
66  !--------------------------------------------------------------------------!
67  PRIVATE
68  ! exclude interface block from doxygen processing
70  INTERFACE setattr
71  MODULE PROCEDURE setattr0a, setattr0b, &
75  END INTERFACE setattr
76  INTERFACE getattr
77  MODULE PROCEDURE getattr0, &
81  END INTERFACE getattr
82  INTERFACE ref
83  MODULE PROCEDURE ref1, ref2
84  END INTERFACE ref
85  INTERFACE OPERATOR (/)
86  MODULE PROCEDURE assign0, assign1, assign2, assign3, assign4, &
89  END INTERFACE
91  ! constants
92  INTEGER, PARAMETER :: max_char_len = 128
93  INTEGER, PARAMETER :: dict_none = 0
94  INTEGER, PARAMETER :: dict_int = 1
95  INTEGER, PARAMETER :: dict_real = 2
96  INTEGER, PARAMETER :: dict_char = 3
97  INTEGER, PARAMETER :: dict_bool = 4
98  INTEGER, PARAMETER :: dict_real_oned = 5
99  INTEGER, PARAMETER :: dict_real_twod = 6
100  INTEGER, PARAMETER :: dict_real_threed = 7
101  INTEGER, PARAMETER :: dict_real_fourd = 8
102  INTEGER, PARAMETER :: dict_int_oned = 9
103  INTEGER, PARAMETER :: dict_real_p = 10
104  INTEGER, PARAMETER :: dict_int_p = 11
105  INTEGER, PARAMETER :: dict_real_fived = 12
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
119 ! Type of the mold, which holds all the data
120 #define TYPE_DICT_MOLD CHARACTER(LEN=1), DIMENSION(:)
121  ! common data structure
122  type_dict_mold, ALLOCATABLE :: mold
123  TYPE dict_typ
124  PRIVATE
125  CHARACTER(LEN=MAX_CHAR_LEN) :: key = ""
126  INTEGER :: type = dict_none
127  type_dict_mold, POINTER :: value => null()
128  TYPE(dict_typ), POINTER :: child => null()
129  TYPE(dict_typ), POINTER :: next => null()
130  END TYPE dict_typ
131  TYPE real_t
132  type_dict_real_p :: p
133  END TYPE
134  TYPE int_t
135  type_dict_int_p :: p
136  END TYPE
138  type_dict_real_twod :: p
139  END TYPE
141  type_dict_real_threed :: p
142  END TYPE
144  type_dict_real_fourd :: p
145  END TYPE
147  type_dict_real_fived :: p
148  END TYPE
149  TYPE(logging_base), SAVE :: this
150  !--------------------------------------------------------------------------!
151  PUBLIC :: &
152  ! types
153  dict_typ, real_t, int_t, &
154  ! constants
158  ! methods
159  setattr, &
160  getattr, &
161  getnext, &
162  getchild, &
163  getkey, &
164  getdatasize, &
165  getdatatype, &
166  getdata, &
167  setdata, &
168  haschild, &
169  hasdata, &
170  haskey, &
171  ref, &
172  OPERATOR(/), &
173  dict, &
174  copyhierarchy, &
175  copydict, &
176  printdict, &
177  initdict, &
178  closedict, &
179  deletedict
180  !--------------------------------------------------------------------------!
181 
182 CONTAINS
183  SUBROUTINE initdict()
184  IMPLICIT NONE
185  !------------------------------------------------------------------------!
186  IF (.NOT.ALLOCATED(mold)) ALLOCATE(mold(1))
187  END SUBROUTINE initdict
188 
189 
190  SUBROUTINE closedict()
191  IMPLICIT NONE
192  !------------------------------------------------------------------------!
193  IF (ALLOCATED(mold)) DEALLOCATE(mold)
194  END SUBROUTINE closedict
195 
196 
201  FUNCTION findpath(root, key, create) RESULT(res)
202  IMPLICIT NONE
203  !------------------------------------------------------------------------!
204  TYPE(dict_typ),POINTER :: root
205  CHARACTER(LEN=*) :: key
206  LOGICAL, OPTIONAL :: create
207  TYPE(dict_typ),POINTER :: res
208  !------------------------------------------------------------------------!
209  TYPE(dict_typ),POINTER :: parent,node
210  LOGICAL :: c
211  type_dict_char :: k, key_
212  !------------------------------------------------------------------------!
213  INTENT(IN) :: key, create
214  !------------------------------------------------------------------------!
215  c = .false.
216  IF(PRESENT(create)) &
217  c = create
218  key_ = trim(key)
219  NULLIFY(parent)
220  node => root
221  k = tokenize(key_)
222  DO WHILE(len_trim(k).GT.0)
223  node => findchild(node,trim(k))
224  IF(ASSOCIATED(node)) THEN
225  parent => node
226  node => node%child
227  ELSE
228  IF(c) THEN
229  ALLOCATE(node)
230  node%key = k
231  IF(ASSOCIATED(parent)) THEN
232  IF(ASSOCIATED(parent%child)) THEN
233  parent => getlast(parent%child)
234  parent%next => node
235  ELSE
236  parent%child => node
237  END IF
238  ELSE
239  IF(ASSOCIATED(root)) THEN
240  parent => getlast(root)
241  parent%next => node
242  ELSE
243  root => node
244  END IF
245  END IF
246  parent => node
247  ELSE
248  NULLIFY(parent)
249  k = ''
250  key_ = ''
251  END IF
252  END IF
253  k = tokenize(key_)
254  END DO
255  res => parent
256 
257  IF(c.EQV..true..AND..NOT.ASSOCIATED(res)) &
258  CALL this%Error("FindPath","Create was activated, so res should be associated.")
259  END FUNCTION findpath
260 
263  RECURSIVE SUBROUTINE setattr0a(root, key, value)
264  IMPLICIT NONE
265  !------------------------------------------------------------------------!
266  TYPE(dict_typ), POINTER :: root
267  CHARACTER(LEN=*) :: key
268  TYPE(dict_typ), TARGET :: value
269  !------------------------------------------------------------------------!
270  TYPE(dict_typ), POINTER :: node, parent
271  type_dict_char :: k
272  !------------------------------------------------------------------------!
273  INTENT(IN) :: key
274  !------------------------------------------------------------------------!
275  node => value
276  DO WHILE(ASSOCIATED(node))
277  WRITE(k,'(A,A,A)') trim(key),'/',trim(node%key)
278  parent => node
279 
280  IF(ASSOCIATED(node%child)) THEN
281  CALL setattr0a(root, trim(k), node%child)
282  ELSE
283  CALL setattr0b(root, trim(k), node%value, node%type)
284  END IF
285  node => node%next
286  CALL deletenode(parent,k)
287  END DO
288  END SUBROUTINE setattr0a
289 
292  SUBROUTINE setattr0b(root, key, value, type)
293  IMPLICIT NONE
294  !------------------------------------------------------------------------!
295  TYPE(Dict_TYP),POINTER :: root
296  CHARACTER(LEN=*) :: key
297  INTEGER :: type
298  type_dict_mold :: value
299  !------------------------------------------------------------------------!
300  TYPE(Dict_TYP),POINTER :: node
301  !------------------------------------------------------------------------!
302  INTENT(IN) :: key, type, value
303  !------------------------------------------------------------------------!
304  node => findpath(root,key,.true.)
305  node%type = type
306  CALL setdata(node,value)
307  END SUBROUTINE setattr0b
308 
312  SUBROUTINE getattr0a(root, key, parent)
313  IMPLICIT NONE
314  !------------------------------------------------------------------------!
315  TYPE(Dict_TYP),POINTER :: root, parent, child
316  CHARACTER(LEN=*) :: key
317  !------------------------------------------------------------------------!
318  type_dict_char :: k, key_
319  !------------------------------------------------------------------------!
320  INTENT(IN) :: key
321  !------------------------------------------------------------------------!
322  parent => root
323  child => root
324  key_ = trim(key)
325  DO WHILE(ASSOCIATED(child).AND.len_trim(key_).GT.0)
326  k = tokenize(key_)
327  parent => findchild(child,k)
328  IF(ASSOCIATED(parent)) &
329  child => parent%child
330  END DO
331  IF(len_trim(key_).GT.0) &
332  NULLIFY(parent)
333  END SUBROUTINE getattr0a
334 
339  SUBROUTINE getattr0b(root, key, type, value, default)
340  IMPLICIT NONE
341  !------------------------------------------------------------------------!
342  TYPE(Dict_TYP), POINTER :: root
343  CHARACTER(LEN=*) :: key
344  INTEGER :: type
345  type_dict_mold, POINTER :: value
346  type_dict_mold, OPTIONAL :: default
347  !------------------------------------------------------------------------!
348  TYPE(Dict_TYP), POINTER :: node
349  CHARACTER(LEN=10) :: b1,b2
350  !------------------------------------------------------------------------!
351  INTENT(IN) :: key, type, default
352  !------------------------------------------------------------------------!
353  CALL getattr0a(root, key, node)
354  IF(.NOT.ASSOCIATED(node)) THEN
355  IF(PRESENT(default)) THEN
356  CALL setattr0b(root,key,default,type)
357  CALL getattr0a(root, key, node)
358  IF(.NOT.ASSOCIATED(node)) &
359  CALL this%Error("GetAttr", "Setting a default value has gone wrong.")
360  ELSE
361  CALL this%Error("GetAttr", "Couldn't find key '"//trim(key)//"'.")
362  END IF
363  END IF
364  IF(type.NE.node%type) THEN
365  WRITE(b1,"(I4.4)") node%type
366  WRITE(b2,"(I4.4)") type
367  CALL this%Error("GetAttr", "Key '"//trim(key)//"' is of type "//trim(b1) &
368  //", but type "//trim(b2)//" requested.")
369  END IF
370  value => node%value
371  END SUBROUTINE getattr0b
372 
375  FUNCTION findchild(root,key) RESULT(res)
376  IMPLICIT NONE
377  !------------------------------------------------------------------------!
378  CHARACTER(LEN=*), INTENT(IN) :: key
379  TYPE(dict_typ), POINTER :: root,res
380  !------------------------------------------------------------------------!
381  res => root
382  DO WHILE(ASSOCIATED(res))
383  IF(trim(res%key).EQ.trim(key)) EXIT
384  res => res%next
385  END DO
386  END FUNCTION findchild
387 
389  FUNCTION getnext(root) RESULT(res)
390  IMPLICIT NONE
391  !------------------------------------------------------------------------!
392  TYPE(dict_typ), POINTER :: root, res
393  !------------------------------------------------------------------------!
394  res => root%next
395  END FUNCTION getnext
396 
398  FUNCTION getlast(root) RESULT(res)
399  IMPLICIT NONE
400  !------------------------------------------------------------------------!
401  TYPE(dict_typ), POINTER :: root, res
402  !------------------------------------------------------------------------!
403  res => root
404  IF(ASSOCIATED(res)) THEN
405  DO WHILE(ASSOCIATED(res%next))
406  res => res%next
407  END DO
408  END IF
409  END FUNCTION getlast
410 
412  FUNCTION getchild(root) RESULT(res)
413  IMPLICIT NONE
414  !------------------------------------------------------------------------!
415  TYPE(dict_typ), POINTER :: root, res
416  !------------------------------------------------------------------------!
417  res => root%child
418  END FUNCTION getchild
419 
421  FUNCTION getkey(root) RESULT(res)
422  IMPLICIT NONE
423  !------------------------------------------------------------------------!
424  TYPE(dict_typ), POINTER :: root
425  type_dict_char :: res
426  !------------------------------------------------------------------------!
427  res = root%key
428  END FUNCTION getkey
429 
433  FUNCTION getdatasize(root) RESULT(res)
434  IMPLICIT NONE
435  !------------------------------------------------------------------------!
436  TYPE(dict_typ), POINTER :: root
437  INTEGER :: res
438  !------------------------------------------------------------------------!
439  IF(ASSOCIATED(root%value)) THEN
440  res = SIZE(root%value)
441  ELSE
442  res = 0
443  END IF
444  END FUNCTION getdatasize
445 
447  FUNCTION getdatatype(root) RESULT(res)
448  IMPLICIT NONE
449  !------------------------------------------------------------------------!
450  TYPE(dict_typ), POINTER :: root
451  INTEGER :: res
452  !------------------------------------------------------------------------!
453  res = root%type
454  END FUNCTION getdatatype
455 
457  FUNCTION getdata(root) RESULT(res)
458  IMPLICIT NONE
459  !------------------------------------------------------------------------!
460  TYPE(dict_typ), POINTER :: root
461  type_dict_mold, POINTER :: res
462  !------------------------------------------------------------------------!
463  res => root%value
464  END FUNCTION getdata
465 
467  FUNCTION haschild(root) RESULT(res)
468  IMPLICIT NONE
469  !------------------------------------------------------------------------!
470  TYPE(dict_typ), POINTER :: root
471  LOGICAL :: res
472  !------------------------------------------------------------------------!
473  res = ASSOCIATED(root%child)
474  END FUNCTION haschild
475 
477  FUNCTION hasdata(root) RESULT(res)
478  IMPLICIT NONE
479  !------------------------------------------------------------------------!
480  TYPE(dict_typ), POINTER :: root
481  LOGICAL :: res
482  !------------------------------------------------------------------------!
483  res = ASSOCIATED(root%value)
484  END FUNCTION hasdata
485 
487  FUNCTION haskey(root, key) RESULT(res)
488  IMPLICIT NONE
489  !------------------------------------------------------------------------!
490  TYPE(dict_typ), POINTER :: root
491  CHARACTER(LEN=*) :: key
492  LOGICAL :: res
493  !------------------------------------------------------------------------!
494  res = ASSOCIATED(findpath(root,trim(key)))
495  END FUNCTION haskey
496 
498  SUBROUTINE setdata(node, val)
499  IMPLICIT NONE
500  !------------------------------------------------------------------------!
501  TYPE(dict_typ), POINTER :: node
502  type_dict_mold :: val
503  !------------------------------------------------------------------------!
504  INTENT(IN) :: val
505  !------------------------------------------------------------------------!
506  IF(SIZE(val).LE.0) &
507  CALL this%Error("SetData", "Array size smaller 0 is not possible.")
508  IF(ASSOCIATED(node%value)) &
509  DEALLOCATE(node%value)
510  ALLOCATE(node%value(SIZE(val)))
511  node%value = val
512  END SUBROUTINE setdata
513 
517  FUNCTION tokenize(key,back) RESULT(res)
518  IMPLICIT NONE
519  !------------------------------------------------------------------------!
520  CHARACTER(LEN=MAX_CHAR_LEN) :: key
521  LOGICAL,OPTIONAL :: back
522  type_dict_char :: res
523  !------------------------------------------------------------------------!
524  LOGICAL :: back_
525  INTEGER :: i
526  !------------------------------------------------------------------------!
527  INTENT(IN) :: back
528  INTENT(INOUT) :: key
529  !------------------------------------------------------------------------!
530  IF(PRESENT(back)) THEN
531  back_ = back
532  ELSE
533  back_ = .false.
534  END IF
535  res = ''
536  IF(key(1:1).EQ.'/') key = key(2:)
537  i = scan(key,'/',back_)
538  IF(i.GT.0) THEN
539  IF(.NOT.back_) THEN
540  res = key(1:i-1)
541  key = key(i+1:)
542  ELSE
543  res = key(i+1:)
544  key = key(1:i-1)
545  END IF
546  ELSE
547  res = key
548  key = ''
549  END IF
550  END FUNCTION tokenize
551 
557  FUNCTION dict(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,&
558  n18,n19,n20) RESULT(res)
559  IMPLICIT NONE
560  !------------------------------------------------------------------------!
561  TYPE(dict_typ), POINTER :: res,n1
562  TYPE(dict_typ), POINTER, OPTIONAL :: n2,n3,n4,n5,n6,n7,n8,n9,n10,n11, &
563  n12,n13,n14,n15,n16,n17,n18,n19,n20
564  !------------------------------------------------------------------------!
565  NULLIFY(res)
566  CALL setattr0a(res,'',n1)
567  IF(PRESENT( n2)) CALL setattr0a(res,'', n2)
568  IF(PRESENT( n3)) CALL setattr0a(res,'', n3)
569  IF(PRESENT( n4)) CALL setattr0a(res,'', n4)
570  IF(PRESENT( n5)) CALL setattr0a(res,'', n5)
571  IF(PRESENT( n6)) CALL setattr0a(res,'', n6)
572  IF(PRESENT( n7)) CALL setattr0a(res,'', n7)
573  IF(PRESENT( n8)) CALL setattr0a(res,'', n8)
574  IF(PRESENT( n9)) CALL setattr0a(res,'', n9)
575  IF(PRESENT(n10)) CALL setattr0a(res,'',n10)
576  IF(PRESENT(n11)) CALL setattr0a(res,'',n11)
577  IF(PRESENT(n12)) CALL setattr0a(res,'',n12)
578  IF(PRESENT(n13)) CALL setattr0a(res,'',n13)
579  IF(PRESENT(n14)) CALL setattr0a(res,'',n14)
580  IF(PRESENT(n15)) CALL setattr0a(res,'',n15)
581  IF(PRESENT(n16)) CALL setattr0a(res,'',n16)
582  IF(PRESENT(n17)) CALL setattr0a(res,'',n17)
583  IF(PRESENT(n18)) CALL setattr0a(res,'',n18)
584  IF(PRESENT(n19)) CALL setattr0a(res,'',n19)
585  IF(PRESENT(n20)) CALL setattr0a(res,'',n20)
586  END FUNCTION dict
587 
588  SUBROUTINE setattr1(root, key, val)
589  IMPLICIT NONE
590  !------------------------------------------------------------------------!
591  TYPE(Dict_TYP), POINTER :: root
592  CHARACTER(LEN=*) :: key
593  type_dict_int :: val
594  !------------------------------------------------------------------------!
595  INTENT(IN) :: key, val
596  !------------------------------------------------------------------------!
597  CALL setattr0b(root,key,transfer(val,mold),dict_int)
598  END SUBROUTINE setattr1
599 
600  SUBROUTINE setattr2(root, key, val)
601  IMPLICIT NONE
602  !------------------------------------------------------------------------!
603  TYPE(Dict_TYP), POINTER :: root
604  CHARACTER(LEN=*) :: key
605  type_dict_real :: val
606  !------------------------------------------------------------------------!
607  INTENT(IN) :: key, val
608  !------------------------------------------------------------------------!
609  CALL setattr0b(root,key,transfer(val,mold),dict_real)
610  END SUBROUTINE setattr2
611 
612  SUBROUTINE setattr3(root, key, val)
613  IMPLICIT NONE
614  !------------------------------------------------------------------------!
615  TYPE(Dict_TYP), POINTER :: root
616  CHARACTER(LEN=*) :: key, val
617  type_dict_char :: val_
618  !------------------------------------------------------------------------!
619  INTENT(IN) :: key, val
620  !------------------------------------------------------------------------!
621  val_ = trim(val)
622  CALL setattr0b(root,key,transfer(val_,mold),dict_char)
623  END SUBROUTINE setattr3
624 
625  SUBROUTINE setattr4(root, key, val)
626  IMPLICIT NONE
627  !------------------------------------------------------------------------!
628  TYPE(Dict_TYP), POINTER :: root
629  CHARACTER(LEN=*) :: key
630  type_dict_bool :: val
631  !------------------------------------------------------------------------!
632  INTENT(IN) :: key, val
633  !------------------------------------------------------------------------!
634  CALL setattr0b(root,key,transfer(val,mold),dict_bool)
635  END SUBROUTINE setattr4
636 
637  SUBROUTINE setattr5(root, key, val)
638  IMPLICIT NONE
639  !------------------------------------------------------------------------!
640  TYPE(Dict_TYP), POINTER :: root
641  CHARACTER(LEN=*) :: key
642  type_dict_real_oned :: val
643  !------------------------------------------------------------------------!
644  INTENT(IN) :: key, val
645  !------------------------------------------------------------------------!
646  CALL setattr0b(root,key,transfer(val,mold),dict_real_oned)
647  END SUBROUTINE setattr5
648 
649  SUBROUTINE setattr6(root, key, val)
650  IMPLICIT NONE
651  !------------------------------------------------------------------------!
652  TYPE(Dict_TYP), POINTER :: root
653  CHARACTER(LEN=*) :: key
654  REAL, DIMENSION(:,:), TARGET :: val
655  TYPE(real_twod_t) :: c
656  !------------------------------------------------------------------------!
657  INTENT(IN) :: key,val
658  !------------------------------------------------------------------------!
659  c%p => val
660  CALL setattr0b(root,key,transfer(c,mold),dict_real_twod)
661  END SUBROUTINE setattr6
662 
663  SUBROUTINE setattr7(root, key, val)
664  IMPLICIT NONE
665  !------------------------------------------------------------------------!
666  TYPE(Dict_TYP), POINTER :: root
667  CHARACTER(LEN=*) :: key
668  REAL, DIMENSION(:,:,:), TARGET :: val
669  TYPE(real_threed_t) :: c
670  !------------------------------------------------------------------------!
671  INTENT(IN) :: key, val
672  !------------------------------------------------------------------------!
673  c%p => val
674  CALL setattr0b(root,key,transfer(c,mold),dict_real_threed)
675  END SUBROUTINE setattr7
676 
677  SUBROUTINE setattr8(root, key, val)
678  IMPLICIT NONE
679  !------------------------------------------------------------------------!
680  TYPE(Dict_TYP), POINTER :: root
681  CHARACTER(LEN=*) :: key
682  REAL, DIMENSION(:,:,:,:), TARGET :: val
683  TYPE(real_fourd_t) :: c
684  !------------------------------------------------------------------------!
685  INTENT(IN) :: key, val
686  !------------------------------------------------------------------------!
687  c%p => val
688  CALL setattr0b(root,key,transfer(c,mold),dict_real_fourd)
689  END SUBROUTINE setattr8
690 
691  SUBROUTINE setattr9(root, key, val)
692  IMPLICIT NONE
693  !------------------------------------------------------------------------!
694  TYPE(Dict_TYP), POINTER :: root
695  CHARACTER(LEN=*) :: key
696  type_dict_int_oned :: val
697  !------------------------------------------------------------------------!
698  INTENT(IN) :: key, val
699  !------------------------------------------------------------------------!
700  CALL setattr0b(root,key,transfer(val,mold),dict_int_oned)
701  END SUBROUTINE setattr9
702 
703  SUBROUTINE setattr10(root, key, val)
704  IMPLICIT NONE
705  !------------------------------------------------------------------------!
706  TYPE(Dict_TYP), POINTER :: root
707  CHARACTER(LEN=*) :: key
708  TYPE(real_t) :: val
709  !------------------------------------------------------------------------!
710  INTENT(IN) :: key, val
711  !------------------------------------------------------------------------!
712  CALL setattr0b(root,key,transfer(val,mold),dict_real_p)
713  END SUBROUTINE setattr10
714 
715  SUBROUTINE setattr11(root, key, val)
716  IMPLICIT NONE
717  !------------------------------------------------------------------------!
718  TYPE(Dict_TYP), POINTER :: root
719  CHARACTER(LEN=*) :: key
720  TYPE(int_t) :: val
721  !------------------------------------------------------------------------!
722  INTENT(IN) :: key, val
723  !------------------------------------------------------------------------!
724  CALL setattr0b(root,key,transfer(val,mold),dict_int_p)
725  END SUBROUTINE setattr11
726 
727  SUBROUTINE setattr12(root, key, val)
728  IMPLICIT NONE
729  !------------------------------------------------------------------------!
730  TYPE(Dict_TYP), POINTER :: root
731  CHARACTER(LEN=*) :: key
732  REAL, DIMENSION(:,:,:,:,:), TARGET :: val
733  TYPE(real_fived_t) :: c
734  !------------------------------------------------------------------------!
735  INTENT(IN) :: key, val
736  !------------------------------------------------------------------------!
737  c%p => val
738  CALL setattr0b(root,key,transfer(c,mold),dict_real_fived)
739  END SUBROUTINE setattr12
740 
741  RECURSIVE SUBROUTINE printdict(root, prefix)
742  IMPLICIT NONE
743  !------------------------------------------------------------------------!
744  TYPE(dict_typ), TARGET ::root
745  CHARACTER(LEN=*), OPTIONAL :: prefix
746  !------------------------------------------------------------------------!
747  TYPE(dict_typ), POINTER :: node
748  type_dict_char :: prefix_
749  type_dict_char :: s,str
750  !------------------------------------------------------------------------!
751  node => root
752  prefix_ = ''
753  IF(PRESENT(prefix)) &
754  prefix_ = trim(prefix)
755  DO WHILE(ASSOCIATED(node))
756  WRITE(s,'(A,A,A)') trim(prefix_),'/',trim(node%key)
757  IF(ASSOCIATED(node%value)) THEN
758  WRITE(str,'(A,I2,A,A,A,I4)') "type=",node%type,", key=",trim(s),&
759  ", size=",SIZE(node%value)
760  ELSE
761  WRITE(str,'(A,I2,A,A)') "type=",node%type,", key=",trim(s)
762  END IF
763  CALL this%Info(str)
764  IF(ASSOCIATED(node%child)) &
765  CALL printdict(node%child, s)
766  node => node%next
767  END DO
768  END SUBROUTINE printdict
769 
771  RECURSIVE SUBROUTINE copydict(root, outdir)
772  IMPLICIT NONE
773  !------------------------------------------------------------------------!
774  TYPE(dict_typ), POINTER :: root, outdir, dir, odir, tmp
775  !------------------------------------------------------------------------!
776  dir => root
777  NULLIFY(outdir)
778  NULLIFY(odir)
779  DO WHILE(ASSOCIATED(dir))
780  IF(ASSOCIATED(odir)) THEN
781  ALLOCATE(odir%next)
782  odir => odir%next
783  ELSE
784  ALLOCATE(odir)
785  outdir => odir
786  END IF
787  odir%type = dir%type
788  odir%key = dir%key
789  IF(ASSOCIATED(dir%value)) THEN
790  CALL setdata(odir,dir%value)
791  END IF
792 
793  IF(ASSOCIATED(dir%child)) THEN
794  CALL copydict(dir%child, tmp)
795  odir%child => tmp
796  END IF
797  dir => dir%next
798  END DO
799  END SUBROUTINE copydict
800 
801 
803  RECURSIVE SUBROUTINE copyhierarchy(root, outdir)
804  IMPLICIT NONE
805  !------------------------------------------------------------------------!
806  TYPE(dict_typ), POINTER :: root, outdir, dir, odir
807  !------------------------------------------------------------------------!
808  dir => root
809  NULLIFY(outdir)
810  NULLIFY(odir)
811  DO WHILE(ASSOCIATED(dir))
812  IF(ASSOCIATED(dir%child)) THEN
813  IF(ASSOCIATED(odir)) THEN
814  ALLOCATE(odir%next)
815  odir => odir%next
816  ELSE
817  ALLOCATE(odir)
818  outdir => odir
819  END IF
820  odir%key = dir%key
821  CALL copyhierarchy(dir%child,odir%child)
822  END IF
823  dir => dir%next
824  END DO
825  END SUBROUTINE copyhierarchy
826 
829  SUBROUTINE getattr0(root, key, res)
830  IMPLICIT NONE
831  !------------------------------------------------------------------------!
832  TYPE(Dict_TYP), POINTER :: root, res
833  CHARACTER(LEN=*) :: key
834  !------------------------------------------------------------------------!
835  INTENT(IN) :: key
836  !------------------------------------------------------------------------!
837  CALL getattr0a(root, key, res)
838  IF(ASSOCIATED(res)) THEN
839  IF(.NOT.hasdata(res).AND.haschild(res)) THEN
840  res => res%child
841  END IF
842  END IF
843  END SUBROUTINE getattr0
844 
845  SUBROUTINE getattr1(root, key, res, default)
846  IMPLICIT NONE
847  !------------------------------------------------------------------------!
848  TYPE(Dict_TYP), POINTER :: root
849  type_dict_int :: res
850  type_dict_int, OPTIONAL :: default
851  CHARACTER(LEN=*) :: key
852  !------------------------------------------------------------------------!
853  type_dict_mold, POINTER :: value
854  !------------------------------------------------------------------------!
855  INTENT(IN) :: key, default
856  INTENT(INOUT) :: res
857  !------------------------------------------------------------------------!
858  IF(PRESENT(default)) THEN
859  CALL getattr0b(root, key, dict_int, value, transfer(default,mold))
860  ELSE
861  CALL getattr0b(root, key, dict_int, value)
862  END IF
863  res = transfer(value,res)
864  END SUBROUTINE getattr1
865 
866  SUBROUTINE getattr2(root, key, res, default)
867  IMPLICIT NONE
868  !------------------------------------------------------------------------!
869  TYPE(Dict_TYP), POINTER :: root
870  type_dict_real :: res
871  type_dict_real, OPTIONAL :: default
872  CHARACTER(LEN=*) :: key
873  !------------------------------------------------------------------------!
874  type_dict_mold, POINTER :: value
875  !------------------------------------------------------------------------!
876  INTENT(IN) :: key, default
877  INTENT(INOUT) :: res
878  !------------------------------------------------------------------------!
879  IF(PRESENT(default)) THEN
880  CALL getattr0b(root, key, dict_real, value, transfer(default,mold))
881  ELSE
882  CALL getattr0b(root, key, dict_real, value)
883  END IF
884  res = transfer(value,res)
885  END SUBROUTINE getattr2
886 
887  SUBROUTINE getattr3(root, key, res, default)
888  IMPLICIT NONE
889  !------------------------------------------------------------------------!
890  TYPE(Dict_TYP), POINTER :: root
891  type_dict_char :: res
892  type_dict_char, OPTIONAL :: default
893  CHARACTER(LEN=*) :: key
894  !------------------------------------------------------------------------!
895  type_dict_mold, POINTER :: value
896  !------------------------------------------------------------------------!
897  INTENT(IN) :: key
898  INTENT(INOUT) :: res
899  !------------------------------------------------------------------------!
900  IF(PRESENT(default)) THEN
901  CALL getattr0b(root, key, dict_char, value, transfer(default,mold))
902  ELSE
903  CALL getattr0b(root, key, dict_char, value)
904  END IF
905  res = transfer(value,res)
906  END SUBROUTINE getattr3
907 
908  SUBROUTINE getattr4(root, key, res, default)
909  IMPLICIT NONE
910  !------------------------------------------------------------------------!
911  TYPE(Dict_TYP), POINTER :: root
912  type_dict_bool :: res
913  type_dict_bool, OPTIONAL :: default
914  CHARACTER(LEN=*) :: key
915  !------------------------------------------------------------------------!
916  type_dict_mold, POINTER :: value
917  !------------------------------------------------------------------------!
918  INTENT(IN) :: key
919  INTENT(INOUT) :: res
920  !------------------------------------------------------------------------!
921  IF(PRESENT(default)) THEN
922  CALL getattr0b(root, key, dict_bool, value, transfer(default,mold))
923  ELSE
924  CALL getattr0b(root, key, dict_bool, value)
925  END IF
926  res = transfer(value,res)
927  END SUBROUTINE getattr4
928 
929  SUBROUTINE getattr5(root, key, res, default)
930  IMPLICIT NONE
931  !------------------------------------------------------------------------!
932  TYPE(Dict_TYP), POINTER :: root
933  type_dict_real_oned :: res
934  type_dict_real_oned, OPTIONAL :: default
935  CHARACTER(LEN=*) :: key
936  !------------------------------------------------------------------------!
937  type_dict_mold, POINTER :: value
938  !------------------------------------------------------------------------!
939  INTENT(IN) :: key
940  INTENT(INOUT) :: res
941  !------------------------------------------------------------------------!
942  IF(PRESENT(default)) THEN
943  CALL getattr0b(root, key, dict_real_oned, value, transfer(default,mold))
944  ELSE
945  CALL getattr0b(root, key, dict_real_oned, value)
946  END IF
947  IF(SIZE(transfer(value,res)).NE.SIZE(res)) &
948  CALL this%Error("GetAttr5","1D array with key '" // trim(key) &
949  // "' has the wrong size.")
950 
951  res = transfer(value,res)
952  END SUBROUTINE getattr5
953 
954  SUBROUTINE getattr6(root, key, res, default)
955  IMPLICIT NONE
956  !------------------------------------------------------------------------!
957  TYPE(Dict_TYP), POINTER :: root
958  type_dict_real_twod :: res
959  type_dict_real_twod, OPTIONAL :: default
960  CHARACTER(LEN=*) :: key
961  !------------------------------------------------------------------------!
962  type_dict_mold, POINTER :: value
963  TYPE(real_twod_t) :: c
964  !------------------------------------------------------------------------!
965  INTENT(IN) :: key
966  !------------------------------------------------------------------------!
967  IF(PRESENT(default)) THEN
968  c%p => default
969  CALL getattr0b(root, key, dict_real_twod, value, transfer(c,mold))
970  ELSE
971  CALL getattr0b(root, key, dict_real_twod, value)
972  END IF
973  c = transfer(value,c)
974  res => c%p
975  END SUBROUTINE getattr6
976 
977  SUBROUTINE getattr7(root, key, res, default)
978  IMPLICIT NONE
979  !------------------------------------------------------------------------!
980  TYPE(Dict_TYP), POINTER :: root
981  type_dict_real_threed :: res
982  type_dict_real_threed, OPTIONAL :: default
983  CHARACTER(LEN=*) :: key
984  !------------------------------------------------------------------------!
985  type_dict_mold, POINTER :: value
986  TYPE(real_threed_t) :: c
987  !------------------------------------------------------------------------!
988  INTENT(IN) :: key
989  !------------------------------------------------------------------------!
990  IF(PRESENT(default)) THEN
991  c%p => default
992  CALL getattr0b(root, key, dict_real_threed, value, transfer(c,mold))
993  ELSE
994  CALL getattr0b(root, key, dict_real_threed, value)
995  END IF
996  c = transfer(value,c)
997  res => c%p
998  END SUBROUTINE getattr7
999 
1000  SUBROUTINE getattr8(root, key, res, default)
1001  IMPLICIT NONE
1002  !------------------------------------------------------------------------!
1003  TYPE(Dict_TYP), POINTER :: root
1004  type_dict_real_fourd :: res
1005  type_dict_real_fourd, OPTIONAL :: default
1006  CHARACTER(LEN=*) :: key
1007  !------------------------------------------------------------------------!
1008  type_dict_mold, POINTER :: value
1009  TYPE(real_fourd_t) :: c
1010  !------------------------------------------------------------------------!
1011  INTENT(IN) :: key
1012  !------------------------------------------------------------------------!
1013  IF(PRESENT(default)) THEN
1014  c%p => default
1015  CALL getattr0b(root, key, dict_real_fourd, value, transfer(c,mold))
1016  ELSE
1017  CALL getattr0b(root, key, dict_real_fourd, value)
1018  END IF
1019  c = transfer(value,c)
1020  res => c%p
1021  END SUBROUTINE getattr8
1022 
1023  SUBROUTINE getattr9(root, key, res, default)
1024  IMPLICIT NONE
1025  !------------------------------------------------------------------------!
1026  TYPE(Dict_TYP), POINTER :: root
1027  type_dict_int_oned :: res
1028  type_dict_int_oned, OPTIONAL :: default
1029  CHARACTER(LEN=*) :: key
1030  !------------------------------------------------------------------------!
1031  type_dict_mold, POINTER :: value
1032  !------------------------------------------------------------------------!
1033  INTENT(IN) :: key
1034  INTENT(INOUT) :: res
1035  !------------------------------------------------------------------------!
1036  IF(PRESENT(default)) THEN
1037  CALL getattr0b(root, key, dict_int_oned, value, transfer(default,mold))
1038  ELSE
1039  CALL getattr0b(root, key, dict_int_oned, value)
1040  END IF
1041  res = transfer(value,res)
1042  END SUBROUTINE getattr9
1043 
1044  SUBROUTINE getattr10(root, key, res, default)
1045  IMPLICIT NONE
1046  !------------------------------------------------------------------------!
1047  TYPE(Dict_TYP), POINTER :: root
1048  TYPE(real_t) :: res
1049  TYPE(real_t), OPTIONAL :: default
1050  CHARACTER(LEN=*) :: key
1051  !------------------------------------------------------------------------!
1052  type_dict_mold, POINTER :: value
1053  !------------------------------------------------------------------------!
1054  INTENT(IN) :: key
1055  !------------------------------------------------------------------------!
1056  IF(PRESENT(default)) THEN
1057  CALL getattr0b(root, key, dict_real_p, value, transfer(default,mold))
1058  ELSE
1059  CALL getattr0b(root, key, dict_real_p, value)
1060  END IF
1061  res = transfer(value,res)
1062  END SUBROUTINE getattr10
1063 
1064  SUBROUTINE getattr11(root, key, res, default)
1065  IMPLICIT NONE
1066  !------------------------------------------------------------------------!
1067  TYPE(Dict_TYP), POINTER :: root
1068  TYPE(int_t) :: res
1069  TYPE(int_t), OPTIONAL :: default
1070  CHARACTER(LEN=*) :: key
1071  !------------------------------------------------------------------------!
1072  type_dict_mold, POINTER :: value
1073  !------------------------------------------------------------------------!
1074  INTENT(IN) :: key
1075  !------------------------------------------------------------------------!
1076  IF(PRESENT(default)) THEN
1077  CALL getattr0b(root, key, dict_int_p, value, transfer(default,mold))
1078  ELSE
1079  CALL getattr0b(root, key, dict_int_p, value)
1080  END IF
1081  res = transfer(value,res)
1082  END SUBROUTINE getattr11
1083 
1084  SUBROUTINE getattr12(root, key, res, default)
1085  IMPLICIT NONE
1086  !------------------------------------------------------------------------!
1087  TYPE(Dict_TYP), POINTER :: root
1088  type_dict_real_fived :: res
1089  type_dict_real_fived, OPTIONAL :: default
1090  CHARACTER(LEN=*) :: key
1091  !------------------------------------------------------------------------!
1092  type_dict_mold, POINTER :: value
1093  TYPE(real_fived_t) :: c
1094  !------------------------------------------------------------------------!
1095  INTENT(IN) :: key
1096  !------------------------------------------------------------------------!
1097  IF(PRESENT(default)) THEN
1098  c%p => default
1099  CALL getattr0b(root, key, dict_real_fived, value, transfer(c,mold))
1100  ELSE
1101  CALL getattr0b(root, key, dict_real_fived, value)
1102  END IF
1103  c = transfer(value,c)
1104  res => c%p
1105  END SUBROUTINE getattr12
1106 
1107  SUBROUTINE deletenode(node,k)
1108  IMPLICIT NONE
1109  !------------------------------------------------------------------------!
1110  TYPE(Dict_TYP), POINTER :: node
1111  CHARACTER(LEN=*) :: k
1112  LOGICAL, SAVE :: first=.true.
1113  !------------------------------------------------------------------------!
1114  INTEGER :: status
1115  CHARACTER(LEN=512) :: str
1116  !------------------------------------------------------------------------!
1117  NULLIFY(node%child,node%next)
1118  IF(ASSOCIATED(node%value)) &
1119  DEALLOCATE(node%value)
1120  DEALLOCATE(node,stat=status)
1121  IF(status.NE.0.AND.first) THEN
1122  ! This warning (no. 195) does occur on the SX ACE. The definite reason
1123  ! is unknown. It is probably related to deallocating a pointer, which
1124  ! has been associated to a TARGET subroutine parameter. But this cannot
1125  ! be change, since a TARGET instead of a POINTER is required for
1126  ! overloading the '/' operator.
1127  WRITE(str,'(A,A,A,I3)')&
1128  "Deallocating key '",trim(k),&
1129  "' throws the error nio.: ",status
1130  !CALL Warning(this,"SetAttr0a",TRIM(str))
1131  WRITE(str,'(A,A,A,I3)')&
1132  "More invocations of this error will be suppressed."
1133  !CALL Warning(this,"SetAttr0a",TRIM(str))
1134  first = .false.
1135  END IF
1136  END SUBROUTINE deletenode
1137 
1139  RECURSIVE SUBROUTINE deletedict(root)
1140  IMPLICIT NONE
1141  !------------------------------------------------------------------------!
1142  TYPE(dict_typ), POINTER :: root, node, next, child
1143  !------------------------------------------------------------------------!
1144  type_dict_char :: k
1145  !------------------------------------------------------------------------!
1146  node => root
1147  DO WHILE(ASSOCIATED(node))
1148  next => node%next
1149  child => node%child
1150  k = trim(node%key)
1151  CALL deletenode(node,trim(k))
1152  IF (ASSOCIATED(child)) &
1153  CALL deletedict(child)
1154  node => next
1155  END DO
1156  NULLIFY(root)
1157  END SUBROUTINE deletedict
1158 
1159  FUNCTION assign0(key, val) RESULT(res)
1160  IMPLICIT NONE
1161  !------------------------------------------------------------------------!
1162  TYPE(dict_typ), POINTER :: res
1163  CHARACTER(LEN=*) :: key
1164  TYPE(dict_typ), TARGET :: val
1165  !------------------------------------------------------------------------!
1166  INTENT(IN) :: key,val
1167  !------------------------------------------------------------------------!
1168  NULLIFY(res)
1169  CALL setattr(res, key, val)
1170  END FUNCTION assign0
1171 
1172  FUNCTION assign1(key, val) RESULT(res)
1173  IMPLICIT NONE
1174  !------------------------------------------------------------------------!
1175  TYPE(dict_typ), POINTER :: res
1176  CHARACTER(LEN=*) :: key
1177  type_dict_int :: val
1178  !------------------------------------------------------------------------!
1179  INTENT(IN) :: key, val
1180  !------------------------------------------------------------------------!
1181  NULLIFY(res)
1182  CALL setattr(res, key, val)
1183  END FUNCTION assign1
1184 
1185  FUNCTION assign2(key, val) RESULT(res)
1186  IMPLICIT NONE
1187  !------------------------------------------------------------------------!
1188  TYPE(dict_typ), POINTER :: res
1189  CHARACTER(LEN=*) :: key
1190  type_dict_real :: val
1191  !------------------------------------------------------------------------!
1192  INTENT(IN) :: key, val
1193  !------------------------------------------------------------------------!
1194  NULLIFY(res)
1195  CALL setattr(res, key, val)
1196  END FUNCTION assign2
1197 
1198  FUNCTION assign3(key, val) RESULT(res)
1199  IMPLICIT NONE
1200  !------------------------------------------------------------------------!
1201  TYPE(dict_typ), POINTER :: res
1202  CHARACTER(LEN=*) :: key, val
1203  !------------------------------------------------------------------------!
1204  INTENT(IN) :: key, val
1205  !------------------------------------------------------------------------!
1206  NULLIFY(res)
1207  CALL setattr(res, key, val)
1208  END FUNCTION assign3
1209 
1210  FUNCTION assign4(key, val) RESULT(res)
1211  IMPLICIT NONE
1212  !------------------------------------------------------------------------!
1213  TYPE(dict_typ), POINTER :: res
1214  CHARACTER(LEN=*) :: key
1215  type_dict_bool :: val
1216  !------------------------------------------------------------------------!
1217  INTENT(IN) :: key, val
1218  !------------------------------------------------------------------------!
1219  NULLIFY(res)
1220  CALL setattr(res, key, val)
1221  END FUNCTION assign4
1222 
1223  FUNCTION assign5(key, val) RESULT(res)
1224  IMPLICIT NONE
1225  !------------------------------------------------------------------------!
1226  TYPE(dict_typ), POINTER :: res
1227  CHARACTER(LEN=*) :: key
1228  type_dict_real_oned :: val
1229  !------------------------------------------------------------------------!
1230  INTENT(IN) :: key, val
1231  !------------------------------------------------------------------------!
1232  NULLIFY(res)
1233  CALL setattr(res, key, val)
1234  END FUNCTION assign5
1235 
1236  FUNCTION assign6(key, val) RESULT(res)
1237  IMPLICIT NONE
1238  !------------------------------------------------------------------------!
1239  TYPE(dict_typ), POINTER :: res
1240  CHARACTER(LEN=*) :: key
1241  REAL, DIMENSION(:,:), TARGET :: val
1242  !------------------------------------------------------------------------!
1243  INTENT(IN) :: key, val
1244  !------------------------------------------------------------------------!
1245  NULLIFY(res)
1246  CALL setattr(res, key, val)
1247  END FUNCTION assign6
1248 
1249  FUNCTION assign7(key, val) RESULT(res)
1250  IMPLICIT NONE
1251  !------------------------------------------------------------------------!
1252  TYPE(dict_typ), POINTER :: res
1253  CHARACTER(LEN=*) :: key
1254  REAL, DIMENSION(:,:,:), TARGET :: val
1255  !------------------------------------------------------------------------!
1256  INTENT(IN) :: key, val
1257  !------------------------------------------------------------------------!
1258  NULLIFY(res)
1259  CALL setattr(res, key, val)
1260  END FUNCTION assign7
1261 
1262  FUNCTION assign8(key, val) RESULT(res)
1263  IMPLICIT NONE
1264  !------------------------------------------------------------------------!
1265  TYPE(dict_typ), POINTER :: res
1266  CHARACTER(LEN=*) :: key
1267  REAL, DIMENSION(:,:,:,:), TARGET :: val
1268  !------------------------------------------------------------------------!
1269  INTENT(IN) :: key, val
1270  !------------------------------------------------------------------------!
1271  NULLIFY(res)
1272  CALL setattr(res, key, val)
1273  END FUNCTION assign8
1274 
1275  FUNCTION assign9(key, val) RESULT(res)
1276  IMPLICIT NONE
1277  !------------------------------------------------------------------------!
1278  TYPE(dict_typ), POINTER :: res
1279  CHARACTER(LEN=*) :: key
1280  type_dict_int_oned :: val
1281  !------------------------------------------------------------------------!
1282  INTENT(IN) :: key, val
1283  !------------------------------------------------------------------------!
1284  NULLIFY(res)
1285  CALL setattr(res, key, val)
1286  END FUNCTION assign9
1287 
1288  FUNCTION assign10(key, val) RESULT(res)
1289  IMPLICIT NONE
1290  !------------------------------------------------------------------------!
1291  TYPE(dict_typ), POINTER :: res
1292  CHARACTER(LEN=*) :: key
1293  TYPE(real_t) :: val
1294  !------------------------------------------------------------------------!
1295  INTENT(IN) :: key, val
1296  !------------------------------------------------------------------------!
1297  NULLIFY(res)
1298  CALL setattr(res, key, val)
1299  END FUNCTION assign10
1300 
1301  FUNCTION assign11(key, val) RESULT(res)
1302  IMPLICIT NONE
1303  !------------------------------------------------------------------------!
1304  TYPE(dict_typ), POINTER :: res
1305  CHARACTER(LEN=*) :: key
1306  TYPE(int_t) :: val
1307  !------------------------------------------------------------------------!
1308  INTENT(IN) :: key, val
1309  !------------------------------------------------------------------------!
1310  NULLIFY(res)
1311  CALL setattr(res, key, val)
1312  END FUNCTION assign11
1313 
1314  FUNCTION assign12(key, val) RESULT(res)
1315  IMPLICIT NONE
1316  !------------------------------------------------------------------------!
1317  TYPE(dict_typ), POINTER :: res
1318  CHARACTER(LEN=*) :: key
1319  REAL, DIMENSION(:,:,:,:,:), TARGET :: val
1320  !------------------------------------------------------------------------!
1321  INTENT(IN) :: key, val
1322  !------------------------------------------------------------------------!
1323  NULLIFY(res)
1324  CALL setattr(res, key, val)
1325  END FUNCTION assign12
1326 
1327  FUNCTION ref1(p) RESULT(res)
1328  IMPLICIT NONE
1329  !------------------------------------------------------------------------!
1330  type_dict_real_p :: p
1331  TYPE(real_t) :: res
1332  !------------------------------------------------------------------------!
1333  res%p => p
1334  END FUNCTION ref1
1335 
1336  FUNCTION ref2(p) RESULT(res)
1337  IMPLICIT NONE
1338  !------------------------------------------------------------------------!
1339  type_dict_int_p :: p
1340  TYPE(int_t) :: res
1341  !------------------------------------------------------------------------!
1342  res%p => p
1343  END FUNCTION ref2
1344 
1345 END MODULE common_dict
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...
type(dict_typ) function, pointer assign8(key, val)
recursive subroutine, public copydict(root, outdir)
Copy complete Dictionary.
type(int_t) function ref2(p)
subroutine getattr12(root, key, res, default)
type(logging_base), save this
type(dict_typ) function, pointer assign10(key, val)
type(dict_typ) function, pointer assign2(key, val)
type(real_t) function ref1(p)
recursive subroutine, public copyhierarchy(root, outdir)
Copy all nodes, which have children from &#39;root&#39; to &#39;outdir&#39;.
type(dict_typ) function, pointer, public getchild(root)
Get the pointer to a direct child of the pointer &#39;root&#39;.
integer function, public getdatatype(root)
Return the datatype of node &#39;root&#39;.
subroutine getattr9(root, key, res, default)
integer, parameter, public dict_real_oned
Definition: common_dict.f90:98
Basic fosite module.
common data structure
type(dict_typ) function, pointer assign3(key, val)
integer, parameter, public dict_none
Definition: common_dict.f90:93
subroutine getattr5(root, key, res, default)
integer, parameter, public dict_real_fourd
subroutine setattr8(root, key, val)
subroutine setattr5(root, key, val)
subroutine getattr10(root, key, res, default)
logical function, public haschild(root)
Check if the node &#39;root&#39; has one or more children.
subroutine getattr4(root, key, res, default)
integer, parameter, public dict_real_p
subroutine, public setdata(node, val)
Set data of &#39;node&#39; ot &#39;val&#39;.
subroutine getattr6(root, key, res, default)
integer, parameter, public dict_char
Definition: common_dict.f90:96
function, public getkey(root)
Get the key of pointer &#39;root&#39;.
subroutine getattr3(root, key, res, default)
subroutine getattr11(root, key, res, default)
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.
type(dict_typ) function, pointer findchild(root, key)
Find the direct child with key &#39;key&#39; in a list of childs. &#39;root&#39; points to the first child...
recursive subroutine, public printdict(root, prefix)
subroutine setattr1(root, key, val)
recursive subroutine setattr0a(root, key, value)
Set the dictionary &#39;value&#39; as child at the path &#39;key&#39; relative to &#39;root&#39;. If a child at this path is ...
subroutine getattr8(root, key, res, default)
type(dict_typ) function, pointer getlast(root)
Get the pointer to the last child.
type(dict_typ) function, pointer assign12(key, val)
integer, parameter, public dict_real_threed
type(dict_typ) function, pointer assign4(key, val)
integer, parameter, public dict_int_p
type(dict_typ) function, pointer assign0(key, val)
subroutine setattr0b(root, key, value, type)
Create an empty node at path &#39;key&#39; relative to &#39;root&#39;, if value and type are not defined. If they are defined, also fill the node with data.
subroutine setattr12(root, key, val)
type(dict_typ) function, pointer assign9(key, val)
type(dict_typ) function, pointer assign6(key, val)
integer, parameter, public dict_real_twod
Definition: common_dict.f90:99
subroutine, public closedict()
recursive subroutine, public deletedict(root)
Delete the dictionary &#39;root&#39; and all subnodes.
type(dict_typ) function, pointer, public getnext(root)
Get the pointer to the next child.
integer, parameter, public dict_int
Definition: common_dict.f90:94
type(dict_typ) function, pointer assign7(key, val)
subroutine setattr6(root, key, val)
integer function, public getdatasize(root)
Get the size of the data in node &#39;root&#39;. If there is no data 0 is returned. note: This is also the by...
subroutine setattr2(root, key, val)
integer, parameter, public dict_real_fived
integer, parameter, public max_char_len
Definition: common_dict.f90:92
type(dict_typ) function, pointer assign5(key, val)
Dictionary for generic data types.
Definition: common_dict.f90:61
subroutine setattr3(root, key, val)
logical function, public hasdata(root)
Checks if the node &#39;root&#39; has data associated.
subroutine deletenode(node, k)
type(dict_typ) function, pointer findpath(root, key, create)
Search for the path in &#39;key&#39; beginning at root and return a pointer to this node in &#39;res&#39;...
subroutine getattr0(root, key, res)
Return the node at path &#39;key&#39; relative to &#39;root&#39; in &#39;res&#39;. If this node has no data, but a child (e.g. a directory), return the child instead.
subroutine setattr9(root, key, val)
logical function, public haskey(root, key)
Checks if a node with key &#39;key&#39; exists.
subroutine getattr1(root, key, res, default)
subroutine setattr11(root, key, val)
integer, parameter, public dict_real
Definition: common_dict.f90:95
subroutine, public initdict()
subroutine getattr0a(root, key, parent)
Retrieve the node at path &#39;key&#39; relative to &#39;root&#39;. The result will be given as third argument &#39;paren...
pointer, public getdata(root)
Return the datatype of node &#39;root&#39;.
type(dict_typ) function, pointer assign1(key, val)
integer, parameter, public dict_int_oned
type(dict_typ) function, pointer assign11(key, val)
subroutine setattr4(root, key, val)
character(len=1), save prefix
preceds info output
subroutine setattr10(root, key, val)
integer, parameter, public dict_bool
Definition: common_dict.f90:97
subroutine setattr7(root, key, val)
subroutine getattr7(root, key, res, default)
subroutine getattr0b(root, key, type, value, default)
Retrieve the data &#39;value&#39; of kind &#39;type&#39; at path &#39;key&#39; relative to &#39;root&#39;. If the path can not be fou...
subroutine getattr2(root, key, res, default)