ROMS
Loading...
Searching...
No Matches
yaml_parser::yaml_get Interface Reference

Public Member Functions

integer function yaml_get_i_struc (self, keystring, v)
 
integer function yaml_get_l_struc (self, keystring, v)
 
integer function yaml_get_r_struc (self, keystring, v)
 
integer function yaml_get_s_struc (self, keystring, v)
 
integer function yaml_get_ivar_0d (self, keystring, value)
 
integer function yaml_get_ivar_1d (self, keystring, value)
 
integer function yaml_get_lvar_0d (self, keystring, value)
 
integer function yaml_get_lvar_1d (self, keystring, value)
 
integer function yaml_get_rvar_0d (self, keystring, value)
 
integer function yaml_get_rvar_1d (self, keystring, value)
 
integer function yaml_get_svar_0d (self, keystring, value)
 
integer function yaml_get_svar_1d (self, keystring, value)
 

Detailed Description

Definition at line 239 of file yaml_parser_test.F.

Member Function/Subroutine Documentation

◆ yaml_get_i_struc()

integer function yaml_parser::yaml_get::yaml_get_i_struc ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
type (yaml_ivec), dimension(:), intent(out), allocatable v )

Definition at line 1805 of file yaml_parser_test.F.

1806!
1807!***********************************************************************
1808! !
1809! It loads a vector set of integers in YAML block-list structure, !
1810! V(1:Nitems)%vector(1:Nvalues). If the dummy argument V structure !
1811! is allocated, it deallocates/allocates the required Nitems and !
1812! Nvalues dimensions. !
1813! !
1814! On Input: !
1815! !
1816! self YAML tree dictionary object (CLASS yaml_tree) !
1817! keystring YAML tree aggregated keys (string) !
1818! !
1819! On Output: !
1820! !
1821! V Vector of integers in block list (TYPE yaml_Ivec) !
1822! status Error code (integer) !
1823! !
1824!***********************************************************************
1825!
1826! Imported variable declarations.
1827!
1828 class(yaml_tree), intent(in) :: self
1829 character (len=*), intent(in) :: keystring
1830 TYPE (yaml_Ivec), allocatable, intent(out) :: V(:)
1831!
1832! Local variable declarations.
1833!
1834 TYPE (yaml_extract), allocatable :: S(:)
1835!
1836 integer :: LenStr, Nitems, Nvalues, i, n
1837 integer :: status
1838!
1839 character (len=Lmax) :: msg
1840
1841 character (len=*), parameter :: MyFile = &
1842 & __FILE__//", yaml_Get_i_struc"
1843!
1844!-----------------------------------------------------------------------
1845! Extract requested key-string values.
1846!-----------------------------------------------------------------------
1847!
1848 status=noerr
1849!
1850 IF (yaml_error(self%extract(keystring, s), &
1851 & noerr, __line__, myfile)) RETURN
1852!
1853! Allocate output structure.
1854!
1855 nitems=SIZE(s, dim=1)
1856 IF (ALLOCATED(v)) DEALLOCATE (v)
1857 ALLOCATE ( v(nitems) )
1858!
1859! Convert string vector values to integers.
1860!
1861 DO n=1,nitems
1862 IF (s(n)%has_vector) THEN
1863 nvalues=SIZE(s(n)%vector)
1864 ALLOCATE ( v(n)%vector(nvalues) )
1865 DO i=1,nvalues
1866 READ (s(n)%vector(i)%value, * ,iostat=status, iomsg=msg) &
1867 & v(n)%vector(i)
1868 IF (yaml_error(status, noerr, __line__, myfile)) THEN
1869 yaml_errflag=5
1870 IF (yaml_master) WRITE (yaml_stdout,10) trim(keystring), &
1871 & s(n)%vector(i)%value, &
1872 & trim(msg)
1873 RETURN
1874 END IF
1875 END DO
1876 END IF
1877 END DO
1878!
1879! Deallocate local extraction structure.
1880!
1881 IF (ALLOCATED(s)) DEALLOCATE (s)
1882!
1883 10 FORMAT (/,' YAML_GET_I_STRUC - Error while converting string to', &
1884 & ' integer, key: ',a,', value = ',a,/,20x,'ErrMsg: ',a)
1885!
1886 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_ivar_0d()

integer function yaml_parser::yaml_get::yaml_get_ivar_0d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
integer, intent(out) value )

Definition at line 2131 of file yaml_parser_test.F.

2132!
2133!***********************************************************************
2134! !
2135! It gets scalar integer data from YAML dictionary object. !
2136! !
2137! On Input: !
2138! !
2139! self YAML tree dictionary object (CLASS yaml_tree) !
2140! keystring YAML tree aggregated keys (string) !
2141! !
2142! On Output: !
2143! !
2144! value YAML value (integer; scalar) !
2145! status Error code (integer) !
2146! !
2147!***********************************************************************
2148!
2149! Imported variable declarations.
2150!
2151 class(yaml_tree), intent(in) :: self
2152 character (len=*), intent(in) :: keystring
2153 integer, intent(out) :: value
2154!
2155! Local variable declarations.
2156!
2157 TYPE (yaml_extract), allocatable :: S(:)
2158!
2159 integer :: Nvalues, status
2160!
2161 character (len=Lmax) :: msg
2162
2163 character (len=*), parameter :: MyFile = &
2164 & __FILE__//", yaml_Get_ivar_0d"
2165!
2166!-----------------------------------------------------------------------
2167! Extract requested key-string value.
2168!-----------------------------------------------------------------------
2169!
2170 status=noerr
2171!
2172 IF (yaml_error(self%extract(keystring, s), &
2173 & noerr, __line__, myfile)) RETURN
2174!
2175! Make sure that extracted value is a scalar.
2176!
2177 nvalues=SIZE(s)
2178!
2179 IF (nvalues.gt.1) THEN
2180 status=7
2181 yaml_errflag=status
2182 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2183 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2184 & self%filename
2185 RETURN
2186 END IF
2187!
2188! Convert string value to integer.
2189!
2190 ELSE
2191 READ (s(1)%value, *, iostat=status, iomsg=msg) value
2192 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2193 yaml_errflag=5
2194 IF (yaml_master) WRITE (yaml_stdout,20) trim(keystring), &
2195 & s(1)%value, trim(msg)
2196 RETURN
2197 END IF
2198 END IF
2199!
2200! Deallocate.
2201!
2202 IF (ALLOCATED(s)) DEALLOCATE (s)
2203!
2204 10 FORMAT (/,' YAML_GET_IVAR_0D - Extracted value is not a scalar,', &
2205 & ' key-string: ',a,/,20x,'Nvalues = ',i0,/,20x,'File: ',a)
2206 20 FORMAT (/,' YAML_GET_IVAR_0D - Error while converting string to', &
2207 & ' integer, key: ',a,', value = ',a,/,20x,'ErrMsg: ',a)
2208!
2209 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_ivar_1d()

integer function yaml_parser::yaml_get::yaml_get_ivar_1d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
integer, dimension(:), intent(out) value )

Definition at line 2212 of file yaml_parser_test.F.

2213!
2214!***********************************************************************
2215! !
2216! It gets 1D integer data from YAML dictionary object. !
2217! !
2218! On Input: !
2219! !
2220! self YAML tree dictionary object (CLASS yaml_tree) !
2221! keystring YAML tree aggregated keys (string) !
2222! !
2223! On Output: !
2224! !
2225! value YAML value (integer; 1D-array) !
2226! status Error code (integer) !
2227! !
2228!***********************************************************************
2229!
2230! Imported variable declarations.
2231!
2232 class(yaml_tree), intent(in) :: self
2233 character (len=*), intent(in) :: keystring
2234 integer, intent(out) :: value(:)
2235!
2236! Local variable declarations.
2237!
2238 TYPE (yaml_extract), allocatable :: S(:)
2239!
2240 integer :: Nvalues, i, status
2241!
2242 character (len=Lmax) :: msg
2243
2244 character (len=*), parameter :: MyFile = &
2245 & __FILE__//", yaml_Get_ivar_1d"
2246!
2247!-----------------------------------------------------------------------
2248! Extract requested key-string values.
2249!-----------------------------------------------------------------------
2250!
2251 status=noerr
2252!
2253 IF (yaml_error(self%extract(keystring, s), &
2254 & noerr, __line__, myfile)) RETURN
2255!
2256! Make sure that extracted value is a scalar.
2257!
2258 nvalues=SIZE(s, dim=1)
2259!
2260 IF (SIZE(value, dim=1).lt.nvalues) THEN
2261 status=7
2262 yaml_errflag=status
2263 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2264 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2265 & SIZE(value, dim=1), &
2266 & self%filename
2267 RETURN
2268 END IF
2269 END IF
2270!
2271! Convert string values to integers.
2272!
2273 DO i=1,nvalues
2274 READ (s(i)%value, *, iostat=status, iomsg=msg) value(i)
2275 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2276 yaml_errflag=5
2277 IF (yaml_master) WRITE (yaml_stdout,20) trim(keystring), &
2278 & s(i)%value, trim(msg)
2279 RETURN
2280 END IF
2281 END DO
2282!
2283! Deallocate.
2284!
2285 IF (ALLOCATED(s)) DEALLOCATE (s)
2286!
2287 10 FORMAT (/,' YAML_GET_IVAR_1D - Inconsistent number of values,', &
2288 & ' key-string: ',a,/,20x,'YAML size = ',i0, &
2289 & ', Variable size = ',i0,/,20x,'File: ',a)
2290 20 FORMAT (/,' YAML_GET_IVAR_1D - Error while converting string to', &
2291 & ' integer, key: ',a,', value = ',a,/,20x,'ErrMsg: ',a)
2292!
2293 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_l_struc()

integer function yaml_parser::yaml_get::yaml_get_l_struc ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
type (yaml_lvec), dimension(:), intent(out), allocatable v )

Definition at line 1889 of file yaml_parser_test.F.

1890!
1891!***********************************************************************
1892! !
1893! It loads a vector set of logicals in YAML block-list structure, !
1894! V(1:Nitems)%vector(1:Nvalues). If the dummy argument V structure !
1895! is allocated, it deallocates/allocates the required Nitems and !
1896! Nvalues dimensions. !
1897! !
1898! On Input: !
1899! !
1900! self YAML tree dictionary object (CLASS yaml_tree) !
1901! keystring YAML tree aggregated keys (string) !
1902! !
1903! On Output: !
1904! !
1905! V Vector of logicals in block list (TYPE yaml_Lvec) !
1906! status Error code (integer) !
1907! !
1908!***********************************************************************
1909!
1910! Imported variable declarations.
1911!
1912 class(yaml_tree), intent(in) :: self
1913 character (len=*), intent(in) :: keystring
1914 TYPE (yaml_Lvec), allocatable, intent(out) :: V(:)
1915!
1916! Local variable declarations.
1917!
1918 TYPE (yaml_extract), allocatable :: S(:)
1919!
1920 integer :: Nitems, Nvalues, n, i
1921 integer :: status
1922!
1923 character (len=*), parameter :: MyFile = &
1924 & __FILE__//", yaml_Get_l_struc"
1925!
1926!-----------------------------------------------------------------------
1927! Extract requested key-string values.
1928!-----------------------------------------------------------------------
1929!
1930 status=noerr
1931!
1932 IF (yaml_error(self%extract(keystring, s), &
1933 & noerr, __line__, myfile)) RETURN
1934!
1935! Allocate output structure.
1936!
1937 nitems=SIZE(s, dim=1)
1938 IF (ALLOCATED(v)) DEALLOCATE (v)
1939 ALLOCATE ( v(nitems) )
1940!
1941! Convert string vector values to logicals.
1942!
1943 DO n=1,nitems
1944 IF (s(n)%has_vector) THEN
1945 nvalues=SIZE(s(n)%vector)
1946 ALLOCATE ( v(n)%vector(nvalues) )
1947 DO i=1,nvalues
1948 IF (yaml_uppercase(s(n)%vector(i)%value(1:1)).eq.'T') THEN
1949 v(n)%vector(i)=.true.
1950 ELSE
1951 v(n)%vector(i)=.false.
1952 END IF
1953 END DO
1954 END IF
1955 END DO
1956!
1957! Deallocate local extraction structure.
1958!
1959 IF (ALLOCATED(s)) DEALLOCATE (s)
1960!
1961 RETURN

References yaml_parser::noerr, yaml_parser::yaml_error(), and yaml_parser::yaml_uppercase().

Here is the call graph for this function:

◆ yaml_get_lvar_0d()

integer function yaml_parser::yaml_get::yaml_get_lvar_0d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
logical, intent(out) value )

Definition at line 2296 of file yaml_parser_test.F.

2297!
2298!***********************************************************************
2299! !
2300! It gets scalar logical data from YAML disctionary object. !
2301! !
2302! On Input: !
2303! !
2304! self YAML tree dictionary object (CLASS yaml_tree) !
2305! keystring YAML tree aggregated keys (string) !
2306! !
2307! On Output: !
2308! !
2309! value YAML value (logical; scalar) !
2310! !
2311!***********************************************************************
2312!
2313! Imported variable declarations.
2314!
2315 class(yaml_tree), intent(in) :: self
2316 character (len=*), intent(in) :: keystring
2317 logical, intent(out) :: value
2318!
2319! Local variable declarations.
2320!
2321 TYPE (yaml_extract), allocatable :: S(:)
2322!
2323 integer :: Nvalues, status
2324!
2325 character (len=*), parameter :: MyFile = &
2326 & __FILE__//", yaml_Get_lvar_0d"
2327!
2328!-----------------------------------------------------------------------
2329! Extract requested key-string value.
2330!-----------------------------------------------------------------------
2331!
2332 status=noerr
2333!
2334 IF (yaml_error(self%extract(keystring, s), &
2335 & noerr, __line__, myfile)) RETURN
2336!
2337! Make sure that extracted value is a scalar.
2338!
2339 nvalues=SIZE(s)
2340!
2341 IF (nvalues.gt.1) THEN
2342 status=7
2343 yaml_errflag=status
2344 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2345 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2346 & self%filename
2347 RETURN
2348 END IF
2349!
2350! Convert string value to logical.
2351!
2352 ELSE
2353 IF (yaml_uppercase(s(1)%value(1:1)).eq.'T') THEN
2354 value=.true.
2355 ELSE
2356 value=.false.
2357 END IF
2358 END IF
2359!
2360! Deallocate.
2361!
2362 IF (ALLOCATED(s)) DEALLOCATE (s)
2363!
2364 10 FORMAT (/,' YAML_GET_LVAR_0D - Extracted value is not a scalar,', &
2365 & ' key-string: ',a,/,20x,'Nvalues = ',i0,/,20x,'File: ',a)
2366!
2367 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, yaml_parser::yaml_stdout, and yaml_parser::yaml_uppercase().

Here is the call graph for this function:

◆ yaml_get_lvar_1d()

integer function yaml_parser::yaml_get::yaml_get_lvar_1d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
logical, dimension(:), intent(out) value )

Definition at line 2370 of file yaml_parser_test.F.

2371!
2372!***********************************************************************
2373! !
2374! It gets 1D logical data from YAML dictionary object. !
2375! !
2376! On Input: !
2377! !
2378! self YAML tree dictionary object (CLASS yaml_tree) !
2379! keystring YAML tree aggregated keys (string) !
2380! !
2381! On Output: !
2382! !
2383! value YAML value (logical; 1D-array) !
2384! status Error code (integer) !
2385! !
2386!***********************************************************************
2387!
2388! Imported variable declarations.
2389!
2390 class(yaml_tree), intent(in) :: self
2391 character (len=*), intent(in) :: keystring
2392 logical, intent(out) :: value(:)
2393!
2394! Local variable declarations.
2395!
2396 TYPE (yaml_extract), allocatable :: S(:)
2397!
2398 integer :: Nvalues, i, status
2399!
2400 character (len=*), parameter :: MyFile = &
2401 & __FILE__//", yaml_Get_lvar_1d"
2402!
2403!-----------------------------------------------------------------------
2404! Extract requested key-string values.
2405!-----------------------------------------------------------------------
2406!
2407 status=noerr
2408!
2409 IF (yaml_error(self%extract(keystring, s), &
2410 & noerr, __line__, myfile)) RETURN
2411!
2412! Make sure that extracted value is a scalar.
2413!
2414 nvalues=SIZE(s, dim=1)
2415!
2416 IF (SIZE(value, dim=1).lt.nvalues) THEN
2417 yaml_errflag=7
2418 status=yaml_errflag
2419 IF (yaml_error(yaml_errflag, noerr, __line__, myfile)) THEN
2420 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2421 & SIZE(value, dim=1), &
2422 & self%filename
2423 RETURN
2424 END IF
2425 END IF
2426!
2427! Convert string values to logicals.
2428!
2429 DO i=1,nvalues
2430 IF (yaml_uppercase(s(i)%value(1:1)).eq.'T') THEN
2431 value(i)=.true.
2432 ELSE
2433 value(i)=.false.
2434 END IF
2435 END DO
2436!
2437! Deallocate.
2438!
2439 IF (ALLOCATED(s)) DEALLOCATE (s)
2440!
2441 10 FORMAT (/,' YAML_GET_LVAR_1D - Inconsistent number of values,', &
2442 & ' key-string: ',a,/,20x,'YAML size = ',i0, &
2443 & ', Variable size = ',i0,/,20x,'File: ',a)
2444!
2445 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, yaml_parser::yaml_stdout, and yaml_parser::yaml_uppercase().

Here is the call graph for this function:

◆ yaml_get_r_struc()

integer function yaml_parser::yaml_get::yaml_get_r_struc ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
type (yaml_rvec), dimension(:), intent(out), allocatable v )

Definition at line 1964 of file yaml_parser_test.F.

1965!
1966!***********************************************************************
1967! !
1968! It loads a vector set of real values in YAML block-list structure, !
1969! V(1:Nitems)%vector(1:Nvalues). If the dummy argument V structure !
1970! is allocated, it deallocates/allocates the required Nitems and !
1971! Nvalues dimensions. !
1972! !
1973! On Input: !
1974! !
1975! self YAML tree dictionary object (CLASS yaml_tree) !
1976! keystring YAML tree aggregated keys (string) !
1977! !
1978! On Output: !
1979! !
1980! V Vector of reals in block list (TYPE yaml_Rvec) !
1981! status Error code (integer) !
1982! !
1983!***********************************************************************
1984!
1985! Imported variable declarations.
1986!
1987 class(yaml_tree), intent(in) :: self
1988 character (len=*), intent(in) :: keystring
1989 TYPE (yaml_Rvec), allocatable, intent(out) :: V(:)
1990!
1991! Local variable declarations.
1992!
1993 TYPE (yaml_extract), allocatable :: S(:)
1994!
1995 integer :: Nitems, Nvalues, i, n
1996 integer :: status
1997!
1998 character (len=Lmax) :: msg
1999
2000 character (len=*), parameter :: MyFile = &
2001 & __FILE__//", yaml_Get_r_struc"
2002!
2003!-----------------------------------------------------------------------
2004! Extract requested key-string values.
2005!-----------------------------------------------------------------------
2006!
2007 status=noerr
2008!
2009 IF (yaml_error(self%extract(keystring, s), &
2010 & noerr, __line__, myfile)) RETURN
2011!
2012! Allocate output structure.
2013!
2014 nitems=SIZE(s, dim=1)
2015 IF (ALLOCATED(v)) DEALLOCATE (v)
2016 ALLOCATE ( v(nitems) )
2017!
2018! Convert string vector values to floating-point.
2019!
2020 DO n=1,nitems
2021 IF (s(n)%has_vector) THEN
2022 nvalues=SIZE(s(n)%vector)
2023 ALLOCATE ( v(n)%vector(nvalues) )
2024 DO i=1,nvalues
2025 READ (s(n)%vector(i)%value, * ,iostat=status, iomsg=msg) &
2026 & v(n)%vector(i)
2027 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2028 yaml_errflag=5
2029 IF (yaml_master) WRITE (yaml_stdout,10) trim(keystring), &
2030 & s(n)%vector(i)%value, &
2031 & trim(msg)
2032 RETURN
2033 END IF
2034 END DO
2035 ELSE
2036 READ (s(n)%value, * ,iostat=status, iomsg=msg) &
2037 & v(n)%vector(i)
2038 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2039 yaml_errflag=5
2040 IF (yaml_master) WRITE (yaml_stdout,10) trim(keystring), &
2041 & s(n)%value, &
2042 & trim(msg)
2043 RETURN
2044 END IF
2045 END IF
2046 END DO
2047!
2048! Deallocate local extraction structure.
2049!
2050 IF (ALLOCATED(s)) DEALLOCATE (s)
2051!
2052 10 FORMAT (/,' YAML_GET_R_STRUC - Error while converting string to', &
2053 & ' real, key: ',a,', value = ',a,/,20x,'ErrMsg: ',a)
2054!
2055 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_rvar_0d()

integer function yaml_parser::yaml_get::yaml_get_rvar_0d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
real (kind_real), intent(out) value )

Definition at line 2448 of file yaml_parser_test.F.

2449!
2450!***********************************************************************
2451! !
2452! It gets scalar floating-point data from YAML dictionary object. !
2453! !
2454! On Input: !
2455! !
2456! self YAML tree dictionary object (CLASS yaml_tree) !
2457! keystring YAML tree aggregated keys (string) !
2458! !
2459! On Output: !
2460! !
2461! value YAML value (real; scalar) !
2462! status Error code (integer) !
2463! !
2464!***********************************************************************
2465!
2466! Imported variable declarations.
2467!
2468 class(yaml_tree), intent(in) :: self
2469 character (len=*), intent(in) :: keystring
2470 real (kind_real), intent(out) :: value
2471!
2472! Local variable declarations.
2473!
2474 TYPE (yaml_extract), allocatable :: S(:)
2475!
2476 integer :: Nvalues, ie, status
2477!
2478 character (len=Lmax) :: msg
2479
2480 character (len=*), parameter :: MyFile = &
2481 & __FILE__//", yaml_Get_rvar_0d"
2482!
2483!-----------------------------------------------------------------------
2484! Extract requested key-string value.
2485!-----------------------------------------------------------------------
2486!
2487 status=noerr
2488!
2489 IF (yaml_error(self%extract(keystring, s), &
2490 & noerr, __line__, myfile)) RETURN
2491!
2492! Make sure that extracted value is a scalar.
2493!
2494 nvalues=SIZE(s)
2495!
2496 IF (nvalues.gt.1) THEN
2497 yaml_errflag=7
2498 status=yaml_errflag
2499 IF (yaml_error(yaml_errflag, noerr, __line__, myfile)) THEN
2500 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2501 & self%filename
2502 RETURN
2503 END IF
2504!
2505! Convert string value to real.
2506!
2507 ELSE
2508 s(1)%value=adjustl(s(1)%value)
2509 ie=len_trim(s(1)%value)
2510 READ (s(1)%value(1:ie), *, iostat=status, iomsg=msg) value
2511 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2512 yaml_errflag=5
2513 IF (yaml_master) WRITE (yaml_stdout,20) trim(keystring), &
2514 & s(1)%value, trim(msg)
2515 RETURN
2516 END IF
2517 END IF
2518!
2519! Deallocate.
2520!
2521 IF (ALLOCATED(s)) DEALLOCATE (s)
2522!
2523 10 FORMAT (/,' YAML_GET_RVAR_0D - Extracted value is not a scalar,', &
2524 & ' key-string: ',a,/,20x,'Nvalues = ',i0,/,20x,'File: ',a)
2525 20 FORMAT (/,' YAML_GET_RVAR_0D - Error while converting string to', &
2526 & ' integer, key: ',a,', value = ',a,/,20x,'ErrMsg: ',a)
2527!
2528 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_rvar_1d()

integer function yaml_parser::yaml_get::yaml_get_rvar_1d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
real (kind_real), dimension(:), intent(out) value )

Definition at line 2531 of file yaml_parser_test.F.

2532!
2533!***********************************************************************
2534! !
2535! It gets 1D floating-point data from YAML dictionary object. !
2536! !
2537! On Input: !
2538! !
2539! self YAML tree dictionary object (CLASS yaml_tree) !
2540! keystring YAML tree aggregated keys (string) !
2541! !
2542! On Output: !
2543! !
2544! value YAML value (real; 1D-array) !
2545! status Error code (integer) !
2546! !
2547!***********************************************************************
2548!
2549! Imported variable declarations.
2550!
2551 class(yaml_tree), intent(in) :: self
2552 character (len=*), intent(in) :: keystring
2553 real (kind_real), intent(out) :: value(:)
2554!
2555! Local variable declarations.
2556!
2557 TYPE (yaml_extract), allocatable :: S(:)
2558!
2559 integer :: Nvalues, i, ie, status
2560!
2561 character (len=Lmax) :: msg
2562
2563 character (len=*), parameter :: MyFile = &
2564 & __FILE__//", yaml_Get_rvar_1d"
2565!
2566!-----------------------------------------------------------------------
2567! Extract requested key-string values.
2568!-----------------------------------------------------------------------
2569!
2570 status=noerr
2571!
2572 IF (yaml_error(self%extract(keystring, s), &
2573 & noerr, __line__, myfile)) RETURN
2574!
2575! Make sure that extracted value is a scalar.
2576!
2577 nvalues=SIZE(s, dim=1)
2578!
2579 IF (SIZE(value, dim=1).lt.nvalues) THEN
2580 yaml_errflag=7
2581 status=yaml_errflag
2582 IF (yaml_error(yaml_errflag, noerr, __line__, myfile)) THEN
2583 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2584 & SIZE(value, dim=1), &
2585 & self%filename
2586 RETURN
2587 END IF
2588 END IF
2589!
2590! Convert string values to reals.
2591!
2592 DO i=1,nvalues
2593 s(i)%value=adjustl(s(i)%value)
2594 ie=len_trim(s(i)%value)
2595 READ (s(i)%value(1:ie), *, iostat=status, iomsg=msg) value(i)
2596 IF (yaml_error(status, noerr, __line__, myfile)) THEN
2597 yaml_errflag=5
2598 IF (yaml_master) WRITE (yaml_stdout,20) trim(keystring), &
2599 & s(i)%value, trim(msg)
2600 RETURN
2601 END IF
2602 END DO
2603!
2604! Deallocate.
2605!
2606 IF (ALLOCATED(s)) DEALLOCATE (s)
2607!
2608 10 FORMAT (/,' YAML_GET_RVAR_1D - Inconsistent number of values,', &
2609 & ' key-string: ',a,/,20x,'YAML size = ',i0, &
2610 & ', Variable size = ',i0,/,20x,'File: ',a)
2611 20 FORMAT (/,' YAML_GET_RVAR_1D - Error while converting string to', &
2612 & ' real, key: ',a,', value = ',a,/,20x,'ErrMsg: ',a)
2613!
2614 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_s_struc()

integer function yaml_parser::yaml_get::yaml_get_s_struc ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
type (yaml_svec), dimension(:), intent(out), allocatable v )

Definition at line 2058 of file yaml_parser_test.F.

2059!
2060!***********************************************************************
2061! !
2062! It loads a vector set of strings in YAML block-list structure, !
2063! V(1:Nitems)%vector(1:Nvalues)%value. If the dummy argument V !
2064! structure is allocated, it deallocates/allocates the required !
2065! Nitems and Nvalues dimensions. !
2066! !
2067! On Input: !
2068! !
2069! self YAML tree dictionary object (CLASS yaml_tree) !
2070! keystring YAML tree aggregated keys (string) !
2071! !
2072! On Output: !
2073! !
2074! V Vector of strings in block list (TYPE yaml_Svec) !
2075! status Error code (integer) !
2076! !
2077!***********************************************************************
2078!
2079! Imported variable declarations.
2080!
2081 class(yaml_tree), intent(in) :: self
2082 character (len=*), intent(in) :: keystring
2083 TYPE (yaml_Svec), allocatable, intent(out) :: V(:)
2084!
2085! Local variable declarations.
2086!
2087 TYPE (yaml_extract), allocatable :: S(:)
2088!
2089 integer :: Nitems, Nvalues, n, i
2090 integer :: status
2091!
2092 character (len=*), parameter :: MyFile = &
2093 & __FILE__//", yaml_Get_s_struc"
2094!
2095!-----------------------------------------------------------------------
2096! Extract requested key-string values.
2097!-----------------------------------------------------------------------
2098!
2099 status=noerr
2100!
2101 IF (yaml_error(self%extract(keystring, s), &
2102 & noerr, __line__, myfile)) RETURN
2103!
2104! Allocate output structure.
2105!
2106 nitems=SIZE(s, dim=1)
2107 IF (ALLOCATED(v)) DEALLOCATE (v)
2108 ALLOCATE ( v(nitems) )
2109!
2110! Load string vector values to output structure.
2111!
2112 DO n=1,nitems
2113 IF (s(n)%has_vector) THEN
2114 nvalues=SIZE(s(n)%vector)
2115 ALLOCATE ( v(n)%vector(nvalues) )
2116 DO i=1,nvalues
2117 v(n)%vector(i)%value=s(n)%vector(i)%value
2118 END DO
2119 ELSE
2120 v(n)%value=s(n)%value
2121 END IF
2122 END DO
2123!
2124! Deallocate local extraction structure.
2125!
2126 IF (ALLOCATED(s)) DEALLOCATE (s)
2127!
2128 RETURN

References yaml_parser::noerr, and yaml_parser::yaml_error().

Here is the call graph for this function:

◆ yaml_get_svar_0d()

integer function yaml_parser::yaml_get::yaml_get_svar_0d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
character (len=*), intent(out) value )

Definition at line 2617 of file yaml_parser_test.F.

2618!
2619!***********************************************************************
2620! !
2621! It gets scalar string data from YAML dictionary object. !
2622! !
2623! On Input: !
2624! !
2625! self YAML tree dictionary object (CLASS yaml_tree) !
2626! keystring YAML tree aggregated keys (string) !
2627! !
2628! On Output: !
2629! !
2630! value YAML value (string; scalar) !
2631! status Error code (integer) !
2632! !
2633!***********************************************************************
2634!
2635! Imported variable declarations.
2636!
2637 class(yaml_tree), intent(in ) :: self
2638 character (len=*), intent(in ) :: keystring
2639 character (len=*), intent(out) :: value
2640!
2641! Local variable declarations.
2642!
2643 TYPE (yaml_extract), allocatable :: S(:)
2644!
2645 integer :: Nvalues, status
2646!
2647 character (len=*), parameter :: MyFile = &
2648 & __FILE__//", yaml_Get_lvar_0d"
2649!
2650!-----------------------------------------------------------------------
2651! Extract requested key-string value.
2652!-----------------------------------------------------------------------
2653!
2654 status=noerr
2655!
2656 IF (yaml_error(self%extract(keystring, s), &
2657 & noerr, __line__, myfile)) RETURN
2658!
2659! Make sure that extracted value is a scalar.
2660!
2661 nvalues=SIZE(s)
2662!
2663 IF (nvalues.gt.1) THEN
2664 yaml_errflag=7
2665 status=yaml_errflag
2666 IF (yaml_error(yaml_errflag, noerr, __line__, myfile)) THEN
2667 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2668 & self%filename
2669 RETURN
2670 END IF
2671!
2672! Load string value.
2673!
2674 ELSE
2675 value=s(1)%value
2676 END IF
2677!
2678! Deallocate.
2679!
2680 IF (ALLOCATED(s)) DEALLOCATE (s)
2681!
2682 10 FORMAT (/,' YAML_GET_SVAR_0D - Extracted value is not a scalar,', &
2683 & ' key-string: ',a,/,20x,'Nvalues = ',i0,/,20x,'File: ',a)
2684!
2685 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

◆ yaml_get_svar_1d()

integer function yaml_parser::yaml_get::yaml_get_svar_1d ( class (yaml_tree), intent(in) self,
character (len=*), intent(in) keystring,
character (len=*), dimension(:), intent(out) value )

Definition at line 2688 of file yaml_parser_test.F.

2689!
2690!***********************************************************************
2691! !
2692! It gets 1D string data from YAML dictionary object. !
2693! !
2694! On Input: !
2695! !
2696! self YAML tree dictionary object (CLASS yaml_tree) !
2697! keystring YAML tree aggregated keys (string) !
2698! !
2699! On Output: !
2700! !
2701! value YAML value (string; 1D-array) !
2702! status Error code (integer) !
2703! !
2704!***********************************************************************
2705!
2706! Imported variable declarations.
2707!
2708 class(yaml_tree), intent(in ) :: self
2709 character (len=*), intent(in ) :: keystring
2710 character (len=*), intent(out) :: value(:)
2711!
2712! Local variable declarations.
2713!
2714 TYPE (yaml_extract), allocatable :: S(:)
2715!
2716 integer :: Nvalues, i, status
2717!
2718 character (len=*), parameter :: MyFile = &
2719 & __FILE__//", yaml_Get_lvar_1d"
2720!
2721!-----------------------------------------------------------------------
2722! Extract requested key-string values.
2723!-----------------------------------------------------------------------
2724!
2725 status=noerr
2726!
2727 IF (yaml_error(self%extract(keystring, s), &
2728 & noerr, __line__, myfile)) RETURN
2729!
2730! Make sure that extracted value is a scalar.
2731!
2732 nvalues=SIZE(s, dim=1)
2733!
2734 IF (SIZE(value, dim=1).lt.nvalues) THEN
2735 yaml_errflag=7
2736 status=yaml_errflag
2737 IF (yaml_error(yaml_errflag, noerr, __line__, myfile)) THEN
2738 IF (yaml_master) WRITE (yaml_stdout,10) keystring, nvalues, &
2739 & SIZE(value, dim=1), &
2740 & self%filename
2741 RETURN
2742 END IF
2743 END IF
2744!
2745! Load string values.
2746!
2747 DO i=1,nvalues
2748 value(i)=s(i)%value
2749 END DO
2750!
2751! Deallocate.
2752!
2753 IF (ALLOCATED(s)) DEALLOCATE (s)
2754!
2755 10 FORMAT (/,' YAML_GET_SVAR_1D - Inconsistent number of values,', &
2756 & ' key-string: ',a,/,20x,'YAML size = ',i0, &
2757 & ', Variable size = ',i0,/,20x,'File: ',a)
2758!
2759 RETURN

References yaml_parser::noerr, yaml_parser::yaml_errflag, yaml_parser::yaml_error(), yaml_parser::yaml_master, and yaml_parser::yaml_stdout.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: