henad_models/virus_network/lanes.rs
1use henad_compute::agent_lanes;
2
3// --8<-- [start:lanes]
4agent_lanes! {
5 /// Node lanes for Virus on a Network.
6 ///
7 /// `state` is double buffered, since a node reads its neighbours' state while writing its own state.
8 /// `timer` is single buffered, as each node only touches its own timer.
9 pub struct VirusLanes {
10 read VirusRead;
11 chunk VirusChunk;
12 /// Infection state, one of `SUSCEPTIBLE`, `INFECTED` and `RESISTANT`.
13 dual state / next_state: u8,
14 /// Ticks since the node's last virus check, wrapping to 0 every `virus_check_frequency` ticks.
15 plain timer: u32 = 0,
16 /// Horizontal position in world units.
17 plain pos_x: f32 = 0.0,
18 /// Vertical position in world units.
19 plain pos_y: f32 = 0.0,
20 }
21 color = state;
22}
23// --8<-- [end:lanes]