Loading...
Searching...
No Matches
sizingaudit.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2#pragma once
3#include "meshresult.h"
4#include <QRectF>
5#include <functional>
6
7namespace mesh
8{
9// Version 1: nominal triangle size sqrt(4A/sqrt(3)), quad size sqrt(A).
10// The minimum target is advisory. A separately requested edge floor is hard
11// in strict mode. Transition is the ratio of nominal sizes across shared faces.
29 // Bound from the immutable requested field over the WHOLE cell bbox.
30 // Zero means unbounded; negative/nonfinite values are errors, never passes.
32 std::function<double(const QRectF &)> footprintMaximum;
34 std::function<bool()> cancelled;
40 quint64 maximumWorkspaceBytes = quint64(1) << 30, workBudget = 0;
41 int maximumExamples = 20;
42};
43
52
58 int cell = -1, neighbour = -1;
59 quint8 flags = 0;
60 QPointF location;
65 double measured = 0, requested = 0;
66 QString message;
67};
68
79 bool complete = false, valid = false, cancelled = false, resourceLimited = false;
80 QString error;
107 QVector<quint8> cellFlags;
109 QVector<SizingAuditExample> examples;
115 bool limitsSatisfied() const
116 {
119 }
120};
121// Read-only independent geometry/connectivity audit. Does not call the CDT's
122// acceptance or sizing helpers. Sorted compact face records avoid an edge hash
123// proportional to millions of cells. Failure/exhaustion is never certification.
136SizingAuditReport auditMeshSizing(const MeshResult &, const SizingAuditOptions & = {});
137}
value types for the 2D mesh generator.
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and...
SizingCellFlag
Per-cell bits in SizingAuditReport::cellFlags and SizingAuditExample::flags.
Definition sizingaudit.h:44
@ AboveMaximum
Nominal size above the global maximumSize.
Definition sizingaudit.h:47
@ BelowEdgeFloor
Shortest edge below the hard minimumEdge floor.
Definition sizingaudit.h:46
@ TouchesConstraint
An edge is in MeshResult::boundaryEdges; not a violation.
Definition sizingaudit.h:50
@ AboveLocalMaximum
Nominal size above the cell's footprintMaximum bound.
Definition sizingaudit.h:48
@ TransitionExceeded
Either cell of a shared face whose ratio exceeds adjacentRatio.
Definition sizingaudit.h:49
@ BelowTarget
Nominal size below the advisory minimumTarget.
Definition sizingaudit.h:45
SizingAuditReport auditMeshSizing(const MeshResult &, const SizingAuditOptions &={})
Measure delivered cell sizes, edge floors and size transitions of a mixed mesh.
Definition sizingaudit.cpp:28
One recorded violation, for diagnostics.
Definition sizingaudit.h:53
int cell
Index into MeshResult::triangles; the larger cell for a transition.
Definition sizingaudit.h:58
int neighbour
The smaller cell across the face for TransitionExceeded; -1 otherwise.
Definition sizingaudit.h:58
QString message
English description of the violation.
Definition sizingaudit.h:66
quint8 flags
The single SizingCellFlag this example reports.
Definition sizingaudit.h:59
QPointF location
Average of the cell's vertex XY coordinates.
Definition sizingaudit.h:60
double measured
Shortest edge, nominal size or size ratio, according to flags.
Definition sizingaudit.h:65
double requested
The limit the measured value was compared with.
Definition sizingaudit.h:65
Limits, budgets and callbacks for auditMeshSizing().
Definition sizingaudit.h:18
double adjacentRatio
Largest ratio of nominal sizes across a shared face; must be >= 1 when nonzero.
Definition sizingaudit.h:28
double minimumTarget
Advisory smallest nominal size; smaller cells are counted and flagged BelowTarget but do not fail Siz...
Definition sizingaudit.h:28
double maximumSize
Global largest nominal size.
Definition sizingaudit.h:28
quint64 maximumWorkspaceBytes
Estimated limit for the face records, cell sizes and constraint keys (1 GiB by default); when exceede...
Definition sizingaudit.h:40
std::function< bool()> cancelled
Optional cancellation poll, called synchronously at the start and every 4096 work units.
Definition sizingaudit.h:34
quint64 workBudget
Work-unit limit; 0 selects 1024 per cell plus 100,000.
Definition sizingaudit.h:40
double minimumEdge
Hard floor for the shortest edge of every cell.
Definition sizingaudit.h:28
std::function< double(const QRectF &)> footprintMaximum
Optional nominal-size bound, called synchronously once per cell with its XY bounding box.
Definition sizingaudit.h:32
int maximumExamples
Example records kept, clamped to [0, 1000].
Definition sizingaudit.h:41
Result of auditMeshSizing().
Definition sizingaudit.h:69
bool limitsSatisfied() const
Whether the mesh met every hard limit.
Definition sizingaudit.h:115
QVector< quint8 > cellFlags
SizingCellFlag bits per MeshResult::triangles entry; empty if no cell was measured.
Definition sizingaudit.h:107
quint64 cellsChecked
Cells measured.
Definition sizingaudit.h:97
double largestNominal
Largest nominal cell size (XY length).
Definition sizingaudit.h:105
bool valid
Every check ran on valid limits and mesh geometry.
Definition sizingaudit.h:79
quint64 facesChecked
Faces shared by exactly two cells.
Definition sizingaudit.h:97
quint64 aboveLocalMaximum
Cells above their footprintMaximum bound.
Definition sizingaudit.h:98
quint64 belowEdgeFloor
Cells with an edge below minimumEdge.
Definition sizingaudit.h:97
quint64 belowTarget
Cells below the advisory minimumTarget.
Definition sizingaudit.h:97
bool resourceLimited
The work budget or the estimated workspace limit was exceeded.
Definition sizingaudit.h:79
quint64 workUsed
Work units consumed.
Definition sizingaudit.h:98
double largestAdjacentRatio
Largest nominal-size ratio across a shared face; 1 when there is none.
Definition sizingaudit.h:105
bool complete
Not stopped by cancellation or a work or workspace budget.
Definition sizingaudit.h:79
QVector< SizingAuditExample > examples
First violations found, up to maximumExamples; BelowTarget is never recorded.
Definition sizingaudit.h:109
double smallestNominal
Smallest nominal cell size (XY length).
Definition sizingaudit.h:105
bool cancelled
Cancellation was observed.
Definition sizingaudit.h:79
quint64 transitionFaces
Shared faces whose size ratio exceeds adjacentRatio.
Definition sizingaudit.h:98
quint64 aboveMaximum
Cells above maximumSize.
Definition sizingaudit.h:98
QString error
English reason when valid is false; empty otherwise.
Definition sizingaudit.h:80