def prepare

stelliferous@0.0.2.0 · tensor_band_window.bend:113

import stelliferous@0.0.2.0/tensor_band_window.bend as TensorBandWindow
import Base
import stelliferous@0.0.2.0/tensor_band.bend as Bands
import stelliferous@0.0.2.0/storage_buffer.bend as Storage
import stelliferous@0.0.2.0/traversal_partition.bend as Partition

113# The full core tree is threaded through the preparation pass without cloning.
114# Each allocation is a requested neighbour range, never a core-sized window.
115# The resulting halo tree follows the same layout, ready to pair with cores.
116def prepare(~Element: Data,+geometry: Geometry,+fill: Element,layout: Bands.Plan,bands: Bands.Bands(~Element)) -> Bands.Bands(~Element) & Halos(~Element):
117  match layout:
118    case Bands.Rows{+first,+count}: halo(~Element,input_geometry(geometry),fill,first,count,window(geometry,first,count),bands)
119    case Bands.Split{left,right}:
120      Storage.bind_pair(~Bands.Bands(~Element),~Halos(~Element),~(Bands.Bands(~Element) & Halos(~Element)),
121        prepare(~Element,geometry,fill,left,bands),bands => left =>
122          Storage.bind_pair(~Bands.Bands(~Element),~Halos(~Element),~(Bands.Bands(~Element) & Halos(~Element)),
123            prepare(~Element,geometry,fill,right,bands),bands => right => (bands,Partition.Fork{left,right})))

Uses (11)

Used by (2)