Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitaecc11a5b2

README.md

loops

Orders directed edges into rings and chains. This kernel links each edge to the edge that follows it (next) and marks the edges a chain starts with (head); the jump and loops_cut and loops_place kernels do the rest.

For the boundary of a mesh (core.boundary runs the sequence), the directed edges are its open edges run the way their one face runs them (tail is a when the core.edges table's reversed is 0, else b). The whole sequence over m edges and npts points:

  1. loops (STAGE clear, claim, link): next, head.
  2. jump (MODE min), ceil(log2 m) rounds, starting from parent = next and value = the edge index: every edge holds the smallest index within reach, and parent holds the edge 2^k steps ahead.
  3. loops_cut (STAGE head, cut): a ring (a cycle) starts at its smallest edge; a chain starts at its head. The edge before each start becomes the end of its list.
  4. jump (MODE rank) over the cut lists, starting with value 1 on every non-end edge: each edge's end and its distance to it.
  5. loops_place (STAGE claim, place): each edge's ring (the first edge of its list) and its position along the ring.

A compaction of the first edges numbers the rings, and a prefix sum of ring lengths (rank of the first edge plus 1) gives the ring starts; an edge's place in the ordered listing is its ring's start plus its position.

Over a live count (COUNT=device, see the abi README) the stages claim and link run over a capacity of edges whose live count is domain_count, and the n and npts params are not read. Stage clear runs over the capacity of points and writes the cleared value into every slot, which is the value a slot past the live points holds. In stage link a slot past the live edges links to itself and is no head. It binds 7 storage buffers (6 in the plain variant).