volumential.list1_gallery#
Enumeration of the list 1 (near-neighbor) interaction gallery.
This module owns the geometric enumeration of every distinct target-box-center-to-source-box-center displacement that can occur between a box and one of its near neighbors in a level-restricted box tree. The gallery is expressed in integer units of a quarter box width so that all involved lengths stay exact integers, which lets downstream table code index cases by a cheap positional encoding.
- class volumential.list1_gallery.TreeBox(center: ndarray, radius: int, child_nlevels: int)[source]#
Bases:
objectA minimalistic tree box used only to enumerate the gallery.
Courtesy of: Andreas Klockner
- draw() None[source]#
Draw the box outline with
matplotlib(2D boxes only).
- volumential.list1_gallery.build_tree(dimensions: int) TreeBox[source]#
Build the four-level reference tree the gallery is enumerated on.
Four levels deep means box centers land on a
2**4 x 2**4integer grid.Courtesy of: Andreas Klockner
- volumential.list1_gallery.generate_boxes_on_level(box: TreeBox, ilevel: int) Iterator[TreeBox][source]#
Yield the descendants of box that sit ilevel levels below it.
Courtesy of: Andreas Klockner
- volumential.list1_gallery.generate_boxes(box: TreeBox) Iterator[TreeBox][source]#
Yield box and all of its descendants.
Courtesy of: Andreas Klockner
- volumential.list1_gallery.linf_dist(box1: TreeBox, box2: TreeBox) float[source]#
Return the \(\ell^\infty\) gap between two boxes (0 if adjacent).
Courtesy of: Andreas Klockner
- volumential.list1_gallery.generate_interactions(dimensions: int) list[tuple[TreeBox, TreeBox]][source]#
Return every (target box, source box) pair that touches, in dimensions.
Target boxes are taken from level 2 of the reference tree and kept away from the domain boundary, so that their neighborhoods are complete. Source boxes are drawn from all levels, which is what makes the gallery cover mixed-level interactions.
Courtesy of: Andreas Klockner
- volumential.list1_gallery.postprocess_interactions(near_neighbor_interactions: Sequence[tuple[TreeBox, TreeBox]]) list[tuple[int, ...]][source]#
Reduce touching box pairs to the sorted set of distinct case vectors.
- class volumential.list1_gallery.List1Gallery(vec_list: list[tuple[int, ...]], case_encode: Callable[[Sequence[int]], int], case_indices: ndarray)[source]#
Bases:
NamedTupleThe list 1 gallery for one dimension.
- volumential.list1_gallery.generate_list1_gallery(dim: int) List1Gallery[source]#
Generate a list1 that serves as the gallery for all possible list1 interactions with given dimension and order.
The returned value is a
List1Gallery, which unpacks as the(vec_list, case_encode, case_indices)triple it has always been.