ROMS
Loading...
Searching...
No Matches
inp_decode_mod::load_s1d Interface Reference

Public Member Functions

integer function load_s1d1 (nval, fname, fdim, line, label, igrid, mgrids, nfiles, io_type, s)
 
integer function load_s1d2 (nval, fname, fdim, line, label, igrid, mgrids, nfiles, idim, ie, io_type, s)
 

Detailed Description

Definition at line 84 of file inp_decode.F.

Member Function/Subroutine Documentation

◆ load_s1d1()

integer function inp_decode_mod::load_s1d::load_s1d1 ( integer, intent(in) nval,
character (len=256), dimension(fdim), intent(in) fname,
integer, intent(in) fdim,
character (len=*), intent(in) line,
character (len=*), intent(inout) label,
integer, intent(inout) igrid,
integer, intent(in) mgrids,
integer, dimension(mgrids), intent(inout) nfiles,
integer, intent(in) io_type,
type(t_io), dimension(mgrids), intent(inout) s )

Definition at line 1723 of file inp_decode.F.

1725!
1726!***********************************************************************
1727! !
1728! This function loads input values into requested 1D structure !
1729! S(Mgrids) containing information about I/O files. !
1730! !
1731! On Input: !
1732! !
1733! Nval Number of values processed (integer) !
1734! Fname File name(s) processed (string array) !
1735! Fdim File name(s) dimension in calling program (integer) !
1736! line Current input line (string) !
1737! label I/O structure label (string) !
1738! igrid Nested grid counter (integer) !
1739! Mgrids Number of nested grids (integer) !
1740! Nfiles Number of files per grid (integer array) !
1741! io_type File I/O type (integer) !
1742! S(Mgrids) Derived type structure array, TYPE(T_IO) !
1743! !
1744! On Output: !
1745! !
1746! igrid Updated nested grid counter. !
1747! S(Mgrids) Updated derived type structure array, TYPE(T_IO). !
1748! load_s1d_1 Number of output values processed. !
1749! !
1750!***********************************************************************
1751!
1752! Imported variable declarations.
1753!
1754 integer, intent(in) :: Mgrids, Nval, Fdim, io_type
1755 integer, intent(inout) :: igrid
1756 integer, intent(inout) :: Nfiles(Mgrids)
1757
1758 character (len=*), intent(in) :: line
1759 character (len=256), intent(in) :: Fname(Fdim)
1760 character (len=*), intent(inout) :: label
1761
1762 TYPE(T_IO), intent(inout) :: S(Mgrids)
1763!
1764! Local variable declarations.
1765!
1766 logical :: load, persist
1767
1768 integer :: Icont, Ipipe, i, is, j, lstr, my_Mgrids, ng
1769 integer :: load_s1d1
1770
1771 character (len=1 ), parameter :: blank = ' '
1772!
1773!-----------------------------------------------------------------------
1774! Count files for all grids and activate load switch.
1775!-----------------------------------------------------------------------
1776!
1777! Check current line for the continuation symbol [char(92)=\] or pipe
1778! symbol [char(124)=|]. The continuation symbol is used to separate
1779! string values for different grid, whereas the pipe symbol is used
1780! to separate multi-string values for split input files. User may
1781! split the records for a particular input field into several files.
1782!
1783 icont=index(trim(line),char(92) ,back=.false.)
1784 ipipe=index(trim(line),char(124),back=.false.)
1785 IF ((icont.eq.0).and.(ipipe.eq.0)) THEN
1786 load=.true. ! last input string
1787 ELSE
1788 load=.false. ! process next string
1789 END IF
1790!
1791! Accumulate number of multi-files per each grid.
1792!
1793 nfiles(igrid)=nfiles(igrid)+1
1794!
1795! Set grid counter.
1796!
1797 IF (.not.load) THEN
1798 igrid=igrid+min(1,icont)
1799 END IF
1800 IF (igrid.gt.mgrids) THEN
1801 IF (master) THEN
1802 WRITE (stdout,10) trim(line)
1803 END IF
1804 exit_flag=2
1805 RETURN
1806 END IF
1807!
1808!-----------------------------------------------------------------------
1809! Load I/O information into structure.
1810!-----------------------------------------------------------------------
1811!
1812 IF (load) THEN
1813!
1814! If nesting and the number of file name entries is less than Mgrids,
1815! persist the last values provided. This is the case when not enough
1816! entries are provided by "==" plural symbol after the KEYWORD.
1817!
1818 IF (igrid.lt.mgrids) THEN
1819 DO i=igrid+1,mgrids
1820 nfiles(i)=nfiles(igrid)
1821 END DO
1822 my_mgrids=igrid
1823 persist=.true.
1824 ELSE
1825 my_mgrids=mgrids
1826 persist=.false.
1827 END IF
1828!
1829! Allocate various fields in structure, if not continuation or pipe
1830! symbol is found which indicates end of input data.
1831!
1832 IF (label(1:3).eq.'FLT') THEN
1833#ifdef FLOAT_BIOLOGY
1834 is=-10
1835#else
1836 is=-6
1837#endif
1838 ELSE
1839 is=1
1840 END IF
1841!
1842 DO ng=1,mgrids
1843 allocate ( s(ng)%Nrec(nfiles(ng)) )
1844 allocate ( s(ng)%time_min(nfiles(ng)) )
1845 allocate ( s(ng)%time_max(nfiles(ng)) )
1846 allocate ( s(ng)%Vid(is:nv) )
1847 allocate ( s(ng)%Tid(mt) )
1848#if defined PIO_LIB && defined DISTRIBUTE
1849 allocate ( s(ng)%pioVar(is:nv) )
1850 allocate ( s(ng)%pioTrc(mt) )
1851#endif
1852 allocate ( s(ng)%files(nfiles(ng)) )
1853 END DO
1854!
1855! Intialize strings to blank to facilitate processing.
1856!
1857 DO ng=1,mgrids
1858 lstr=len(s(ng)%name)
1859 DO i=1,lstr
1860 s(ng)%head(i:i)=blank
1861 s(ng)%base(i:i)=blank
1862 s(ng)%name(i:i)=blank
1863 END DO
1864 DO j=1,nfiles(ng)
1865 DO i=1,lstr
1866 s(ng)%files(j)(i:i)=blank
1867 END DO
1868 END DO
1869 END DO
1870!
1871! Initialize and load fields into structure.
1872!
1873 i=0
1874 DO ng=1,my_mgrids
1875 s(ng)%IOtype=io_type ! file IO type
1876 s(ng)%Nfiles=nfiles(ng) ! number of multi-files
1877 s(ng)%Fcount=1 ! multi-file counter
1878 s(ng)%load=1 ! filename load counter
1879 s(ng)%Rindex=0 ! time index
1880 s(ng)%ncid=-1 ! closed NetCDF state
1881 s(ng)%Vid=-1 ! NetCDF variables IDs
1882 s(ng)%Tid=-1 ! NetCDF tracers IDs
1883#if defined PIO_LIB && defined DISTRIBUTE
1884 s(ng)%pioFile%fh=-1 ! closed file handler
1885 DO j=1,nv
1886 s(ng)%pioVar(j)%vd%varID=-1 ! variables IDs
1887 s(ng)%pioVar(j)%dkind=-1 ! variables data kind
1888 s(ng)%pioVar(j)%gtype=0 ! variables C-grid type
1889 END DO
1890 DO j=1,mt
1891 s(ng)%pioTrc(j)%vd%varID=-1 ! tracers IDs
1892 s(ng)%pioTrc(j)%dkind=-1 ! tracers data kind
1893 s(ng)%pioTrc(j)%gtype=0 ! tracers C-grid type
1894 END DO
1895#endif
1896 DO j=1,nfiles(ng)
1897 i=i+1
1898 s(ng)%files(j)=trim(fname(i)) ! load multi-files
1899 s(ng)%Nrec(j)=0 ! record counter
1900 s(ng)%time_min(j)=0.0_dp ! starting time
1901 s(ng)%time_max(j)=0.0_dp ! ending time
1902 END DO
1903 s(ng)%label=trim(label) ! structure label
1904 s(ng)%name=trim(s(ng)%files(1)) ! load first file
1905 lstr=len_trim(s(ng)%name)
1906 s(ng)%head=s(ng)%name(1:lstr-3) ! do not include ".nc"
1907 s(ng)%base=s(ng)%name(1:lstr-3) ! do not include ".nc"
1908 nfiles(ng)=0 ! clean file counter
1909 END DO
1910!
1911! If appropriate, persist last value(s).
1912!
1913 IF (persist) THEN
1914 DO ng=igrid+1,mgrids
1915 s(ng)%IOtype=io_type
1916 s(ng)%Nfiles=s(igrid)%Nfiles
1917 s(ng)%Fcount=1
1918 s(ng)%load=1
1919 s(ng)%Rindex=0
1920 s(ng)%ncid=-1
1921 s(ng)%Vid=-1
1922 s(ng)%Tid=-1
1923#if defined PIO_LIB && defined DISTRIBUTE
1924 s(ng)%pioFile%fh=-1
1925 DO j=is,nv
1926 s(ng)%pioVar(j)%vd%varID=-1
1927 s(ng)%pioVar(j)%dkind=-1
1928 s(ng)%pioVar(j)%gtype=0
1929 END DO
1930 DO j=1,mt
1931 s(ng)%pioTrc(j)%vd%varID=-1
1932 s(ng)%pioTrc(j)%dkind=-1
1933 s(ng)%pioTrc(j)%gtype=0
1934 END DO
1935#endif
1936 DO j=1,s(igrid)%Nfiles
1937 s(ng)%files(j)=s(igrid)%files(j)
1938 s(ng)%Nrec(j)=0
1939 s(ng)%time_min(j)=0.0_dp
1940 s(ng)%time_max(j)=0.0_dp
1941 END DO
1942 s(ng)%label=trim(label)
1943 s(ng)%name=s(igrid)%name
1944 s(ng)%base=s(igrid)%base
1945 nfiles(ng)=0
1946 END DO
1947 END IF
1948!
1949! Reset counters and clean label.
1950!
1951 igrid=1
1952 DO ng=1,mgrids
1953 nfiles(ng)=0
1954 END DO
1955 DO i=1,len(label)
1956 label(i:i)=blank
1957 END DO
1958 END IF
1959 load_s1d1=nval
1960
1961 10 FORMAT (/,' LOAD_S1D1 - incorrect continuation symbol in line:', &
1962 & /,14x,a,/,11x,'number of nested grid values exceeded.')
1963!
1964 RETURN

References mod_scalars::exit_flag, inp_decode_mod::load_s1d1(), mod_parallel::master, mod_param::mt, mod_ncparam::nv, and mod_iounits::stdout.

Here is the call graph for this function:

◆ load_s1d2()

integer function inp_decode_mod::load_s1d::load_s1d2 ( integer, intent(in) nval,
character (len=256), dimension(fdim), intent(in) fname,
integer, intent(in) fdim,
character (len=*), intent(in) line,
character (len=*), intent(inout) label,
integer, intent(inout) igrid,
integer, intent(in) mgrids,
integer, dimension(mgrids), intent(inout) nfiles,
integer, intent(in) idim,
integer, intent(in) ie,
integer, intent(in) io_type,
type(t_io), dimension(idim,mgrids), intent(inout) s )

Definition at line 1967 of file inp_decode.F.

1969!
1970!***********************************************************************
1971! !
1972! This function loads input values into requested 2D structure !
1973! S(Ie,:) elemement containing information about I/O files. !
1974! !
1975! On Input: !
1976! !
1977! Nval Number of values processed (integer) !
1978! Fname File name(s) processed (string array) !
1979! Fdim File name(s) dimension in calling program (integer) !
1980! line Current input line (string) !
1981! label I/O structure label (string) !
1982! igrid Nested grid counter (integer) !
1983! Mgrids Number of nested grids (integer) !
1984! Nfiles Number of files per grid (integer array) !
1985! idim Size of structure inner dimension (integer) !
1986! Ie Inner dimension element to process (integer) !
1987! io_type File I/O type (integer) !
1988! S(Ie,Mgrids) Derived type structure array, TYPE(T_IO) !
1989! !
1990! On Output: !
1991! !
1992! igrid Updated nested grid counter. !
1993! S(Ie,Mgrids) Updated derived type structure array, TYPE(T_IO). !
1994! load_s1d_2 Number of output values processed. !
1995! !
1996!***********************************************************************
1997!
1998 USE mod_param
1999 USE mod_parallel
2000 USE mod_iounits
2001 USE mod_ncparam
2002 USE mod_scalars
2003!
2004! Imported variable declarations.
2005!
2006 integer, intent(in) :: Mgrids, Nval, Fdim, Ie, idim, io_type
2007 integer, intent(inout) :: igrid
2008 integer, intent(inout) :: Nfiles(Mgrids)
2009
2010 character (len=*), intent(in) :: line
2011 character (len=256), intent(in) :: Fname(Fdim)
2012 character (len=*), intent(inout) :: label
2013
2014 TYPE(T_IO), intent(inout) :: S(idim,Mgrids)
2015!
2016! Local variable declarations.
2017!
2018 logical :: load, persist
2019
2020 integer :: Icont, Ipipe, i, is, j, lstr, my_Mgrids, ng
2021 integer :: load_s1d2
2022
2023 character (len=1 ), parameter :: blank = ' '
2024!
2025!-----------------------------------------------------------------------
2026! Count files for all grids and activate load switch.
2027!-----------------------------------------------------------------------
2028!
2029! Check current line for the continuation symbol [char(92)=\] or pipe
2030! symbol [char(124)=|]. The continuation symbol is used to separate
2031! string values for different grid, whereas the pipe symbol is used
2032! to separate multi-string values for split input files. User may
2033! split the records for a particular input field into several files.
2034!
2035 icont=index(trim(line),char(92) ,back=.false.)
2036 ipipe=index(trim(line),char(124),back=.false.)
2037 IF ((icont.eq.0).and.(ipipe.eq.0)) THEN
2038 load=.true. ! last input string
2039 ELSE
2040 load=.false. ! process next string
2041 END IF
2042!
2043! Accumulate number of multi-files per each grid.
2044!
2045 nfiles(igrid)=nfiles(igrid)+1
2046!
2047! Set grid counter.
2048!
2049 IF (.not.load) THEN
2050 igrid=igrid+min(1,icont)
2051 END IF
2052 IF (igrid.gt.mgrids) THEN
2053 IF (master) THEN
2054 WRITE (stdout,10) trim(line)
2055 END IF
2056 exit_flag=2
2057 RETURN
2058 END IF
2059!
2060!-----------------------------------------------------------------------
2061! Load I/O information into structure.
2062!-----------------------------------------------------------------------
2063!
2064 IF (load) THEN
2065!
2066! If nesting and the number of file name entries is less than Mgrids,
2067! persist the last values provided. This is the case when not enough
2068! entries are provided by "==" plural symbol after the KEYWORD.
2069!
2070 IF (igrid.lt.mgrids) THEN
2071 DO i=igrid+1,mgrids
2072 nfiles(i)=nfiles(igrid)
2073 END DO
2074 my_mgrids=igrid
2075 persist=.true.
2076 ELSE
2077 my_mgrids=mgrids
2078 persist=.false.
2079 END IF
2080!
2081! Allocate various fields in structure, if not continuation or pipe
2082! symbol is found which indicates end of input data.
2083!
2084 DO ng=1,mgrids
2085 allocate ( s(ie,ng)%Nrec(nfiles(ng)) )
2086 allocate ( s(ie,ng)%time_min(nfiles(ng)) )
2087 allocate ( s(ie,ng)%time_max(nfiles(ng)) )
2088 allocate ( s(ie,ng)%Vid(nv) )
2089 allocate ( s(ie,ng)%Tid(mt) )
2090#if defined PIO_LIB && defined DISTRIBUTE
2091 allocate ( s(ie,ng)%pioVar(nv) )
2092 allocate ( s(ie,ng)%pioTrc(mt) )
2093#endif
2094 allocate ( s(ie,ng)%files(nfiles(ng)) )
2095 END DO
2096!
2097! Intialize strings to blank to facilitate processing.
2098!
2099 DO ng=1,mgrids
2100 lstr=len(s(ie,ng)%name)
2101 DO i=1,lstr
2102 s(ie,ng)%head(i:i)=blank
2103 s(ie,ng)%base(i:i)=blank
2104 s(ie,ng)%name(i:i)=blank
2105 END DO
2106 DO j=1,nfiles(ng)
2107 DO i=1,lstr
2108 s(ie,ng)%files(j)(i:i)=blank
2109 END DO
2110 END DO
2111 END DO
2112!
2113! Initialize and load fields into structure.
2114!
2115 i=0
2116 DO ng=1,my_mgrids
2117 s(ie,ng)%IOtype=io_type ! file IO type
2118 s(ie,ng)%Nfiles=nfiles(ng) ! number of multi-files
2119 s(ie,ng)%Fcount=1 ! multi-file counter
2120 s(ie,ng)%load=1 ! filename load counter
2121 s(ie,ng)%Rindex=0 ! time index
2122 s(ie,ng)%ncid=-1 ! closed NetCDF state
2123 s(ie,ng)%Vid=-1 ! NetCDF variables IDs
2124 s(ie,ng)%Tid=-1 ! NetCDF tracers IDs
2125#if defined PIO_LIB && defined DISTRIBUTE
2126 s(ie,ng)%pioFile%fh=-1 ! closed file handler
2127 DO j=1,nv
2128 s(ie,ng)%pioVar(j)%vd%varID=-1 ! variables IDs
2129 s(ie,ng)%pioVar(j)%dkind=-1 ! variables data kind
2130 s(ie,ng)%pioVar(j)%gtype=0 ! variables C-grid type
2131 END DO
2132 DO j=1,mt
2133 s(ie,ng)%pioTrc(j)%vd%varID=-1 ! tracers IDs
2134 s(ie,ng)%pioTrc(j)%dkind=-1 ! tracers data kind
2135 s(ie,ng)%pioTrc(j)%gtype=0 ! tracers C-grid type
2136 END DO
2137#endif
2138 DO j=1,nfiles(ng)
2139 i=i+1
2140 s(ie,ng)%files(j)=trim(fname(i)) ! load multi-files
2141 s(ie,ng)%Nrec(j)=0 ! record counter
2142 s(ie,ng)%time_min(j)=0.0_dp ! starting time
2143 s(ie,ng)%time_max(j)=0.0_dp ! ending time
2144 END DO
2145 s(ie,ng)%label=trim(label) ! structure label
2146 s(ie,ng)%name=trim(s(ie,ng)%files(1)) ! load first file
2147 lstr=len_trim(s(ie,ng)%name)
2148 s(ie,ng)%head=s(ie,ng)%name(1:lstr-3) ! do not include ".nc"
2149 s(ie,ng)%base=s(ie,ng)%name(1:lstr-3) ! do not include ".nc"
2150 nfiles(ng)=0 ! clean file counter
2151 END DO
2152!
2153! If appropriate, persist last value(s).
2154!
2155 IF (persist) THEN
2156 DO ng=igrid+1,mgrids
2157 s(ie,ng)%IOtype=io_type
2158 s(ie,ng)%Nfiles=s(ie,igrid)%Nfiles
2159 s(ie,ng)%Fcount=1
2160 s(ie,ng)%load=1
2161 s(ie,ng)%Rindex=0
2162 s(ie,ng)%ncid=-1
2163 s(ie,ng)%Vid=-1
2164 s(ie,ng)%Tid=-1
2165#if defined PIO_LIB && defined DISTRIBUTE
2166 s(ie,ng)%pioFile%fh=-1
2167 DO j=1,nv
2168 s(ie,ng)%pioVar(j)%vd%varID=-1
2169 s(ie,ng)%pioVar(j)%dkind=-1
2170 s(ie,ng)%pioVar(j)%gtype=0
2171 END DO
2172 DO j=1,mt
2173 s(ie,ng)%pioTrc(j)%vd%varID=-1
2174 s(ie,ng)%pioTrc(j)%dkind=-1
2175 s(ie,ng)%pioTrc(j)%gtype=0
2176 END DO
2177#endif
2178 DO j=1,s(ie,igrid)%Nfiles
2179 s(ie,ng)%files(j)=s(ie,igrid)%files(j)
2180 s(ie,ng)%Nrec(j)=0
2181 s(ie,ng)%time_min(j)=0.0_dp
2182 s(ie,ng)%time_max(j)=0.0_dp
2183 END DO
2184 s(ie,ng)%label=trim(label)
2185 s(ie,ng)%name=s(ie,igrid)%name
2186 s(ie,ng)%base=s(ie,igrid)%base
2187 nfiles(ng)=0
2188 END DO
2189 END IF
2190!
2191! Reset counters and clean label.
2192!
2193 igrid=1
2194 DO ng=1,mgrids
2195 nfiles(ng)=0
2196 END DO
2197 DO i=1,len(label)
2198 label(i:i)=blank
2199 END DO
2200 END IF
2201 load_s1d2=nval
2202
2203 10 FORMAT (/,' LOAD_S1D2 - incorrect continuation symbol in line:', &
2204 & /,14x,a,/,11x,'number of nested grid values exceeded.')
2205!
2206 RETURN
integer stdout
integer, parameter nv
logical master
integer mt
Definition mod_param.F:490
integer exit_flag

References mod_scalars::exit_flag, inp_decode_mod::load_s1d2(), mod_parallel::master, mod_param::mt, mod_ncparam::nv, and mod_iounits::stdout.

Here is the call graph for this function:

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