391 logical :: FirstPass, Lswitch(Ldim)
393 integer :: Nblanks, Nbranches, Npairs
394 integer :: i, io_err, status
396 character (len=Lkey) :: anchor, io_errmsg, key
397 character (len=Lmax) :: line, value
399 character (len=*),
parameter :: MyFile = &
400 & __FILE__//
", yaml_tree_create"
406 OPEN (unit=
iunit, file=self%filename, form=
'formatted', &
407 & status=
'old', iostat=io_err, iomsg=io_errmsg)
408 IF (io_err.ne.0)
THEN
411 IF (yaml_master)
WRITE (yaml_stdout,10) self%filename, &
425 yaml_line :
DO WHILE (.true.)
427 status=self%read_line(nblanks, line, key,
value, anchor, &
434 IF (yaml_master)
WRITE (yaml_stdout,20) self%filename, &
448 IF (nblanks.eq.0)
THEN
449 nbranches = nbranches+1
454 IF (firstpass.and.(nblanks.gt.0))
THEN
462 IF (nblanks.gt.0)
THEN
463 IF (mod(nblanks, self%indent).ne.0)
THEN
466 IF (yaml_master)
WRITE (yaml_stdout,30) nblanks, &
486 self%Nbranches=nbranches
491 IF (.not.self%IsCreated)
THEN
492 ALLOCATE ( self%list(npairs) )
493 self%IsCreated=.true.
502 10
FORMAT (/,
' YAML_TREE_CREATE - Unable to open input YAML file: ', &
503 & a,/,20x,
'ERROR: ',a)
504 20
FORMAT (/,
' YAML_TREE_CREATE - Error while reading YAML file: ', &
505 & a,/,20x,
'LINE: ',a)
506 30
FORMAT (/,
' YAML_TREE_CREATE - Inconsistent indentation, ', &
507 &
'self%indent = ',i0,
', nblanks = ',i0)
508 40
FORMAT (/,
' YAML_TREE_CREATE - Inconsistent indentation, ', &
509 &
'nblanks = ',i0,
', indent blank policy = ',i0,/,20x, &
510 &
'Number of nested collections = ',i0, &
511 &
' is greater than 3',/,20x,
'Line: ',a)
512 50
FORMAT (/,
' YAML_TREE_CREATE - Cannot find branches in YAML ', &
580 integer :: Lstr, Nblanks, i, indent, padding
582 character (len=Lkey) :: key
583 character (len=Lmax) :: string, value
589 IF (yaml_master)
THEN
590 WRITE (yaml_stdout,10) self%filename
594 padding=self%list(i)%left_padding
595 nblanks=indent*padding
597 IF (
ALLOCATED(self%list(i)%value))
THEN
598 value=self%list(i)%value
603 IF (self%list(i)%is_block)
THEN
605 IF (self%list(i)%is_sequence)
THEN
606 WRITE (string,20) i, repeat(char(32),nblanks),
'- ', &
607 & trim(key),
': [', trim(
value),
']'
609 WRITE (string,30) i, repeat(char(32),nblanks),
'- ', &
610 & trim(key),
': ', trim(
value)
613 WRITE (string,40) i, repeat(char(32),nblanks),
'- ', &
618 IF (self%list(i)%is_sequence)
THEN
619 WRITE (string,30) i, repeat(char(32),nblanks), &
620 & trim(key),
': [', trim(
value),
']'
622 WRITE (string,40) i, repeat(char(32),nblanks), &
623 & trim(key),
': ', trim(
value)
626 WRITE (string,50) i, repeat(char(32),nblanks), &
630 WRITE (yaml_stdout,60) trim(string)
634 10
FORMAT (/,
"YAML Tree Dictinary, file: '",a,
"'",/, &
635 &
'==========================',/)
636 20
FORMAT (
'L=',i4.4,1x,
'% ',6a)
637 30
FORMAT (
'L=',i4.4,1x,
'% ',5a)
638 40
FORMAT (
'L=',i4.4,1x,
'% ',4a)
639 50
FORMAT (
'L=',i4.4,1x,
'% ',3a)
667 character (len=*),
intent(in) :: keystring
676 integer :: i, ib, ic, ie, ik, ipair, is, j, li, pid
677 integer :: lstr, lenstr, nkeys, npairs, nvalues
678 integer :: icomma, idot
681 integer,
allocatable :: p(:)
683 character (len=:),
allocatable :: kstring
684 character (len=:),
allocatable :: vstring
686 character (len=*),
parameter :: myfile = &
687 & __FILE__//
", yaml_tree_extract"
697 lstr=len_trim(keystring)
699 & keystring, lenstr), &
700 &
noerr, __line__, myfile))
RETURN
706 ALLOCATE ( k(nkeys) )
712 idot=index(kstring,char(46),back=.false.)
720 & kstring(is:ie), lenstr), &
721 &
noerr, __line__, myfile))
RETURN
722 IF (idot.gt.0) kstring(is:ie+1) = repeat(char(32), ie-is+2)
723 kstring=trim(adjustl(kstring))
741 lstr=len_trim(self%list(i)%key)
742 IF ((self%list(i)%key).eq.(k(ik)%value))
THEN
745 print
'(2(a,i0,2a))',
'key ',ik,
' = ', trim(k(ik)%value), &
746 &
', YAML list ',i,
' = ', &
747 & trim(self%list(i)%key)
750 pid=self%list(i)%parent_id
751 IF (self%list(i)%is_block.or.self%list(pid)%is_block)
THEN
754 IF (ik.eq.nkeys)
THEN
766 IF (blockflow.and.(self%list(i)%left_padding.eq.0))
THEN
774 IF (npairs.ne.0)
THEN
775 IF (.not.
ALLOCATED(p))
ALLOCATE ( p(npairs) )
780 IF (yaml_master)
WRITE (yaml_stdout,10) keystring, &
792 IF ((self%list(i)%key).eq.(k(ik)%value))
THEN
793 IF (ik.eq.nkeys)
THEN
800 IF ((ic.gt.0).and.(self%list(i)%left_padding.eq.0))
THEN
818 & self%list(ipair)%value, &
820 &
noerr, __line__, myfile))
RETURN
842 IF (self%list(ipair)%is_sequence)
THEN
843 lstr=len_trim(vstring)
846 IF (.not.
ALLOCATED(s))
THEN
847 ALLOCATE ( s(npairs) )
850 s(1:npairs)%has_vector=.true.
852 ALLOCATE ( s(i)%vector(nvalues) )
856 icomma=index(vstring,char(44),back=.false.)
858 IF (icomma.eq.0)
THEN
866 &
noerr, __line__, myfile))
RETURN
869 print
'(3a,2(i0,a),a)',
'keystring = ',trim(keystring), &
870 &
', S(', i,
')%vector(', j,
') = ', &
871 & trim(s(i)%vector(j)%value)
874 IF (icomma.gt.0) vstring(is:ie+1)=repeat(char(32),ie-is+2)
875 vstring=trim(adjustl(vstring))
882 IF (.not.
ALLOCATED(s))
THEN
883 ALLOCATE ( s(npairs) )
886 s(1:npairs)%has_vector=.false.
890 & vstring, lenstr), &
891 &
noerr, __line__, myfile))
RETURN
894 print
'(a,i0,4a)',
'keystring ',i,
' = ', trim(keystring), &
895 &
', value = ', trim(s(i)%value)
905 IF (self%list(ipair)%is_sequence)
THEN
906 lstr=len_trim(vstring)
909 IF (.not.
ALLOCATED(s))
THEN
910 ALLOCATE ( s(nvalues) )
913 s(1:nvalues)%has_vector=.false.
918 icomma=index(vstring,char(44),back=.false.)
920 IF (icomma.eq.0)
THEN
928 &
noerr, __line__, myfile))
RETURN
929 IF (icomma.gt.0) vstring(is:ie+1)=repeat(char(32),ie-is+2)
930 vstring=trim(adjustl(vstring))
933 print
'(a,i0,4a)',
'keystring ',j,
' = ', &
935 &
', value = ', trim(s(j)%value)
943 IF (.not.
ALLOCATED(s))
THEN
946 s(1)%has_vector=.false.
949 & vstring, lenstr), &
950 &
noerr, __line__, myfile))
RETURN
953 print
'(4a)',
'keystring = ', trim(keystring), &
954 &
', value = ', trim(s(1)%value)
964 IF (
ALLOCATED(k))
DEALLOCATE (k)
965 IF (
ALLOCATED(p))
DEALLOCATE (p)
966 IF (
ALLOCATED(kstring))
DEALLOCATE (kstring)
967 IF (
ALLOCATED(vstring))
DEALLOCATE (vstring)
969 10
FORMAT (/,
" YAML_TREE_EXTRACT - Cannot find key-string: '",a, &
970 &
"'",/,21x,
'File: ',a)
971 20
FORMAT (/,
" YAML_TREE_EXTRACT - Not supported key-string: '",a, &
972 &
"'",/,21x,
'nested sub-blocking in a leading blocking ', &
973 &
'list',/,21x,
'File: ',a)
998 logical :: Lswitch(Ldim)
1000 integer :: Nblanks, LenStr, left_padding, new_parent, old_parent
1001 integer :: i, ibranch, icount, ic_alias, ic_anchor, status
1003 character (len=Lkey) :: anchor, key
1004 character (len=Lmax) :: line, value
1006 character (len=*),
parameter :: MyFile = &
1007 & __FILE__//
", yaml_tree_fill"
1020 yaml_line :
DO WHILE (.true.)
1022 status=self%read_line(nblanks, line, key,
value, anchor, &
1025 SELECT CASE (status)
1029 IF (yaml_master)
WRITE (yaml_stdout,10) self%filename, &
1043 IF (nblanks.eq.0)
THEN
1051 self%list(icount)%has_alias = lswitch(1)
1052 self%list(icount)%has_anchor = lswitch(2)
1053 self%list(icount)%is_block = lswitch(3)
1054 self%list(icount)%is_sequence = lswitch(4)
1055 self%list(icount)%is_logical = lswitch(5)
1056 self%list(icount)%is_integer = lswitch(6)
1057 self%list(icount)%is_real = lswitch(7)
1058 self%list(icount)%is_string = lswitch(8)
1060 IF (lswitch(1)) ic_alias=ic_alias+1
1061 IF (lswitch(2)) ic_anchor=ic_anchor+1
1065 left_padding=nblanks/self%indent
1066 self%list(icount)%left_padding=left_padding
1070 IF (nblanks.gt.0)
THEN
1071 IF (left_padding.gt.self%list(icount-1)%left_padding)
THEN
1072 new_parent=old_parent
1076 self%list(icount)%id=icount
1077 self%list(icount)%parent_id=new_parent
1085 &
noerr, __line__, myfile))
RETURN
1089 &
noerr, __line__, myfile))
RETURN
1091 IF (len_trim(
value).gt.0)
THEN
1094 &
noerr, __line__, myfile))
RETURN
1097 IF (lswitch(2).and.len_trim(anchor).gt.0)
THEN
1099 & anchor, lenstr), &
1100 &
noerr, __line__, myfile))
RETURN
1110 IF ((ic_alias.gt.0).and.(ic_anchor.gt.0))
THEN
1111 CALL self%fill_aliases (ic_alias, ic_anchor)
1118 10
FORMAT (/,
' YAML_TREE_FILL - Error while reading YAML file: ', &
1119 & a,/,18x,
'LINE: ',a)
1142 integer,
intent(in) :: Nalias
1143 integer,
intent(in) :: Nanchor
1147 logical :: Lswitch(Ldim)
1149 integer :: Ialias, LenStr, i, j, ic
1151 character (len=Lkey),
dimension(Nanchor) :: AnchorKey, AnchorVal
1152 character (len=Lmax) :: AliasVal
1154 character (len=*),
parameter :: MyFile = &
1155 & __FILE__//
", yaml_tree_fill_aliases"
1163 IF (self%list(i)%has_anchor)
THEN
1165 anchorkey(ic)=self%list(i)%anchor
1166 anchorval(ic)=self%list(i)%value
1178 IF (self%list(j)%has_alias)
THEN
1179 aliasval=self%list(j)%value
1180 ialias=index(aliasval,char(42),back=.false.)
1181 IF (ialias.gt.0)
THEN
1182 aliasval(ialias:ialias)=char(32)
1183 aliasval=trim(adjustl(aliasval))
1189 IF (trim(aliasval).eq.trim(anchorkey(i)))
THEN
1190 DEALLOCATE (self%list(j)%value)
1192 & trim(anchorval(i)), &
1194 &
noerr, __line__, myfile))
RETURN
1198 self%list(j)%is_logical = lswitch(5)
1199 self%list(j)%is_integer = lswitch(6)
1200 self%list(j)%is_real = lswitch(7)
1201 self%list(j)%is_string = lswitch(8)
1232 character (len=*),
intent(in ) :: keystring
1240 integer :: lstr, lenstr
1241 integer :: i, idot, ie, is, j, nkeys
1243 character (len=:),
allocatable :: kstring
1245 character (len=*),
parameter :: myfile = &
1246 & __FILE__//
", yaml_tree_has"
1256 lstr=len_trim(keystring)
1258 & keystring, lenstr), &
1259 &
noerr, __line__, myfile))
RETURN
1265 IF (nkeys.eq.1)
THEN
1266 DO i=1,
SIZE(self%list)
1267 IF (self%list(i)%key.eq.kstring)
THEN
1272 DEALLOCATE (kstring)
1278 ALLOCATE ( k(nkeys) )
1284 idot=index(kstring,char(46),back=.false.)
1287 ie=len_trim(kstring)
1292 & kstring(is:ie), lenstr), &
1293 &
noerr, __line__, myfile))
RETURN
1294 IF (idot.gt.0) kstring(is:ie+1) = repeat(char(32), ie-is+2)
1295 kstring=trim(adjustl(kstring))
1304 DO i=is,
SIZE(self%list)
1305 IF (self%list(i)%key.eq.k(j)%value)
THEN
1311 IF (.not.foundit)
EXIT
1313 DEALLOCATE (k, kstring)
1320 & anchor, Lswitch) &
1361 logical,
intent(out) :: lswitch(:)
1363 integer,
intent(out) :: nblanks
1365 character (len=*),
intent(out) :: line
1366 character (len=*),
intent(out) :: key
1367 character (len=*),
intent(out) :: value
1368 character (len=*),
intent(out) :: anchor
1372 logical :: lbracket, rbracket
1374 integer :: ialias, ianchor, iblank, icolon, idash, ihash, ispace
1375 integer :: ibracketl, ibracketr
1376 integer :: lstr, lstrnext, lstrval, i, j, k
1379 character (len=Lmax) :: linecopy, next_line
1381 character (len=*),
parameter :: myfile = &
1382 & __FILE__//
", yaml_tree_read_line"
1401 anchor(i:i)=char(32)
1410 READ (
iunit,
'(a)',
err=10,
END=20) line
1416 DO i=1,len_trim(line)
1422 linecopy=trim(adjustl(line))
1427 IF ((lstr.gt.0).and.(linecopy(1:1).ne.char(35)))
THEN
1428 ihash=index(line,char(35),back=.false.)
1429 IF (ihash.gt.0)
THEN
1431 line=trim(line(1:lstr))
1447 icolon=index(line,char(58),back=.false.)
1448 IF (icolon.eq.0)
THEN
1451 IF (yaml_master)
THEN
1452 WRITE (yaml_stdout,30) trim(line)
1457 idash =index(line,char(45),back=.false.)
1458 IF ((idash.gt.0).and.(idash.lt.icolon))
THEN
1459 iblank=index(line(1:idash),char(32),back=.true.)
1461 iblank=index(line(1:icolon),char(32),back=.true.)
1462 IF (iblank.gt.0)
THEN
1464 IF ((65.le.ichar(line(1:1))).and. &
1465 & (ichar(line(1:1)).le.122))
THEN
1467 ELSE IF ((65.le.ichar(line(k:k))).and. &
1468 & (ichar(line(k:k)).le.122))
THEN
1469 iblank=index(line(1:k),char(32),back=.true.)
1480 IF ((idash.gt.0).and.(idash.lt.icolon))
THEN
1481 key=trim(adjustl(line(idash+1:icolon-1)))
1483 key=trim(adjustl(line(1:icolon-1)))
1485 value=trim(adjustl(line(icolon+1:lstr)))
1489 ialias=index(
value,char(42),back=.false.)
1490 IF (ialias.gt.0)
THEN
1494 ianchor=index(
value,char(38),back=.false.)
1495 IF (ianchor.gt.0)
THEN
1496 ispace=index(value(ianchor+1:),char(32),back=.false.)
1497 anchor=value(ianchor+1:ispace)
1499 value(ianchor:ispace)=repeat(char(32),ispace-ianchor+1)
1500 value=trim(adjustl(
value))
1503 IF ((idash.gt.0).and.(idash.lt.icolon))
THEN
1507 ibracketl=index(
value,char(91),back=.false.)
1508 IF (ibracketl.gt.0)
THEN
1510 value(ibracketl:ibracketl)=char(32)
1511 value=trim(adjustl(
value))
1514 ibracketr=index(
value,char(93),back=.false.)
1515 IF (ibracketr.gt.0)
THEN
1517 value(ibracketr:ibracketr)=char(32)
1518 value=trim(adjustl(
value))
1526 IF (.not.rbracket.and.lbracket)
THEN
1527 DO WHILE (.not.rbracket)
1528 READ (
iunit,
'(a)',
err=10,
END=20) next_line
1532 DO i=1,len_trim(next_line)
1533 j=ichar(next_line(i:i))
1535 next_line(i:i)=char(32)
1538 next_line=trim(adjustl(next_line))
1543 ihash=index(next_line,char(35),back=.false.)
1544 lstrnext=len_trim(next_line)
1545 IF ((lstrnext.gt.0).and.(ihash.gt.0))
THEN
1547 next_line=trim(next_line(1:lstrnext))
1548 lstrnext=len_trim(next_line)
1554 lstrval=len_trim(
value)
1555 line=line(1:lstr)//char(32)//next_line(1:lstrnext)
1556 value=value(1:lstrval)//char(32)//next_line(1:lstrnext)
1558 ibracketr=index(
value,char(93),back=.false.)
1559 IF (ibracketr.gt.0)
THEN
1561 value(ibracketr:ibracketr)=char(32)
1562 value=trim(adjustl(
value))
1566 IF (lbracket.and.rbracket) lswitch(4)=.true.
1582 30
FORMAT (/,
' YAML_TREE_READ_LINE - Unable to find colon token ', &
1583 &
'after key word',/,23x,
'LINE: ',a)
1759 character (len=*),
intent(in) :: keystring
1760 TYPE (
yaml_ivec),
allocatable,
intent(out) :: v(:)
1766 integer :: lenstr, nitems, nvalues, i, n
1769 character (len=Lmax) :: msg
1771 character (len=*),
parameter :: myfile = &
1772 & __FILE__//
", yaml_Get_i_struc"
1781 &
noerr, __line__, myfile))
RETURN
1785 nitems=
SIZE(s, dim=1)
1786 IF (
ALLOCATED(v))
DEALLOCATE (v)
1787 ALLOCATE ( v(nitems) )
1792 IF (s(n)%has_vector)
THEN
1793 nvalues=
SIZE(s(n)%vector)
1794 ALLOCATE ( v(n)%vector(nvalues) )
1796 READ (s(n)%vector(i)%value, * ,iostat=status, iomsg=msg) &
1800 IF (yaml_master)
WRITE (yaml_stdout,10) trim(keystring), &
1801 & s(n)%vector(i)%value, &
1811 IF (
ALLOCATED(s))
DEALLOCATE (s)
1813 10
FORMAT (/,
' YAML_GET_I_STRUC - Error while converting string to', &
1814 &
' integer, key: ',a,
', value = ',a,/,20x,
'ErrMsg: ',a)
1918 character (len=*),
intent(in) :: keystring
1919 TYPE (
yaml_rvec),
allocatable,
intent(out) :: v(:)
1925 integer :: nitems, nvalues, i, n
1928 character (len=Lmax) :: msg
1930 character (len=*),
parameter :: myfile = &
1931 & __FILE__//
", yaml_Get_r_struc"
1940 &
noerr, __line__, myfile))
RETURN
1944 nitems=
SIZE(s, dim=1)
1945 IF (
ALLOCATED(v))
DEALLOCATE (v)
1946 ALLOCATE ( v(nitems) )
1951 IF (s(n)%has_vector)
THEN
1952 nvalues=
SIZE(s(n)%vector)
1953 ALLOCATE ( v(n)%vector(nvalues) )
1955 READ (s(n)%vector(i)%value, * ,iostat=status, iomsg=msg) &
1959 IF (yaml_master)
WRITE (yaml_stdout,10) trim(keystring), &
1960 & s(n)%vector(i)%value, &
1966 READ (s(n)%value, * ,iostat=status, iomsg=msg) &
1970 IF (yaml_master)
WRITE (yaml_stdout,10) trim(keystring), &
1980 IF (
ALLOCATED(s))
DEALLOCATE (s)
1982 10
FORMAT (/,
' YAML_GET_R_STRUC - Error while converting string to', &
1983 &
' real, key: ',a,
', value = ',a,/,20x,
'ErrMsg: ',a)
2082 character (len=*),
intent(in) :: keystring
2083 integer,
intent(out) :: value
2089 integer :: nvalues, status
2091 character (len=Lmax) :: msg
2093 character (len=*),
parameter :: myfile = &
2094 & __FILE__//
", yaml_Get_ivar_0d"
2103 &
noerr, __line__, myfile))
RETURN
2109 IF (nvalues.gt.1)
THEN
2113 IF (yaml_master)
WRITE (yaml_stdout,10) keystring, nvalues, &
2121 READ (s(1)%value, *, iostat=status, iomsg=msg)
value
2124 IF (yaml_master)
WRITE (yaml_stdout,20) trim(keystring), &
2125 & s(1)%value, trim(msg)
2132 IF (
ALLOCATED(s))
DEALLOCATE (s)
2134 10
FORMAT (/,
' YAML_GET_IVAR_0D - Extracted value is not a scalar,', &
2135 &
' key-string: ',a,/,20x,
'Nvalues = ',i0,/,20x,
'File: ',a)
2136 20
FORMAT (/,
' YAML_GET_IVAR_0D - Error while converting string to', &
2137 &
' integer, key: ',a,
', value = ',a,/,20x,
'ErrMsg: ',a)
2163 character (len=*),
intent(in) :: keystring
2164 integer,
intent(out) ::
value(:)
2170 integer :: nvalues, i, status
2172 character (len=Lmax) :: msg
2174 character (len=*),
parameter :: myfile = &
2175 & __FILE__//
", yaml_Get_ivar_1d"
2184 &
noerr, __line__, myfile))
RETURN
2188 nvalues=
SIZE(s, dim=1)
2190 IF (
SIZE(
value, dim=1).lt.nvalues)
THEN
2194 IF (yaml_master)
WRITE (yaml_stdout,10) keystring, nvalues, &
2195 &
SIZE(
value, dim=1), &
2204 READ (s(i)%value, *, iostat=status, iomsg=msg) value(i)
2207 IF (yaml_master)
WRITE (yaml_stdout,20) trim(keystring), &
2208 & s(i)%value, trim(msg)
2215 IF (
ALLOCATED(s))
DEALLOCATE (s)
2217 10
FORMAT (/,
' YAML_GET_IVAR_1D - Inconsistent number of values,', &
2218 &
' key-string: ',a,/,20x,
'YAML size = ',i0, &
2219 &
', Variable size = ',i0,/,20x,
'File: ',a)
2220 20
FORMAT (/,
' YAML_GET_IVAR_1D - Error while converting string to', &
2221 &
' integer, key: ',a,
', value = ',a,/,20x,
'ErrMsg: ',a)
2399 character (len=*),
intent(in) :: keystring
2400 real (kind_real),
intent(out) :: value
2406 integer :: nvalues, ie, status
2408 character (len=Lmax) :: msg
2410 character (len=*),
parameter :: myfile = &
2411 & __FILE__//
", yaml_Get_rvar_0d"
2420 &
noerr, __line__, myfile))
RETURN
2426 IF (nvalues.gt.1)
THEN
2430 IF (yaml_master)
WRITE (yaml_stdout,10) keystring, nvalues, &
2438 s(1)%value=adjustl(s(1)%value)
2439 ie=len_trim(s(1)%value)
2440 READ (s(1)%value(1:ie), *, iostat=status, iomsg=msg)
value
2443 IF (yaml_master)
WRITE (yaml_stdout,20) trim(keystring), &
2444 & s(1)%value, trim(msg)
2451 IF (
ALLOCATED(s))
DEALLOCATE (s)
2453 10
FORMAT (/,
' YAML_GET_RVAR_0D - Extracted value is not a scalar,', &
2454 &
' key-string: ',a,/,20x,
'Nvalues = ',i0,/,20x,
'File: ',a)
2455 20
FORMAT (/,
' YAML_GET_RVAR_0D - Error while converting string to', &
2456 &
' integer, key: ',a,
', value = ',a,/,20x,
'ErrMsg: ',a)
2482 character (len=*),
intent(in) :: keystring
2483 real (kind_real),
intent(out) ::
value(:)
2489 integer :: nvalues, i, ie, status
2491 character (len=Lmax) :: msg
2493 character (len=*),
parameter :: myfile = &
2494 & __FILE__//
", yaml_Get_rvar_1d"
2503 &
noerr, __line__, myfile))
RETURN
2507 nvalues=
SIZE(s, dim=1)
2509 IF (
SIZE(
value, dim=1).lt.nvalues)
THEN
2513 IF (yaml_master)
WRITE (yaml_stdout,10) keystring, nvalues, &
2514 &
SIZE(
value, dim=1), &
2523 s(i)%value=adjustl(s(i)%value)
2524 ie=len_trim(s(i)%value)
2525 READ (s(i)%value(1:ie), *, iostat=status, iomsg=msg) value(i)
2528 IF (yaml_master)
WRITE (yaml_stdout,20) trim(keystring), &
2529 & s(i)%value, trim(msg)
2536 IF (
ALLOCATED(s))
DEALLOCATE (s)
2538 10
FORMAT (/,
' YAML_GET_RVAR_1D - Inconsistent number of values,', &
2539 &
' key-string: ',a,/,20x,
'YAML size = ',i0, &
2540 &
', Variable size = ',i0,/,20x,
'File: ',a)
2541 20
FORMAT (/,
' YAML_GET_RVAR_1D - Error while converting string to', &
2542 &
' real, key: ',a,
', value = ',a,/,20x,
'ErrMsg: ',a)
2804 logical,
intent(inout) :: lswitch(:)
2806 character (len=*),
intent(inout) :: value
2810 integer :: lstr, schar
2811 integer :: colon, dot, exponent, letter, numeric, precision
2812 integer :: i, multiple
2830 lstr=len_trim(
value)
2833 schar=ichar(value(i:i))
2838 IF (((48.le.schar).and.(schar.le.57)).or. &
2839 & (schar.eq.43).or.(schar.eq.45)) numeric=numeric+1
2844 IF (schar.eq.46) dot=dot+1
2849 IF ((schar.eq.69).or.(schar.eq.101)) precision=precision+1
2853 IF ((schar.eq.69).or.(schar.eq.101)) exponent=exponent+1
2858 IF (lswitch(4)) multiple=multiple+1
2864 IF (schar.eq.58) colon=colon+1
2868 IF (((65.le.schar).and.(schar.le.90)).or. &
2869 & (schar.eq.97).or.(schar.eq.122)) letter=letter+1
2874 IF ((numeric.gt.0).and.(colon.eq.0))
THEN
2875 IF ((dot.gt.0).or.(exponent.gt.0).or.(precision.gt.0))
THEN
2881 IF ((
value.eq.
'true').or.(
value.eq.
'false').or. &
2882 & (
value.eq.
'TRUE').or.(
value.eq.
'FALSE'))
THEN
2884 ELSE IF (letter.gt.0)
THEN