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

Public Member Functions

subroutine getpar_0d_r (mymaster, value, keyword, inpname)
 
subroutine getpar_1d_r (mymaster, ndim, value, keyword, inpname)
 

Detailed Description

Definition at line 49 of file stdinp_mod.F.

Member Function/Subroutine Documentation

◆ getpar_0d_r()

subroutine stdinp_mod::getpar_r::getpar_0d_r ( logical, intent(in) mymaster,
real(r8), intent(out) value,
character (len=*), intent(in) keyword,
character (len=*), intent(in), optional inpname )

Definition at line 555 of file stdinp_mod.F.

556!
557!***********************************************************************
558! !
559! Reads a scalar floating-point parameter from ROMS standard input !
560! file. !
561! !
562! On Input: !
563! !
564! MyMaster Switch indicating Master process (logical) !
565! KeyWord Keyword associated with input parameter (string) !
566! InpName Standard input filename (string; OPTIONAL) !
567! !
568! On Output: !
569! !
570! Value Standard input parameter value (real) !
571! !
572!***********************************************************************
573!
574! Imported variable declarations.
575!
576 logical, intent(in) :: MyMaster
577!
578 real(r8), intent(out) :: Value
579!
580 character (len=*), intent(in) :: KeyWord
581 character (len=*), intent(in), optional :: InpName
582!
583! Local variable declarations.
584!
585 logical :: foundit, GotFile
586
587 integer :: InpUnit, Npts, Nval, io_err, status
588
589 real(r8) :: Rvalue(1)
590
591 real(dp), dimension(nRval) :: Rval
592!
593 character (len= 40) :: string
594 character (len=256) :: io_errmsg, line
595 character (len=256), dimension(nCval) :: Cval
596!
597!-----------------------------------------------------------------------
598! Read requested ROMS standard input floating-point parameter.
599!-----------------------------------------------------------------------
600!
601! Get standard input unit.
602!
603 io_err=0
604 IF (PRESENT(inpname)) THEN
605 inpunit=1
606 OPEN (inpunit, file=trim(inpname), form='formatted', &
607 & status='old', iostat=io_err, iomsg=io_errmsg)
608 IF (io_err.ne.0) THEN
609 IF (mymaster) WRITE (stdout,10) trim(inpname), &
610 & trim(io_errmsg)
611 10 FORMAT (/,' GETPAR_0D_R - Unable to open input script: ',a, &
612 & /,15x,'ERROR: ',a)
613 exit_flag=5
614 RETURN
615 ELSE
616 gotfile=.true.
617 END IF
618 ELSE
619 inpunit=stdinp_unit(mymaster, gotfile)
620 END IF
621!
622! Process requested parameter.
623!
624 foundit=.false.
625 DO WHILE (.true.)
626 READ (inpunit,'(a)',err=20,END=40) line
627 status=decode_line(line, string, nval, cval, rval)
628 IF (status.gt.0) THEN
629 IF (trim(string).eq.trim(keyword)) THEN
630 npts=load_r(nval, rval, 1, rvalue)
631 Value=rvalue(1)
632 foundit=.true.
633 END IF
634 END IF
635 END DO
636 20 IF (mymaster) THEN
637 WRITE (stdout,30) line
638 30 FORMAT (/,' GETPAR_0D_R - Error while processing line: ',/,a)
639 END IF
640 exit_flag=4
641 40 CONTINUE
642 IF (.not.foundit) THEN
643 IF (mymaster) THEN
644 WRITE (stdout,50) trim(keyword)
645 50 FORMAT (/,' GETPAR_0D_R - unable to find KeyWord: ',a, &
646 & /,15x,'in ROMS standard input file.')
647 END IF
648 exit_flag=5
649 END IF
650 IF (gotfile) THEN
651 CLOSE (inpunit)
652 END IF
653!
654 RETURN

References stdinp_mod::stdinp_unit().

Here is the call graph for this function:

◆ getpar_1d_r()

subroutine stdinp_mod::getpar_r::getpar_1d_r ( logical, intent(in) mymaster,
integer, intent(in) ndim,
real(r8), dimension(:), intent(out) value,
character (len=*), intent(in) keyword,
character (len=*), intent(in), optional inpname )

Definition at line 657 of file stdinp_mod.F.

658!
659!***********************************************************************
660! !
661! Reads a 1D floating-point parameter from ROMS standard input file. !
662! !
663! On Input: !
664! !
665! MyMaster Switch indicating Master process (logical) !
666! Ndim Size integer variable dimension !
667! KeyWord Keyword associated with input parameter (string) !
668! InpName Standard input filename (string; OPTIONAL) !
669! !
670! On Output: !
671! !
672! Value Standard input parameter value (real 1D array) !
673! !
674!***********************************************************************
675!
676! Imported variable declarations.
677!
678 logical, intent(in) :: MyMaster
679!
680 integer, intent(in) :: Ndim
681!
682 real(r8), intent(out) :: Value(:)
683!
684 character (len=*), intent(in) :: KeyWord
685 character (len=*), intent(in), optional :: InpName
686!
687! Local variable declarations.
688!
689 logical :: foundit, GotFile
690!
691 integer :: InpUnit, Npts, Nval, io_err, status
692!
693 real(dp), dimension(nRval) :: Rval
694!
695 character (len= 40) :: string
696 character (len=256) :: io_errmsg, line
697 character (len=256), dimension(nCval) :: Cval
698!
699!-----------------------------------------------------------------------
700! Read requested ROMS standard input 1D floating-point parameter.
701!-----------------------------------------------------------------------
702!
703! Get standard input unit.
704!
705 io_err=0
706 IF (PRESENT(inpname)) THEN
707 inpunit=1
708 OPEN (inpunit, file=trim(inpname), form='formatted', &
709 & status='old', iostat=io_err, iomsg=io_errmsg)
710 IF (io_err.ne.0) THEN
711 IF (mymaster) WRITE (stdout,10) trim(inpname), &
712 & trim(io_errmsg)
713 10 FORMAT (/,' GETPAR_1D_R - Unable to open input script: ',a, &
714 & /,15x,'ERROR: ',a)
715 exit_flag=5
716 RETURN
717 ELSE
718 gotfile=.true.
719 END IF
720 ELSE
721 inpunit=stdinp_unit(mymaster, gotfile)
722 END IF
723!
724! Process requested parameter.
725!
726 foundit=.false.
727 DO WHILE (.true.)
728 READ (inpunit,'(a)',err=20,END=40) line
729 status=decode_line(line, string, nval, cval, rval)
730 IF (status.gt.0) THEN
731 IF (trim(string).eq.trim(keyword)) THEN
732 npts=load_r(nval, rval, ndim, Value)
733 foundit=.true.
734 END IF
735 END IF
736 END DO
737 20 IF (mymaster) THEN
738 WRITE (stdout,30) line
739 30 FORMAT (/,' GETPAR_1D_R - Error while processing line: ',/,a)
740 END IF
741 exit_flag=4
742 40 CONTINUE
743 IF (.not.foundit) THEN
744 IF (mymaster) THEN
745 WRITE (stdout,50) trim(keyword)
746 50 FORMAT (/,' GETPAR_1D_R - unable to find KeyWord: ',a, &
747 & /,15x,'in ROMS standard input file.')
748 END IF
749 exit_flag=5
750 END IF
751 IF (gotfile) THEN
752 CLOSE (inpunit)
753 END IF
754!
755 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: