pub fn build_flat_mesh(
blocks: &[Block],
face_matches: &[FaceMatch],
outer_faces: &[FaceRecord],
) -> FlatMeshExpand description
Build a flat mesh from multi-block Plot3D data.
This is the central conversion function: structured blocks + connectivity data are transformed into flat, GPU-friendly arrays.
§Pipeline
- Build dual graph: compute global cell numbering via
build_cell_graph. - Compute cell metrics: volumes and centroids for each block using the
metricsmodule, then scatter into global arrays. - Build interior faces: within each block, iterate over the three face families (I-faces, J-faces, K-faces). Each interior face connects two adjacent cells.
- Build cross-block faces: from the
face_matches, each interface cell pair becomes a face. Area vectors are taken from the metrics of whichever block “owns” the face (block1 side). - Build boundary faces: the
outer_facesparameter lists all unmatched boundary surfaces. Each boundary face hasneighbor = -1and carries the surface’s ID for boundary condition dispatch.
§Arguments
blocks- All blocks in the multi-block grid.face_matches- Block-block interface connectivity.outer_faces- Unmatched boundary faces with surface IDs. EachFaceRecordshould have itsidfield set to the desired surface ID.
§Returns
A FlatMesh ready for GPU upload.