Generic method to read data in the GRIDDATA block for a package.
229
231
232 class(NumericalPackageType) :: this
233 character(len=24), dimension(:), intent(in) :: tags
234 logical, dimension(:), intent(inout) :: lfound
235 character(len=24), dimension(:), intent(in), optional :: varinames
236
237 logical :: lkeyword
238 logical :: endOfBlock
239 integer(I4B) :: nsize
240 integer(I4B) :: j
241 character(len=24) :: tmpvar
242 character(len=LENVARNAME) :: varname
243 character(len=LINELENGTH) :: keyword
244 character(len=:), allocatable :: line
245 integer(I4B) :: istart, istop, lloc
246 integer(I4B), dimension(:), pointer, contiguous :: aint
247 real(DP), dimension(:), pointer, contiguous :: adbl
248
249
250 nsize = size(tags)
251 do
252 call this%parser%GetNextLine(endofblock)
253 if (endofblock) exit
254 call this%parser%GetStringCaps(keyword)
255 call this%parser%GetRemainingLine(line)
256 lkeyword = .false.
257 lloc = 1
258 tag_iter: do j = 1, nsize
259 if (trim(adjustl(keyword)) == trim(adjustl(tags(j)))) then
260 lkeyword = .true.
261 lfound(j) = .true.
262 if (present(varinames)) then
263 tmpvar = adjustl(varinames(j))
264 else
265 tmpvar = adjustl(tags(j))
266 end if
267 varname = tmpvar(1:lenvarname)
268 if (keyword(1:1) == 'I') then
269 call mem_setptr(aint, trim(varname), trim(this%memoryPath))
270 call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, &
271 this%parser%iuactive, aint, tags(j))
272 else
273 call mem_setptr(adbl, trim(varname), trim(this%memoryPath))
274 call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, &
275 this%parser%iuactive, adbl, tags(j))
276 end if
277 exit tag_iter
278 end if
279 end do tag_iter
280 if (.not. lkeyword) then
281 write (errmsg, '(a,a)') 'Unknown GRIDDATA tag: ', &
282 trim(keyword)
283 call store_error(errmsg)
284 call this%parser%StoreErrorUnit()
285 end if
286 end do