Hilbert-curve renumbering of a freshly generated mesh. More...
#include "mesh/meshresult.h"Go to the source code of this file.
Namespaces | |
| namespace | mesh |
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. | |
Functions | |
| void | mesh::reorderMeshHilbert (MeshResult *m) |
| Spatially permute cells within triangle/quad classes and renumber vertices by first use. | |
| double | mesh::meanVertexIndexSpread (const MeshResult &m) |
| Compute mean absolute index jump across each cell's consecutive cyclic corner pairs. | |
Hilbert-curve renumbering of a freshly generated mesh.
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. Refinement insertion can leave neighbouring cells 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 triangulation finishes, 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.