Struct gridsim::SquareGrid[][src]

pub struct SquareGrid<'a, S: Sim<'a>> { /* fields omitted */ }

Represents the state of the simulation.

Methods

impl<'a, S: Sim<'a>> SquareGrid<'a, S>
[src]

Make a new grid using the Cell's Default impl.

Make a new grid by cloning a default Cell.

Make a new grid directly from an initial iter.

Make a grid by evaluating each centered signed coordinate to a cell with a closure.

Make a grid using a collection of centered signed coordinates with associated cells.

Make a grid using a collection of centered signed coordinates that indicate true cells.

Offset an index to a new index.

Get a &Cell. Panics if out of bounds.

Get a &Cell. Panics if out of bounds.

Get a &Cell. Panics if out of bounds.

Get a &mut Cell. Panics if out of bounds.

Get a &mut Cell. Panics if out of bounds.

This can only be called in the trait TakeMoveDirection when implmenting a new Neighborhood.

This can only be called in the trait TakeMoveDirection when implmenting a new Neighborhood.

Get the Grid's Cell slice.

Get the Grid's Cell slice mutably.

Get the Grid's width.

Get the Grid's height.

Get the Grid's size.

impl<'a, S, C, D, M, N, MN> SquareGrid<'a, S> where
    S: Sim<'a, Cell = C, Diff = D, Move = M, Neighbors = N, MoveNeighbors = MN> + 'a,
    S::Cell: Sync + Send,
    S::Diff: Sync + Send,
    S::Move: Sync + Send,
    S::Neighbors: Sync + Send,
    S::MoveNeighbors: Sync + Send,
    Self: GetNeighbors<'a, usize, N>,
    Self: TakeMoveNeighbors<usize, MN>, 
[src]

Run the Grid for one cycle and parallelize the simulation.

impl<'a, S, C, D, M, N, MN> SquareGrid<'a, S> where
    S: Sim<'a, Cell = C, Diff = D, Move = M, Neighbors = N, MoveNeighbors = MN> + 'a,
    S::Cell: Sync + Send + Serialize + Deserialize<'dc> + 'a,
    S::Diff: Sync + Send,
    S::Move: Sync + Send,
    S::Neighbors: Sync + Send,
    S::MoveNeighbors: Sync + Send,
    Self: GetNeighbors<'a, usize, N>,
    Self: TakeMoveNeighbors<usize, MN>, 
[src]

Run the Grid for one cycle and parallelize the simulation.

Make sure the reads and writes are only connected to other SquareGrid::cycle running on any machine using THE EXACT SAME simulation or else there may be undefined behavior.

Trait Implementations

impl<'a, S: Clone + Sim<'a>> Clone for SquareGrid<'a, S> where
    S::Cell: Clone,
    S::Diff: Clone,
    S::MoveNeighbors: Clone
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, S: Debug + Sim<'a>> Debug for SquareGrid<'a, S> where
    S::Cell: Debug,
    S::Diff: Debug,
    S::MoveNeighbors: Debug
[src]

Formats the value using the given formatter. Read more

impl<'a, S: Sim<'a>> TakeMoveNeighbors<usize, ()> for SquareGrid<'a, S>
[src]

This should be called exactly once for every index, making it unsafe. Read more

impl<'a, S, D> TakeDiff<usize, D> for SquareGrid<'a, S> where
    S: Sim<'a, Diff = D>, 
[src]

This should be called exactly once for every index, making it unsafe. Read more

impl<'a, C, S> GetNeighbors<'a, usize, Neighbors<&'a C>> for SquareGrid<'a, S> where
    S: Sim<'a, Cell = C>, 
[src]

impl<'a, S, M> TakeMoveDirection<usize, Direction, M> for SquareGrid<'a, S> where
    S: Sim<'a, Move = M, MoveNeighbors = Neighbors<M>>, 
[src]

This should be called exactly once for every index and direction. Read more

impl<'a, S, M> TakeMoveNeighbors<usize, Neighbors<M>> for SquareGrid<'a, S> where
    S: Sim<'a, Move = M, MoveNeighbors = Neighbors<M>>, 
[src]

This should be called exactly once for every index, making it unsafe. Read more

impl<'a, C, S> GetNeighbors<'a, usize, Neighbors<&'a C>> for SquareGrid<'a, S> where
    S: Sim<'a, Cell = C>, 
[src]

impl<'a, S, M> TakeMoveDirection<usize, Direction, M> for SquareGrid<'a, S> where
    S: Sim<'a, Move = M, MoveNeighbors = Neighbors<M>>, 
[src]

This should be called exactly once for every index and direction. Read more

impl<'a, S, M> TakeMoveNeighbors<usize, Neighbors<M>> for SquareGrid<'a, S> where
    S: Sim<'a, Move = M, MoveNeighbors = Neighbors<M>>, 
[src]

This should be called exactly once for every index, making it unsafe. Read more

Auto Trait Implementations

impl<'a, S> Send for SquareGrid<'a, S> where
    <S as Sim<'a>>::Cell: Send,
    <S as Sim<'a>>::Diff: Send,
    <S as Sim<'a>>::MoveNeighbors: Send

impl<'a, S> Sync for SquareGrid<'a, S> where
    <S as Sim<'a>>::Cell: Sync,
    <S as Sim<'a>>::Diff: Sync,
    <S as Sim<'a>>::MoveNeighbors: Sync