sgio.read_material_from_json#
- sgio.read_material_from_json(file_path: str) dict[str, CauchyContinuumModel]#
Read a single material from a JSON file and return as a dictionary.
- Parameters:
file_path (str) – Path to the JSON file containing a material dictionary
- Returns:
Dictionary with material name as key and material model as value
- Return type:
dict[str, CauchyContinuumModel]
- Raises:
FileNotFoundError – If the specified file does not exist
ValueError – If the JSON is invalid or does not represent a single material, or if the material has no name
TypeError – If the JSON content is not a dictionary
Examples
>>> # JSON file: {"name": "Steel", "isotropy": 0, "e": 200e9, "nu": 0.3, "density": 7850} >>> materials = read_material_from_json("steel.json") >>> materials['Steel'].e1 200000000000.0
Notes
This function now returns a dictionary to align with the name-based material storage architecture. The material’s name field is used as the dictionary key.