pycfast.parsers.parse_cfast_file#

pycfast.parsers.parse_cfast_file(file_path, output_path=None)[source]#

Parse a CFAST input file and return a CFASTModel object.

Convenience function that creates a CFASTParser instance and parses the specified file in one call. This is the recommended way to parse CFAST input files for most use cases.

Parameters:

file_path (str | Path) – Path to the CFAST input file (.in). Can be string or Path object.

Returns:

CFASTModel object with all components parsed from the file, including simulation environment, materials, compartments, vents, fires, and devices.

Return type:

CFASTModel

Raises:
  • FileNotFoundError: – If the input file doesn’t exist.

  • ValueError: – If the file format is invalid or required parameters are missing.

Warning

COMPONENT NAMES (TITLE, MATERIAL, ID, ETC.) SHOULD USE ALPHANUMERIC CHARACTERS ONLY. SPECIAL CHARACTERS LIKE QUOTES AND SLASHES MAY CAUSE PARSING ISSUES AND WILL BE AUTOMATICALLY SANITIZED WHERE POSSIBLE.

Examples

>>> model = parse_cfast_file("simulation.in")
>>> print(f"Title: {model.simulation_environment.title}")
>>> print(f"Compartments: {len(model.compartments)}")