pub struct ReactiveCellGraph {
pub cells: Vec<ReactiveCell>,
pub name_to_index: FlatNameIndex,
pub topo_order: Vec<usize>,
pub dirty_words: Vec<u64>,
pub clock_seconds: f64,
}Expand description
Compiled reactive cell dependency graph.
Fields§
§cells: Vec<ReactiveCell>List of cell nodes.
name_to_index: FlatNameIndexSorted flat lookup table from cell name to its index in cells.
topo_order: Vec<usize>Topologically sorted order of cell indices (dependencies before dependents).
dirty_words: Vec<u64>Dirty bitset words (64 cells per word; grows past 64 cells).
clock_seconds: f64Current logical time clock (in seconds since epoch / start).
Implementations§
Source§impl ReactiveCellGraph
impl ReactiveCellGraph
Sourcepub const CELL_BATCH_512: usize = 512
pub const CELL_BATCH_512: usize = 512
Homogeneous ready-cluster size for P16.2. Scalar path still evaluates one cell at a time; the batch is the set of dirty cells whose dependencies are already clean, capped at 512.
Sourcepub fn from_program(program: &Program) -> Result<Self, ReactiveCellError>
pub fn from_program(program: &Program) -> Result<Self, ReactiveCellError>
Build a reactive cell graph from an AST Program.
Sourcepub fn is_dirty_bit(&self, idx: usize) -> bool
pub fn is_dirty_bit(&self, idx: usize) -> bool
True if cell idx is marked dirty. Works past 64 cells.
Sourcepub fn dirty_mask(&self) -> u64
pub fn dirty_mask(&self) -> u64
First 64 dirty bits (debug / HUD). Prefer Self::is_dirty_bit.
Sourcepub fn compile(&mut self) -> Result<(), ReactiveCellError>
pub fn compile(&mut self) -> Result<(), ReactiveCellError>
Compile dependencies, wire dependents, check cycles, and compute topological order.
Sourcepub fn mark_dirty(&mut self, name: &str)
pub fn mark_dirty(&mut self, name: &str)
Mark a single cell and all its transitive downstream dependents as dirty.
Sourcepub fn mark_all_dirty(&mut self)
pub fn mark_all_dirty(&mut self)
Mark all cells in the graph as dirty.
Sourcepub fn set_input(&mut self, name: &str, value: Value, env: &mut Env)
pub fn set_input(&mut self, name: &str, value: Value, env: &mut Env)
Set an external input signal / variable and mark downstream cells dirty.
Sourcepub fn step(
&mut self,
env: &mut Env,
dt_seconds: f64,
) -> Result<Vec<(String, Value)>, ReactiveCellError>
pub fn step( &mut self, env: &mut Env, dt_seconds: f64, ) -> Result<Vec<(String, Value)>, ReactiveCellError>
Advance time and evaluate dirty cells on a local in-process host.
Prefer Self::step_with when a live Host (Poet, tests with
query rows, GPU) must dispatch capability.invoke.
Sourcepub fn evaluate_cell_batch_512<H: Host>(
&mut self,
engine: &mut Engine<'_, H>,
env: &mut Env,
dt_seconds: f64,
) -> Result<Vec<(String, Value)>, ReactiveCellError>
pub fn evaluate_cell_batch_512<H: Host>( &mut self, engine: &mut Engine<'_, H>, env: &mut Env, dt_seconds: f64, ) -> Result<Vec<(String, Value)>, ReactiveCellError>
One ready cluster of up to 512 dirty cells, then stop. Callers loop until the dirty set is empty.