GETINT Function

public function GETINT(Key, Proposal, quiet_def_in) result(GetInt)

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".

Arguments

Type IntentOptional 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

Return Value integer

Integer read from setup file or initialized with default value


Calls

proc~~getint~~CallsGraph proc~getint GETINT interface~findstr FindStr proc~getint->interface~findstr proc~converttoproposalstr ConvertToProposalStr proc~getint->proc~converttoproposalstr swrite swrite proc~getint->swrite interface~findstr->interface~findstr proc~remove_blanks remove_blanks proc~converttoproposalstr->proc~remove_blanks

Source Code

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