polyfoammesh.commercial.exporter

Mesh Conversion & Export Factory — output formats for every major CFD solver.

Supported formats (keys of EXPORT_FORMAT_REGISTRY — the registry is the single source of truth, and every key has a matching _export_* handler):

  • OpenFOAM (native polyMesh)

  • CGNS (.cgns)

  • VTU (ParaView)

  • Abaqus (.inp)

  • SU2 (.su2)

  • GMSH (.msh)

  • STL (surface)

Classes

ExportResult([success, format, output_path, ...])

MeshExporter()

Multi-format mesh export factory.

class polyfoammesh.commercial.exporter.ExportResult(success=False, format='', output_path='', cell_count=0, file_size_bytes=0, wall_time_s=0.0, error='')[source]

Bases: object

Parameters:
success: bool = False
format: str = ''
output_path: str = ''
cell_count: int = 0
file_size_bytes: int = 0
wall_time_s: float = 0.0
error: str = ''
class polyfoammesh.commercial.exporter.MeshExporter[source]

Bases: object

Multi-format mesh export factory.

Usage:

exporter = MeshExporter()
result = exporter.export(case_dir, fmt="cgns", output_path="mesh.cgns")
print(f"Exported: {result.file_size_bytes} bytes")
export(case_dir, fmt, output_path=None)[source]

Export the mesh at case_dir to the specified format.

Parameters:
  • case_dir (Path | str) – OpenFOAM case directory with constant/polyMesh.

  • fmt (str) – Target format key from EXPORT_FORMAT_REGISTRY.

  • output_path (Path | str | None) – Optional output path. Auto-generated if None.

Return type:

ExportResult

Returns:

ExportResult with success status and metadata.