Functions to assemble meshes and blocks from chunks.
Helpful definitions:
- Surjective (onto): Every global index that should exist is covered by the
map. Example: if global size is 5 and your map contains [0,1,2,3,4] (possibly
with repeats), the mapping is surjective. If an index is missing, it's not.
Surjective means “all targets get hit at least once.”
- Injective (one-to-one): No duplicates in the map. Each local index goes to a
unique global index. Example: [0,2,4] is injective, [0,2,2] is not.
- Bijective (one-to-one and onto): Both injective and surjective. Every global
index appears exactly once. Example: [0,1,2,3] for a global of size 4.