GETLOGICAL Function

public function GETLOGICAL(Key, Proposal, quiet_def_in) result(GetLogical)

Read logical 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

logical, intent(in), optional :: Proposal

Default values as logical

logical, intent(in), optional :: quiet_def_in

flag to be quiet if DEFAULT is taken

Return Value logical

Logical read from setup file or initialized with default value


Calls

proc~~getlogical~~CallsGraph proc~getlogical GETLOGICAL interface~findstr FindStr proc~getlogical->interface~findstr proc~converttoproposalstr ConvertToProposalStr proc~getlogical->proc~converttoproposalstr swrite swrite proc~getlogical->swrite interface~findstr->interface~findstr proc~remove_blanks remove_blanks proc~converttoproposalstr->proc~remove_blanks

Source Code

FUNCTION GETLOGICAL(Key,Proposal,quiet_def_in)
! MODULES
IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT VARIABLES
CHARACTER(LEN=*),INTENT(IN)          :: Key          !! Search for this keyword in ini file
LOGICAL         ,OPTIONAL,INTENT(IN) :: Proposal     !! Default values as logical
LOGICAL         ,OPTIONAL,INTENT(IN) :: quiet_def_in !! flag to be quiet if DEFAULT is taken
!-----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
LOGICAL                              :: GetLogical !! Logical 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,logScalar=Proposal)
  CALL FindStr(Key,HelpStr,DefMsg,ProposalStr)
ELSE
  CALL FindStr(Key,HelpStr,DefMsg)
END IF
READ(HelpStr,*,IOSTAT=ioerr)GetLogical
IF(ioerr.NE.0)THEN
  WRITE(UNIT_stdout,*)'PROBLEM IN READIN OF LINE (logical):'
  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,l33,a3,a7,a3)')' | ',TRIM(Key),' | ', GetLogical,' | ',TRIM(DefMsg),' | '
END IF
END FUNCTION GETLOGICAL