Cover

Trait Cover 

Source
pub trait Cover<P> {
    type Checkerboard: Checkerboard<P>;

    // Required methods
    fn cover<R: Rng + ?Sized>(
        &self,
        rng: &mut R,
        interaction_range: PositiveReal,
    ) -> Self::Checkerboard;
    fn cover_into<R: Rng + ?Sized>(
        &self,
        checkerboard: &mut Self::Checkerboard,
        rng: &mut R,
        interaction_range: PositiveReal,
    );
}
Expand description

Construct a Checkerboard that covers all points in this boundary.

Required Associated Types§

Source

type Checkerboard: Checkerboard<P>

The checkerboard type associated with this boundary.

Required Methods§

Source

fn cover<R: Rng + ?Sized>( &self, rng: &mut R, interaction_range: PositiveReal, ) -> Self::Checkerboard

Construct a Checkerboard that covers all points in this boundary.

The constructed Checkerboard must place spaces assuming that any body might interact with another body at distances less than interaction_range. ParallelSweep must reject trial moves from one space to another. To make simulations ergodic, cover must randomly place the checkerboard boundaries using the provided rng.

Source

fn cover_into<R: Rng + ?Sized>( &self, checkerboard: &mut Self::Checkerboard, rng: &mut R, interaction_range: PositiveReal, )

Update a given checkerboard to match this boundary.

After calling cover_into, checkerboard will have the same properties as the return value of self.cover(rng, interaction_range). However, cover_into may be able to reuse existing dynamically allocated memory in checkerboard or avoid some calculations completely (e.g. when the checkerboard dimensions remain the same).

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.

Implementations on Foreign Types§

Source§

impl<const N: usize> Cover<Cartesian<N>> for Closed<Hypercuboid<N>>

Source§

type Checkerboard = HypercuboidCheckerboard<N>

Source§

fn cover<R: Rng + ?Sized>( &self, rng: &mut R, interaction_range: PositiveReal, ) -> Self::Checkerboard

Source§

fn cover_into<R: Rng + ?Sized>( &self, checkerboard: &mut Self::Checkerboard, rng: &mut R, interaction_range: PositiveReal, )

Source§

impl<const N: usize> Cover<Cartesian<N>> for Periodic<Hypercuboid<N>>

Source§

type Checkerboard = HypercuboidCheckerboard<N>

Source§

fn cover<R: Rng + ?Sized>( &self, rng: &mut R, interaction_range: PositiveReal, ) -> Self::Checkerboard

Source§

fn cover_into<R: Rng + ?Sized>( &self, checkerboard: &mut Self::Checkerboard, rng: &mut R, interaction_range: PositiveReal, )

Implementors§