get_logical Subroutine

private subroutine get_logical(me, name, variable, found)

Get a logical variable from the config file.

Type Bound

config_file

Arguments

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


Calls

proc~~get_logical~~CallsGraph proc~get_logical config_file%get_logical get get proc~get_logical->get

Called by

proc~~get_logical~~CalledByGraph proc~get_logical config_file%get_logical none~get config_file%get none~get->proc~get_logical proc~read_config_file my_solver_type%read_config_file proc~read_config_file->none~get proc~read_epoch read_epoch proc~read_config_file->proc~read_epoch proc~read_epoch->none~get proc~initialize_the_solver my_solver_type%initialize_the_solver proc~initialize_the_solver->proc~read_config_file proc~halo_solver_main halo_solver_main proc~halo_solver_main->proc~initialize_the_solver

Source Code

    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