Native configuration and checkpoint I/O

The top-level vcsmd namespace is the recommended facade over the format-specific I/O modules. The implementation remains organized under vcsmd.io.

Configuration mappings and files

vcsmd.config_from_mapping(mapping)

Parse and validate one native configuration mapping.

mapping is copied into domain objects; callers may safely reuse or mutate their input mapping after this function returns. Calling prepare() here makes dimensional and formulation-specific errors appear while loading, before execution starts.

Parameters:

mapping (Mapping[str, Any])

Return type:

SimulationConfig

vcsmd.config_to_mapping(config)

Return the canonical, format-independent representation of config.

Parameters:

config (SimulationConfig)

Return type:

dict[str, Any]

vcsmd.load_config(path)

Load JSON, YAML, or TOML based on path’s suffix.

Parameters:

path (Path)

Return type:

SimulationConfig

vcsmd.save_config(config, path)

Write canonical configuration data in the format selected by suffix.

Parameters:
Return type:

None

load_config selects JSON, YAML, or TOML from the path suffix. All three formats use the same schema and validation pipeline. Dimensional scalars are records with value and unit; dimensional arrays use values and unit.

Checkpoints

vcsmd.load_checkpoint(path)

Load a model and a quantity-bearing public state for vcsmd.simulate.

Parameters:

path (Path)

Return type:

tuple[NumericalModel, SimulationState]

vcsmd.save_checkpoint(path, model, state)

Persist a public simulation state, including its complete numerical history.

Parameters:
Return type:

None

The facade wraps a loaded numerical state as vcsmd.SimulationState and requires that public state when saving. Native archives use named numeric arrays and do not use Python pickle objects.

The lower-level checkpoint implementation is available for advanced numerical code:

vcsmd.io.checkpoint.load_checkpoint(path)

Load and validate an exact native checkpoint.

Parameters:

path (Path)

Return type:

tuple[NumericalModel, SimulationState]

vcsmd.io.checkpoint.save_checkpoint(path, model, state)

Atomically save a complete native restart checkpoint.

Parameters:
Return type:

None