config_schema_2d Module

2D mirror of config_schema (Full 2D Parity phase P2): the transport's SET_/GET_ opcodes resolve parameter names against THIS table when the attached session is dim=2. Kind tags are shared with the 1D module so protocol_codec.decode_set_value needs no dim awareness. Setters validate key existence and type only; VALUE ranges are enforced by validate_config_2d at session INITIALIZE (same contract as 1D). n_cell is a namelist-reader cascade convenience, not a config_2d_t field, and is deliberately absent. config_2d has no real3 parameters, so the real3 accessors always report unknown-key (kept for symmetry).

Internals are derived from the shared config_engine field-descriptor table (built once per call by config_2d.build_field_table_2d) rather than a hand-maintained select case per field; the public API is unchanged.



Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: n_schema_entries_2d = n_config_fields_2d

Number of published 2D schema entries (== n_config_fields_2d, the frozen ensure_schema_2d order this table used to hand-list).

type(config_2d_t), private, save, target :: schema_defaults_2d

Static schema state: one saved table bound to a saved default instance.

type(field_desc_t), private, save :: schema_fields_2d(n_config_fields_2d)
logical, private, save :: schema_2d_ready = .false.

Derived Types

type, public ::  config_schema_entry_2d_t

Minimal schema record: canonical key, namelist group, value kind.

Components

Type Visibility Attributes Name Initial
character(len=32), public :: key = ''
character(len=32), public :: group = ''
integer, public :: value_kind = 0

Functions

public function find_config_schema_entry_2d(key) result(index)

Find a 2D schema entry by key; 0 when absent.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key

Return Value integer

private function casefolds_on_set(fields, normalized_key) result(yes)

Keys whose value read_config_2d stores lowercased (selector-like fields): every kind_choice field in the table, PLUS grid_type and output_format, which are kind_string rather than kind_choice but get the same historical to_lower-on-parse treatment, so the setter must special-case them alongside the choice keys. Table-driven rather than a hand-maintained key list, but yields the identical 12 keys the old list named (10 choice-kind fields + these 2 string-kind fields).

Arguments

Type IntentOptional Attributes Name
type(field_desc_t), intent(in) :: fields(:)
character(len=*), intent(in) :: normalized_key

Return Value logical


Subroutines

public subroutine schema_lookup_2d(key, idx, expected_kind, ok, message)

Resolve a wire-protocol key against the 2D schema (same shape as protocol_codec.schema_lookup). Unknown key: ok=.false. with an "unknown config key: ..." message the transport forwards verbatim.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: key
integer, intent(out) :: idx
integer, intent(out) :: expected_kind
logical, intent(out) :: ok
character(len=*), intent(out) :: message

public subroutine config_2d_get_integer(cfg, key, value, is_ok, message)

Read one integer-valued field from cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(in) :: cfg
character(len=*), intent(in) :: key
integer, intent(out) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_set_integer(cfg, key, value, is_ok, message)

Write one integer-valued field in cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(inout), target :: cfg
character(len=*), intent(in) :: key
integer, intent(in) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_get_real(cfg, key, value, is_ok, message)

Read one scalar real-valued field from cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(in) :: cfg
character(len=*), intent(in) :: key
real(kind=wp), intent(out) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_set_real(cfg, key, value, is_ok, message)

Write one scalar real-valued field in cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(inout), target :: cfg
character(len=*), intent(in) :: key
real(kind=wp), intent(in) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_get_logical(cfg, key, value, is_ok, message)

Read one logical field from cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(in) :: cfg
character(len=*), intent(in) :: key
logical, intent(out) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_set_logical(cfg, key, value, is_ok, message)

Write one logical field in cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(inout), target :: cfg
character(len=*), intent(in) :: key
logical, intent(in) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_get_string(cfg, key, value, is_ok, message)

Read one string or choice-token field from cfg by schema key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(in) :: cfg
character(len=*), intent(in) :: key
character(len=*), intent(out) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_set_string(cfg, key, value, is_ok, message)

Write one string or choice-token field in cfg by schema key. Choice tokens (and grid_type/output_format) are lowercased on write, mirroring read_config_2d's to_lower-on-parse behavior: downstream dispatch (schemes_2d, boundary_2d/boundary_conditions, resolve_*_scheme) compares these fields with exact-case ==, so a value set through this wire-protocol path must land already-normalized.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(inout), target :: cfg
character(len=*), intent(in) :: key
character(len=*), intent(in) :: value
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_get_real3(cfg, key, value, is_ok, message)

config_2d has no real3 parameters: always unknown-key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(in) :: cfg
character(len=*), intent(in) :: key
real(kind=wp), intent(out) :: value(3)
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

public subroutine config_2d_set_real3(cfg, key, value, is_ok, message)

config_2d has no real3 parameters: always unknown-key.

Arguments

Type IntentOptional Attributes Name
type(config_2d_t), intent(inout) :: cfg
character(len=*), intent(in) :: key
real(kind=wp), intent(in) :: value(3)
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message

private subroutine ensure_schema_2d()

Populate the saved schema table on first use, bound to a saved default config_2d_t instance (mirrors config_schema's ensure_schema).

Arguments

None

private subroutine set_status_2d(ok, err, is_ok, message)

Fan out a success flag and message to optional outputs (mirrors 1D).

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: ok
character(len=*), intent(in) :: err
logical, intent(out), optional :: is_ok
character(len=*), intent(out), optional :: message