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.
mappingis copied into domain objects; callers may safely reuse or mutate their input mapping after this function returns. Callingprepare()here makes dimensional and formulation-specific errors appear while loading, before execution starts.- Parameters:
mapping (Mapping[str, Any])
- Return type:
- 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:
- vcsmd.save_config(config, path)¶
Write canonical configuration data in the format selected by suffix.
- Parameters:
config (SimulationConfig)
path (Path)
- 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:
path (Path)
model (NumericalModel)
state (SimulationState)
- 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:
path (Path)
model (NumericalModel)
state (SimulationState)
- Return type:
None