SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
meshreorder.h File Reference
#include "mesh/meshresult.h"
Include dependency graph for meshreorder.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  mesh
 

Functions

void mesh::reorderMeshHilbert (MeshResult *m)
 
double mesh::meanVertexIndexSpread (const MeshResult &m)
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Hilbert-curve renumbering of a freshly generated mesh.

The engine's cell/vertex index IS the file line order of [2D_TRIANGLES]/[2D_VERTICES] (no renumbering happens at load), and its explicit marcher's hot loops are memory-bound with scattered per-cell reads through cL/cR and cell→edge CSR indirection. Triangle's native refinement-insertion order is spatially near-random, so neighbouring cells land far apart in the arrays. Sorting triangles along a Hilbert curve of their centroids (and renumbering vertices by first appearance in the new triangle order) makes spatial neighbours index-adjacent — better cache-line reuse in the flux/state loops, more contiguous active-set tier ranges under spatially coherent wetting, and better render-chunk locality in the GUI — with zero engine changes.

Run this immediately after Triangle returns, before any index-keyed consumer (elevation fill, node mapping, and coupling are all coordinate-keyed, so ordering is free at that point). It is a pure permutation: the vertex/triangle multisets, orientation, and every per-element attribute are unchanged.