pub struct VirusNetwork;Expand description
Virus on a Network as a NetworkModel.
Trait Implementations§
Source§impl Debug for VirusNetwork
impl Debug for VirusNetwork
Source§impl NetworkModel for VirusNetwork
impl NetworkModel for VirusNetwork
Source§const ID: &'static str = "virus_network"
const ID: &'static str = "virus_network"
Stable id that identifies the model in a model set, on the command line and in a spec file.
Source§const DESCRIPTION: &'static str = "A virus spreading over a network."
const DESCRIPTION: &'static str = "A virus spreading over a network."
One-line description shown in the UI.
Source§const EDGE_PALETTE: &'static [[u8; 4]]
const EDGE_PALETTE: &'static [[u8; 4]]
Edge colours, indexed by each edge’s colour byte.
Source§const STATS: &'static [StatDescriptor]
const STATS: &'static [StatDescriptor]
Stat series shown in the history chart.
Source§const ACTIONS: &'static [ActionDescriptor] = ACTION_SPECS
const ACTIONS: &'static [ActionDescriptor] = ACTION_SPECS
One-off actions, each shown as a button in the Parameters panel.
Source§const DEFAULT_NODES: u32 = 10_000
const DEFAULT_NODES: u32 = 10_000
Default of
num_agents, the node count.Source§const DEFAULT_EXTENT: Extent
const DEFAULT_EXTENT: Extent
World the layout spreads nodes over. It is used for drawing only.
Source§type Lanes = VirusLanes
type Lanes = VirusLanes
Node lanes, declared with
agent_lanes!.Source§type Params = VirusParams
type Params = VirusParams
Hot parameters, extracted once per tick.
Source§type Aux = ()
type Aux = ()
Model state kept outside the lanes and the graph, or
() for a model without such state.Source§fn param_descriptors() -> Vec<ParamDescriptor>
fn param_descriptors() -> Vec<ParamDescriptor>
Returns the model’s own parameters, which follow the engine’s
num_agents, world_width and world_height.Source§fn from_params(params: &[ParamValue], _extent: Extent) -> VirusParams
fn from_params(params: &[ParamValue], _extent: Extent) -> VirusParams
Extracts the hot parameters for one tick from this model’s own slice of the params.
Source§fn directed(params: &VirusParams) -> bool
fn directed(params: &VirusParams) -> bool
Returns whether edges are directed. The engine reads it every tick.
Source§fn init(
nodes: &mut Nodes<'_, Self>,
extent: Extent,
params: &[ParamValue],
rng: &mut u64,
)
fn init( nodes: &mut Nodes<'_, Self>, extent: Extent, params: &[ParamValue], rng: &mut u64, )
Seeds the lanes and the edges. Read more
Source§fn run_global_pass(
nodes: &mut Nodes<'_, Self>,
params: &VirusParams,
_extent: Extent,
rng: &mut u64,
_tick: u64,
)
fn run_global_pass( nodes: &mut Nodes<'_, Self>, params: &VirusParams, _extent: Extent, rng: &mut u64, _tick: u64, )
Runs a sequential pass before the node pass. Read more
Source§fn run_node_pass(
lanes: &mut VirusLanes,
ctx: &NodeCtx<'_, Self>,
seed: u64,
tick: u64,
)
fn run_node_pass( lanes: &mut VirusLanes, ctx: &NodeCtx<'_, Self>, seed: u64, tick: u64, )
Runs a parallel pass over every slot, including retired ones. Read more
Source§fn act(
action: usize,
nodes: &mut Nodes<'_, Self>,
_extent: Extent,
_params: &[ParamValue],
rng: &mut u64,
)
fn act( action: usize, nodes: &mut Nodes<'_, Self>, _extent: Extent, _params: &[ParamValue], rng: &mut u64, )
Runs entry
action of Self::ACTIONS between ticks, drawing from its own RNG stream.Source§fn prepare_view(nodes: &mut Nodes<'_, Self>, _tick: u64)
fn prepare_view(nodes: &mut Nodes<'_, Self>, _tick: u64)
Prepares state for drawing. Read more
Source§fn stats(lanes: &VirusLanes, _graph: &Network, (): &()) -> Vec<StatValue>
fn stats(lanes: &VirusLanes, _graph: &Network, (): &()) -> Vec<StatValue>
Returns the current statistics, in
Self::STATS order. Read moreSource§const CHUNK: usize = 512
const CHUNK: usize = 512
Number of nodes per chunk in the node pass. Each chunk gets its own RNG stream.
Source§const LAYOUT: SpringParams = SpringParams::DEFAULT
const LAYOUT: SpringParams = SpringParams::DEFAULT
Constants of the spring layout.
Auto Trait Implementations§
impl Freeze for VirusNetwork
impl RefUnwindSafe for VirusNetwork
impl Send for VirusNetwork
impl Sync for VirusNetwork
impl Unpin for VirusNetwork
impl UnsafeUnpin for VirusNetwork
impl UnwindSafe for VirusNetwork
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more