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

Public Member Functions

subroutine getpar_0d_s (mymaster, value, keyword, inpname)
 

Detailed Description

Definition at line 54 of file stdinp_mod.F.

Member Function/Subroutine Documentation

◆ getpar_0d_s()

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

Definition at line 758 of file stdinp_mod.F.

759!
760!***********************************************************************
761! !
762! Reads a scalar string from ROMS standard input file. !
763! !
764! On Input: !
765! !
766! MyMaster Switch indicating Master process (logical) !
767! KeyWord Keyword associated with input parameter (string) !
768! InpName Standard input filename (string; OPTIONAL) !
769! !
770! On Output: !
771! !
772! Value Standard input parameter value (string) !
773! !
774!***********************************************************************
775!
776! Imported variable declarations.
777!
778 logical, intent(in) :: MyMaster
779!
780 character (len=*), intent( in) :: KeyWord
781 character (len=*), intent(out) :: Value
782 character (len=*), intent( in), optional :: InpName
783!
784! Local variable declarations.
785!
786 logical :: foundit, GotFile
787!
788 integer :: InpUnit, Npts, Nval, i, io_err, status
789!
790 real(dp), dimension(nRval) :: Rval
791!
792 character (len=1 ), parameter :: blank = ' '
793 character (len= 40) :: string
794 character (len=256) :: io_errmsg, line
795 character (len=256), dimension(nCval) :: Cval
796!
797!-----------------------------------------------------------------------
798! Read requested ROMS standard input integer parameter.
799!-----------------------------------------------------------------------
800!
801! Get standard input unit.
802!
803 io_err=0
804 IF (PRESENT(inpname)) THEN
805 inpunit=1
806 OPEN (inpunit, file=trim(inpname), form='formatted', &
807 & status='old', iostat=io_err, iomsg=io_errmsg)
808 IF (io_err.ne.0) THEN
809 IF (mymaster) WRITE (stdout,10) trim(inpname), &
810 & trim(io_errmsg)
811 10 FORMAT (/,' GETPAR_0D_S - Unable to open input script: ',a, &
812 & /,15x,'ERROR: ',a)
813 exit_flag=5
814 RETURN
815 ELSE
816 gotfile=.true.
817 END IF
818 ELSE
819 inpunit=stdinp_unit(mymaster, gotfile)
820 END IF
821!
822! Process requested parameter.
823!
824 foundit=.false.
825 DO WHILE (.true.)
826 READ (inpunit,'(a)',err=20,END=40) line
827 status=decode_line(line, string, nval, cval, rval)
828 IF (status.gt.0) THEN
829 IF (trim(string).eq.trim(keyword)) THEN
830 DO i=1,len(Value)
831 value(i:i)=blank
832 END DO
833 Value=trim(adjustl(cval(nval)))
834 foundit=.true.
835 END IF
836 END IF
837 END DO
838 20 IF (mymaster) THEN
839 WRITE (stdout,30) line
840 30 FORMAT (/,' GETPAR_0D_S - Error while processing line: ',/,a)
841 END IF
842 exit_flag=4
843 40 CONTINUE
844 IF (.not.foundit) THEN
845 IF (mymaster) THEN
846 WRITE (stdout,50) trim(keyword)
847 50 FORMAT (/,' GETPAR_0D_S - unable to find KeyWord: ',a, &
848 & /,15x,'in ROMS standard input file.')
849 END IF
850 exit_flag=5
851 END IF
852 IF (gotfile) THEN
853 CLOSE (inpunit)
854 END IF
855!
856 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: