pub trait System:
Debug
+ Sync
+ Send
+ TileBondInfo
+ Clone {
Show 30 methods
// Required methods
fn system_info(&self) -> String;
fn update_after_event<St: State>(&self, state: &mut St, event: &Event);
fn event_rate_at_point<St: State>(
&self,
state: &St,
p: PointSafeHere,
) -> PerSecond;
fn choose_event_at_point<St: State>(
&self,
state: &St,
p: PointSafe2,
acc: PerSecond,
) -> (Event, f64);
fn seed_locs(&self) -> Vec<(PointSafe2, Tile)>;
fn calc_mismatch_locations<St: State>(&self, state: &St) -> Array2<usize>;
// Provided methods
fn new_state<St: StateWithCreate + State>(
&self,
params: St::Params,
) -> Result<St, GrowError> { ... }
fn calc_n_tiles<St: State>(&self, state: &St) -> NumTiles { ... }
fn take_single_step<St: State>(
&self,
state: &mut St,
max_time_step: Second,
) -> StepOutcome { ... }
fn evolve<St: State>(
&self,
state: &mut St,
bounds: EvolveBounds,
) -> Result<EvolveOutcome, GrowError> { ... }
fn evolve_states<St: State>(
&mut self,
states: &mut [St],
bounds: EvolveBounds,
) -> Vec<Result<EvolveOutcome, GrowError>> { ... }
fn set_point<St: State>(
&self,
state: &mut St,
point: Point,
tile: Tile,
) -> Result<&Self, GrowError> { ... }
fn set_safe_point<St: State>(
&self,
state: &mut St,
point: PointSafe2,
tile: Tile,
) -> &Self { ... }
fn set_points<St: State>(
&self,
state: &mut St,
changelist: &[(Point, Tile)],
) -> &Self { ... }
fn set_safe_points<St: State>(
&self,
state: &mut St,
changelist: &[(PointSafe2, Tile)],
) -> &Self { ... }
fn place_tile<St: State>(
&self,
state: &mut St,
point: PointSafe2,
tile: Tile,
replace: bool,
) -> Result<f64, GrowError> { ... }
fn configure_empty_state<St: State>(
&self,
state: &mut St,
) -> Result<(), GrowError> { ... }
fn perform_event<St: State>(&self, state: &mut St, event: &Event) -> f64 { ... }
fn calc_mismatches<St: State>(&self, state: &St) -> usize { ... }
fn update_points<St: State>(&self, state: &mut St, points: &[PointSafeHere]) { ... }
fn update_state<St: State>(&self, state: &mut St, needed: &NeededUpdate) { ... }
fn set_param(
&mut self,
_name: &str,
_value: Box<dyn Any>,
) -> Result<NeededUpdate, GrowError> { ... }
fn get_param(&self, _name: &str) -> Result<Box<dyn Any>, GrowError> { ... }
fn list_parameters(&self) -> Vec<ParameterInfo> { ... }
fn extract_model_name(info: &str) -> String { ... }
fn evolve_in_window<St: State>(
&mut self,
state: &mut St,
block: Option<usize>,
start_paused: bool,
bounds: EvolveBounds,
initial_timescale: Option<f64>,
initial_max_events_per_sec: Option<u64>,
) -> Result<EvolveOutcome, RgrowError> { ... }
fn calc_dimers(&self) -> Result<Vec<DimerInfo>, GrowError> { ... }
fn clone_state<St: StateWithCreate>(&self, initial_state: &St) -> St { ... }
fn clone_state_into_state<St: StateWithCreate>(
&self,
initial_state: &St,
target: &mut St,
) { ... }
fn clone_state_into_empty_state<St: StateWithCreate>(
&self,
initial_state: &St,
target: &mut St,
) { ... }
}Required Methods§
fn system_info(&self) -> String
fn update_after_event<St: State>(&self, state: &mut St, event: &Event)
Sourcefn event_rate_at_point<St: State>(
&self,
state: &St,
p: PointSafeHere,
) -> PerSecond
fn event_rate_at_point<St: State>( &self, state: &St, p: PointSafeHere, ) -> PerSecond
Returns the total event rate at a given point. These should correspond with the events chosen by choose_event_at_point.
Sourcefn choose_event_at_point<St: State>(
&self,
state: &St,
p: PointSafe2,
acc: PerSecond,
) -> (Event, f64)
fn choose_event_at_point<St: State>( &self, state: &St, p: PointSafe2, acc: PerSecond, ) -> (Event, f64)
Given a point, and an accumulated random rate choice acc (which should be less than the total rate at the point),
return the event that should take place, and the rate of that particular event.
Sourcefn seed_locs(&self) -> Vec<(PointSafe2, Tile)>
fn seed_locs(&self) -> Vec<(PointSafe2, Tile)>
Returns a vector of (point, tile number) tuples for the seed tiles, useful for populating an initial state.
Provided Methods§
fn new_state<St: StateWithCreate + State>( &self, params: St::Params, ) -> Result<St, GrowError>
fn calc_n_tiles<St: State>(&self, state: &St) -> NumTiles
fn take_single_step<St: State>( &self, state: &mut St, max_time_step: Second, ) -> StepOutcome
fn evolve<St: State>( &self, state: &mut St, bounds: EvolveBounds, ) -> Result<EvolveOutcome, GrowError>
fn evolve_states<St: State>( &mut self, states: &mut [St], bounds: EvolveBounds, ) -> Vec<Result<EvolveOutcome, GrowError>>
fn set_point<St: State>( &self, state: &mut St, point: Point, tile: Tile, ) -> Result<&Self, GrowError>
fn set_safe_point<St: State>( &self, state: &mut St, point: PointSafe2, tile: Tile, ) -> &Self
fn set_points<St: State>( &self, state: &mut St, changelist: &[(Point, Tile)], ) -> &Self
fn set_safe_points<St: State>( &self, state: &mut St, changelist: &[(PointSafe2, Tile)], ) -> &Self
Sourcefn place_tile<St: State>(
&self,
state: &mut St,
point: PointSafe2,
tile: Tile,
replace: bool,
) -> Result<f64, GrowError>
fn place_tile<St: State>( &self, state: &mut St, point: PointSafe2, tile: Tile, replace: bool, ) -> Result<f64, GrowError>
Place a tile at a particular location, handling double tiles appropriately for kTAM. For kTAM, placing a “real” tile (left/top part of double tile) will also place the corresponding “fake” tile (right/bottom part). Attempting to place a “fake” tile directly will place the corresponding “real” tile instead.
If replace is true, any existing tile at the target site is removed first.
If replace is false, returns GrowError::TilePlacementBlocked if the site is occupied.
This updates tile counts and rates but does not increment the event counter
or record events in the state tracker. Callers that need event tracking
should call record_event separately.
Returns energy change caused by placement, or NaN if energy is not calculated.
fn configure_empty_state<St: State>( &self, state: &mut St, ) -> Result<(), GrowError>
Sourcefn perform_event<St: State>(&self, state: &mut St, event: &Event) -> f64
fn perform_event<St: State>(&self, state: &mut St, event: &Event) -> f64
Perform a particular event/change to a state. Do not update the state’s time/etc, or rates, which should be done in update_after_event and take_single_step.
fn calc_mismatches<St: State>(&self, state: &St) -> usize
fn update_points<St: State>(&self, state: &mut St, points: &[PointSafeHere])
fn update_state<St: State>(&self, state: &mut St, needed: &NeededUpdate)
fn set_param( &mut self, _name: &str, _value: Box<dyn Any>, ) -> Result<NeededUpdate, GrowError>
fn get_param(&self, _name: &str) -> Result<Box<dyn Any>, GrowError>
fn list_parameters(&self) -> Vec<ParameterInfo>
fn extract_model_name(info: &str) -> String
fn evolve_in_window<St: State>( &mut self, state: &mut St, block: Option<usize>, start_paused: bool, bounds: EvolveBounds, initial_timescale: Option<f64>, initial_max_events_per_sec: Option<u64>, ) -> Result<EvolveOutcome, RgrowError>
Sourcefn calc_dimers(&self) -> Result<Vec<DimerInfo>, GrowError>
fn calc_dimers(&self) -> Result<Vec<DimerInfo>, GrowError>
Returns information on dimers that the system can form.
fn clone_state<St: StateWithCreate>(&self, initial_state: &St) -> St
fn clone_state_into_state<St: StateWithCreate>( &self, initial_state: &St, target: &mut St, )
fn clone_state_into_empty_state<St: StateWithCreate>( &self, initial_state: &St, target: &mut St, )
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.