mapping, guard against bns[b1] being NULL. This will legitimately
occur in this implementation whenever b1's neighbouring blocks are
all numbered less than b1, e.g., for the very last block.
Uncovered by: knl (During Shell presentation)
parameters and return values.
While here, convert function pair coarse_topology_build_coarsef()
and coarse_topology_build_final() to CSR push-back build mode.
the set. Allow 'm' table-lookups (i==m is valid). Full table
detected by inspecting final s[j]. Finally, hash_set_insert_core()
does not return the key but rather the index at which the key was
inserted. Update assertion in hash_set_expand() to respect this
property.
Also, for increased transparency during debugging, assign
intermediate quantities of the hash function to separate variables.
- Initialise new neighbours to INT_MIN rather than -1. The latter
is a valid block (the outside) and it is better to properly
distinguish unset values from boundary blocks.
- Ensure NULL-initialisation of a block's neighbour structure when
this structure has just been allocated.
- Adjust bin-search algorithm to support i==nneigh (target larger
than all existing neighbouring blocks).
- This means that if i==nneigh, then we must take precaution so as
not to reference any invalid table elements. However, an
explicit check for i<nneigh means that the semantics of the
memmove() statement becomes more transparent.
- Finally, we must properly assign the 'nblocks' and 'nfaces'
fields of the struct coarse_topology before returning to caller.