The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and cell attributes, the mesh generator, quad regions, matching and cleanup, mesh statistics, and the INP and 2DM mesh codecs.
More...
Namespaces | |
| namespace | detail |
| Internal helpers of the Qt facades; not part of the supported API. | |
| namespace | native_adapter |
| Conversions between the Qt value types of namespace mesh and the standard types of meshkit::plan, used by the Qt facades. | |
| namespace | pslg |
| Preparation of planar straight-line graphs (PSLG) for meshing: Ramer–Douglas–Peucker simplification, straightness trimming, densification and resampling of paths and rings, hole-ring preparation, and point-in-rings tests. | |
| namespace | quadquality_detail |
| Internal checks behind the Qt quadrilateral quality metrics; not part of the supported API. | |
Classes | |
| struct | BankPairPatch |
| Two open bank polylines with independently supplied directions. More... | |
| struct | CellAreaStats |
| Min / max / mean / median of cell areas, triangles and quads (project CRS units²). More... | |
| struct | CellCoupling |
| A 1D node coupled to a mesh cell (centroid coupling). More... | |
| struct | CellGeom |
| Per-cell derived geometry shared by every consumer. More... | |
| struct | CellParamSpec |
| Describes one editable per-cell parameter: how to label it, how to configure a numeric editor for it, and whether it is live yet. More... | |
| struct | CflStats |
| The 2D marcher's CFL characteristic length, per cell and summarised. More... | |
| class | CoarseningQueue |
| Indexed binary min-heap holding at most one entry per vertex for resolution-aware coarsening. More... | |
| struct | ConstraintAuditExample |
| Qt form of meshkit::plan::ConstraintAuditExample: one recorded audit violation. More... | |
| struct | ConstraintAuditOptions |
| Qt form of meshkit::plan::ConstraintAuditOptions: pins, cancellation and resource limits for the constraint audits, copied field by field into the native options. More... | |
| struct | ConstraintAuditReport |
| Qt form of meshkit::plan::ConstraintAuditReport: result of auditConstraintSimplification() or auditMeshConstraints(). More... | |
| struct | ConstraintPolicyOverride |
| Partial ConstraintSimplificationPolicy layered over a parent policy, for per-source overrides. More... | |
| struct | ConstraintPreview |
| Bounded display summary of a simplification candidate, built by makeConstraintPreview(). More... | |
| struct | ConstraintPreviewFeature |
| Display data for one feature of a constraint-simplification preview. More... | |
| struct | ConstraintSegment |
| A polyline that must appear as constrained edges in the mesh. More... | |
| struct | ConstraintSimplificationOptions |
| Collection-wide inputs and resource limits for simplifyConstraints(). More... | |
| struct | ConstraintSimplificationPolicy |
| Per-feature limits for constraint simplification. More... | |
| struct | ConstraintSimplificationResult |
| Output of simplifyConstraints(); features and changes are parallel to the input. More... | |
| struct | CouplingMap |
| 1D↔2D coupling map produced by the meshing dialog. More... | |
| struct | FacingPair |
| One facing run found by findFacingPairs(). More... | |
| struct | FacingPairOptions |
| Detection policy for findFacingPairs(). More... | |
| struct | GenerationOptions |
| Quality knobs surfaced to the user dialog. More... | |
| struct | GenerationProgress |
| Counter snapshot passed to ConstrainedDelaunay::QualityOptions::onProgress during refineQuality(). More... | |
| struct | GenerationStats |
| What the last generate() built (MeshGenerator::stats()). More... | |
| struct | GradingStats |
| Size-grading and shape gates (workplans/MESH_OVERHAUL_PLAN_2026-09-29.md §6). More... | |
| struct | InfilDefaultRow |
One [2D_INFILTRATION_DEFAULTS] row. More... | |
| struct | InfilLookupEntry |
| One row of a classified lookup: a key (or key pair, for the Curve-Number landuse×HSG case) mapping to a full InfilRow. More... | |
| struct | InfilLookupTable |
| An editable, reusable classified lookup table. More... | |
| struct | InfilOptions |
[2D_INFILTRATION_OPTIONS]. More... | |
| struct | InfilRow |
| One infiltration specification: method + positional parameters + destination. More... | |
| class | InpMeshReader |
Stateless reader for the [2D_*] mesh sections of a SWMM .inp (inline or via [2D_MESH_FILE]), the counterpart of InpMeshWriter. More... | |
| struct | InpMeshReadResult |
| Outcome of InpMeshReader::read. More... | |
| class | InpMeshWriter |
Stateless writer that renders a MeshResult plus CouplingMap as SWMM [2D_*] section text and writes or patches it into a .inp and, in External mode, a sidecar .2dm. More... | |
| class | MeshBCTypes |
| Namespace-like QObject that registers the boundary-condition Type with Qt's meta-object system (Q_ENUM) and hosts static label/token/engine conversions. More... | |
| struct | MeshEdge |
| A boundary edge with its source-segment marker preserved. More... | |
| struct | MeshEdgeBC |
| Boundary condition, conveyance factor and wall drag of one cell-edge slot. More... | |
| class | MeshGenerator |
| Generate a 2D triangular mesh. More... | |
| struct | MeshResult |
| Result of MeshGenerator::generate. More... | |
| struct | MeshTriangle |
| A cell in the mesh — a triangle or (since the engine's mixed tri-quad meshes, workplans/TRI_QUAD_MESHING_PLAN_2026-09-06.md) a convex quadrilateral — indices into MeshResult::vertices. More... | |
| struct | MeshVertex |
| A vertex in the generated mesh. More... | |
| class | NaturalNeighbourInterpolator |
| Natural-neighbour (Sibson or Laplace) interpolator over scattered (x, y, z) seeds. More... | |
| struct | PatchAssessment |
| Result of assessPlannedPatch(). More... | |
| struct | PatchDecision |
| Per-region planning record explaining the disposition chosen by planQuadRegions(). More... | |
| struct | PatchInterfaceConflict |
| One interface face whose nominal-size ratio exceeds the limit. More... | |
| struct | PatchInterfaceReport |
| Result of auditPatchInterfaces(). More... | |
| struct | PatchLimits |
| Acceptance limits for one mapped patch, checked cell by cell by assessPlannedPatch(). More... | |
| struct | PatchLine |
| A polyline through a patch's vertices that must be reported as mesh edges with a marker — a conduit running along a strip's middle row. More... | |
| struct | PatchMesh |
| A generated patch in local indices. More... | |
| struct | QuadBlockGrid |
| Local cell size on a regular grid; NaN marks unusable cells. More... | |
| struct | QuadBlockOptions |
| Policy for placeQuadBlocks(). More... | |
| struct | QuadCleanupOptions |
| Policy for cleanupAndSmoothQuads(). More... | |
| struct | QuadCleanupStats |
| Counts reported by cleanupAndSmoothQuads(). More... | |
| struct | QuadPairingOptions |
| Policy for pairTrianglesIntoQuads(). More... | |
| struct | QuadPairingStats |
| Counts reported by pairTrianglesIntoQuads(). More... | |
| struct | QuadPlan |
| Result of planQuadRegions(). More... | |
| struct | QuadPlanningGeometry |
| Source geometry that protects against planned patches, in the regions' XY frame. More... | |
| struct | QuadPlanningOptions |
| Settings and budgets for planQuadRegions(). More... | |
| struct | QuadQuality |
| Shape metrics of one quadrilateral, as computed by quadQuality(). More... | |
| struct | QuadQualityBounds |
| Acceptance bounds shared by pairing, cleanup, smoothing and the legacy tri-pair merge. More... | |
| struct | QuadRegion |
| A polygon in which quadrilateral cells are requested, with its spacing, shape and tagging policy. More... | |
| struct | QuadRegionReport |
| Per-region outcome of generate() (MeshGenerator::quadRegionReports()). More... | |
| struct | QuadStats |
| Quadrilateral-cell statistics (workplans/TRI_QUAD_MESHING_PLAN §5): count, interior-angle range and bed non-planarity. More... | |
| struct | QuadTemplate |
| Four vertex ids in cyclic (CCW) order, indexed into the generated mesh passed to pairTrianglesIntoQuads(). More... | |
| struct | RefineHook |
| Cancellation, progress and graded sizing callbacks. More... | |
| struct | RegionMarker |
| A region attribute — an interior seed point whose value propagates through the constrained Delaunay region flood fill. More... | |
| struct | ResolutionSettings |
| Unit-independent mesh resolution choices (lengths in SI metres) with JSON round-trip, legacy migration and validation. More... | |
| struct | ResolvedInfil |
| Result of resolving one triangle's infiltration. More... | |
| struct | SimplificationChange |
| Outcome for one input feature; ConstraintSimplificationResult::changes is parallel to the input. More... | |
| struct | SimplificationFeature |
| One source constraint, an open polyline or a ring, given to simplifyConstraints(). More... | |
| class | SizeField |
| Distance-to-feature field sampled as a max-area function. More... | |
| struct | SizeFieldOptions |
| Policy for SizeField::build(). More... | |
| struct | SizingAuditExample |
| One recorded violation, for diagnostics. More... | |
| struct | SizingAuditOptions |
| Limits, budgets and callbacks for auditMeshSizing(). More... | |
| struct | SizingAuditReport |
| Result of auditMeshSizing(). More... | |
| class | Sms2dmReader |
| Stateless reader that turns an SMS 2DM mesh (file or text) into a MeshResult. More... | |
| struct | SteinerPoint |
| A point that must appear as a vertex in the output mesh. More... | |
| struct | StructuredPatch |
| Four-sided patch: corners in cyclic order (either orientation); n subdivisions along corner0→corner1 (and corner3→corner2), m along corner0→corner3 (and corner1→corner2). More... | |
| struct | SweptPatch |
Swept patch: the centreline is offset ±width/2 (mitred at interior vertices) and cut into across quads per station. More... | |
| struct | TerrainTolerancePolicy |
| Maps a reference terrain tolerance and a footprint target size to the tolerance used there. More... | |
Typedefs | |
| using | ConstrainedDelaunay = meshkit::BasicConstrainedDelaunay<meshkit::detail::QtStorage> |
| The constrained Delaunay kernel on Qt storage (QVector, QPointF, QString); the same implementation as meshkit::ConstrainedDelaunay, which uses standard containers. | |
| using | EdgeVertexPair = QPair<int, int> |
| Undirected mesh edge, as (min, max) vertex indices. | |
| using | MeshCell = MeshTriangle |
| Alias: a "triangle" row is any cell (triangle or quad). | |
Enumerations | |
| enum class | PatchDisposition { Triangles , Accepted , Repaired , RequiredFailure } |
| Final outcome of one quad region in unified cell planning. More... | |
| enum class | MeshOutputMode { External , Inline } |
| Output strategy for the four 2D mesh sections. More... | |
| enum class | InfilMethod : int { None = -1 , Horton = 0 , ModHorton = 1 , GreenAmpt = 2 , ModGreenAmpt = 3 , CurveNumber = 4 , Constant = 5 } |
| Infiltration method. More... | |
| enum class | InfilDest : int { Lost = 0 , SubcatchAquifer = 1 , Aquifer2D = 2 } |
Destination of infiltrated water (engine Infil2DDest). More... | |
| enum class | InfilProvenance : int { None = 0 , Star = 1 , Tag = 2 , Override = 3 } |
| Where a cell's resolved parameters came from — drives the muted/italic "inherited" rendering in the attribute table and property panels, and is what undo must restore (GUI plan §3.5(3)). More... | |
| enum class | QuadRegionMode { Auto , Mapped , Submapped , Free , TrianglesOnly } |
| Requested (or classified) cell strategy of a QuadRegion. More... | |
| enum | SizingCellFlag : quint8 { BelowTarget = 1 , BelowEdgeFloor = 2 , AboveMaximum = 4 , AboveLocalMaximum = 8 , TransitionExceeded = 16 , TouchesConstraint = 32 } |
| Per-cell bits in SizingAuditReport::cellFlags and SizingAuditExample::flags. More... | |
| enum class | CoarseningOrder |
| Order in which terrain coarsening tries to remove free vertices. More... | |
| enum class | TerrainToleranceMode |
| How TerrainTolerancePolicy::tolerance() derives a footprint's terrain tolerance. More... | |
Functions | |
| QVector< FacingPair > | findFacingPairs (const QVector< QVector< QPointF > > &lines, const QVector< QPair< QPointF, QPointF > > &obstacles, const FacingPairOptions &opt) |
| Greedily identify near-parallel breakline runs facing across an unobstructed sampled strip. | |
| PatchAssessment | assessPlannedPatch (const PatchMesh &, const PatchLimits &) |
| Check a generated mapped patch cell by cell against acceptance limits. | |
| QuadPlan | planQuadRegions (const QVector< QuadRegion > &, const QuadPlanningGeometry &, const QuadPlanningOptions &={}) |
| Plan mapped quad patches for all regions jointly, before CDT construction. | |
| PatchInterfaceReport | auditPatchInterfaces (const MeshResult &, const QVector< MeshEdge > &, double maximumRatio, const std::function< bool()> &cancelled={}, int maximumExamples=64) |
| Measure nominal-size ratios across delivered patch interface edges. | |
| ConstraintAuditReport | auditConstraintSimplification (const QVector< SimplificationFeature > &original, const ConstraintSimplificationResult &candidate, const ConstraintAuditOptions &options={}) |
| Qt facade of meshkit::plan::auditConstraintSimplification(): converts the arguments to native copies, runs the native audit and converts the report back. | |
| ConstraintAuditReport | auditMeshConstraints (const QVector< SimplificationFeature > &constraints, const MeshResult &mesh, const ConstraintAuditOptions &options={}) |
| Qt facade of meshkit::plan::auditMeshConstraints(): features and options are converted to native copies, the mesh is read through borrowed views during the call. | |
| ConstraintPreview | makeConstraintPreview (const QVector< SimplificationFeature > &original, const ConstraintSimplificationResult &candidate, const std::function< bool()> &cancelled={}, int maximumVertices=50000, int maximumFeatures=500) |
| Build bounded display data comparing source features with a simplification candidate. | |
| ConstraintSimplificationResult | simplifyConstraints (const QVector< SimplificationFeature > &features, const ConstraintSimplificationOptions &options={}) |
| Remove redundant vertices from a collection of constraint features without moving any coordinate. | |
| bool | unitsHeaderIsSI (const QString &unitsHeader) |
| Recognize the retained metric-mesh header vocabulary without converting geometry. | |
| constexpr int | edgeSlot (int cell, int e) noexcept |
| Compute the flat stride-four slot for one cell-local edge. | |
| constexpr int | slotCell (int slot) noexcept |
| Decode the owning cell index from a stride-four flat edge slot. | |
| constexpr int | slotLocal (int slot) noexcept |
| Decode local edge position from a stride-four flat slot. | |
| constexpr int | edgeSlotCount (int nCells) noexcept |
| Calculate padded per-edge storage length for a cell count. | |
| void | edgeEndpoints (const MeshTriangle &t, int k, int &a, int &b) noexcept |
| Resolve the ordered vertex IDs of one cell-local opposite-edge convention. | |
| bool | rt0CellDischarge (int cell, int nv, const float *flux, const float *length, const float *nx, const float *ny, double &qx, double &qy) noexcept |
| Reconstruct planar specific discharge by least-squares fitting outward edge-normal discharge. | |
| bool | cellVelocity (int cell, int nv, const float *flux, const float *length, const float *nx, const float *ny, double depth, double dryDepth, double &vx, double &vy) noexcept |
| Reconstruct cell velocity from edge discharge only when a usable wet depth is available. | |
| CellGeom | cellGeom (const QVector< MeshVertex > &vertices, const MeshTriangle &t) |
| Compute triangle/quad subtriangles, positive fan area, area centroid and arithmetic mean elevation. | |
| double | cellSignedArea (const QVector< MeshVertex > &vertices, const MeshTriangle &t) noexcept |
| Compute oriented polygon area in local coordinates to reduce projected-origin cancellation. | |
| bool | cellIsConvex (const QVector< MeshVertex > &vertices, const MeshTriangle &t) noexcept |
| Check strict consistent quad turns, treating every triangle as convex without inspection. | |
| bool | cellContains (const QVector< MeshVertex > &vertices, const MeshTriangle &t, const QPointF &p, double eps=0.0) noexcept |
| Test a point against the elevation-selected cell subtriangle fan using barycentric slack. | |
| const QVector< CellParamSpec > & | cellParamSpecs () |
| Return the immutable shared registry of mesh cell parameter/editor specifications. | |
| const CellParamSpec * | cellParamSpec (const QByteArray &key) |
| Find a registry specification by its case-sensitive stable byte key. | |
| QString | cellParamLabel (const QByteArray &key, const QString &depthUnitLabel) |
| Build a display label using the registry and an optional project depth-unit suffix. | |
| double | cellParamValue (const MeshResult &mesh, int tri, const QByteArray &key) |
| Read a stored or inheritance-resolved cell parameter without substituting editor defaults. | |
| QByteArray | initialConditionCounterpart (const QByteArray &key) |
Name the alternative initial-condition key of key. | |
| double | triangleArea (const MeshResult &mesh, int tri) |
| Measure positive fan area for a triangle or quadrilateral cell. | |
| QPointF | cellCentroid (const MeshResult &mesh, int cell) |
| Compute the planar area centroid using the shared cell fan geometry. | |
| QuadStats | computeQuadStats (const MeshResult &mesh) |
| Summarize quad angles, quality, bed twist and interior quad-only vertex valence. | |
| CellAreaStats | computeCellAreaStats (const MeshResult &mesh) |
| Summarize unsigned fan areas of all index-valid triangle and quad rows. | |
| QHash< EdgeVertexPair, QVector< int > > | buildEdgeTriangles (const MeshResult &mesh) |
| Build an owned undirected edge-to-incident-cell adjacency map. | |
| QVector< double > | computeCellLchar (const MeshResult &mesh) |
| Estimate the engine-style CFL characteristic length from cell geometry and interior faces. | |
| CflStats | computeCflStats (const MeshResult &mesh, int ltsTiers=4) |
| Summarize positive geometric CFL lengths and a uniform-depth local-timestep work proxy. | |
| GradingStats | computeGradingStats (const MeshResult &mesh) |
| Summarize adjacent-cell size ratios, face orthogonality and minimum cell corner angles. | |
| QPair< int, int > | edgeKey (int a, int b) noexcept |
| Normalize two endpoint identifiers into an undirected ordered key. | |
| ResolvedInfil | resolveInfil (const MeshResult &mesh, int tri) |
| Resolve an owned infiltration specification while preserving its authoring provenance. | |
| InfilRow | starDefault (const MeshResult &mesh) |
| Copy the first wildcard infiltration default, if present. | |
| int | indexOfDefault (const MeshResult &mesh, const QString &tag) |
| Find the first exact case-sensitive default tag match. | |
| bool | infilUsesParam (InfilMethod method, int slot) |
| Check whether a model uses a zero-based positional parameter slot. | |
| int | infilParamCount (InfilMethod method) |
| Report serialized parameter-column width rather than number of active values. | |
| QString | infilParamLabel (InfilMethod method, int slot) |
| Translate the model-specific label for an active positional parameter. | |
| QByteArray | infilParamKey (InfilMethod method, int slot) |
| Map an active model slot to its case-sensitive shared registry key. | |
| int | infilSlotForKey (InfilMethod method, const QByteArray &key) |
| Resolve a named parameter key to its position under one model. | |
| const QVector< QByteArray > & | infilParamKeys () |
| Return the immutable union of named infiltration parameter keys in registration order. | |
| QString | infilMethodToken (InfilMethod m) |
| Encode an infiltration method using the stable uppercase file vocabulary. | |
| InfilMethod | infilMethodFromToken (const QString &token, bool *ok=nullptr) |
| Parse a trimmed case-insensitive infiltration method token. | |
| QString | infilMethodLabel (InfilMethod m) |
| Translate a display label for an infiltration method. | |
| QStringList | infilMethodLabels () |
| Build translated method labels in consecutive enum order from None through Constant. | |
| QString | infilDestToken (InfilDest d) |
| Encode a destination enum as its retained uppercase file token. | |
| InfilDest | infilDestFromToken (const QString &token, bool *ok=nullptr) |
| Parse a retained destination token independently of current engine support. | |
| QString | infilDestLabel (InfilDest d) |
| Translate the display label of a retained destination value. | |
| QStringList | infilDestLabels () |
| Build translated destination labels in enum order Lost, SubcatchAquifer, Aquifer2D. | |
| QString | infilDestHint (InfilDest d) |
| Translate destination guidance without resolving any open model. | |
| bool | saveLookupTableCsv (const InfilLookupTable &table, const QString &path, QString *err) |
| Serialize classified infiltration entries and optional fallback to a QSaveFile CSV replacement. | |
| bool | loadLookupTableCsv (InfilLookupTable *table, const QString &path, QString *err) |
| Load the permissive unquoted classified-lookup CSV format into a fresh table value. | |
| QString | validate (const StructuredPatch &p) |
| Input checks. | |
| QString | validate (const SweptPatch &p) |
| Check a swept patch's inputs and its representable station, cell and boundary counts. | |
| QString | validate (const PatchMesh &pm) |
| Requires finite convex CCW quads, consistently shared cell edges, and one simple boundary matching exactly the outer cell edges. | |
| QPolygonF | orderedPatchBoundary (const PatchMesh &pm, QString *err=nullptr) |
| Validate the complete patch and return its CCW boundary, without a repeated closing vertex. | |
| PatchMesh | makeTransfinitePatch (const StructuredPatch &p, QString *err=nullptr) |
| Transfinite interpolation on the four straight sides. | |
| PatchMesh | makeSweptPatch (const SweptPatch &p, QString *err=nullptr) |
| Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads. | |
| PatchMesh | makeBankPairPatch (const BankPairPatch &p, QString *err=nullptr) |
| Build a conforming strip between two simple, disjoint banks. | |
| PatchMesh | makeTransfinitePatch (const QVector< QVector< QPointF > > &sides, int n, int m, const QString &tag, QString *err=nullptr) |
| Transfinite (Coons) interpolation on four POLYLINE sides forming a loop: sides[0] runs c0→c1, sides[1] c1→c2, sides[2] c2→c3, sides[3] c3→c0 (each side's last point equals the next side's first). | |
| PatchMesh | makeTransfinitePatchAtStations (const QVector< QVector< QPointF > > &sides, const QString &tag, QString *err=nullptr) |
| Coons patch whose boundary vertices are exactly the given side stations. | |
| PatchMesh | makeMappedPatch (const QPolygonF &ring, const QVector< int > &corners, double h, const QString &tag, QString *err=nullptr) |
Split a CCW ring at the four corners (ring vertex indices, ring order) into polyline sides, choose n = max(1, round(mean(len0, len2)/h)), m likewise from sides 1/3, and call the polyline overload. | |
| PatchMesh | makeMappedPatch (const QPolygonF &ring, const QVector< int > &corners, double hAlong, double hAcross, double alongAngleDeg, const QString &tag, QString *err=nullptr) |
| Mapped patch with independent physical-axis spacing. | |
| QuadCleanupStats | cleanupAndSmoothQuads (MeshResult &mesh, const QSet< int > &movable, const QuadCleanupOptions &opts, QVector< int > *vertexOldToNew) |
| Remove eligible quad doublets, improve valence diagonals, smooth movable xy and compact/reorder cells. | |
| QVector< int > | reorderTrianglesFirst (MeshResult &mesh) |
| Stable-partition cell rows into triangles followed by quads and remap selected cell metadata. | |
| QuadPairingStats | pairTrianglesIntoQuads (MeshResult &mesh, const QVector< int > &cellIds, const QVector< QuadTemplate > &templates, const QSet< QPair< int, int > > &lockedEdges, const QuadPairingOptions &opts, QVector< int > *oldToNew) |
| Pair selected valid triangle rows into acceptable CCW quads, then rebuild engine cell order. | |
| QVector< int > | maximumMatching (int n, const QVector< QPair< int, int > > &edges) |
| Compute an unweighted maximum-cardinality matching in an undirected general graph. | |
| bool | unionQuad (const QVector< MeshVertex > &vertices, const MeshTriangle &t1, const MeshTriangle &t2, MeshTriangle &quad) |
| Form and convexity-check a CCW quadrilateral candidate from two triangle records. | |
| QuadQuality | quadQuality (const QPointF &a, const QPointF &b, const QPointF &c, const QPointF &d) |
| Measure one quadrilateral using cyclic corners and translation/scale-resistant planar arithmetic. | |
| QuadQuality | quadQuality (const QVector< MeshVertex > &vertices, const MeshTriangle &t) |
| Measure a quad cell through its borrowed vertex records. | |
| bool | quadAcceptable (const QuadQuality &q, const QuadQualityBounds &b) |
| Apply inclusive hard angle/Jacobian/aspect limits to a valid convex metric record. | |
| double | quadScore (const QuadQuality &q, const QuadQualityBounds &b) |
| Rank valid convex quads by Jacobian, rectangularity and a soft aspect penalty. | |
| double | triangleScaledJacobian (const QPointF &a, const QPointF &b, const QPointF &c) |
| Compute the minimum orientation-normalized corner sine of a triangle. | |
| double | cellCornerAngleDeg (const QVector< MeshVertex > &v, const MeshTriangle &t, int i) |
| Compute the unsigned corner angle of a triangle or quad. | |
| QuadQualityBounds | quadRegionQualityBounds (const QuadRegion ®ion, QuadQualityBounds global) |
| Copy global quality bounds and apply an explicitly nonnegative region aspect override. | |
| QPolygonF | normalizeRingCCW (const QPolygonF &ring) |
| Copy a ring while dropping scale-fuzzy consecutive/closing duplicates and reversing negative area. | |
| bool | polylineIntersectsRect (const QVector< QPointF > &path, const QRectF &rect) |
| Test whether any consecutive path segment meets a normalized closed rectangle. | |
| double | ringSignedArea (const QPolygonF &ring) |
| Compute oriented shoelace area after translating corners to the first vertex. | |
| bool | pointInRing (const QPolygonF &ring, const QPointF &p) |
| Test a point using a strict horizontal-ray odd-even crossing rule. | |
| bool | pointInRegion (const QPolygonF &ring, const QVector< QPolygonF > &holes, const QPointF &p) |
| Combine outer-ring parity with exclusion by every supplied hole-ring parity. | |
| bool | ringIsSimple (const QPolygonF &ring) |
| Reject proper nonadjacent edge crossings using plain double orientation signs. | |
| QString | validateQuadRegion (const QuadRegion &r, const QVector< QPolygonF > &domains, const QVector< QPolygonF > &holes) |
| Check region authoring policy, normalized ring and sampled domain/hole containment. | |
| QString | validateQuadRegionsDisjoint (const QVector< QuadRegion > ®ions) |
| Check explicit region pairs for proper crossings or strictly interior sampled vertices. | |
| QuadRegionMode | classifyQuadRegion (const QPolygonF &ring, QVector< int > *corners, double cornerTolDeg=25.0, double rectilinearTolDeg=2.0) |
| Heuristically classify normalized ring turns as Mapped, Submapped or Free. | |
| QPolygonF | resampleRing (const QPolygonF &ring, double h, double keepTurnDeg=0.0) |
| Normalize a ring and insert equal-part subdivisions along all implicit closing edges. | |
| double | ringTurnDeg (const QPolygonF &ring, int i) |
| Compute a signed exterior turn at one ring corner using adjacent edge cross/dot products. | |
| void | reorderMeshHilbert (MeshResult *m) |
| Spatially permute cells within triangle/quad classes and renumber vertices by first use. | |
| double | meanVertexIndexSpread (const MeshResult &m) |
| Compute mean absolute index jump across each cell's consecutive cyclic corner pairs. | |
| QuadBlockGrid | quadBlockGridFromMesh (const MeshResult &mesh, double pitch, const QVector< QVector< QPointF > > &blockers) |
| Estimate local equilateral side lengths from triangles and mask existing quads/features. | |
| QuadBlockGrid | quadBlockGridFromField (const QRectF &r, double pitch, const std::function< double(const QRectF &)> &f, const QVector< QVector< QPointF > > &b, const std::function< bool()> &cancel, qint64 cap) |
| Build a block grid from a size field over a rectangle, before any triangulation (Qt adapter over meshkit::plan::quadBlockGridFromField). | |
| QVector< QuadRegion > | placeQuadBlocks (const QuadBlockGrid &grid, const QuadBlockOptions &options) |
| Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands. | |
| SizingAuditReport | auditMeshSizing (const MeshResult &, const SizingAuditOptions &={}) |
| Measure delivered cell sizes, edge floors and size transitions of a mixed mesh. | |
| double | resolutionRemovalImportance (double flatness, double actualSize, double targetSize) |
| Rank a vertex for resolution-aware coarsening; lower values are tried first. | |
Variables | |
| constexpr int | kEdgeStride = 4 |
| Edge slots per cell in every flat per-edge array (== engine kMaxCellVerts). | |
| constexpr int | kInfilMaxParams = 5 |
| Widest positional parameter count (Horton: f0 fmin decay dry_time Fmax). | |
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and cell attributes, the mesh generator, quad regions, matching and cleanup, mesh statistics, and the INP and 2DM mesh codecs.
Uses Qt value types (QVector, QPointF, QString); the planning, sizing and constraint facades delegate to the standard C++ implementations in meshkit and meshkit::plan.
The constrained Delaunay kernel on Qt storage (QVector, QPointF, QString); the same implementation as meshkit::ConstrainedDelaunay, which uses standard containers.
| using mesh::EdgeVertexPair = QPair<int, int> |
Undirected mesh edge, as (min, max) vertex indices.
| using mesh::MeshCell = MeshTriangle |
Alias: a "triangle" row is any cell (triangle or quad).
|
strong |
Order in which terrain coarsening tries to remove free vertices.
|
strong |
|
strong |
Infiltration method.
Values mirror the engine's InfilModel plus an explicit None. Stored in files as the tokens returned by infilMethodToken().
|
strong |
Where a cell's resolved parameters came from — drives the muted/italic "inherited" rendering in the attribute table and property panels, and is what undo must restore (GUI plan §3.5(3)).
| Enumerator | |
|---|---|
| None | No model resolves for this cell. |
| Star | From the '*' default row. |
| Tag | From a tag default row. |
| Override | From a per-cell override. |
|
strong |
Output strategy for the four 2D mesh sections.
External (default) keeps the main .inp clean and lets multiple SWMM models share a single mesh — the user-stated preference (2026-04-26). Inline is the fallback for callers who specifically want everything in one file.
| Enumerator | |
|---|---|
| External | Write |
| Inline | Inline the four sections directly in the |
|
strong |
Final outcome of one quad region in unified cell planning.
|
strong |
Requested (or classified) cell strategy of a QuadRegion.
classifyQuadRegion() can return Mapped, Submapped or Free for a ring. MeshGenerator builds only mapped (transfinite) patches: every request other than TrianglesOnly is meshed with quads when the ring has four logical sides and with triangles otherwise; the outcome is reported as Mapped or TrianglesOnly in QuadRegionReport::resolved.
| Enumerator | |
|---|---|
| Auto | classifyQuadRegion() decides: Mapped → Submapped → Free. |
| Mapped | Four logical sides (polylines) → transfinite quads. Needs 4 corners. |
| Submapped | Exactly rectilinear ring. A classification only: MeshGenerator meshes it like Mapped. |
| Free | Quad-dominant (cross-field lattice) candidate. A classification only: MeshGenerator meshes it like Mapped. |
| TrianglesOnly | Region ring is still a constraint loop, interior stays triangles. |
| enum mesh::SizingCellFlag : quint8 |
Per-cell bits in SizingAuditReport::cellFlags and SizingAuditExample::flags.
| Enumerator | |
|---|---|
| BelowTarget | Nominal size below the advisory minimumTarget. |
| BelowEdgeFloor | Shortest edge below the hard minimumEdge floor. |
| AboveMaximum | Nominal size above the global maximumSize. |
| AboveLocalMaximum | Nominal size above the cell's footprintMaximum bound. |
| TransitionExceeded | Either cell of a shared face whose ratio exceeds adjacentRatio. |
| TouchesConstraint | An edge is in MeshResult::boundaryEdges; not a violation. |
|
strong |
How TerrainTolerancePolicy::tolerance() derives a footprint's terrain tolerance.
| PatchAssessment mesh::assessPlannedPatch | ( | const PatchMesh & | p, |
| const PatchLimits & | l ) |
Check a generated mapped patch cell by cell against acceptance limits.
The first argument is the patch, read only; it must have cells, and every cell must be a quad with in-range vertex indices, finite coordinates and a convex, positive-area shape. The second argument holds the limits, validated first: finite nonnegative values, minimumAngleDegrees below 180, a finite alongAngleDegrees, and alongSize and acrossSize either both positive or both zero. Checking stops at the first failing cell. Cancellation is polled every 1024 cells; callbacks run synchronously on the calling thread.
| ConstraintAuditReport mesh::auditConstraintSimplification | ( | const QVector< SimplificationFeature > & | original, |
| const ConstraintSimplificationResult & | candidate, | ||
| const ConstraintAuditOptions & | options = {} ) |
Qt facade of meshkit::plan::auditConstraintSimplification(): converts the arguments to native copies, runs the native audit and converts the report back.
Per feature: valid policy; unchanged id, closed, role, marker, requiredInMesh and elevation presence; a strictly increasing source mapping; retained vertices and heights exactly equal to their sources; endpoints and ring closure kept; no Preserve-mode, fixed or above-maxTurnDegrees vertex removed; consistent removed count; ring orientation and area limits; XY/Z deviation and monotone projection of each removed vertex. Then source rings must not touch themselves and, when anything was removed, each new shortcut is checked against other output edges, pins and the original graph for crossings, collapsed distinct paths, lost junctions, swept pockets and minimumClearance.
| [in] | original | Features given to simplifyConstraints(); read only, not retained. |
| [in] | candidate | Its result; must be ok with one feature and change per original. |
| [in] | options | Pins, cancellation and limits; the callback runs synchronously. |
| ConstraintAuditReport mesh::auditMeshConstraints | ( | const QVector< SimplificationFeature > & | constraints, |
| const MeshResult & | mesh, | ||
| const ConstraintAuditOptions & | options = {} ) |
Qt facade of meshkit::plan::auditMeshConstraints(): features and options are converted to native copies, the mesh is read through borrowed views during the call.
Each non-degenerate segment of a feature with requiredInMesh must be covered end to end, from its first to its last vertex, by a chain of delivered edges (mesh.boundaryEdges) lying on it within coordinateRoundoff, each with one or two incident cells and, for a nonzero feature marker, the same marker. Domain and Hole edges need their cells on the correct side; delivered endpoint z must match authored z to roundoff. Not a general cell-overlap proof.
| [in] | constraints | Source features; Domain/Hole rings also define the inside used for side checks. Read only, not retained. |
| [in] | mesh | Delivered mesh; must have ok set. Read only, not retained. |
| [in] | options | Cancellation and limits; protectedPoints is not used. |
| SizingAuditReport mesh::auditMeshSizing | ( | const MeshResult & | mesh, |
| const SizingAuditOptions & | options = {} ) |
Measure delivered cell sizes, edge floors and size transitions of a mixed mesh.
The first argument is the mesh, read only. It must be ok and nonempty. Every cell, triangle or quad, needs distinct in-range vertex indices with finite XY and a strictly convex counterclockwise shape; boundary edges need distinct in-range vertices; a face may be shared by at most two cells, which must traverse it in opposite directions. Only XY is used. The second argument holds the limits, budgets and callbacks; callbacks run synchronously on the calling thread.
| PatchInterfaceReport mesh::auditPatchInterfaces | ( | const MeshResult & | m, |
| const QVector< MeshEdge > & | edges, | ||
| double | maximumRatio, | ||
| const std::function< bool()> & | cancelled = {}, | ||
| int | maximumExamples = 64 ) |
Measure nominal-size ratios across delivered patch interface edges.
Nominal size is sqrt(4A / sqrt(3)) for a triangle and sqrt(A) for a quad, from the signed XY area, so every cell must be counterclockwise. An edge with two incident cells is a shared face; an edge with one is skipped. The parameters are unnamed in this declaration; the names below are the definition's.
| [in] | m | The delivered mesh; read only. |
| [in] | edges | Patch boundary edges as vertex index pairs into the mesh's vertices (direction and marker ignored); read only. |
| [in] | maximumRatio | Largest allowed ratio of the two nominal sizes; finite and >= 1. |
| [in] | cancelled | Optional poll, called synchronously about every 4096 cells. |
| [in] | maximumExamples | Violations to report, clamped to [0, 1000]; those with the smallest cell indices are kept. |
|
nodiscard |
Build an owned undirected edge-to-incident-cell adjacency map.
| [in] | mesh | Borrowed cell/vertex arrays, unchanged; every cell with any out-of-range ID is skipped. |
Map every undirected edge to the triangles incident on it.
MeshResult stores no adjacency, and every pass that needs neighbours has so far rebuilt this by hand. Triangles with out-of-range indices are skipped. (meshminsizecleanup.cpp's Topo::build still has its own copy fused into a larger loop; converge them when that file is next touched.)
|
nodiscard |
Compute the planar area centroid using the shared cell fan geometry.
| [in] | mesh | Borrowed stable geometry with finite nonfolded valid cells, unchanged. |
| [in] | cell | Zero-based triangle/quad row index, bounds checked along with every vertex ID. |
Area centroid of cell cell (mesh::cellGeom — the vertex mean for a triangle, the area-weighted sub-triangle centroid for a quad). A null point for an out-of-range cell.
|
inlinenoexcept |
Test a point against the elevation-selected cell subtriangle fan using barycentric slack.
| [in] | vertices | Stable valid referenced cell vertices in shared planar units. |
| [in] | t | Valid cyclic triangle/nonfolded quad, preserved; cellGeom defines fan and diagonal. |
| [in] | p | Finite query point in same planar units, preserved. |
| [in] | eps | Dimensionless nonnegative barycentric tolerance, default 0 includes triangle boundaries; negative values shrink allowable barycentric region, not validated. |
Point-in-cell test on the sub-triangle fan (barycentric per sub-triangle).
|
inline |
Compute the unsigned corner angle of a triangle or quad.
| [in] | v | Stable vertex storage containing every referenced cell index in range. |
| [in] | t | Valid cyclic cell, preserved. |
| [in] | i | Local corner in[0,t.vertexCount()), unchecked. |
Interior angle at corner i of a cell (degrees), triangles and quads.
|
inline |
Compute triangle/quad subtriangles, positive fan area, area centroid and arithmetic mean elevation.
| [in] | vertices | Stable vertex records with valid t indices, common planar units and consistent z units. |
| [in] | t | Valid nonfolded cyclic cell, preserved; quads use stable elevation ordering to choose storage diagonal. |
Geometry of cell t against vertices.
A quad is split along the Begnudelli & Sanders (2007) diagonal: with the vertices ordered by elevation n1 ≤ n2 ≤ n3 ≤ n4 — Case 1: n1,n4 opposite → sub-triangles (n1,n2,n4),(n1,n3,n4); Case 2: n1,n4 adjacent and n2 adjacent to n1 → (n1,n2,n4),(n2,n3,n4); Case 3 → (n1,n3,n4),(n2,n3,n4). The centroid is the area-weighted centroid of the two sub-triangles (a property of the polygon, independent of the diagonal).
|
inlinenoexcept |
Check strict consistent quad turns, treating every triangle as convex without inspection.
| [in] | vertices | Stable coordinates with valid quad vertex indices when t is a quad. |
| [in] | t | Triangle or cyclic quad, preserved. |
Convexity test for a quad (every consecutive cross product has the same non-zero sign). Triangles are trivially convex.
|
nodiscard |
Build a display label using the registry and an optional project depth-unit suffix.
| [in] | key | Borrowed case-sensitive parameter key, unchanged. |
| [in] | depthUnitLabel | Borrowed display unit text, normally UnitSystem::depthLabel(); no conversion occurs. |
Full label for key including the unit suffix when the parameter is a length. depthUnitLabel comes from UnitSystem::depthLabel().
|
nodiscard |
Find a registry specification by its case-sensitive stable byte key.
| [in] | key | Borrowed key, unchanged; unknown/empty keys do not match. |
Look up one spec by key; returns nullptr when unknown.
|
nodiscard |
Return the immutable shared registry of mesh cell parameter/editor specifications.
The registry, in display order. Stable for the process lifetime.
|
nodiscard |
Read a stored or inheritance-resolved cell parameter without substituting editor defaults.
| [in] | mesh | Borrowed stable mesh and authoring-preview arrays, unchanged. |
| [in] | tri | Cell/preview index; ordinary parameters require [0,triangles.size()). Preview owner/weather keys instead validate only their corresponding preview array extent, so a preview may exist without a cell. |
| [in] | key | Borrowed case-sensitive registry key; method-specific infiltration keys resolve override, region tag then wildcard, and unused method slots are unavailable. |
Current value of key on triangle tri.
The infil.* keys resolve through mesh::resolveInfil (override → tag row → '*' row), so an inherited value reads back here exactly as the engine would see it; a parameter the resolved METHOD does not use returns NaN, which is what drives the attribute table's per-row column masking. infil.method returns the mesh::InfilMethod integer (-1 = None).
|
inlinenoexcept |
Compute oriented polygon area in local coordinates to reduce projected-origin cancellation.
| [in] | vertices | Stable planar coordinates in common units, every t index valid. |
| [in] | t | Cyclic triangle/quad, preserved. |
Signed area of the polygon (positive = counter-clockwise).
|
inlinenoexcept |
Reconstruct cell velocity from edge discharge only when a usable wet depth is available.
| [in] | cell | Nonnegative valid cell index, stride-four address arithmetic must fit int. |
| [in] | nv | Number of real edges 3 or 4, no padding read. |
| [in] | flux | Nonnull stable flat outward volumetric fluxes m3/s, extent>=4*(cell+1). |
| [in] | length | Nonnull stable equal-extent lengths metres. |
| [in] | nx | Nonnull stable equal-extent outward unit-normal x components. |
| [in] | ny | Nonnull stable equal-extent outward unit-normal y components. |
| [in] | depth | Finite positive hydraulic depth in metres; below dryDepth refuses. |
| [in] | dryDepth | Dry threshold in metres; caller supplies nonnegative finite policy value, threshold equality is wet, depth<=0 always refuses. |
| [out] | vx | Borrowed x velocity m/s, set zero before validation; can be nonfinite if final division fails. |
| [out] | vy | Borrowed y velocity m/s, same policy, use distinct outputs. |
Velocity in SI m/s from outward volumetric edge flux. Never substitute specific discharge for velocity, or divide by a dry/non-finite depth.
| QuadRegionMode mesh::classifyQuadRegion | ( | const QPolygonF & | ring, |
| QVector< int > * | corners, | ||
| double | cornerTolDeg = 25.0, | ||
| double | rectilinearTolDeg = 2.0 ) |
Heuristically classify normalized ring turns as Mapped, Submapped or Free.
| [in] | ring | Borrowed finite valid planar ring, unchanged; normalized CCW/open before evaluating turns. |
| [out] | corners | Optional borrowed vector, cleared first; Mapped success fills four indices into the normalized ring, not necessarily original input positions. Other modes leave it empty. |
| [in] | cornerTolDeg | Finite nonnegative degree tolerance, default 25. Mapped needs exactly four turns within inclusive 90+/-tolerance and all other absolute turns strictly below tolerance. |
| [in] | rectilinearTolDeg | Finite nonnegative degree tolerance, default 2. Submapped accepts every absolute turn close to 90 or close to zero (straight-through vertices are allowed). |
Auto-classification (plan §4.1) on the normalised ring.
Turning angle at each vertex (exterior angle, CCW positive): - exactly four vertices with turn in [90 − cornerTolDeg, 90 + cornerTolDeg] and every other |turn| < cornerTolDeg → Mapped (corners = those four, in ring order); - every turn within rectilinearTolDeg of ±90° or zero → Submapped; - otherwise Free. corners receives the Mapped corners when non-null (cleared otherwise).
| QuadCleanupStats mesh::cleanupAndSmoothQuads | ( | MeshResult & | mesh, |
| const QSet< int > & | movable, | ||
| const QuadCleanupOptions & | opts, | ||
| QVector< int > * | vertexOldToNew ) |
Remove eligible quad doublets, improve valence diagonals, smooth movable xy and compact/reorder cells.
| [in,out] | mesh | Borrowed exclusively mutable finite valid mesh. Caller protects domain/constraint/ coupled vertices by excluding them from movable; no automatic boundary, coupling or interface protection is inferred. All surviving cell IDs must remain valid for unchecked smoothing/compaction geometry reads. |
| [in] | movable | Borrowed vertex-ID set, unchanged; invalid IDs filtered and valid IDs processed sorted. Only these vertices can move/remove, but cell order and surviving vertex indices can change globally. |
| [in] | opts | Borrowed policy; negative topology/smoothing counts act as zero. Topology candidates must pass full quad bounds and CCW area. Smoothing checks orientation/convexity, incident min Jacobian, per-cell min(previous,configured quad floor/triangle .5), and no introduced/worsened active aspect cap; it does not independently enforce the angle bounds. Jacobi moves are rechecked together with reverts. |
| [out] | vertexOldToNew | Optional borrowed vector, identity at entry or old-to-compacted IDs with -1 for removed vertices. Caller-held index sets/views must be rebuilt afterward; output pointer not retained. |
Run cleanup then smoothing. vertexOldToNew (optional) receives the vertex remap after doublet compaction (-1 = removed); identity when nothing was removed. Cells are rebuilt triangles-first afterwards.
|
nodiscard |
Summarize unsigned fan areas of all index-valid triangle and quad rows.
| [in] | mesh | Borrowed stable finite nonfolded geometry, unchanged; invalid-index rows are skipped, but valid-index zero-area rows remain in the sample. |
Compute cell-area statistics over all triangles in mesh.
Area is triangleArea. Triangles referencing out-of-range vertex indices are skipped. Median of an even count is the average of the two middle values.
|
nodiscard |
Estimate the engine-style CFL characteristic length from cell geometry and interior faces.
| [in] | mesh | Borrowed stable finite nonfolded geometry in consistent project-CRS units, unchanged; indices are checked, but full topology/finite validation is caller's responsibility. |
Per-cell L_char for mesh, indexed like mesh.triangles. Cells with invalid indices get 0.
|
nodiscard |
Summarize positive geometric CFL lengths and a uniform-depth local-timestep work proxy.
| [in] | mesh | Borrowed stable finite geometry in project-CRS units, unchanged. |
| [in] | ltsTiers | Requested work-proxy tier cap, clamped to [1,8], default 4. |
Summarise computeCellLchar. ltsTiers mirrors the engine's [2D_OPTIONS] LTS_TIERS (1..8, default 4).
|
nodiscard |
Summarize adjacent-cell size ratios, face orthogonality and minimum cell corner angles.
| [in] | mesh | Borrowed stable finite nonfolded triangle/quad geometry, unchanged; invalid-index, nonpositive-area or nonpositive-longest-edge cells are excluded. |
|
nodiscard |
Summarize quad angles, quality, bed twist and interior quad-only vertex valence.
| [in] | mesh | Borrowed stable geometry and boundaryEdges, unchanged; finite representable planar/z coordinates are required for meaningful results. Invalid vertex-index cells are skipped. |
|
inlinenoexcept |
Resolve the ordered vertex IDs of one cell-local opposite-edge convention.
| [in] | t | Valid cyclic triangle/quad, preserved, no vertex-coordinate lookup. |
| [in] | k | Local edge in[0,t.vertexCount()), caller must not pass triangle padding3. |
| [out] | a | Borrowed reference overwritten with vertex((k+1)nv). |
| [out] | b | Borrowed reference overwritten with vertex((k+2)nv); caller should use distinct outputs. |
Endpoints (a, b) of local edge k of cell t: v[(k+1)nv], v[(k+2)nv].
|
inlinenoexcept |
Normalize two endpoint identifiers into an undirected ordered key.
| [in] | a | First integer vertex identifier, any value including negative sentinel accepted. |
| [in] | b | Second integer identifier, equal values allowed. |
Unordered vertex-pair key used for locked edges: (min, max).
|
constexprnoexcept |
Compute the flat stride-four slot for one cell-local edge.
| [in] | cell | Nonnegative zero-based cell index; cell*4+e must fit int. |
| [in] | e | Local edge[0,3] for storage addressing; triangle slot 3 is padding, not a real edge. |
Flat edge slot of local edge e of cell cell.
|
constexprnoexcept |
Calculate padded per-edge storage length for a cell count.
| [in] | nCells | Nonnegative cell count with 4*nCells representable in int. |
Number of flat edge slots for nCells cells.
|
nodiscard |
Greedily identify near-parallel breakline runs facing across an unobstructed sampled strip.
| [in] | lines | Borrowed finite planar paths, unchanged; only consecutive edges exist, closed rings must repeat first point. Nonpositive-length segments skipped; sizes/grid/arc/station arithmetic must be representable and feasible. Coordinates/grid-cell floor plus neighboring loop increments must fit qint64. |
| [in] | obstacles | Borrowed finite segment endpoints in the same CRS/units, unchanged; obstacle hit blocks a ray instead of becoming a bank. No polygon/volume clearance test is performed. |
| [in] | opt | Borrowed policy with finite 0<minWidth<maxWidth and station>0; minStations>=2, finite nonnegative widthChange/endTrimFraction and maxAngleDeg normally [0,90] are caller's contract. Station counts, integer end trimming and sampling loops must be representable/feasible. Optional elevationAt executes synchronously in the same xy frame and consistent vertical units; NaN/nonfinite samples are unavailable, exceptions propagate and callback must not mutate inputs. |
Find facing pairs among lines (open polylines; a closed ring repeats its first point). From stations along each line a ray is cast both ways along the normal; the first thing it meets within maxWidth must be another line, near-parallel, at least minWidth away — an obstacles segment, or the same line, blocks it. Consecutive stations that meet the same line at a steadily changing separation form a run. Pairs come back longest first and never share a portion of a line.
| int mesh::indexOfDefault | ( | const MeshResult & | mesh, |
| const QString & | tag ) |
Find the first exact case-sensitive default tag match.
| [in] | mesh | Borrowed stable default rows, unchanged. |
| [in] | tag | Borrowed tag, compared without trimming or normalization; empty and * are allowed. |
Index of tag in MeshResult::infilDefaults, or -1.
| InfilDest mesh::infilDestFromToken | ( | const QString & | token, |
| bool * | ok = nullptr ) |
Parse a retained destination token independently of current engine support.
| [in] | token | Borrowed complete case-insensitive token, surrounding whitespace ignored. |
| [out] | ok | Optional borrowed flag, true for LOST/SUBCATCH_AQUIFER/AQUIFER_2D, false otherwise. |
| QString mesh::infilDestHint | ( | InfilDest | d | ) |
Translate destination guidance without resolving any open model.
| [in] | d | Destination enum; unknown values use the Lost guidance. |
A one-sentence tooltip for destination d: where the water goes and what the choice needs.
The hint describes authoring guidance only; it does not inspect a model. Aquifer2D is retained for legacy-file migration and its hint directs users to the groundwater ownership review workflow.
| QString mesh::infilDestLabel | ( | InfilDest | d | ) |
Translate the display label of a retained destination value.
| [in] | d | Destination enum, unchanged; unknown values use Lost. |
| QStringList mesh::infilDestLabels | ( | ) |
Build translated destination labels in enum order Lost, SubcatchAquifer, Aquifer2D.
| QString mesh::infilDestToken | ( | InfilDest | d | ) |
Encode a destination enum as its retained uppercase file token.
| [in] | d | Destination enum, unchanged. |
| InfilMethod mesh::infilMethodFromToken | ( | const QString & | token, |
| bool * | ok = nullptr ) |
Parse a trimmed case-insensitive infiltration method token.
| [in] | token | Borrowed stable text, unchanged; complete token must match the file vocabulary. |
| [out] | ok | Optional borrowed recognition flag, true for a known token including NONE, false otherwise. |
| QString mesh::infilMethodLabel | ( | InfilMethod | m | ) |
Translate a display label for an infiltration method.
| [in] | m | Method enum, unchanged; unknown values use the None label. |
| QStringList mesh::infilMethodLabels | ( | ) |
Build translated method labels in consecutive enum order from None through Constant.
| QString mesh::infilMethodToken | ( | InfilMethod | m | ) |
Encode an infiltration method using the stable uppercase file vocabulary.
| [in] | m | Method enum, unchanged. |
| int mesh::infilParamCount | ( | InfilMethod | method | ) |
Report serialized parameter-column width rather than number of active values.
| [in] | method | Infiltration method, unknown/None values yield zero. |
Number of serialized positional columns for method, including unused placeholders.
| QByteArray mesh::infilParamKey | ( | InfilMethod | method, |
| int | slot ) |
Map an active model slot to its case-sensitive shared registry key.
| [in] | method | Model enum, unchanged. |
| [in] | slot | Zero-based positional slot, 0..4; unused/out-of-range combinations return empty. |
Registry key for positional slot slot under method, e.g. "infil.f0". Empty when unused.
This is the bridge to mesh::cellParamSpecs(): the attribute table registers one column per NAMED key (the union across methods) and masks per row via infilUsesParam().
| const QVector< QByteArray > & mesh::infilParamKeys | ( | ) |
Return the immutable union of named infiltration parameter keys in registration order.
Every named parameter key, in registration order. The attribute table and the assign dialog iterate this.
| QString mesh::infilParamLabel | ( | InfilMethod | method, |
| int | slot ) |
Translate the model-specific label for an active positional parameter.
| [in] | method | Model enum, unchanged. |
| [in] | slot | Zero-based slot, valid only when infilUsesParam(method,slot) is true. |
Display label for positional slot slot under method, e.g. ("Horton", 0) → "Max
Rate (f0)". Empty when unused.
| int mesh::infilSlotForKey | ( | InfilMethod | method, |
| const QByteArray & | key ) |
Resolve a named parameter key to its position under one model.
| [in] | method | Model enum used to interpret slot semantics, unchanged. |
| [in] | key | Borrowed case-sensitive registry key; empty/unknown keys do not match. |
Inverse of infilParamKey(): maps a registry key to the positional slot it occupies under method, or -1 when method does not use it.
| bool mesh::infilUsesParam | ( | InfilMethod | method, |
| int | slot ) |
Check whether a model uses a zero-based positional parameter slot.
| [in] | method | Model enum, unknown/None values use no slots. |
| [in] | slot | Position 0..4; any outside position returns false. |
True when method uses positional slot slot.
Drives the attribute table's per-row column masking: a cell whose method does not use a parameter renders "—" and refuses edits, exactly like MeshAttributeTableModel::rowIsBoundaryEdge() does for BC columns on interior edges.
|
nodiscard |
Name the alternative initial-condition key of key.
A cell's initial state is authored either as a depth or as a water-surface elevation. Edit commands use this to clear the one the user did not just set, so a cell never carries both.
| bool mesh::loadLookupTableCsv | ( | InfilLookupTable * | table, |
| const QString & | path, | ||
| QString * | err ) |
Load the permissive unquoted classified-lookup CSV format into a fresh table value.
| [out] | table | Required borrowed destination; null returns false. Untouched when opening fails; reset after successful open and then populated incrementally, including a basename fallback name. |
| [in] | path | Borrowed UTF-8 input pathname, unchanged. |
| [out] | err | Optional borrowed string, overwritten only on open failure; not cleared on success or null-destination refusal. |
| PatchMesh mesh::makeBankPairPatch | ( | const BankPairPatch & | p, |
| QString * | err = nullptr ) |
Build a conforming strip between two simple, disjoint banks.
Rejects ambiguous endpoint pairing, touching/crossing banks, folded cells, unrepresentable station geometry and unsafe subdivision counts.
| ConstraintPreview mesh::makeConstraintPreview | ( | const QVector< SimplificationFeature > & | original, |
| const ConstraintSimplificationResult & | candidate, | ||
| const std::function< bool()> & | cancelled = {}, | ||
| int | maximumVertices = 50000, | ||
| int | maximumFeatures = 500 ) |
Build bounded display data comparing source features with a simplification candidate.
Reads its inputs only; it does not run or repeat the preparation audit.
| [in] | original | Source features given to simplifyConstraints(); read only. |
| [in] | candidate | Result of simplifyConstraints() for original; read only. When it is not ok or its feature or change count differs from original, an empty default preview is returned without any error indication. |
| [in] | cancelled | Optional poll, called synchronously once per feature and about every 4096 visited vertices; returning true returns the partial preview with cancelled set. |
| [in] | maximumVertices | Display vertex budget, clamped to [4, 250000]. Up to min(2000, maximumVertices / 10) go to removed-vertex markers; the rest is split evenly over the original and proposed paths of the displayed features, at least 2 points per path. |
| [in] | maximumFeatures | Displayed feature limit, clamped to at least 1 and at most min(5000, path budget / 4). |
| PatchMesh mesh::makeMappedPatch | ( | const QPolygonF & | ring, |
| const QVector< int > & | corners, | ||
| double | h, | ||
| const QString & | tag, | ||
| QString * | err = nullptr ) |
Split a CCW ring at the four corners (ring vertex indices, ring order) into polyline sides, choose n = max(1, round(mean(len0, len2)/h)), m likewise from sides 1/3, and call the polyline overload.
| PatchMesh mesh::makeMappedPatch | ( | const QPolygonF & | ring, |
| const QVector< int > & | corners, | ||
| double | hAlong, | ||
| double | hAcross, | ||
| double | alongAngleDeg, | ||
| const QString & | tag, | ||
| QString * | err = nullptr ) |
Mapped patch with independent physical-axis spacing.
The axis is undirected, measured counterclockwise from +x in degrees. The opposite logical side pair most aligned with it receives hAlong; the other receives hAcross. Equal association scores are rejected. Ring rotation/reversal must not exchange the physical spacings. Widths use the ring's coordinate units.
| PatchMesh mesh::makeSweptPatch | ( | const SweptPatch & | p, |
| QString * | err = nullptr ) |
Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads.
Station and index counts are checked before allocation. Invalid or globally overlapping/touching offsets return an empty PatchMesh and a diagnostic identifying the affected stations.
| PatchMesh mesh::makeTransfinitePatch | ( | const QVector< QVector< QPointF > > & | sides, |
| int | n, | ||
| int | m, | ||
| const QString & | tag, | ||
| QString * | err = nullptr ) |
Transfinite (Coons) interpolation on four POLYLINE sides forming a loop: sides[0] runs c0→c1, sides[1] c1→c2, sides[2] c2→c3, sides[3] c3→c0 (each side's last point equals the next side's first).
Sides are arc-length parametrised; n subdivisions along sides 0/2, m along 1/3. Boundary vertices are placed ON the polylines (so the ring the caller emits as PSLG segments is exactly this patch's boundary loop). Returns an empty PatchMesh + *err on invalid input (side with < 2 points, endpoints not matching, n or m < 1, folded quad).
| PatchMesh mesh::makeTransfinitePatch | ( | const StructuredPatch & | p, |
| QString * | err = nullptr ) |
Transfinite interpolation on the four straight sides.
The result has (n+1)×(m+1) vertices and n×m quads. On invalid input returns an empty PatchMesh and sets *err.
| PatchMesh mesh::makeTransfinitePatchAtStations | ( | const QVector< QVector< QPointF > > & | sides, |
| const QString & | tag, | ||
| QString * | err = nullptr ) |
Coons patch whose boundary vertices are exactly the given side stations.
| [in] | sides | Four cyclic polylines c0→c1, c1→c2, c2→c3, c3→c0, each with >= 2 finite points; sides 0/2 and 1/3 need equal point counts, and each side's last point must equal the next side's first exactly. n = sides[0].size() - 1, m = sides[1].size() - 1. |
| [in] | tag | Copied verbatim to the patch and every quad. |
| [out] | err | Optional; receives the diagnostic, or an empty string on success. |
| QVector< int > mesh::maximumMatching | ( | int | n, |
| const QVector< QPair< int, int > > & | edges ) |
Compute an unweighted maximum-cardinality matching in an undirected general graph.
| [in] | n | Number of vertices, normally nonnegative and feasible for int-indexed working arrays; n<=0 returns empty, n==1 returns one unmatched entry. |
| [in] | edges | Borrowed endpoint pairs, unchanged; out-of-range, negative and self-loop pairs skipped, duplicate/reversed pairs are retained as adjacency incidences. |
Maximum-cardinality matching on a general graph — Edmonds' blossom algorithm. edges are unordered pairs in [0, n). Returns mate[i] (-1 = unmatched). Exposed for the brute-force cross-check test.
|
nodiscard |
Compute mean absolute index jump across each cell's consecutive cyclic corner pairs.
| [in] | m | Borrowed mesh, unchanged; stored identifiers need not index coordinates, but each integer difference must fit int before absolute value. Handles triangles and quads, irrespective of validity. |
Cheap locality proxy: mean |vi − vj| over the three vertex-index pairs of every triangle. O(nt), no allocation — safe to log on any mesh size.
| QPolygonF mesh::normalizeRingCCW | ( | const QPolygonF & | ring | ) |
Copy a ring while dropping scale-fuzzy consecutive/closing duplicates and reversing negative area.
| [in] | ring | Borrowed finite planar points, unchanged; fuzzy coordinate tolerance is 1e-9 times max(1,largest absolute original coordinate), separately on x/y, so it depends on projected origin. |
Drop a closing duplicate, drop consecutive duplicates, make CCW.
| QPolygonF mesh::orderedPatchBoundary | ( | const PatchMesh & | pm, |
| QString * | err = nullptr ) |
Validate the complete patch and return its CCW boundary, without a repeated closing vertex.
Segment input orientation/order is immaterial. On failure returns an empty ring and sets err.
| QuadPairingStats mesh::pairTrianglesIntoQuads | ( | MeshResult & | mesh, |
| const QVector< int > & | cellIds, | ||
| const QVector< QuadTemplate > & | templates, | ||
| const QSet< QPair< int, int > > & | lockedEdges, | ||
| const QuadPairingOptions & | opts, | ||
| QVector< int > * | oldToNew ) |
Pair selected valid triangle rows into acceptable CCW quads, then rebuild engine cell order.
| [in,out] | mesh | Borrowed exclusively mutable mesh, finite valid nonoverlapping geometry; vertex storage/coordinates are preserved, cells and selected index-keyed metadata can be replaced/remapped. Selected pairs should share coherent tag/material/initial-depth values; no equality check is performed. |
| [in] | cellIds | Borrowed candidate old cell IDs, unchanged. Invalid/out-of-range/duplicate IDs, existing quads and triangles with invalid vertex IDs are skipped. Every other cell can still move during final reorder. |
| [in] | templates | Borrowed cyclic four-output-vertex templates, unchanged. Invalid IDs/duplicates/ quality failures are skipped. Templates rank by score then input index; either triangulation diagonal may match. |
| [in] | lockedEdges | Borrowed normalized edgeKey(min,max) set; pairing never removes these shared edges. No normalization is performed on supplied set keys, unmatched keys have no effect. |
| [in] | opts | Borrowed finite quality policy; enables residual maximum-cardinality blossom and up to five score-improving alternating-four-cycle polish passes. This is not maximum-weight optimization. |
| [out] | oldToNew | Optional borrowed vector, filled with identity at entry even for no-op; on rebuild maps each old cell to its new cell, both paired triangles to the same quad. No output pointer retained. |
Pair the triangles cellIds (indices into mesh.triangles; every one must be a triangle) into quads. templates carry OUTPUT vertex ids. lockedEdges (mesh::edgeKey pairs) are never straddled. On return oldToNew (optional) maps every old cell index to its new index (a paired triangle maps to its quad). Region triangles that were not paired keep their tag/mannings/initDepth; a quad inherits them from its first triangle (tags of the two triangles are equal inside a region).
| QVector< QuadRegion > mesh::placeQuadBlocks | ( | const QuadBlockGrid & | grid, |
| const QuadBlockOptions & | options ) |
Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands.
| [in] | grid | Borrowed stable grid with finite positive pitch/origin and valid storage extent, unchanged; nonfinite/nonpositive h entries are unusable. All logarithmic band indices, powers, spacing-to-cell ceil conversions and loop/product arithmetic must be representable. |
| [in] | options | Borrowed policy with finite bandRatio>1, feasible finite minSpacing and positive minQuadsPerSide recommended. maxBlocks<=0 produces no regions; nonpositive minimum spacing does not filter. |
Axis-aligned rectangles over nearly uniform usable cells, largest first, each at least minQuadsPerSide quads of its spacing per side, kept one spacing apart from each other. Each comes back as a Mapped QuadRegion whose spacing is its band's.
| QuadPlan mesh::planQuadRegions | ( | const QVector< QuadRegion > & | r, |
| const QuadPlanningGeometry & | g, | ||
| const QuadPlanningOptions & | o = {} ) |
Plan mapped quad patches for all regions jointly, before CDT construction.
The arguments, all read only, are the regions, the protecting source geometry and the options. A region is a candidate unless quads are disabled globally or by QuadRegionMode::TrianglesOnly, and only when its ring has at least three vertices, nonzero area and exactly four corners: QuadRegion::corners (strictly increasing ring indices) or, when empty, the vertices turning more than 30 degrees. Each side follows the ring between corners with every source vertex on it inserted; opposite sides and identical shared sides get one station count, at least ceil(length / spacing) and never fewer than their segments. Spacing is QuadRegion::spacing or defaultSize (directional spacing by side alignment), scaled down to limits.maximumSize over the ring's bounding box. A candidate is refused when excluded, outside the domain, inside a hole, fixed patch or triangles-only region, crossed or entered by source geometry, duplicating another boundary, or failing assessPlannedPatch(); repairable failures double the counts of its sides for up to maximumRepairRounds rounds. Required regions are processed first; finally a patch whose boundary vertex lies inside another patch's boundary edge is refused, the later one.
| bool mesh::pointInRegion | ( | const QPolygonF & | ring, |
| const QVector< QPolygonF > & | holes, | ||
| const QPointF & | p ) |
Combine outer-ring parity with exclusion by every supplied hole-ring parity.
| [in] | ring | Borrowed finite planar outer ring, unchanged. |
| [in] | holes | Borrowed finite hole rings in the same frame, unchanged; no containment/disjointness validation. |
| [in] | p | Borrowed finite point, unchanged. |
Inside ring and outside every ring of holes — the region's meshable interior. With no holes this is exactly pointInRing().
| bool mesh::pointInRing | ( | const QPolygonF & | ring, |
| const QPointF & | p ) |
Test a point using a strict horizontal-ray odd-even crossing rule.
| [in] | ring | Borrowed finite planar ring, unchanged; scale-fuzzy closing duplicate ignored. |
| [in] | p | Borrowed finite query in the same planar units, unchanged. |
Odd-even point-in-polygon (closed ring, last == first optional).
| bool mesh::polylineIntersectsRect | ( | const QVector< QPointF > & | path, |
| const QRectF & | rect ) |
Test whether any consecutive path segment meets a normalized closed rectangle.
| [in] | path | Borrowed finite planar coordinates, unchanged; at least two points required, zero-length segments still test as points. Parameter-interval arithmetic must remain representable. |
| [in] | rect | Borrowed finite rectangle in the same planar units, unchanged; normalized internally, zero-width/height normalized boxes return false. |
True when any segment of a finite-coordinate polyline intersects the closed rectangle, including boundary contact and axis-aligned paths. Fewer than two points or an empty rectangle returns false.
|
inline |
Apply inclusive hard angle/Jacobian/aspect limits to a valid convex metric record.
| [in] | q | Stable metrics with positive finite area and valid ranges, otherwise rejected. |
| [in] | b | Finite thresholds, angles degrees, minimum Jacobian and maximum aspect dimensionless; maxAspect<=0 disables aspect cap. Caller chooses meaningful angle/score limits; no automatic clamping. |
Hard acceptance test (finite valid geometry + convexity + unchanged angle bounds, SJ floor and aspect cap).
| QuadBlockGrid mesh::quadBlockGridFromField | ( | const QRectF & | r, |
| double | pitch, | ||
| const std::function< double(const QRectF &)> & | f, | ||
| const QVector< QVector< QPointF > > & | b, | ||
| const std::function< bool()> & | cancel, | ||
| qint64 | cap ) |
Build a block grid from a size field over a rectangle, before any triangulation (Qt adapter over meshkit::plan::quadBlockGridFromField).
| [in] | r | Area to cover, mesh XY units; must have positive width and height. The grid starts at its top-left (minimum x, minimum y) corner with ceil(width / pitch) × ceil(height / pitch) cells. |
| [in] | pitch | Cell side in mesh XY units; must be finite and > 0. |
| [in] | f | Size bound for one cell's box, called synchronously once per cell; a cell's h is 0.9 × the result when that is finite, > 0 and fits a float, else the cell is unusable (NaN). Must be non-empty: this adapter always wraps it, so an empty f throws std::bad_function_call instead of returning an invalid grid. |
| [in] | b | Feature polylines in the same units, sampled every half pitch; each sample marks its cell and the 8 neighbours unusable (repeat the first point to close a ring). |
| [in] | cancel | Optional; polled every 4096 cells or blocker samples. |
| [in] | cap | Upper bound on cols × rows; must be >= 1. |
| QuadBlockGrid mesh::quadBlockGridFromMesh | ( | const MeshResult & | mesh, |
| double | pitch, | ||
| const QVector< QVector< QPointF > > & | blockers ) |
Estimate local equilateral side lengths from triangles and mask existing quads/features.
| [in] | mesh | Borrowed stable finite valid triangle/quad geometry, unchanged. Every cell vertex ID must be in range; area/centroid/products and grid coordinate-to-int conversions must be representable. |
| [in] | pitch | Finite positive background cell side in planar mesh units, feasible integer dimensions; nonpositive/NaN or no vertices returns invalid grid, but infinite pitch is caller-invalid, not rejected. |
| [in] | blockers | Borrowed finite feature paths in the same CRS/units, unchanged. Only consecutive segments are sampled, so repeat first point to close rings. Sample-step counts must fit int. |
The local cell size of mesh on a grid of pitch, with every cell touched by blockers (domain and hole rings, constraint lines, break lines) or by an existing quad marked unusable.
|
inline |
Measure one quadrilateral using cyclic corners and translation/scale-resistant planar arithmetic.
| [in] | a | First finite planar corner, used as local origin; same coordinate units as other corners. |
| [in] | b | Second cyclic corner, preserved. |
| [in] | c | Third cyclic corner, preserved. |
| [in] | d | Fourth cyclic corner, preserved; winding may be clockwise or counterclockwise. |
Metrics for corners a,b,c,d in cyclic order. Coordinates and all metric values, including positive area, must remain representable. Invalid inputs return a non-convex result; CW and CCW valid quads share metrics.
|
inline |
Measure a quad cell through its borrowed vertex records.
| [in] | vertices | Stable storage containing every t index in range, planar coordinates in common units. |
| [in] | t | Quad with four valid indices and v3>=0; triangle or invalid index use is unchecked. |
Metrics for a quad cell of mesh (t.v3 >= 0 required).
|
inline |
Copy global quality bounds and apply an explicitly nonnegative region aspect override.
| [in] | region | Borrowed region policy, unchanged; aspectMax<0 inherits, zero disables aspect cap, positive values override. NaN compares false/inherits; infinity is copied and later finite checks reject it. |
| [in] | global | Bounds copied by value, only maxAspect can change. |
Resolve Free-region bounds. Only the aspect cap may override the global bounds; negative values inherit and zero explicitly disables it.
|
inline |
Rank valid convex quads by Jacobian, rectangularity and a soft aspect penalty.
| [in] | q | Stable metrics, invalid ranges/nonconvex/nonfinite geometry scores zero. |
| [in] | b | Finite bounds; only positive maxAspect affects score, other finite hard thresholds are not applied here. Nonpositive maxAspect disables penalty. |
Pairing / legacy tri-pair ranking in [0,1]: SJ · rectangularity · min(1, aspectMax/aspect). Perfect rectangles within the configured aspect cap tie squares; angle distortion penalizes rhombi and kites. Diagonal skew remains a diagnostic, not a ranking term. Invalid/non-convex quads score zero. Smoothing retains its separate SJ guard.
| void mesh::reorderMeshHilbert | ( | MeshResult * | m | ) |
Spatially permute cells within triangle/quad classes and renumber vertices by first use.
| [in,out] | m | Optional borrowed mesh, null or empty cells/vertices is a no-op. Requires every cell and boundary-edge vertex ID in range, finite representable geometry, and sizes fitting int. |
Renumber triangles along a Hilbert curve of their centroids and vertices by first appearance; remaps triangle/boundary-edge/cell-coupling indices. No-op on an empty mesh.
| QVector< int > mesh::reorderTrianglesFirst | ( | MeshResult & | mesh | ) |
Stable-partition cell rows into triangles followed by quads and remap selected cell metadata.
| [in,out] | mesh | Borrowed exclusively mutable mesh. Copies complete cell records, preserves order within each class, replaces cell storage; vertex geometry and boundary edges remain unchanged. |
Reorder cells triangles-first, stable within each class. Returns the old→new cell index map. Shared with meshquadmatch.
| QPolygonF mesh::resampleRing | ( | const QPolygonF & | ring, |
| double | h, | ||
| double | keepTurnDeg = 0.0 ) |
Normalize a ring and insert equal-part subdivisions along all implicit closing edges.
| [in] | ring | Borrowed finite planar ring, unchanged; fuzzy duplicates are removed and winding normalized. |
| [in] | h | Finite positive target spacing in planar units; nonpositive/NaN returns normalized ring. For active resampling every lround(edgeLength/h), int narrowing and output count must be representable. |
| [in] | keepTurnDeg | Retained compatibility parameter in degrees, currently ignored; every normalized original vertex survives regardless of turn. |
Resample a closed ring at spacing h: every edge is split into max(1, round(len/h)) equal parts; ring vertices whose |turn| >= keepTurnDeg are always kept, others are kept too (geometry is never simplified here — run pslg::simplifyPolyline first). Output is CCW, open (no closing duplicate).
|
inline |
Rank a vertex for resolution-aware coarsening; lower values are tried first.
| [in] | flatness | Star flatness: the smallest cosine between a facet normal and the star's summed normal, clamped to [-1, 1]; 1 is flat. |
| [in] | actualSize | Current local cell size in XY units; positive and finite. |
| [in] | targetSize | Prescribed target size in the same units; positive and finite. |
sqrt(2 * (1 - flatness)) * actualSize / targetSize, dimensionless and >= 0; +infinity when flatness is nonfinite or a size is not positive and finite. | ResolvedInfil mesh::resolveInfil | ( | const MeshResult & | mesh, |
| int | tri ) |
Resolve an owned infiltration specification while preserving its authoring provenance.
Engine D-I3 precedence: ‘override > tag row > ’*' row > none`.
| [in] | mesh | Borrowed stable cell/default/override arrays, unchanged. |
| [in] | tri | Zero-based cell index, bounds checked before looking for an override. |
Resolve one triangle's infiltration per engine D-I3 precedence: ‘override > tag row > ’*' row > none`.
Reads MeshResult::infilOverrides, MeshResult::infilDefaults and the triangle's MeshTriangle::tag. Never mutates the mesh.
Provenance names the row's SOURCE, not whether a model ends up running: a tag row (or an override) spelling NONE still resolves to Tag / Override with an isNone() row. That distinction is load-bearing twice over — MeshSetTriangleInfilCommand::undo() uses it to decide between restoring a per-cell row and erasing the override back to inheritance, and the attribute table uses it to render a region-supplied "None" in the muted/italic inherited style rather than as a per-cell decision. The engine's own Infil2D::prov_ collapses those cases to NONE because it is solver-facing and only cares whether a kernel runs.
| bool mesh::ringIsSimple | ( | const QPolygonF & | ring | ) |
Reject proper nonadjacent edge crossings using plain double orientation signs.
| [in] | ring | Borrowed finite planar sequence, unchanged; fuzzy closing duplicate ignored. |
True when ring is simple (no proper self-intersection). O(n²).
| double mesh::ringSignedArea | ( | const QPolygonF & | ring | ) |
Compute oriented shoelace area after translating corners to the first vertex.
| [in] | ring | Borrowed finite planar sequence, unchanged; closes implicitly, explicit duplicate allowed. |
Signed shoelace area (CCW positive).
| double mesh::ringTurnDeg | ( | const QPolygonF & | ring, |
| int | i ) |
Compute a signed exterior turn at one ring corner using adjacent edge cross/dot products.
| [in] | ring | Borrowed finite planar sequence, unchanged; fuzzy closing duplicate excluded. |
| [in] | i | Corner index, wrapped cyclically including negative values; modulo/addition must fit int. |
Exterior turning angle (degrees, CCW positive) at ring vertex i.
|
inlinenoexcept |
Reconstruct planar specific discharge by least-squares fitting outward edge-normal discharge.
| [in] | cell | Nonnegative cell index with representable cell*4 addressing. |
| [in] | nv | Real edge count 3 or 4, excludes triangle padding. |
| [in] | flux | Required nonnull stable flat array of at least 4*(cell+1) floats, outward-positive m3/s. |
| [in] | length | Required nonnull equally sized edge lengths in metres; <=1e-12 skips an edge. |
| [in] | nx | Required nonnull equally sized outward unit-normal x components, dimensionless. |
| [in] | ny | Required nonnull equally sized outward unit-normal y components, dimensionless. |
| [out] | qx | Borrowed x discharge output in m2/s, assigned only after determinant passes. |
| [out] | qy | Borrowed y discharge output in m2/s, assigned only after determinant passes; use distinct outputs. |
RT0 least-squares specific discharge (m²/s) of one cell from its outward-positive normal edge fluxes (m³/s).
The engine's own reconstruction (SurfaceFluxCalculator::computeFaceVelocity): with nv outward unit normals n_e and normal speeds q_e = flux_e/length_e, solve the nv×2 least-squares system N·q ≈ b via the normal equations (NᵀN) q = Nᵀ b. |q_e| is clamped to 10 against wet/dry-front spikes and a non-finite q_e is skipped so it cannot poison the 2×2 solve. Divide by the cell depth for velocity. The per-edge arrays are the flat edgeSlot layout (cell's slots are read, nothing else).
| bool mesh::saveLookupTableCsv | ( | const InfilLookupTable & | table, |
| const QString & | path, | ||
| QString * | err ) |
Serialize classified infiltration entries and optional fallback to a QSaveFile CSV replacement.
| [in] | table | Borrowed table, unchanged; names/keys/metadata must not contain commas/newlines that need CSV quoting, because this simple format performs no escaping. Parameters retain project units. |
| [in] | path | Borrowed output pathname, parent directory must already be writable; unchanged. |
| [out] | err | Optional borrowed error string, overwritten on open/commit failure and left untouched on success. No source pointer retained. |
CSV round-trip. Column order: key1[,key2],method,p0,p1,p2,p3,p4,dest, # comments, header row optional.
| ConstraintSimplificationResult mesh::simplifyConstraints | ( | const QVector< SimplificationFeature > & | features, |
| const ConstraintSimplificationOptions & | options = {} ) |
Remove redundant vertices from a collection of constraint features without moving any coordinate.
Every feature is validated first: its policy, its z count, equal elevations on a repeated closing vertex, finite coordinates and a total vertex count below INT_MAX - 3; then the protected points. When no feature is in Mode::Simplify with more than two vertices the input is returned unchanged with ok true. Otherwise the kept anchors are split recursively until every shortcut passes the XY/Z deviation, monotone-projection, crossing, junction, clearance and pocket checks against the original graph and protected points. Rings are then checked against their area limits and a final index checks the output shortcuts against each other.
| [in] | features | Source features in one planar frame; read only, copied into the result. |
| [in] | options | Protected points, cancellation and resource limits; the callback runs synchronously on the calling thread. |
|
constexprnoexcept |
Decode the owning cell index from a stride-four flat edge slot.
| [in] | slot | Nonnegative flat slot in the relevant array range, unchecked. |
Cell / local edge of a flat slot.
|
constexprnoexcept |
Decode local edge position from a stride-four flat slot.
| [in] | slot | Nonnegative valid flat slot, unchecked. |
| InfilRow mesh::starDefault | ( | const MeshResult & | mesh | ) |
Copy the first wildcard infiltration default, if present.
| [in] | mesh | Borrowed stable defaults array, unchanged. |
Convenience: the '*' row from mesh, or a None row when absent.
|
nodiscard |
Measure positive fan area for a triangle or quadrilateral cell.
| [in] | mesh | Borrowed stable geometry in consistent planar units, unchanged; valid cells should be finite and nonfolded. Index validation is performed but physical geometry is not repaired. |
| [in] | tri | Zero-based cell index, including quadrilateral rows despite the historical function name. |
Unsigned area of triangle tri (|cross| / 2), in project CRS units². Returns 0 for an out-of-range triangle or one referencing out-of-range vertices.
The single definition of "cell area" in the GUI: the Metadata tab's statistics below and the Attribute Table's Cells column both read it, so a sliver hunted down by sorting the table is the same cell the min/max summary is reporting.
|
inline |
Compute the minimum orientation-normalized corner sine of a triangle.
| [in] | a | First planar vertex, finite coordinates and representable differences/products required. |
| [in] | b | Second vertex in same coordinate units. |
| [in] | c | Third vertex in same coordinate units, winding may be either direction. |
Minimum sine of a triangle's angles (1 is unattainable; equilateral = 0.866; right isosceles = 0.707). Used by the smoothing guard for the triangles that remain inside a quad region.
| bool mesh::unionQuad | ( | const QVector< MeshVertex > & | vertices, |
| const MeshTriangle & | t1, | ||
| const MeshTriangle & | t2, | ||
| MeshTriangle & | quad ) |
Form and convexity-check a CCW quadrilateral candidate from two triangle records.
| [in] | vertices | Borrowed stable finite planar vertices, unchanged; relevant IDs are bounds checked, representable area/turn arithmetic is caller's responsibility. |
| [in] | t1 | Borrowed first true triangle with valid distinct vertex IDs, unchanged; supplies tag, roughness and initial-depth attributes without testing equality to t2. |
| [in] | t2 | Borrowed second true triangle sharing exactly two identifiers, unchanged. |
| [out] | quad | Borrowed output, untouched for early type/shared-ID/bounds refusal, but overwritten with a default-plus-t1-attributes candidate before convexity testing; final false can leave this candidate. Caller should not alias output with inputs if input preservation is required. |
The CCW quad formed by two triangles sharing edge (p,q): returns false when they do not share exactly two vertices or the union is not a simple quad. quad receives v0..v3 (tag etc. copied from t1).
|
nodiscard |
Recognize the retained metric-mesh header vocabulary without converting geometry.
| [in] | unitsHeader | Borrowed header value, trimmed and compared case-insensitively, unchanged. |
True when unitsHeader (the verbatim ;; UNITS: value) declares a metric mesh, i.e. one the engine will NOT rescale.
Mirrors the engine's prescan2DUnitsHeader keyword set exactly — "SI (m)", "m", "metre(s)", "meter(s)", case-insensitive. Anything else, including an absent or explicitly imperial header, is not metric. Callers that need to know whether the engine converted the mesh to SI (issue #155) must apply this together with FLOW_UNITS: the engine scales only when FLOW_UNITS is US-customary AND this returns false.
| QString mesh::validate | ( | const PatchMesh & | pm | ) |
Requires finite convex CCW quads, consistently shared cell edges, and one simple boundary matching exactly the outer cell edges.
Boundary crossings, remote touches, holes and disconnected pieces are rejected; an indexed boundary check avoids comparing every cell pair. Empty string = valid.
| QString mesh::validate | ( | const StructuredPatch & | p | ) |
Input checks.
Empty string = valid.
| QString mesh::validate | ( | const SweptPatch & | p | ) |
Check a swept patch's inputs and its representable station, cell and boundary counts.
| [in] | p | Patch to check, unchanged: >= 2 finite centreline points with no repeated consecutive point, finite width > 0, across >= 1 and finite along >= 0, in one XY unit. |
| QString mesh::validateQuadRegion | ( | const QuadRegion & | r, |
| const QVector< QPolygonF > & | domains, | ||
| const QVector< QPolygonF > & | holes ) |
Check region authoring policy, normalized ring and sampled domain/hole containment.
| [in] | r | Borrowed region, unchanged. Finite aspect override must be negative/inherit, zero/unbounded or >=1. Directional spacing requires finite positive along/across lengths and finite angle, Auto/Mapped mode, no background flag or owned holes; isotropic spacing is used only when >0 without an explicit finite check. |
| [in] | domains | Borrowed finite planar domain rings, unchanged; empty skips domain tests, background regions also skip them. Every normalized vertex plus area centroid must lie in exactly one same domain, with scale-fuzzy boundary counting inside. |
| [in] | holes | Borrowed finite excluded rings in the same units, unchanged. A vertex/centroid strictly inside a hole rejects, fuzzy boundary contact is allowed. r.holes is not otherwise geometrically validated here. |
Validate one region: >= 3 distinct vertices, simple, area >= 4·h² (h = spacing when > 0, else skipped), every vertex inside exactly one of domains and outside every holes ring. Empty string = valid.
| QString mesh::validateQuadRegionsDisjoint | ( | const QVector< QuadRegion > & | regions | ) |
Check explicit region pairs for proper crossings or strictly interior sampled vertices.
| [in] | regions | Borrowed finite region rings, unchanged; normalized to open CCW copies. Call individual validation separately; degenerate <3-corner rings are ignored by overlap testing. |
Pairwise check: rings may share edges/vertices but no ring vertex of one may lie strictly inside another and edges may not properly cross. Returns the first offending pair as "region i overlaps region j", or "".
|
constexpr |
Edge slots per cell in every flat per-edge array (== engine kMaxCellVerts).
|
inlineconstexpr |
Widest positional parameter count (Horton: f0 fmin decay dry_time Fmax).