apply_toml_document Subroutine

public subroutine apply_toml_document(cfg, document, authoring)

toml-f のルートテーブルから既知セクションを読み込む。

Arguments

Type IntentOptional Attributes Name
type(app_config), intent(inout) :: cfg
type(config_toml_table), intent(inout) :: document
type(app_config_authoring), intent(inout) :: authoring

Calls

proc~~apply_toml_document~~CallsGraph proc~apply_toml_document apply_toml_document get_keys get_keys proc~apply_toml_document->get_keys get_value get_value proc~apply_toml_document->get_value interface~apply_domain_toml_table apply_domain_toml_table proc~apply_toml_document->interface~apply_domain_toml_table interface~apply_field_boundary_toml_table apply_field_boundary_toml_table proc~apply_toml_document->interface~apply_field_boundary_toml_table interface~apply_mesh_toml_table apply_mesh_toml_table proc~apply_toml_document->interface~apply_mesh_toml_table interface~apply_output_toml_table apply_output_toml_table proc~apply_toml_document->interface~apply_output_toml_table interface~apply_particle_boundary_toml_table apply_particle_boundary_toml_table proc~apply_toml_document->interface~apply_particle_boundary_toml_table interface~apply_particles_toml_table apply_particles_toml_table proc~apply_toml_document->interface~apply_particles_toml_table interface~apply_periodic2_toml_table apply_periodic2_toml_table proc~apply_toml_document->interface~apply_periodic2_toml_table interface~apply_reservoir_toml_table apply_reservoir_toml_table proc~apply_toml_document->interface~apply_reservoir_toml_table interface~apply_sim_toml_table apply_sim_toml_table proc~apply_toml_document->interface~apply_sim_toml_table interface~apply_surface_current_model_toml_table apply_surface_current_model_toml_table proc~apply_toml_document->interface~apply_surface_current_model_toml_table proc~lower_ascii lower_ascii proc~apply_toml_document->proc~lower_ascii proc~require_toml_success require_toml_success proc~apply_toml_document->proc~require_toml_success proc~stop_config_error stop_config_error proc~require_toml_success->proc~stop_config_error

Called by

proc~~apply_toml_document~~CalledByGraph proc~apply_toml_document apply_toml_document proc~load_toml_config load_toml_config proc~load_toml_config->proc~apply_toml_document proc~load_app_config load_app_config proc~load_app_config->proc~load_toml_config proc~handle_early_cli handle_early_cli proc~handle_early_cli->proc~load_app_config proc~load_or_init_run_state load_or_init_run_state proc~load_or_init_run_state->proc~load_app_config program~zhao_atlas_main zhao_atlas_main program~zhao_atlas_main->proc~load_app_config program~zhao_response_main zhao_response_main program~zhao_response_main->proc~load_app_config program~main main program~main->proc~handle_early_cli program~main->proc~load_or_init_run_state

Source Code

  subroutine apply_toml_document(cfg, document, authoring)
    type(app_config), intent(inout) :: cfg
    type(config_toml_table), intent(inout) :: document
    type(app_config_authoring), intent(inout) :: authoring
    type(toml_key), allocatable :: keys(:)
    type(config_toml_table), pointer :: section
    integer :: ikey, stat
    character(len=:), allocatable :: key_name

    call document%get_keys(keys)
    do ikey = 1, size(keys)
      key_name = lower_ascii(trim(keys(ikey)%key))
      nullify (section)
      call get_value(document, keys(ikey), section, requested=.false., stat=stat)
      call require_toml_success(stat, '['//trim(keys(ikey)%key)//']')
      select case (trim(key_name))
      case ('sim')
        if (.not. associated(section)) error stop 'TOML section [sim] must be a table.'
        call apply_sim_toml_table(cfg, section)
      case ('domain')
        if (.not. associated(section)) error stop 'TOML section [domain] must be a table.'
        call apply_domain_toml_table(section, authoring%domain)
      case ('field_boundary')
        if (.not. associated(section)) error stop 'TOML section [field_boundary] must be a table.'
        call apply_field_boundary_toml_table(section, authoring%field_boundary)
      case ('particle_boundary')
        if (.not. associated(section)) error stop 'TOML section [particle_boundary] must be a table.'
        call apply_particle_boundary_toml_table(section, authoring%particle_boundary)
      case ('reservoir')
        if (.not. associated(section)) error stop 'TOML section [reservoir] must be a table.'
        call apply_reservoir_toml_table(section, authoring%reservoir)
      case ('surface_current_model')
        if (.not. associated(section)) error stop 'TOML section [surface_current_model] must be a table.'
        call apply_surface_current_model_toml_table(cfg, section)
      case ('particles')
        if (.not. associated(section)) error stop 'TOML section [particles] must be a table.'
        call apply_particles_toml_table(cfg, section, authoring)
      case ('periodic2')
        if (.not. associated(section)) error stop 'TOML section [periodic2] must be a table.'
        call apply_periodic2_toml_table(section, authoring)
      case ('mesh')
        if (.not. associated(section)) error stop 'TOML section [mesh] must be a table.'
        call apply_mesh_toml_table(cfg, section, authoring)
      case ('output')
        if (.not. associated(section)) error stop 'TOML section [output] must be a table.'
        call apply_output_toml_table(cfg, section)
      case default
        error stop 'Unknown TOML section or top-level key: '//trim(keys(ikey)%key)
      end select
    end do
  end subroutine apply_toml_document