Checkerboard

Trait Checkerboard 

Source
pub trait Checkerboard<P> {
    // Required methods
    fn point_to_space_index(&self, point: &P) -> Option<usize>;
    fn space_indices_by_color(&self) -> &[Vec<usize>];
    fn num_spaces(&self) -> usize;
}
Expand description

Partition space into sets of spaces where trial moves can safely be applied in parallel.

ParallelSweep uses a Checkerboard when selecting bodies for parallel trial moves. A well-behaved checkerboard:

  1. Colors spaces such that any body with its position in a space cannot possibly interact with any body positioned in any other space of the same color.
  2. Covers all points within the boundary of the simulation.
  3. Respects periodic boundary conditions (when present).

Given a boundary, construct a suitable Checkerboard via the Cover trait.

Required Methods§

Source

fn point_to_space_index(&self, point: &P) -> Option<usize>

Determine the space index of a given point.

Space indices must be in the range [0,num_spaces). ParallelSweep uses the space index as an array index. point_to_space_index maps a real-valued, D-dimensional point to the linear index.

Source

fn space_indices_by_color(&self) -> &[Vec<usize>]

The indices of all spaces, grouped by color.

In the return value, the outer slice’s length is the number of colors in the checkerboard. Element of that slice contains the indices of all the spaces of that color.

Source

fn num_spaces(&self) -> usize

The total number of spaces in the checkerboard.

Implementors§