456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476 logical, intent(in) :: MyMaster
477 logical, intent(out) :: Value(:)
478
479 integer, intent(in) :: Ndim
480
481 character (len=*), intent(in) :: KeyWord
482 character (len=*), intent(in), optional :: InpName
483
484
485
486 logical :: foundit, GotFile
487
488 integer :: InpUnit, Npts, Nval, io_err, status
489
490 real(dp), dimension(nRval) :: Rval
491
492 character (len= 40) :: string
493 character (len=256) :: io_errmsg, line
494 character (len=256), dimension(nCval) :: Cval
495
496
497
498
499
500
501
502 io_err=0
503 IF (PRESENT(inpname)) THEN
504 inpunit=1
505 OPEN (inpunit, file=trim(inpname), form='formatted', &
506 & status='old', iostat=io_err, iomsg=io_errmsg)
507 IF (io_err.ne.0) THEN
508 IF (mymaster) WRITE (stdout,10) trim(inpname), &
509 & trim(io_errmsg)
510 10 FORMAT (/,' GETPAR_1D_L - Unable to open input script: ',a, &
511 & /,15x,'ERROR: ',a)
512 exit_flag=5
513 RETURN
514 ELSE
515 gotfile=.true.
516 END IF
517 ELSE
518 inpunit=stdinp_unit(mymaster, gotfile)
519 END IF
520
521
522
523 foundit=.false.
524 DO WHILE (.true.)
525 READ (inpunit,'(a)',err=20,END=40) line
526 status=decode_line(line, string, nval, cval, rval)
527 IF (status.gt.0) THEN
528 IF (trim(string).eq.trim(keyword)) THEN
529 npts=load_l(nval, cval, ndim, Value)
530 foundit=.true.
531 END IF
532 END IF
533 END DO
534 20 IF (mymaster) THEN
535 WRITE (stdout,30) line
536 30 FORMAT (/,' GETPAR_1D_L - Error while processing line: ',/,a)
537 END IF
538 exit_flag=4
539 40 CONTINUE
540 IF (.not.foundit) THEN
541 IF (mymaster) THEN
542 WRITE (stdout,50) trim(keyword)
543 50 FORMAT (/,' GETPAR_1D_L - unable to find KeyWord: ',a, &
544 & /,15x,'in ROMS standard input file.')
545 END IF
546 exit_flag=5
547 END IF
548 IF (gotfile) THEN
549 CLOSE (inpunit)
550 END IF
551
552 RETURN