get_toml_real_array Subroutine

public subroutine get_toml_real_array(table, key, value, context)

Arguments

Type IntentOptional Attributes Name
type(toml_table), intent(inout) :: table
type(toml_key), intent(in) :: key
real(kind=dp), intent(out) :: value(:)
character(len=*), intent(in) :: context

Calls

proc~~get_toml_real_array~~CallsGraph proc~get_toml_real_array get_toml_real_array get_value get_value proc~get_toml_real_array->get_value proc~require_toml_success require_toml_success proc~get_toml_real_array->proc~require_toml_success proc~stop_config_error stop_config_error proc~get_toml_real_array->proc~stop_config_error toml_len toml_len proc~get_toml_real_array->toml_len proc~require_toml_success->proc~stop_config_error

Source Code

  subroutine get_toml_real_array(table, key, value, context)
    type(toml_table), intent(inout) :: table
    type(toml_key), intent(in) :: key
    real(dp), intent(out) :: value(:)
    character(len=*), intent(in) :: context
    type(toml_array), pointer :: array
    integer :: i, stat

    nullify (array)
    call get_value(table, key, array, stat=stat)
    call require_toml_success(stat, context)
    if (.not. associated(array)) call stop_config_error('Invalid TOML value for '//trim(context)//'.')
    if (toml_len(array) /= size(value)) then
      call stop_config_error(trim(context)//' has an invalid array length.')
    end if
    do i = 1, size(value)
      call get_value(array, i, value(i), stat=stat)
      call require_toml_success(stat, context)
      if (.not. ieee_is_finite(value(i))) call stop_config_error(trim(context)//' must contain finite values.')
    end do
  end subroutine get_toml_real_array