pycfast.parsers.CFASTParser#

class pycfast.parsers.CFASTParser[source]#

Parser for CFAST input files (.in format).

This class can read CFAST input files and convert them back to CFASTModel objects with all the component classes properly instantiated. The parser handles various CFAST namelist blocks including simulation environment, materials, compartments, vents, fires, and devices.

Parameters:
  • simulation_environment (SimulationEnvironment) – object containing simulation settings.

  • material_properties (List[Material]) – List of Material objects.

  • compartments (List[Compartment]) – List of Compartment objects.

  • wall_vents (List[WallVent]) – List of WallVent objects.

  • ceiling_floor_vents (List[CeilingFloorVent]) – List of CeilingFloorVent objects.

  • mechanical_vents (List[MechanicalVent]) – List of MechanicalVent objects.

  • fires (List[Fire]) – List of Fire objects.

  • devices (List[Device]) – List of Device objects.

  • surface_connections (List[SurfaceConnection]) – List of SurfaceConnection objects.

parse_file(file_path, output_path=None)[source]#

Parse a CFAST input file and return a CFASTModel object.

Reads and parses a CFAST input file (.in format), extracting all namelist blocks and converting them to appropriate PyCFAST component objects.

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

  • output_path (str | Path | None, optional) – Optional path to save the parsed output file. If None, defaults to appending ‘_parsed’ to the original file name.

Returns:

CFASTModel object with all components parsed from the file, including: - Simulation environment settings - Material properties - Compartment definitions - Vent configurations - Fire definitions - Device specifications

Return type:

CFASTModel

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

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

reset()[source]#

Reset parser state for parsing a new file.

Clears all component lists and reinitializes the simulation environment. This method is called automatically when parsing a new file.

Return type:

None