Read integer named "key" from setup file and store in "GETINT". If keyword "Key" is not found in ini file, the default value "Proposal" is used for "GETINT" (error if "Proposal" not given). Ini file was read in before and is stored as list of character strings starting with "FirstString".
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | Key |
Search for this keyword in ini file |
||
| integer, | intent(in), | optional | :: | Proposal |
Default values as integer scalar |
|
| logical, | intent(in), | optional | :: | quiet_def_in |
flag to be quiet if DEFAULT is taken |
Integer read from setup file or initialized with default value
FUNCTION GETINT(Key,Proposal,quiet_def_in) ! MODULES IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES CHARACTER(LEN=*),INTENT(IN) :: Key !! Search for this keyword in ini file INTEGER,OPTIONAL,INTENT(IN) :: Proposal !! Default values as integer scalar LOGICAL,OPTIONAL,INTENT(IN) :: quiet_def_in !! flag to be quiet if DEFAULT is taken !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES INTEGER :: GetInt !! Integer read from setup file or initialized with default value !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES CHARACTER(LEN=MAXLEN) :: HelpStr,ProposalStr CHARACTER(LEN=8) :: DefMsg INTEGER :: ioerr LOGICAL :: quiet_def !=================================================================================================================================== IF (PRESENT(Proposal)) THEN CALL ConvertToProposalStr(ProposalStr,intScalar=Proposal) CALL FindStr(Key,HelpStr,DefMsg,ProposalStr) ELSE CALL FindStr(Key,HelpStr,DefMsg) END IF READ(HelpStr,*,IOSTAT=ioerr)GetInt IF(ioerr.NE.0)THEN WRITE(UNIT_stdout,*)'PROBLEM IN READIN OF LINE (integer):' WRITE(UNIT_stdout,*) TRIM(key),' = ',TRIM(helpStr) CALL abort(__STAMP__,"") END IF quiet_def=.FALSE. IF(PRESENT(quiet_def_in))THEN IF(INDEX(TRIM(DefMsg),"DEFAULT").NE.0)THEN quiet_def=quiet_def_in END IF END IF IF(.NOT.quiet_def) THEN SWRITE(UNIT_StdOut,'(a3,a30,a3,i33,a3,a7,a3)')' | ',TRIM(Key),' | ', GetInt,' | ',TRIM(DefMsg),' | ' END IF END FUNCTION GETINT