6.3 Node Orderings for Curved Geometry

Section 6.1 described how curvature information reaches a geometry object: as a list of physical-space point positions sampled at a known distribution of points on the reference element, from which the modal coefficients of the mapping χ(⃗ξ ) are inferred. That list lives in a Curve object, held by Geometry::m_curve, and consists of a PointsType naming the distribution together with a flat std::vector of PointGeom pointers.

Being a flat vector, the Curve carries no information about which node sits where on the reference element – that is implied entirely by the PointsType and by the shape of the geometry. Getting this ordering wrong does not produce an error; it produces a geometry that is subtly and silently the wrong shape. This section therefore documents, shape by shape, what the ordering actually is.

The two places that have to agree on it are:

Both are also the contract with any external mesh source, since a Curve assembled by MeshGraphIO or by Nektar++’s mesh generator NekMesh must be laid out the same way.

6.3.1 Two Orderings: Modal and Nodal

There are two distinct node orderings in use within Nektar++, and the difference between them is a frequent source of confusion. It is deliberate, and is a consequence of the order in which the code was written.

The modal ordering

is the one described by the edgeVerts and faceVerts tables inside the shape-specific geometry classes (TetGeom, PrismGeom, and so on). It is the ordering that falls out naturally from the tensor-product construction of the expansion bases, and is what the vertex, edge, face and interior modes of an expansion are numbered against. It was revised at one point precisely so as to line up with the tensor-product structure.

The nodal ordering

is the ordering emitted by the eNodal* point distributions in LibUtilities (for example eNodalTetEvenlySpaced), and consumed by the nodal expansions StdNodalTriExp, StdNodalTetExp and StdNodalPrismExp. It predates the modal ordering above. NekMesh was written against it, and so the high-order node ordering in Nektar++’s mesh formats follows the nodal convention.

The practical consequence is that for the simplicial and prismatic shapes, whose curves use a nodal distribution, the layout of a Curve is not simply the shape’s own edgeVerts and faceVerts tables read in order. Assuming that it is will give you an element that is correct at the vertices and wrong in the interior. The known discrepancies are called out per shape below; do not assume that others are absent.

A third layer is worth distinguishing from both of the above. Sections 18.3.2 and 18.3.3 document the ordering NekMesh uses internally and in Nektar++’s mesh formats, which is a plain concatenation of vertices, then mid-edge nodes, then mid-face nodes, then mid-volume nodes, for every shape. That is the nodal convention, and for the simplicial and prismatic shapes it is also the Curve layout. For the tensor-product shapes it is not: a quadrilateral or hexahedral Curve is a tensor grid, and the conversion happens on the way in, in GetCurvedNodesQuad() and its relatives in NekMesh/MeshElements/. So a concatenated node list from a mesh file and the Curve that ends up on a QuadGeom are two different orderings of the same nodes.

6.3.2 The FillGeom / MakeOrder Contract

Curvature is shared: an edge node belongs to the SegGeom for that edge, and every element around that edge must see the same PointGeom object, or the mesh will be discontinuous. v_MakeOrder() therefore does not evaluate boundary nodes on its own mapping. It copies them from the curves of its attached edges and faces, and evaluates only the nodes it genuinely owns – the interior ones. This has two implications.

First, order of operations matters, and MakeOrder must be applied bottom-up: all edges, then all faces, then all elements. Each v_MakeOrder() asserts that the curves it needs are already present.

Second, and less obviously, MakeOrder must never call FillGeom. It evaluates the mapping that is already in place, which means an unfilled geometry silently yields nodes at the origin; the temptation to close that hole by filling on entry should be resisted. If an attached edge or face has already been modified, filling at that point would pull the modification into the parent and subtly move the geometry part-way through the elevation. The protocol is instead two separate passes over the whole mesh: everyone calls FillGeom, and then everyone calls MakeOrder. Callers are responsible for the first pass.

6.3.3 Per-Shape Layouts

Throughout, P denotes the number of points along an edge, so that P = order + 1, and the reference coordinates are ⃗ξ = (ξ1,ξ2,ξ3).

SegGeom

A one-dimensional distribution of P points, running from vertex 0 to vertex 1:

[⃗v0, interior..., ⃗v1].

The end points are the vertices themselves, so the distribution must be one that includes its end points (a GLL or evenly-spaced distribution, not a Gauss one).

QuadGeom

A full tensor grid of P2 points. Grid point (i,j) sits at ⃗
ξ = (px[j],px[i]) and is stored at index iP + j; that is, ξ1 varies fastest.

The boundary of the grid is copied from the four edge curves, which means the vertices come across for free as the ends of those edges. Only the (P -2)2 interior nodes are evaluated. The four element-local edges traverse the grid as follows, with k running along the local edge direction:





Edge Constraint i j




0 ξ2 = -1, ξ1 increasing 0 k
1 ξ1 = +1, ξ2 increasing k P -1
2 ξ2 = +1, ξ1 decreasing P -1 P -1 -k
3 ξ1 = -1, ξ2 decreasing P -1 -k 0




Trap.

QuadGeom’s constructor inverts m_eorient[2] and m_eorient[3] after computing them, so that those stored values describe the edge relative to the anticlockwise circuit of the boundary rather than relative to the element’s local edge direction. Code that needs the latter – as v_MakeOrder() does, to decide whether to read an edge curve forwards or backwards – must flip them back.

TriGeom

A nodal distribution of P(P + 1)∕2 points, laid out as three vertices, then the P -2 interior nodes of each of the three edges in edgeVerts order, then the face interior:

[⃗v0,⃗v1,⃗v2, e0,e1,e2,  interior  ].
 ◟--◝◜--◞ ◟--◝◜--◞ (P◟-2)◝(P◜-◞3)∕2
    3      3(P-2)

Trap. As with QuadGeom, the constructor inverts m_eorient[2], and v_MakeOrder() flips it back.

HexGeom

A full tensor grid of P3 points. Grid point (d0,d1,d2) sits at ⃗
ξ = (px[d0],px[d1],px[d2]) and is stored at index

d +  P (d  + P d ),
 0      1      2

matching the ordering that v_FillGeom() hands to Interp3D.

Because a quadrilateral’s curve is itself a full tensor grid including its own edge and vertex nodes, copying the six face curves brings across every boundary node of the hexahedron, and only the (P -2)3 interior nodes need to be evaluated. Each face’s own (a,b) indexing is related to the element’s view of that face by StdExpansion::ReOrientTracePhysMap, which for a face orientation returns idmap such that idmap[dest] is the source index; the resulting (a,b) then maps onto element directions following v_GetDir() and the faceVerts table:





Face Constraint Spans (d0,d1,d2)




0 ξ3 = -1 (ξ1,ξ2) (a, b, 0)
1 ξ2 = -1 (ξ1,ξ3) (a, 0, b)
2 ξ1 = +1 (ξ2,ξ3) (P -1, a, b)
3 ξ2 = +1 (ξ1,ξ3) (a, P -1, b)
4 ξ1 = -1 (ξ2,ξ3) (0, a, b)
5 ξ3 = +1 (ξ1,ξ2) (a, b, P -1)




TetGeom

A nodal distribution of P(P + 1)(P + 2)∕6 points, laid out as four vertices, then the interior of each of the six edges, then the interior of each of the four faces in faceVerts order, then the interior of the element:

[⃗v0...3, e0...5 ,    f0...3    , interior].
 ◟◝4◜◞  ◟◝◜◞      ◟◝◜-◞     ◟rem◝a◜ind◞er
       6(P-2)  4(P-2)(P-3)∕2

Trap: edge 2 runs backwards. This is the clearest instance of the modal/nodal divergence of Section 6.3.1. TetGeom::edgeVerts[2] is {0,2}, but the nodal distribution emits its third edge block running from vertex 2 to vertex 0. The six blocks are therefore

v0→  v1,  v1→ v2,  v2 → v0,  v0→  v3,  v1→ v3,  v2→ v3,

and that one block must be traversed against the element’s local edge direction. Unlike the triangle and quadrilateral, nothing is flipped in the constructor, so m_eorient[e] may be used directly for the other five.

Face interiors need aligning. A face’s nodes are numbered by whichever element first constructed the TriGeom, which need not be this one. Its interior nodes – the tail of its curve, after the vertex and edge blocks – must therefore be rotated and reflected into this element’s view of the face before being copied. HOTriangle<T>::Align() in SpatialDomains/HOAlignment.h does this, given the face’s own vertex IDs and the IDs this element expects from faceVerts.

PrismGeom

A nodal distribution of P(P + 1)∕2 ⋅P points, laid out as six vertices, then the interior of each of the nine edges, then the interior of each of the five faces in faceVerts order – quadrilateral, triangle, quadrilateral, triangle, quadrilateral – and finally the interior of the element.

Trap: vertices 2 and 3 are transposed. The nodal distribution numbers its vertices in raster order, so nodal slot 2 sits at ⃗ξ = (-1,1,-1), which is where the standard prism puts vertex 3. The permutation from nodal slot to element vertex is therefore

{0, 1, 3, 2, 4, 5 }.

The nine edge blocks, by contrast, do come in edgeVerts order and each runs along its edge, so there is no block to reverse as there is for the tetrahedron.

Mixed faces. The triangular faces (1 and 3) are handled as for the tetrahedron, with HOTriangle::Align(). The quadrilateral faces (0, 2 and 4) carry a full tensor grid, so they are first reindexed into the element’s view with ReOrientTracePhysMap and the interior then taken with the first face direction fastest.

PyrGeom

The pyramid is the remaining gap. The nodal infrastructure it needs (StdNodalPyrExp and an associated point distribution) is newer than that of the other shapes; once it is available, the layout follows the pattern above, with the same two warnings as the prism: the nodal distribution numbers its vertices in raster order, transposing vertices 2 and 3, and its edge blocks 2 and 3 are directed v3→v2 and v0→v3.

6.3.4 Determining an Ordering Empirically

Since neither of the two orderings is authoritative for every shape, the reliable way to establish the layout for a shape is to read it out of the point distribution rather than to infer it from a table:

  1. Ask PointsManager() for the distribution at a modest order – order 4 or so, which is high enough to have a non-trivial number of edge, face and interior nodes and low enough to inspect by hand.

  2. For each node in turn, classify it by its reference-space position: how many of the element’s faces it lies on tells you whether it is a vertex, an edge node, a face node or an interior node, and which one.

  3. Compare the resulting sequence of blocks against the shape’s edgeVerts and faceVerts tables, and record every place the two disagree.

The unit test TestMakeOrder.cpp in library/UnitTests/ SpatialDomains/ exercises the result. It is worth noting how it does so, because the obvious test is vacuous: a single standalone element has identity face orientations, so its face-reindexing paths are never taken and a per-shape round-trip test passes whether or not they are correct. The test therefore sweeps face orientations explicitly, and each of the reindexing paths described above has been confirmed to fail the sweep when removed.