274 class(ModelPackageInputsType) :: this
275 type(CharacterStringType), dimension(:), contiguous, &
276 pointer :: ftypes
277 integer(I4B), dimension(:), allocatable :: cunit_idxs, indx
278 character(len=LENPACKAGETYPE) :: ftype
279 integer(I4B) :: n, m
280 logical(LGP) :: found, has_dis
281
282
283 allocate (cunit_idxs(0))
284 has_dis = .false.
285
286
287 do n = 1, size(ftypes)
288
289 ftype = ftypes(n)
290 found = .false.
291
292
293 if (ftype(1:3) == 'DIS') has_dis = .true.
294
295
296 do m = 1, this%niunit
297 if (this%cunit(m) == ftype) then
298
299 found = .true.
300
301
302 if (any(cunit_idxs == m)) then
303
304 else
305 call expandarray(cunit_idxs)
306 cunit_idxs(size(cunit_idxs)) = m
307 end if
308
309
310 exit
311 end if
312 end do
313
314
315 if (.not. found) then
316 write (errmsg, '(a,a,a,a,a)') 'Model package type not supported &
317 &[model=', trim(this%modelname), ', type=', &
318 trim(ftype), '].'
319 call store_error(errmsg)
320 call store_error_filename(this%modelfname)
321 end if
322 end do
323
324
325 if (.not. has_dis) then
326 write (errmsg, '(3a)') &
327 'Discretization package not specified for model "', &
328 trim(this%modelname), '".'
329 call store_error(errmsg)
330 call store_error_filename(this%modelfname)
331 end if
332
333
334 allocate (this%pkglist(size(cunit_idxs)))
335
336
337 allocate (indx(size(cunit_idxs)))
338 call qsort(indx, cunit_idxs)
339
340
341 do n = 1, size(cunit_idxs)
342 call this%pkglist(n)%create(this%modeltype, this%modelname, &
343 this%cunit(cunit_idxs(n)))
344 end do
345
346
347 deallocate (cunit_idxs)
348 deallocate (indx)