Get a logical variable from the config file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(config_file), | intent(inout) | :: | me | |||
character(len=*), | intent(in) | :: | name |
name of the variable |
||
logical, | intent(inout) | :: | variable |
the variable to populate with the value |
||
logical, | intent(out), | optional | :: | found |
if the variable was in the file |
subroutine get_logical(me, name, variable, found) class(config_file),intent(inout) :: me character(len=*),intent(in) :: name !! name of the variable logical,intent(inout) :: variable !! the variable to populate with the value logical,intent(out),optional :: found !! if the variable was in the file logical :: tmp logical :: required !! if the variable is required !! (if required and not found, `error stop` is called) logical :: was_found !! local copy of `found` required = .not. present(found) call me%json%get(name, tmp, was_found); if (was_found) variable = tmp if (required .and. .not. was_found) & error stop trim(name)//' integer variable not found in config file: '//trim(me%name) if (present(found)) found = was_found end subroutine get_logical