tud_lbm.config.adapter_dict
Dict configuration adapter.
Accepts a plain Python dict and returns a
SimulationConfig.
Usage:
from config.adapter_dict import DictAdapter
adapter = DictAdapter()
config = adapter.load({"grid_shape": [64, 64], "tau": 0.8})
Classes
Adapter that builds a |
Module Contents
- class tud_lbm.config.adapter_dict.DictAdapter[source]
Bases:
tud_lbm.config.adapter_base.ConfigAdapterAdapter that builds a
SimulationConfigfrom a dict.Accepts two shapes:
Flat (SimulationConfig field names at top level):
{"sim_type": "multiphase", "kappa": 0.04, ...}
Nested (mirrors TOML section structure):
{"simulation_type": {"type": "multiphase", ...}, "multiphase": {...}, ...}
- load_raw(source: dict[str, Any]) dict[str, Any][source]
Return a flat config dict from source, handling both flat and nested shapes.
- save(config: tud_lbm.config.simulation_config.SimulationConfig, path: str) None[source]
Save a simulation config to path.