polyfoammesh.commercial.monitor

Real-Time Quality Dashboard — 3D heatmap data and quality metrics.

Provides structured quality data that can be consumed by the 3D viewer for cell-by-cell heatmap rendering, worst-cell identification, histogram generation, and convergence tracking across mesh iterations.

Usage:

monitor = QualityMonitor()
monitor.ingest_checkmesh(output_text)
print(monitor.summary())
heatmap = monitor.heatmap_data()
worst = monitor.worst_cells(n=10)

Classes

QualityMetric([name, value, warn_threshold, ...])

A single quality metric with value, threshold, and pass/fail status.

QualityMonitor([thresholds])

Real-time mesh quality monitor.

QualitySnapshot([timestamp, iteration, ...])

A point-in-time quality snapshot for convergence tracking.

WorstCell([index, metric, value, location])

Information about a low-quality cell.

class polyfoammesh.commercial.monitor.QualityMetric(name='', value=0.0, warn_threshold=0.0, fail_threshold=0.0, unit='')[source]

Bases: object

A single quality metric with value, threshold, and pass/fail status.

Parameters:
name: str = ''
value: float = 0.0
warn_threshold: float = 0.0
fail_threshold: float = 0.0
unit: str = ''
property status: str
to_dict()[source]
Return type:

dict[str, Any]

class polyfoammesh.commercial.monitor.QualitySnapshot(timestamp='', iteration=0, metrics=<factory>, passed=False)[source]

Bases: object

A point-in-time quality snapshot for convergence tracking.

Parameters:
timestamp: str = ''
iteration: int = 0
metrics: dict[str, float]
passed: bool = False
to_dict()[source]
Return type:

dict[str, Any]

class polyfoammesh.commercial.monitor.WorstCell(index=0, metric='', value=0.0, location=(0.0, 0.0, 0.0))[source]

Bases: object

Information about a low-quality cell.

Parameters:
index: int = 0
metric: str = ''
value: float = 0.0
location: tuple[float, float, float] = (0.0, 0.0, 0.0)
class polyfoammesh.commercial.monitor.QualityMonitor(thresholds=None)[source]

Bases: object

Real-time mesh quality monitor.

Parses checkMesh output and provides structured data for UI visualization (heatmaps, histograms, worst-cell lists) and convergence tracking across iterations.

Usage:

monitor = QualityMonitor()
monitor.ingest_checkmesh(checkmesh_output)
print(monitor.summary())
Parameters:

thresholds (dict[str, tuple[float, float]] | None)

THRESHOLDS: dict[str, tuple[float, float]] = {'aspect_ratio': (1000.0, 5000.0), 'non_orthogonality': (65.0, 85.0), 'skewness': (4.0, 10.0)}
ingest_checkmesh(output)[source]

Parse checkMesh output and extract all quality metrics.

Return type:

None

Parameters:

output (str)

property passed: bool
metric(name)[source]
Return type:

QualityMetric | None

Parameters:

name (str)

summary()[source]
Return type:

dict[str, Any]

heatmap_data()[source]

Return per-cell data arrays for heatmap colouring.

Returns a dict with keys like skewness, non_orthogonality, aspect_ratio — each containing a list of per-cell values extracted from the raw checkMesh output.

Return type:

dict[str, list[float]]

worst_cells(n=10)[source]

Identify the N worst cells by each metric.

Parses the checkMesh detail output to find cells with the highest skewness, non-orthogonality, and aspect ratio.

Return type:

list[WorstCell]

Parameters:

n (int)

histogram(metric='skewness', bins=20)[source]

Generate a histogram for a given metric.

Parameters:
  • metric (str) – Metric name (skewness, non_orthogonality, aspect_ratio).

  • bins (int) – Number of histogram bins.

Return type:

dict[str, Any]

Returns:

Dict with counts, edges (bin boundaries), mean, max, p95.

convergence_history()[source]

Return the history of quality snapshots for convergence plotting.

Return type:

list[dict[str, Any]]

export_json(path)[source]

Export the full quality report as JSON.

Return type:

None

Parameters:

path (Path | str)