1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
2003
2004
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
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
2027
2028
2029
2030
2031
2032
2033
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.
2039 ELSE
2040 load=.false.
2041 END IF
2042
2043
2044
2045 nfiles(igrid)=nfiles(igrid)+1
2046
2047
2048
2049 IF (.not.load) THEN
2050 igrid=igrid+min(1,icont)
2051 END IF
2052 IF (igrid.gt.mgrids) THEN
2054 WRITE (
stdout,10) trim(line)
2055 END IF
2057 RETURN
2058 END IF
2059
2060
2061
2062
2063
2064 IF (load) THEN
2065
2066
2067
2068
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
2082
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
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
2114
2115 i=0
2116 DO ng=1,my_mgrids
2117 s(ie,ng)%IOtype=io_type
2118 s(ie,ng)%Nfiles=nfiles(ng)
2119 s(ie,ng)%Fcount=1
2120 s(ie,ng)%load=1
2121 s(ie,ng)%Rindex=0
2122 s(ie,ng)%ncid=-1
2123 s(ie,ng)%Vid=-1
2124 s(ie,ng)%Tid=-1
2125#if defined PIO_LIB && defined DISTRIBUTE
2126 s(ie,ng)%pioFile%fh=-1
2128 s(ie,ng)%pioVar(j)%vd%varID=-1
2129 s(ie,ng)%pioVar(j)%dkind=-1
2130 s(ie,ng)%pioVar(j)%gtype=0
2131 END DO
2133 s(ie,ng)%pioTrc(j)%vd%varID=-1
2134 s(ie,ng)%pioTrc(j)%dkind=-1
2135 s(ie,ng)%pioTrc(j)%gtype=0
2136 END DO
2137#endif
2138 DO j=1,nfiles(ng)
2139 i=i+1
2140 s(ie,ng)%files(j)=trim(fname(i))
2141 s(ie,ng)%Nrec(j)=0
2142 s(ie,ng)%time_min(j)=0.0_dp
2143 s(ie,ng)%time_max(j)=0.0_dp
2144 END DO
2145 s(ie,ng)%label=trim(label)
2146 s(ie,ng)%name=trim(s(ie,ng)%files(1))
2147 lstr=len_trim(s(ie,ng)%name)
2148 s(ie,ng)%head=s(ie,ng)%name(1:lstr-3)
2149 s(ie,ng)%base=s(ie,ng)%name(1:lstr-3)
2150 nfiles(ng)=0
2151 END DO
2152
2153
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
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
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
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