TOML 文書を toml-f で解釈して設定へ反映する。
現在は sim / mesh / output / [[mesh.templates]] / [[particles.species]] を扱う。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
読み込むTOMLファイルパス。 |
||
| type(app_config), | intent(inout) | :: | cfg |
読み込み結果で更新するアプリ設定。 |
subroutine load_toml_config(path, cfg) character(len=*), intent(in) :: path type(app_config), intent(inout) :: cfg integer :: u, ios type(config_toml_table), allocatable :: document type(toml_error), allocatable :: parse_error type(app_config_authoring) :: authoring if (.not. allocated(cfg%templates)) then allocate (cfg%templates(max_templates)) cfg%n_templates = 0_i32 end if if (.not. allocated(cfg%particle_species)) then allocate (cfg%particle_species(max_particle_species)) cfg%particle_species = particle_species_spec() cfg%n_particle_species = 0_i32 end if call init_app_config_authoring(authoring, size(cfg%templates), size(cfg%particle_species)) open (newunit=u, file=trim(path), status='old', action='read', iostat=ios) if (ios /= 0) error stop 'Could not open TOML file.' call toml_parse(document, u, parse_error) close (u) if (allocated(parse_error)) then error stop 'Failed to parse TOML config: '//parse_error%message end if if (.not. allocated(document)) error stop 'Failed to parse TOML config.' call apply_toml_document(cfg, document, authoring) call document%destroy call resolve_surface_current_model_path(path, cfg) call finalize_loaded_config(cfg, authoring) end subroutine load_toml_config