ROMS
Loading...
Searching...
No Matches
stdinp_mod::getpar_l Interface Reference

Public Member Functions

subroutine getpar_0d_l (mymaster, value, keyword, inpname)
 
subroutine getpar_1d_l (mymaster, ndim, value, keyword, inpname)
 

Detailed Description

Definition at line 44 of file stdinp_mod.F.

Member Function/Subroutine Documentation

◆ getpar_0d_l()

subroutine stdinp_mod::getpar_l::getpar_0d_l ( logical, intent(in) mymaster,
logical, intent(out) value,
character (len=*), intent(in) keyword,
character (len=*), intent(in), optional inpname )

Definition at line 356 of file stdinp_mod.F.

357!
358!***********************************************************************
359! !
360! Reads a scalar logical parameter from ROMS standard input file. !
361! !
362! On Input: !
363! !
364! MyMaster Switch indicating Master process (logical) !
365! KeyWord Keyword associated with input parameter (string) !
366! InpName Standard input filename (string; OPTIONAL) !
367! !
368! On Output: !
369! !
370! Value Standard input parameter value (logical) !
371! !
372!***********************************************************************
373!
374! Imported variable declarations.
375!
376 logical, intent(in) :: MyMaster
377 logical, intent(out) :: Value
378!
379 character (len=*), intent(in) :: KeyWord
380 character (len=*), intent(in), optional :: InpName
381!
382! Local variable declarations.
383!
384 logical :: foundit, GotFile
385 logical :: Lvalue(1)
386!
387 integer :: InpUnit, Npts, Nval, io_err, status
388!
389 real(dp), dimension(nRval) :: Rval
390!
391 character (len= 40) :: string
392 character (len=256) :: io_errmsg, line
393 character (len=256), dimension(nCval) :: Cval
394!
395!-----------------------------------------------------------------------
396! Read requested ROMS standard input logical parameter.
397!-----------------------------------------------------------------------
398!
399! Get standard input unit.
400!
401 io_err=0
402 IF (PRESENT(inpname)) THEN
403 inpunit=1
404 OPEN (inpunit, file=trim(inpname), form='formatted', &
405 & status='old', iostat=io_err, iomsg=io_errmsg)
406 IF (io_err.ne.0) THEN
407 IF (mymaster) WRITE (stdout,10) trim(inpname), &
408 & trim(io_errmsg)
409 10 FORMAT (/,' GETPAR_0D_L - Unable to open input script: ',a, &
410 & /,15x,'ERROR: ',a)
411 exit_flag=5
412 RETURN
413 ELSE
414 gotfile=.true.
415 END IF
416 ELSE
417 inpunit=stdinp_unit(mymaster, gotfile)
418 END IF
419!
420! Process requested parameter.
421!
422 foundit=.false.
423 DO WHILE (.true.)
424 READ (inpunit,'(a)',err=20,END=40) line
425 status=decode_line(line, string, nval, cval, rval)
426 IF (status.gt.0) THEN
427 IF (trim(string).eq.trim(keyword)) THEN
428 npts=load_l(nval, cval, 1, lvalue)
429 Value=lvalue(1)
430 foundit=.true.
431 END IF
432 END IF
433 END DO
434 20 IF (mymaster) THEN
435 WRITE (stdout,30) line
436 30 FORMAT (/,' GETPAR_0D_L - Error while processing line: ',/,a)
437 END IF
438 exit_flag=4
439 40 CONTINUE
440 IF (.not.foundit) THEN
441 IF (mymaster) THEN
442 WRITE (stdout,50) trim(keyword)
443 50 FORMAT (/,' GETPAR_0D_L - unable to find KeyWord: ',a, &
444 & /,15x,'in ROMS standard input file.')
445 END IF
446 exit_flag=5
447 END IF
448 IF (gotfile) THEN
449 CLOSE (inpunit)
450 END IF
451!
452 RETURN

References stdinp_mod::stdinp_unit().

Here is the call graph for this function:

◆ getpar_1d_l()

subroutine stdinp_mod::getpar_l::getpar_1d_l ( logical, intent(in) mymaster,
integer, intent(in) ndim,
logical, dimension(:), intent(out) value,
character (len=*), intent(in) keyword,
character (len=*), intent(in), optional inpname )

Definition at line 455 of file stdinp_mod.F.

456!
457!***********************************************************************
458! !
459! Reads a 1D logical parameter from ROMS standard input file. !
460! !
461! On Input: !
462! !
463! MyMaster Switch indicating Master process (logical) !
464! Ndim Size logical variable dimension !
465! KeyWord Keyword associated with input parameter (string) !
466! InpName Standard input filename (string; OPTIONAL) !
467! !
468! On Output: !
469! !
470! Value Standard input parameter value (logical 1D array) !
471! !
472!***********************************************************************
473!
474! Imported variable declarations.
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! Local variable declarations.
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! Read requested ROMS standard input 1D logical parameter.
498!-----------------------------------------------------------------------
499!
500! Get standard input unit.
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! Process requested parameter.
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

References stdinp_mod::stdinp_unit().

Here is the call graph for this function:

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